Papers
Topics
Authors
Recent
Search
2000 character limit reached

Aspect System Dependence Graph (AOSG)

Updated 24 February 2026
  • AOSG is a formal program representation that extends traditional SDGs by explicitly modeling aspect-specific constructs such as pointcuts, advice, and communication nodes.
  • The construction algorithm builds separate dependence graphs for base and aspect code then weaves them via dedicated edges, facilitating accurate dynamic and static slicing.
  • AOSG enhances program analysis in aspect-oriented environments by delivering precise control and data dependence tracking, even in concurrent execution contexts.

An Aspect System Dependence Graph (AOSG) is a directed program representation that extends the classical System Dependence Graph (SDG) to handle the unique modularity and weaving constructs of aspect-oriented programming (AOP). AOSGs explicitly encode base code, advice, pointcuts, and the aspect weaving process by integrating specialized node and edge types, providing a formal substrate for precise program analysis tasks such as dynamic slicing. This formalism is central to enabling accurate, aspect-aware analysis workflows for languages such as AspectJ, including static and dynamic data/control dependence tracking in the presence of cross-cutting concerns (Ray et al., 2014, Ray et al., 2014).

1. Formal Structure of the AOSG

An AOSG for an aspect-oriented program PP is a directed graph G=(V,E)G = (V, E) that generalizes an SDG by including dedicated abstractions for both base and aspect elements:

  • V=VnVpVaVcV = V_n \cup V_p \cup V_a \cup V_c:
    • VnV_n: nodes for ordinary statements or predicates in base code
    • VpV_p: pointcut start nodes (one dummy per pointcut declaration)
    • VaV_a: advice entry/exit nodes (one per advice body)
    • VcV_c: C-Nodes (“communication” nodes) for synchronizing base/aspect logic when multiple cross-cutting links are present
  • E=EctrlEdataEparamEasmE = E_{ctrl} \cup E_{data} \cup E_{param} \cup E_{asm}:
    • EctrlE_{ctrl}: control-dependence edges (post-dominator based)
    • EdataE_{data}: data-dependence edges linking defs to uses without intervening redefinitions
    • EparamE_{param}: interprocedural actual/formal parameter edges
    • EasmE_{asm}: aspect-membership (weaving) edges connecting base join-points to advice or C-Nodes

Key relations are:

  • Control dependence: (u,v)Ectrl(u, v) \in E_{ctrl} iff uu post-dominates vv’s control predicate.
  • Data dependence: (u,v)Edata(u, v) \in E_{data} iff there exists var Vars\in Vars with uu in defSet(var)defSet(var) and vv in useSet(var)useSet(var), with uu reaching vv uninhibited.
  • Aspect-membership: (j,a)Easm(j, a) \in E_{asm} iff jj is a base-code join-point selected by a pointcut, aa is the corresponding advice entry or C-Node.

This edge/node partitioning captures both traditional program dependence and AOP-specific cross-cutting behavior (Ray et al., 2014).

2. Algorithmic Construction of the AOSG

Construction follows four primary stages:

  1. Build base SDG by analyzing control and data dependences in non-aspect code using control flow graphs (CFGs) and def-use relations.
  2. Build Aspect Dependence Graphs (ADG) for each advice, pointcut, and introduction, using method/procedure-like dependence analysis.
  3. Determine aspect-membership edges by connecting join-points in base code (that match pointcuts) to corresponding advice entries in VaV_a via EasmE_{asm}, optionally via C-Nodes if multiple advices or introductions require logical synchronization.
  4. Weave SDG and ADG by assigning interprocedural parameter edges, connecting actual and formal parameters for advice invocations, and leveraging C-Nodes when needed for logical grouping.

This multi-phase construction explicitly models both the static and dynamic connectivity generated by AspectJ-like weaving. Introductions (inter-type declarations) are encoded as new fields/methods attached by EasmE_{asm} (Ray et al., 2014, Ray et al., 2014).

3. Comparison with Traditional System Dependence Graphs

Characteristic differences between the AOSG and classical SDG are outlined below.

Feature SDG AOSG (ASDG)
Vertices Base code statements/predicates + Pointcut starts (VpV_p), advice (VaV_a), C-Nodes (VcV_c)
Edges Control, data, parameter + Aspect-membership (weaving) edges (EasmE_{asm})
Inter-modular Flow Calls, parameters Advice/join-point weaving, introductions
Cross-cutting Handling Not explicit Explicit edge and node modeling

AOSG (synonymous with “Aspect System Dependence Graph” or “ASDG” in some literature) provides explicit mechanisms for tracking aspect weaving and cross-cutting effects, enabling finer-grained, aspect-aware analyses not possible in classical SDG frameworks (Ray et al., 2014).

4. Concrete Example: AspectJ Program and Its AOSG

Consider the simplified AspectJ example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
public class Prime {
  static int n;
  public static void main(String[] args) {
    n = Integer.parseInt(args[0]);
    if (isprime(n)) System.out.println("Prime");
    else           System.out.println("Not Prime");
    System.out.println("Result: "+n);
  }
  static boolean isprime(int n) { ... }
}
public aspect PrimeAspect {
  pointcut pc(int n): call(Boolean Prime.isprime(int)) && args(n);
  before(int n): pc(n) { System.out.println("Testing :"+n); }
  after(int n) returning(boolean r): pc(n) { System.out.println("Status :"+n+""+r); }
}

Key AOSG nodes and edges:

  • Nodes: v1v_1 = n = ..., v2v_2 = if (isprime(n)), v3v_3 = inside main, p1p_1 = dummy pointcut start, abeforea_{before} = advice entry (before), aaftera_{after} = advice entry (after), c1c_1 = C-Node (optional).
  • Edges:
    • (v1v2)(v_1 \to v_2) in EctrlE_{ctrl} and EdataE_{data} for nn
    • (v2v3)(v_2 \to v_3) in EctrlE_{ctrl}
    • (v2abefore)(v_2 \to a_{before}), (v2aafter)(v_2 \to a_{after}) in EasmE_{asm}
    • Parameter edges for advice invocation

A schematic fragment:

1
2
3
4
5
v1 ––(ctrl,data)→ v2 ––(ctrl)→ v3
                   ↘
                 (asm)→ a_before ––(ctrl,data)→ print
                   ↘
                 (asm)→ a_after  ––(ctrl,data)→ print

This construction exposes how aspect weaving and advice executions are incorporated at the program dependence graph level (Ray et al., 2014).

5. Dynamic Slicing via the AOSG

The runtime dynamic slicing algorithm using AOSG proceeds as follows:

  • For each node uu and variable varvar, maintain dslice(u,var)Vdslice(u,var) \subseteq V, initialized to \emptyset; also maintain RecentDef(var)RecentDef(var).
  • All edges in EctrlEdataEasmE_{ctrl} \cup E_{data} \cup E_{asm} are unmarked before execution.
  • On execution of statement SS (mapping to node uu):
    • Let D=RecentDef(var)D = RecentDef(var) (possibly NULLNULL).
    • Unmark any previously marked (xu)(x \to u) edge for varvar.
    • If DNULLD \neq NULL, mark (Du)(D \to u).
    • Update dslice(u,var){D}dslice(D,var)dslice(u, var) \gets \{D\} \cup dslice(D, var).
    • 2. If uu is a def(var)def(var) node, set RecentDef(var):=uRecentDef(var) := u.
    • 3. If uu is an advice entry, mark (joinadvice)(join \to advice) edges and relevant parameter edges.
    • 4. If uu is a method entry, update parameter edges accordingly.

A slicing query for u0,var0\langle u_0, var_0 \rangle is computed as S=vdslice(u0,var0){v}{u0}S = \bigcup_{v \in dslice(u_0, var_0)} \{v\} \cup \{u_0\}.

This runtime protocol directly encodes execution history on the graph by marking/unmarking edges, requiring no trace file. Traversing marked edges from a slicing criterion yields the dynamic slice “on demand” (Ray et al., 2014).

6. Extensions: Concurrency and the CASDG

AOSG generalizes to concurrent programs as the Concurrent Aspect-oriented System Dependence Graph (CASDG):

  • CASDG adds nodes and edges for thread-related relationships:
    • Synchronization-dependence (wait/notify)
    • Non-synchronized edges (sleep, spawn)
    • Communication-dependence (data flow between threads)
    • Exception-check edges (try/catch)

Construction proceeds by building the base SDG, then ADGs for each aspect, then weaving, and finally injecting concurrency edges. The concurrent dynamic slicing algorithm augments the marking/unmarking protocol to update slices across thread, synchronization, and communication edges, ensuring inter-thread dependences are tracked during slicing. The formal recurrence:

dynamicSlice(w,var)={w}uPredm(w)dynamicSlice(u,var)dynamicSlice(w, var) = \{w\} \cup \bigcup_{u \in Pred_m(w)} dynamicSlice(u, var)

encompasses all marked predecessor nodes, including those from concurrency-specific dependence classes (Ray et al., 2014).

7. Applications and Significance in Program Analysis

AOSG underpins advanced program analysis, especially dynamic slicing of aspect-oriented software. Its key benefits include:

  • Precision: The graph marks only the dependences exercised during the run, eliminating spurious statements from slices.
  • Efficiency: No trace file is required; the history is encoded in the marks on the AOSG and RecentDefRecentDef pointers, enabling instant querying at arbitrary program points.
  • Aspect-awareness: Aspect weaving, cross-cutting interactions, introductions, and advice precedence are all represented, enabling analyses sensitive to AOP mechanisms.
  • Extensibility: The approach is modular, allowing extension for concurrency and other advanced programming paradigms (Ray et al., 2014, Ray et al., 2014).

These properties make AOSG the foundation for precise and scalable dynamic slicing in AspectJ and comparable languages, directly supporting tasks in debugging, program understanding, and security analysis.

Definition Search Book Streamline Icon: https://streamlinehq.com
References (2)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Aspect System Dependence Graph (AOSG).