Slicing AspectJ Woven Code Luca Cavallaro Mattia Monga Antonio Castaldo D'Ursi Davide Balzarotti Politecnico di Milano.

Slides:



Advertisements
Similar presentations
Overview Structural Testing Introduction – General Concepts
Advertisements

School of EECS, Peking University “Advanced Compiler Techniques” (Fall 2011) SSA Guo, Yao.
Programming Paradigms Introduction. 6/15/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1:
Pointer Analysis – Part I Mayur Naik Intel Research, Berkeley CS294 Lecture March 17, 2009.
Aspect Oriented Programming. AOP Contents 1 Overview 2 Terminology 3 The Problem 4 The Solution 4 Join point models 5 Implementation 6 Terminology Review.
1 JAC : Aspect Oriented Programming in Java An article review by Yuval Nir and Limor Lahiani.
A Regression Test Selection Technique for Aspect- Oriented Programs Guoqing Xu The Ohio State University
Code Compaction of an Operating System Kernel Haifeng He, John Trimble, Somu Perianayagam, Saumya Debray, Gregory Andrews Computer Science Department.
Program Slicing Mark Weiser and Precise Dynamic Slicing Algorithms Xiangyu Zhang, Rajiv Gupta & Youtao Zhang Presented by Harini Ramaprasad.
1 Program Slicing Purvi Patel. 2 Contents Introduction What is program slicing? Principle of dependences Variants of program slicing Slicing classifications.
University of British Columbia Software Practices Lab 2005 CASCON A Fluid AOP Editor Terry Hon Gregor Kiczales.
Parameterized Object Sensitivity for Points-to Analysis for Java Presented By: - Anand Bahety Dan Bucatanschi.
CS 536 Spring Intermediate Code. Local Optimizations. Lecture 22.
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
University of British Columbia Software Practices Lab CAS Seminar 06 Fluid AJ - A Simple Fluid AOP Tool Terry Hon Gregor Kiczales.
4/23/09Prof. Hilfinger CS 164 Lecture 261 IL for Arrays & Local Optimizations Lecture 26 (Adapted from notes by R. Bodik and G. Necula)
Programming Language Semantics Java Threads and Locks Informal Introduction The Java Specification Language Chapter 17.
Categories of Aspects Shmuel Katz Computer Science Department The Technion Haifa, Israel.
Program Slicing for Refactoring Advanced SW Tools Seminar Jan 2005Yossi Peery.
PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Regression Test Selection for AspectJ Software Guoqing Xu and Atanas.
More on AspectJ. aspect MoveTracking { private static boolean _flag = false; public static boolean testAndClear() { boolean result = _flag; _flag = false;
OOP in Java Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Software Engineering Tools and Methods Presented by: Mohammad Enamur Rashid( ) Mohammad Rashim Uddin( ) Masud Ur Rahman( )
Language Evaluation Criteria
XFindBugs: eXtended FindBugs for AspectJ Haihao Shen, Sai Zhang, Jianjun Zhao, Jianhong Fang, Shiyuan Yao Software Theory and Practice Group (STAP) Shanghai.
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.
Introduction to Aspect Oriented Programming Presented By: Kotaiah Choudary. Ravipati M.Tech IInd Year. School of Info. Tech.
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.
Aspect Oriented Programming Scott Nykl CSSE 411 Senior Seminar.
Composing Adaptive Software Authors Philip K. McKinley, Seyed Masoud Sadjadi, Eric P. Kasten, Betty H.C. Cheng Presented by Ana Rodriguez June 21, 2006.
Aspect Oriented Programming Sumathie Sundaresan CS590 :: Summer 2007 June 30, 2007.
Aspect Oriented Programming Gülşah KARADUMAN.
Design Rules for Increasing Modularity with CaesarJ Carlos Eduardo Pontual Advisor: Paulo Borba 17/06/2010.
AOP-1 Aspect Oriented Programming. AOP-2 Aspects of AOP and Related Tools Limitation of OO Separation of Concerns Aspect Oriented programming AspectJ.
1 Program Slicing Amir Saeidi PhD Student UTRECHT UNIVERSITY.
Design Patterns Gang Qian Department of Computer Science University of Central Oklahoma.
Virtual Support for Dynamic Join Points C. Bockisch, M. Haupt, M. Mezini, K. Ostermann Presented by Itai Sharon
IDENTIFYING SEMANTIC DIFFERENCES IN ASPECTJ PROGRAMS Martin Görg and Jianjun Zhao Computer Science Department, Shanghai Jiao Tong University.
Inter-Type Declarations in AspectJ Awais Rashid Steffen Zschaler © Awais Rashid, Steffen Zschaler 2009.
CASE/Re-factoring and program slicing
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University IWPSE 2003 Program.
Demeter Aspects We study techniques for the emerging area of Aspect-Oriented Software Development and focus on the following areas:  Aspectual Collaborations.
Software Engineering Research Group, Graduate School of Engineering Science, Osaka University A Slicing Method for Object-Oriented Programs Using Lightweight.
Review of Parnas’ Criteria for Decomposing Systems into Modules Zheng Wang, Yuan Zhang Michigan State University 04/19/2002.
Kansas City Java User’s Group Jason W. Bedell July 12, 2006
问题 Code scattering Blocks of duplicated code Blocks of complementary code, and different modules implementing complementary parts of the concern Code.
1 Software Testing & Quality Assurance Lecture 13 Created by: Paulo Alencar Modified by: Frank Xu.
Aspect Security - RaviShekhar Gopalan - Prof. Lieberherr Software Security (CSG379)
AOP/cross-cutting What is an aspect?. An aspect is a modular unit that cross-cuts other modular units. What means cross-cutting? Apply AOP to AOP. Tease.
Introduction to Yan Cui Aspect Oriented Programming by
Pointer and Escape Analysis for Multithreaded Programs Alexandru Salcianu Martin Rinard Laboratory for Computer Science Massachusetts Institute of Technology.
1 An AOP Implementation Framework for Extending Join Point Models Naoyasu Ubayashi(Kyushu Institute of Technology, Japan) Hidehiko Masuhara(University.
Chapter 1: Preliminaries Lecture # 2. Chapter 1: Preliminaries Reasons for Studying Concepts of Programming Languages Programming Domains Language Evaluation.
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
Software Engineering Lecture 7
Visit for more Learning Resources
Chapter 1 Introduction to Computers, Programs, and Java
Unified Modeling Language
Aspect-Oriented Programming with the Eclipse AspectJ plug-in
Discussion with Gregor Kiczales at UBC
Structural testing, Path Testing
Demeter Aspects Who We Are Aspectual Collaborations
Program Slicing Baishakhi Ray University of Virginia
JAsCo an Aspect-Oriented approach tailored for
Structuring Adaptive Applications using AspectJ and AOM
Programming Language Translation
Presentation transcript:

Slicing AspectJ Woven Code Luca Cavallaro Mattia Monga Antonio Castaldo D'Ursi Davide Balzarotti Politecnico di Milano

2 Motivation  AOP is becoming more and more popular since – It allows to better organize the code modularizing cross-cutting concerns – It is easier to develop small and isolated code unit than big and complex programs  Some points are still unclear… How difficult is to maintain/improve aspect oriented code? – It is not clear how a change in an aspect can affect the whole system – Adding a new aspect can violate some system properties Are aspects real unit of comprehension or just syntactic sugar ? – In order to truly understand the behavior of base code one must read the code of every aspects

3 Aspect Interaction  An interaction occurs every time an aspect can affect the behavior of another aspect. – It is very common when multiple aspects apply to the same program. – It is not always a bad thing (it could be a required behavior).  Developers must be aware of possible aspects interactions – Sometimes it is very hard to find out interferences reading the code. (An aspect can modify the value of a field, that change the execution path, causing the change of another field value…. eventually affecting the behavior of another aspect) – It would be nice to have a tool to check aspects interaction at compile time

4 Program Slicing (in a nutshell)  Informally, a slice consists in all the program statements that may influence a given set of statements (called slicing criterion). – Introduced by Weiser in the ’80 for procedural programming – Extended to Object Oriented code by Larsen & Harrold in ’96  Interprocedural slices can be computed solving a reachability problem on the program System Dependence Graph (SDG)  Problems: – Tons of good papers, very few running code – Existing solutions cannot be applied as they are to aspect oriented code

5 Program Slicing for Aspect Interaction Analysis  The slice associated to an aspect is a reduced model of the whole system as far as concern aspect code influence  Let A 1 and A 2 be two aspects and S 1 and S 2 the corresponding backward slices (computed using A 1 and A 2 as slicing criteria) A 1 does not interfere with A 2 if: A 1 ∩ S 2 = ∅ A1 A2 S1 S2

6 A different approach  Rinard, Salcianu, Bugrara. (FSE end of 2004) – Advice classification: augmentation, narrowing, replacement, combination – They use scope to classify the interactions between aspect and method: ● Orthogonal (disjoint fields) ● Independent (no read/write) ● Observation (advice read, method write) ● Actuation (advice write, method read) ● Interference (both write the same fields) – Implementation ● Pointer and escape analysis ● Only method execution and method call join point

7 Slicing AOP  Zhao (2002) – Target language: AspectJ – Aspect oriented SDG (ASDG). Special constructs for advice, introduction… – No dynamic pointcuts and wildcards  Blair & Monga (2003) – Target language: AspectJ – Translate each aspect in a conjugated class, then it applies object oriented algorithms without any modifications – No introductions, no whole program analysis  Problems: – Quite limited support of many AspectJ features – Hard to implement in a working tool

8 Bytecode Slicing Let all the dirty work to the AspectJ compiler Build the System Dependence Graph analyzing the Java byte-code Apply program slicing techniques using each aspect as the slicing criterion Map back the slices nodes to the original classes/aspects Advantages  AspectJ takes care of translating aspects in classes (we implicitly support all its features)  No changes are needed if AspectJ introduces a new functionality Disadvantages  Some details is lost in the weaving process (for instance a hierarchy change)  If AspectJ change its aspects translation approach, we may need to modify our tool

9 Process  Compile the code using AspectJ (or take a precompiled bytecode)  Build the callgraph (soot)  Analyze each procedure (control dependence, data flow, aliases)  Connect everything together in the SDG  For each aspect:  Select all the aspect’s nodes as slicing criterion  Calculate a backward static slice  Map back the resulting nodes to the original classes/aspects

10 Example public class T{ int temperature; public void set_temp(int t){ //.... this.temperature = t; //... } public void shutdown(){... } public aspect TInvariant { before(T t, int newval): set(int T.temperature) && args(newval) && target(t) { if (newval > 100) t.shutdown(); }

public class T{ int temperature; public void set_temp(int t){ //.... this.temperature = t; //... } public void shutdown(){... } public aspect LockAspect { public void T.get_lock(){ System.out.println("Lock aquired"); } public void T.release_lock(){ System.out.println("Lock released"); } before(T t): target(t) && (call(void set_temp(int))){ t.get_lock(); } after(T t): target(t) && (call(void set_temp(int))){ t.release_lock(); } before(T t): target(t) && (call(void shutdown())){ t.get_lock(); } after(T t): target(t) && (call(void shutdown())){ t.release_lock(); }

12 Results  The slice computed using TInvariant as slicing criterion does not contain any line from LockAspect code Non-interference is guaranteed TInvariant may affect the behavior of LockAspect Note: Since the minimum slice is incomputable, the tool can find spurious interaction due to some unnecessary nodes  The slice computed using LockAspect as slicing criterion contains a line from the TInvariant advice code  Also a real interference is not a proof that there is a problem !!!

13 Results (graphs) System Dependence Graph: 236 Nodes 650 Edges vcg format Tulip format

14 Limitation – No arrays – No exception handling – No inner classes – No static members – No recursive calls – No multithread – No inter-procedural aliases. The current prototype has the following limitations:

15 Scalability  Cost of SDG construction  Slicing Cost – A slice is performed by two traversals of the SDG. The cost of each traversal is linear on the size of the graph – In our example, the slicer algorithm took only 6 ms Number of NodesTime (in seconds)

16 Final Considerations  Static analysis seems a promising technique to help developers reasoning about aspects composition  A proper use of metadata annotations (Java 1.5+) by AspectJ compiler might make the mapping phase more precise and less implementation dependent  We are currently working to remove most of the limitations in order to survey quantitatively the modularity and evolvability of real world AspectJ program