PRESTO: Program Analyses and Software Tools Research Group, Ohio State University A Framework for Source-Code- Level Interprocedural Dataflow Analysis.

Slides:



Advertisements
Similar presentations
Uncovering Performance Problems in Java Applications with Reference Propagation Profiling PRESTO: Program Analyses and Software Tools Research Group, Ohio.
Advertisements

CPSC 388 – Compiler Design and Construction
CS412/413 Introduction to Compilers Radu Rugina Lecture 37: DU Chains and SSA Form 29 Apr 02.
Demand-driven Alias Analysis Implementation Based on Open64 Xiaomi An
A Regression Test Selection Technique for Aspect- Oriented Programs Guoqing Xu The Ohio State University
Aspect-Oriented Software Development (AOSD) Tutorial #2 AspectJ Basics.
Next Section: Pointer Analysis Outline: –What is pointer analysis –Intraprocedural pointer analysis –Interprocedural pointer analysis (Wilson & Lam) –Unification.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Advanced Compilers CMPSCI 710.
1 Semantic Processing. 2 Contents Introduction Introduction A Simple Compiler A Simple Compiler Scanning – Theory and Practice Scanning – Theory and Practice.
Previous finals up on the web page use them as practice problems look at them early.
Scaling CFL-Reachability-Based Points- To Analysis Using Context-Sensitive Must-Not-Alias Analysis Guoqing Xu, Atanas Rountev, Manu Sridharan Ohio State.
Run time vs. Compile time
Data Flow Analysis Compiler Design October 5, 2004 These slides live on the Web. I obtained them from Jeff Foster and he said that he obtained.
Aspect-Oriented Software Development (AOSD) Tutorial #2 AspectJ Basics.
PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Regression Test Selection for AspectJ Software Guoqing Xu and Atanas.
1 Run time vs. Compile time The compiler must generate code to handle issues that arise at run time Representation of various data types Procedure linkage.
Pointer analysis. Pointer Analysis Outline: –What is pointer analysis –Intraprocedural pointer analysis –Interprocedural pointer analysis Andersen and.
Procedure Optimizations and Interprocedural Analysis Chapter 15, 19 Mooly Sagiv.
XFindBugs: eXtended FindBugs for AspectJ Haihao Shen, Sai Zhang, Jianjun Zhao, Jianhong Fang, Shiyuan Yao Software Theory and Practice Group (STAP) Shanghai.
JS Arrays, Functions, Events Week 5 INFM 603. Agenda Arrays Functions Event-Driven Programming.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1 Debugging Support.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University ICSE 2003 Java.
Static Control-Flow Analysis for Reverse Engineering of UML Sequence Diagrams Atanas (Nasko) Rountev Ohio State University with Olga Volgin and Miriam.
PRESTO: Program Analyses and Software Tools Research Group, Ohio State University STATIC ANALYSES FOR JAVA IN THE PRESENCE OF DISTRIBUTED COMPONENTS AND.
PRESTO Research Group, Ohio State University Interprocedural Dataflow Analysis in the Presence of Large Libraries Atanas (Nasko) Rountev Scott Kagan Ohio.
Efficient Evaluation of XQuery over Streaming Data Xiaogang Li Gagan Agrawal The Ohio State University.
Control Flow Resolution in Dynamic Language Author: Štěpán Šindelář Supervisor: Filip Zavoral, Ph.D.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University A lightweight.
Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)
Change Impact Analysis for AspectJ Programs Sai Zhang, Zhongxian Gu, Yu Lin and Jianjun Zhao Shanghai Jiao Tong University.
Validated Model Transformation Tihamér Levendovszky Budapest University of Technology and Economics Department of Automation and Applied Informatics Applied.
Aspect Oriented Programming Gülşah KARADUMAN.
PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Merging Equivalent Contexts for Scalable Heap-cloning-based Points-to.
Coverage Criteria for Testing of Object Interactions in Sequence Diagrams Atanas (Nasko) Rountev Scott Kagan Jason Sawin Ohio State University.
Rethinking Soot for Summary-Based Whole- Program Analysis PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Dacong Yan.
AOP-1 Aspect Oriented Programming. AOP-2 Aspects of AOP and Related Tools Limitation of OO Separation of Concerns Aspect Oriented programming AspectJ.
Virtual Support for Dynamic Join Points C. Bockisch, M. Haupt, M. Mezini, K. Ostermann Presented by Itai Sharon
Aspect-Oriented Programming and Modular Reasoning G. KiczalesM. Mezini Presented by Alex Berendeyev.
IDENTIFYING SEMANTIC DIFFERENCES IN ASPECTJ PROGRAMS Martin Görg and Jianjun Zhao Computer Science Department, Shanghai Jiao Tong University.
Region Pointcut for AspectJ Shumpei Akai Shigeru Chiba Muga Nishizawa.
RUN-Time Organization Compiler phase— Before writing a code generator, we must decide how to marshal the resources of the target machine (instructions,
Slicing AspectJ Woven Code Luca Cavallaro Mattia Monga Antonio Castaldo D'Ursi Davide Balzarotti Politecnico di Milano.
CBSE'051 Component-Level Dataflow Analysis Atanas (Nasko) Rountev Ohio State University.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University IWPSE 2003 Program.
PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Efficient Checkpointing of Java Software using Context-Sensitive Capture.
ESEC/FSE-99 1 Data-Flow Analysis of Program Fragments Atanas Rountev 1 Barbara G. Ryder 1 William Landi 2 1 Department of Computer Science, Rutgers University.
Software Engineering Research Group, Graduate School of Engineering Science, Osaka University A Slicing Method for Object-Oriented Programs Using Lightweight.
PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Merging Equivalent Contexts for Scalable Heap-cloning-based Points-to.
Dynamic Analysis and Visualizing of Data Structures in Java Programs Presented by Sokhom Pheng (Supervisor: Clark Verbrugge) McGill University February.
Aspect Mining Jin Huang Huazhong University of Science & Technology, China
Extending the Field Access Pointcuts of AspectJ to Arrays ICS 2006 – Taipei, December 2006 Kung Chen and Chin-Hung Chien* National Chengchi University.
Functions Math library functions Function definition Function invocation Argument passing Scope of an variable Programming 1 DCT 1033.
CSC450 Software Engineering Devon M. Simmonds University of North Carolina, Wilmington 1.
Chapter 1 Java Programming Review. Introduction Java is platform-independent, meaning that you can write a program once and run it anywhere. Java programs.
AOP with AspectJ Awais Rashid, Steffen Zschaler © Awais Rashid, Steffen Zschaler 2009.
1 An AOP Implementation Framework for Extending Join Point Models Naoyasu Ubayashi(Kyushu Institute of Technology, Japan) Hidehiko Masuhara(University.
Object Naming Analysis for Reverse- Engineered Sequence Diagrams Atanas (Nasko) Rountev Beth Harkness Connell Ohio State University.
Features of AOP languages AOP languages have the following main elements: –a join point model (JPM) wrt base PL –a specification language for expressing.
Precisely Selecting Regression Test for Aspect-Oriented Programs Guoqing Xu The Ohio State University
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
Phoenix Based Dynamic Slicing Debugging Tool Eric Cheng Lin Xu Matt Gruskin Ravi Ramaseshan Microsoft Phoenix Intern Team (Summer '06)
Static Analysis of Object References in RMI-based Java Software
Efficient Evaluation of XQuery over Streaming Data
Atanas (Nasko) Rountev Ohio State University
Compositional Pointer and Escape Analysis for Java Programs
Aspect-Oriented Programming with the Eclipse AspectJ plug-in
Interprocedural Analysis Chapter 19
Demand-Driven Context-Sensitive Alias Analysis for Java
자바 언어를 위한 정적 분석 (Static Analyses for Java) ‘99 한국정보과학회 가을학술발표회 튜토리얼
Presentation transcript:

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University A Framework for Source-Code- Level Interprocedural Dataflow Analysis of AspectJ Software Guoqing Xu and Atanas Rountev Ohio State University Supported by NSF under CAREER grant CCF

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 2 Outline  Motivation  Program representation - Control flow representation - Data flow representation  Proof-of-concept analyses - Object effect analysis - Dependence-analysis-based slicing  Experimental evaluation

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 3 Interprocedural Dataflow Analysis  Interprocedural dataflow analysis is important - For various software engineering and compiler construction tasks - e.g. performance optimization, static software verification, testing, software understanding and evolution  Powerful analyses for AspectJ are needed - AOP becomes more and more popular - Need good program representation - Need new algorithms

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 4 Program Representation for AspectJ  Properties of a good representation - Should be easy to use for various clients  Adapt existing Java analysis algorithm - Should provide clean separation between the base code and aspects  Automated reasoning of aspects-base-code interaction  Advantages of source-code-level over bytecode- level analysis - Produces more relevant results - Provides clean separation of base code and aspects - Faster running time

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 5 Proposed representation  Has both properties - Take the large body of existing analysis algorithms for Java, and adapt them easily to AspectJ - Define new analysis algorithms specifically for AspectJ features  Control flow representation [ICSE’07] - Complex interactions of advices - Dynamic advices  Data flow representation [this paper] - Using calls and returns along chains of nested advice invocations - Expose the decision-making data for dynamic advices

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 6 Running Example class Point { int x; void setX(int x) { this.x = x; } static void main(String[] a) { Point p = new Point(); p.setX(10); } } aspect BoundPoint { pointcut setterX(Point p) : call(void Point.setX(*)) && target(p); … // advices } /* before1 */ before(Point p, int x) : setterX(p) { … } /* around1 */ void around(Point p, int x) : setterX(p) { … proceed(p,x); … } /* before2 */ before(Point p) : setterX(p) { … } /* after1 */ after(Point p) : setterX(p) { … }

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 7 Control-Flow Representation  Interprocedural Control Flow Graph (ICFG) - Java-like representation for “ normal ” calls  No join points - New representation for interactions at join points  Interaction graph  Multiple advices applicable at a join point - Calls to represent nesting relationships - Use ph_* placeholder method to represent call to proceed  Dynamic advices - Use ph_decision placeholder decision node to guard call sites of dynamic advices

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 8 root around1 before2 p.setX before1 after1

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 9 Handling of Dynamic Advices before1 return around1 return ph_decision T T ph_proceed1 F F exit return

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 10 Data-flow Representation for IG  Declarations for placeholder methods - Create a formal parameter for (1) the receiver object or (2) a formal parameter of the crosscut method - e.g. for shadow p.setX(6), the entry method is declared as void ph_root(Point arg0, int arg1)  Declarations for non-around-advice - The original list of formal parameters is directly used - e.g.void before1(int arg0, Point arg1)  Call sites for advices are built with appropriate actual parameters - void ph_root(Point arg0, int arg1) { before1(arg1, arg0); }

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 11 Handling of Around Advice  Handling of around advice is complicated - It must have all the necessary parameters of the shadow call site - Parameters needed by an around advice can be different for different shadows  abc solution: replicate the body of an around advice for each shadow that the around advice matches  Our solution: construct a globally valid list that includes parameters required at all matching shadows

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 12 Example setX(Point arg0, int arg1) setY(Point arg2, float arg3) setZ(double arg4, Point arg5) around(Point p):call(void Point.set*(*)) && target(p) around(Point arg0, int arg1, Point arg2, float arg3, double arg4, Point arg5, int dv)

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 13 Handling of Around Advice  Call to around advice - Non-trivial actual parameters are passed to the call site only for the formals corresponding to the currently-active shadow - A unique shadow ID is given for dv - e.g. setX(Point arg0, int arg1) setY(Point arg2, float arg3) setZ(double arg4, Point arg5) around(Point p):call(void Point.set*(*)) && target(p) around(Point arg0, int arg1, Point arg2, float arg3, double arg4, Point arg5, int dv) for p.setX(..), around(arg0, arg1, null, 0, 0, null, 0) for p.setY(..), around(null, 0, arg2, arg3, 0, null, 1)

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 14 Handling of Around Advice (Cond.)  Call to a placeholder method within an around advice - Use dv to select calls to placeholder methods - e.g. void around ( Point arg0, int arg1, Point arg2, float arg3, double arg4, Point arg5, int dv){ switch(dv){ //corresponding to shadow setX case 0: ph_proceed0(arg0, arg1); break; //corresponding to shadow setY case 1: ph_proceed1(arg2, arg3); break; //corresponding to shadow setZ case 2: ph_proceed2(arg4, arg5); }

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 15 Data with ph_decision Nodes  For a dynamic advice, the data that contributes to dynamic decision making is associated with the ph_decision node that guards the call to the advice - E.g. before(Point p, int i):if(i > 0) && args(i) && target(p) both p and i are associated with the ph_decision node

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 16 So What?  Data flow is explicit with parameter passing  Advice nesting relationship is clear  Ready for data-flow analysis

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 17 Object Effect Analysis  Compute for each object passed from the base code into an advice, a state machine encoding all events that must happen on the object - The state machine is represented by a regular expression - Can directly be used for program verification (e.g. checking type- state based properties) - E.g. (reset | ε) (( setX | ε) | ( getX (( setX | ε ) |( setRectangular | ε )))) ((w x w y | ε)) ( ( (w x | ε) | ( r x ( ( w x | ε) | (( w x w y ) | ε))))) - At the core of this analysis is a must-alias analysis  A typical example of interprocedural analysis for AspectJ - Need to track the interprocedural flow of data - Need to be aware of the separation between base code and aspects

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 18 Object Effect Analysis (Cond.)  Data flow problem - We define a lattice element for each reference-typed formal parameter of a ph_root method - E.g. for void ph_root(Point arg0, int arg1) The lattice is {l arg0, ┴, ┬ } - Transfer functions: v1 = v2: fn(S) = S[v1  S(v2)] v1 = v2.fld: fn(S) = S[v1  ┴ ] v1.fld = v2: fn(S) = S v1 = new X: fn(S) = S[v1  ┴ ] other nodes: fn(S) = S - Compute meet-over-all-valid-paths soluction MVP n

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 19 Analysis Algorithm  Phase 1: relate formals to variables - For each variable in a method, compute a set of formal parameters that the variable may alias - Bottom-up traverse call graph to compute a summary function that relates the return value of a method to its parameter(s)  Phase 2: Propagation of lattice elements - Top-down traverse the call graph starting from each ph_root method - For each variable, replace the formal parameter associated to it with the corresponding lattice element(s)  Phase 3: Effect graph construction - Prune ICFG by removing nodes that do not have a lattice element - Compute SCC in the graph, and bottom-up traverse the SCC-DAGs

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 20 Dependence-based Slicing  Another typical example of interprocedural dataflow analysis  Given existing slicing algorithms for Java, adapting it to AspectJ is very simple - Variables associated with ph_decision nodes are considered as used - The slice for a call to proceed in an around advice includes slices that are computed for the group of calls to ph_proceed methods in the advice

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 21 Experimental Evaluation  Comparison of ICFG and SDG sizes between source- code analysis and bytecode analysis  Effect analysis results comparison between using must-alias analysis and may-alias analysis  Slice relevance comparison between source-code slicing and bytecode slicing  Implementation based on the abc compiler - Between static weaving and advice weaving - Intraprocedural representation based on Jimple from abc

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 22 Numbers of Edges in ICFG and SDG # ICFG edges 2X smaller #SDG edges 3X smaller ▲ - SDG Edges ■ - ICFG edges

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 23 Object Effect Analysis  The analysis has short running time - E.g. less than 3 sec for the largest program

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 24 Slicing Relevance Ratio and Time

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 25 Conclusions  We propose a program representation for AspectJ software - A control flow representation and a data flow representation  Two proof-of-concepts analyses - Both are IDE (Interprocedural Distributive Environment) problems, which require context-sensitivity and flow-sensitivity - Representative of (1) a large class of existing Java analysis algorithms and (2) potentially new algorithms designed specifically for AspectJ  Experimental results - Source-code-level analysis is superior to bytecode-level analysis - Program representation is easy to use and adapt existing algorithms - New algorithms can be easily designed