Concurrent Aspect-oriented SDG (CASDG)
- CASDG is a dependence-based intermediate representation that integrates conventional SDGs and modular ADGs for precise analysis of concurrent aspect-oriented programs.
- It employs a unified structure with weaving and parameter edges to accurately capture data and control dependencies across both base code and aspect code.
- The dynamic slicing approach using CASDG (via the CADS algorithm) enables effective debugging and analysis by tracing cross-cutting concerns in concurrent systems.
The Concurrent Aspect-oriented System Dependence Graph (CASDG) is a dependence-based intermediate program representation designed to support the computation of dynamic slices in concurrent aspect-oriented programs. The CASDG structurally integrates dependence information from both conventional object-oriented code and modularized aspect code, facilitating precise analysis of data and control flow in programs employing aspect-oriented constructs, even in the presence of concurrency. The representation and associated slicing techniques are introduced and detailed in "An Approach for Computing Dynamic Slice of Concurrent Aspect-Oriented Programs" (Ray et al., 2014).
1. Structural Composition of CASDG
The CASDG is a composite representation, consisting of two principal classes of subgraphs:
- System Dependence Graph (SDG): Models all data and control dependences in the non-aspect (base) code, including thread-level and synchronization dependences arising from concurrency constructs (Section 5.2.1, Fig. 3).
- Aspect Dependence Graphs (ADGs): For each aspect in the program, an ADG explicitly represents all intra-aspect dependences—including pointcuts, advices, introductions, and aspect-internal methods (Section 5.2.2, Fig. 4).
A set of additional dependence edges, termed “weaving edges,” connect identified join points in the SDG to corresponding entry points in the ADGs. The CASDG thereby encodes both conventional and aspect-related dependencies in a unified framework suitable for dynamic slicing (Section 5.2.4, Fig. 5).
2. Formal Construction of the Aspect Dependence Graph (ADG)
Each aspect in the program is captured by an ADG, described as , where is the union of all aspect-specific vertices, and the set of intra-aspect dependence edges (implicit from Section 5.2.2):
- Node Types:
- Aspect Entry Vertex: Distinguished root for the aspect.
- Advice Start Vertices: One per advice (before, after, around, after-returning, after-throwing).
- Pointcut Start Vertices: One per pointcut designator.
- Introduction Start Vertices: One per inter-type (introduction) declaration.
- Method Entry Vertices: For methods defined inside the aspect; each as its own MDG.
- Statement/Predicate Vertices: One for each executable/propositional statement inside advices, methods, introductions.
- Formal-in/Formal-out Vertices: For parameters read (formal-in) or written (formal-out) by advices/methods.
- Edge Types:
- Control-Dependence Edges: From predicates to governed statements within the same advice/introduction/method.
- Data-Dependence Edges: From variable definitions to subsequent uses.
- Call Edges: From an advice or method call site to the target’s entry vertex.
- Parameter-in/Parameter-out Edges: Modeling parameter passage between actual/formal parameters on calls.
- Aspect-Membership Edges: From the aspect entry vertex to all start vertices (advice, introduction, pointcut, method).
No communication or synchronization edges are present within the ADG itself; these are limited to the SDG/CASDG to address concurrency.
3. Weaving of Aspect Code into the CASDG
Construction of the full CASDG requires explicit “weaving” of ADGs into the SDG at all join points determined by the aspect’s pointcuts (Sections 5.2.3–5.2.4):
- At each base code join point (weaving vertex) that matches a pointcut, a weaving edge is added from the SDG node to the corresponding advice start vertex in the relevant ADG.
- Parameter passing is also mapped: SDG actual-in/out vertices representing the context at the join point are linked by parameter edges to the formal-in/out vertices of the advice (Section 5.2.4).
- This interleaving allows cross-cutting concerns implemented via advice to appear in the overall program dependence structure, enabling precise traversal into and out of aspect code during slicing.
4. Construction Procedure for the CASDG
While no explicit pseudocode is provided, the methodology for constructing the full CASDG can be decomposed into the following steps (Section 5.2):
- For each aspect:
- Create the aspect-entry vertex.
- For each advice:
- Build an MDG for its body; introduce an advice-start vertex and attach the MDG.
- Add formal-in/out vertices for parameters.
- For each inter-type declaration:
- Build an MDG; introduce introduction-start vertex.
- For each pointcut definition:
- Create a pointcut-start vertex (no body graph needed).
- For each helper method:
- Build an MDG; introduce method entry vertex and associated vertices.
- Connect all advice, introduction, pointcut, and method start vertices to the aspect entry vertex via membership edges.
- Weaving:
- Identify join points in SDG corresponding to pointcut matches.
- Insert weaving and parameter edges from SDG to ADG as described above.
The resulting CASDG models the entire concurrent aspect-oriented program as a directed graph of control, data, and inter-module dependences.
5. Theoretical Properties and Soundness
The correctness of dynamic slicing on the CASDG is established at the complete graph level. Section 6.4 provides a correctness argument that the dynamic slicing algorithm (CADS)—operating via marking and unmarking executed nodes in the CASDG—produces correct slices that accurately include all control and data dependences (Sections 6.3–6.4). This relies on the faithful construction of the ADG using standard MDG principles, together with correct introduction of weaving and parameter edges.
No separate proof of soundness or completeness is offered for independent ADG construction; the assumption is that, by analogy with standard MDG approaches, the ADG for each aspect correctly captures the intra-aspect dependences. Concurrency-specific dependences (e.g., synchronization, communication) exist only in the SDG/CASDG, not within the ADGs themselves.
6. Practical Illustration: Example from ThreadAspect
A canonical instance provided in the paper (Figures 1, 4, and 5) demonstrates the representation applied to a concurrent Java program with two Thread subclasses and an aspect ThreadAspect. The ADG for ThreadAspect features:
- Vertex 61 as the aspect entry node.
- Membership edges to pointcut-start vertices 62 (classic()), 67 (classical()), and advice start vertices 63, 65, 68, 70.
- MDG subgraphs rooted at advice start vertices (e.g., 63 for a before advice, 65 for after).
- Statement/predicate vertices and standard dependence edges within each advice or method.
- Upon weaving (Figure 1), the SDG nodes corresponding to execution(void run()) and execution(int rev()) are connected by weaving edges to their matched advices in the ADG. Parameter-in/out edges transfer join-point context.
This explicit integration enables the dynamic slicing procedure to trace dependencies across both threads and cross-cutting aspect code, yielding precise dynamic slices even in concurrent settings.
7. Role in Dynamic Slicing and Program Analysis
The CASDG underpins the dynamic slicing algorithm for concurrent aspect-oriented programs described in (Ray et al., 2014). The presence of ADGs within the unified dependence graph allows the slicing algorithm (CADS) to follow both conventional and aspect-oriented control/data flows, including those introduced by advices at join points. The process of marking/unmarking executed nodes in the CASDG during runtime yields context-sensitive and cross-modular dynamic slices, addressing the complexity posed by both concurrency and aspect weaving.
The CASDG thus provides a rigorous and extensible foundation for further research in program slicing, debugging, and analysis of aspect-oriented and concurrent software systems.