Object Flow Analysis

433 views

Published on

Object Flow Analysis -- Taking an Object-centricView on Dynamic Analysis. Adrian Lienhard. ESUG 2007, Lugano

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
433
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Object Flow Analysis

  1. 1. Object Flow Analysis – Taking an Object-centricView on Dynamic Analysis Adrian Lienhard1, Stéphane Ducasse2 andTudor Gîrba1 1Software Composition Group, University of Bern, Switzerland 2 LISTIC, University of Savoie, France
  2. 2. Object FlowAnalysis —Taking an Object-centricView on DynamicAnalysis :: Adrian Lienhard :: lienhard@iam.unibe.ch A missing aspect of OO dynamic analysis Typical characterization of OO program execution: 1) message passing 2) object interrelationships How are objects passed throught the system?
  3. 3. Object FlowAnalysis —Taking an Object-centricView on DynamicAnalysis :: Adrian Lienhard :: lienhard@iam.unibe.ch 1) the method execution perspective MethodNode>>generate ASTTranslator class>>new ... ... IRBuilder>>initialize IRMethod class>>new ... ASTTranslator>>visitNode: ASTTranslator>>ir IRMethod>>compiledMethod IRTranlator class>new
  4. 4. Object FlowAnalysis —Taking an Object-centricView on DynamicAnalysis :: Adrian Lienhard :: lienhard@iam.unibe.ch 1) the method execution perspective “How is the IRMethod instance passed to MethodNode?” MethodNode>>generate ASTTranslator class>>new ... ... IRBuilder>>initialize IRMethod class>>new ... ASTTranslator>>visitNode: ASTTranslator>>ir IRMethod>>compiledMethod IRTranlator class>new ?
  5. 5. Object FlowAnalysis —Taking an Object-centricView on DynamicAnalysis :: Adrian Lienhard :: lienhard@iam.unibe.ch :IRBuilder :IRMethod :IRSequence :MethodNode :ASTTranslator 2) the object interrelationship perspective
  6. 6. Object FlowAnalysis —Taking an Object-centricView on DynamicAnalysis :: Adrian Lienhard :: lienhard@iam.unibe.ch “How is the IRMethod instance passed to MethodNode?” :IRBuilder :IRMethod :IRSequence :MethodNode :ASTTranslator ? 2) the object interrelationship perspective
  7. 7. Object FlowAnalysis —Taking an Object-centricView on DynamicAnalysis :: Adrian Lienhard :: lienhard@iam.unibe.ch :IRBuilder :IRMethod :IRSequence :MethodNode :ASTTranslator ? MethodNode>>generate ASTTranslator class>>new ... ... IRBuilder>>initialize IRMethod class>>new ... ASTTranslator>>visitNode: ASTTranslator>>ir IRMethod>>compiledMethod IRTranlator class>new ? interdependency? Object Flow Analysis track the transfer of object references
  8. 8. Object FlowAnalysis —Taking an Object-centricView on DynamicAnalysis :: Adrian Lienhard :: lienhard@iam.unibe.ch a) capture all references of an object b) track the transfer of references Object Flow Analysis instantiation field store field read argument field store return return field store argument field read IRBuilder>>initialize ir := IRMethod new. ... IRBuilder>>startNewSequence newSequence := IRSequence new. newSequence method: ir. IRSequence>>method: aMethod method := aMethod. ASTTranslator>>ir ^ builder ir. MethodNode>>generate ast := ASTTranslator new visitNode: self. ir := ast ir. ^ ir compiledMethod. IRMethod>>compiledMethod ^ compiledMethod := IRTranslator new interpret: self; compiledMethod. IRTranslator>>interpret: ir ...
  9. 9. Object FlowAnalysis —Taking an Object-centricView on DynamicAnalysis :: Adrian Lienhard :: lienhard@iam.unibe.ch a) capture all references of an object b) track the transfer of references Object Flow Analysis instantiation field write field read argument field write return return field write argument field read IRBuilder>>initialize ir := IRMethod new. ... IRBuilder>>startNewSequence newSequence := IRSequence new. newSequence method: ir. IRSequence>>method: aMethod method := aMethod. ASTTranslator>>ir ^ builder ir. MethodNode>>generate ast := ASTTranslator new visitNode: self. ir := ast ir. ^ ir compiledMethod. IRMethod>>compiledMethod ^ compiledMethod := IRTranslator new interpret: self; compiledMethod. IRTranslator>>interpret: ir ... instantiation field write field read argument field write return return field write argument field read
  10. 10. Object FlowAnalysis —Taking an Object-centricView on DynamicAnalysis :: Adrian Lienhard :: lienhard@iam.unibe.ch Object Flow Analysis instantiation field write field read argument field write return return field write argument field read IRBuilder>>initialize ir := IRMethod new. ... IRBuilder>>startNewSequence newSequence := IRSequence new. newSequence method: ir. IRSequence>>method: aMethod method := aMethod. ASTTranslator>>ir ^ builder ir. MethodNode>>generate ast := ASTTranslator new visitNode: self. ir := ast ir. ^ ir compiledMethod. IRMethod>>compiledMethod ^ compiledMethod := IRTranslator new interpret: self; compiledMethod. IRTranslator>>interpret: ir ... instantiation field write field read argument field write return return field write argument field read instantiation field store field read argument field store return return field store argument field read IRBuilder>>initialize ir := IRMethod new. ... IRBuilder>>startNewSequence newSequence := IRSequence new. newSequence method: ir. IRSequence>>method: aMethod method := aMethod. ASTTranslator>>ir ^ builder ir. MethodNode>>generate ast := ASTTranslator new visitNode: self. ir := ast ir. ^ ir compiledMethod. IRMethod>>compiledMethod ^ compiledMethod := IRTranslator new interpret: self; compiledMethod. IRTranslator>>interpret: ir ... instantiation field write field read argument field write return return field write argument field read 2 3 2 3 1 1 “How is the IRMethod instance passed to MethodNode?”
  11. 11. Object FlowAnalysis —Taking an Object-centricView on DynamicAnalysis :: Adrian Lienhard :: lienhard@iam.unibe.ch Application How do classes exchange objects?
  12. 12. Object FlowAnalysis —Taking an Object-centricView on DynamicAnalysis :: Adrian Lienhard :: lienhard@iam.unibe.ch Inter-unit flow view classes containedInPackage: ’AST-Nodes’ mapTo: ’AST’. classes hierarchyRootedIn: ’IRInstruction’ mapTo: ’Intermediate-Representation’
  13. 13. Object FlowAnalysis —Taking an Object-centricView on DynamicAnalysis :: Adrian Lienhard :: lienhard@iam.unibe.ch Chronological propagation
  14. 14. Object FlowAnalysis —Taking an Object-centricView on DynamicAnalysis :: Adrian Lienhard :: lienhard@iam.unibe.ch Spanning flows Parser (4)
  15. 15. Object FlowAnalysis —Taking an Object-centricView on DynamicAnalysis :: Adrian Lienhard :: lienhard@iam.unibe.ch Spanning flows IRBuilder
  16. 16. Object FlowAnalysis —Taking an Object-centricView on DynamicAnalysis :: Adrian Lienhard :: lienhard@iam.unibe.ch objects stored in an instance variable objects passed out multiple times objects passed through directly objects created in IRBuilder timeline
  17. 17. Object FlowAnalysis —Taking an Object-centricView on DynamicAnalysis :: Adrian Lienhard :: lienhard@iam.unibe.ch Representing object flows IRBuilder>>initialize ir := IRMethod new. ... IRBuilder>>startNewSequence newSequence := IRSequence new. newSequence method: ir. IRSequence>>method: aMethod method := aMethod. ASTTranslator>>ir ^ builder ir. MethodNode>>generate ast := ASTTranslator new visitNode: self. ir := ast ir. ^ ir compiledMethod. instantiation field store field read argument field store return return field store field read instantiation field write field read argument field write return return ...
  18. 18. Object FlowAnalysis —Taking an Object-centricView on DynamicAnalysis :: Adrian Lienhard :: lienhard@iam.unibe.ch Representing object flows IRBuilder>>initialize ir := IRMethod new. ... IRBuilder>>startNewSequence newSequence := IRSequence new. newSequence method: ir. IRSequence>>method: aMethod method := aMethod. ASTTranslator>>ir ^ builder ir. MethodNode>>generate ast := ASTTranslator new visitNode: self. ir := ast ir. ^ ir compiledMethod. instantiation field store field read argument field store return return field store field read instantiation field write field read argument field write return return ... Alias * 0..1 parent child Instance
  19. 19. Object FlowAnalysis —Taking an Object-centricView on DynamicAnalysis :: Adrian Lienhard :: lienhard@iam.unibe.ch Representing object flows ce nce new. hod isitNode: self. instantiation field store field read argument field store return return field store field read instantiation field write field read argument field write return return ... Alias * 0..1 parent child Instance ArgumentAlias FieldWriteAliasReturnAlias...
  20. 20. Object FlowAnalysis —Taking an Object-centricView on DynamicAnalysis :: Adrian Lienhard :: lienhard@iam.unibe.ch Representing object flows stantiation field store read ument store return return field store field read stantiation field write read ument write return return ... Alias * 0..1 parent child Instance ArgumentAlias FieldWriteAliasReturnAlias... 0..1 * sender Method Class Attribute Activation receiver creator
  21. 21. Object FlowAnalysis —Taking an Object-centricView on DynamicAnalysis :: Adrian Lienhard :: lienhard@iam.unibe.ch Summary IRBuilder>>initialize ir := IRMethod new. ... IRBuilder>>startNewSequence newSequence := IRSequence new. newSequence method: ir. IRSequence>>method: aMethod method := aMethod. ASTTranslator>>ir ^ builder ir. MethodNode>>generate ast := ASTTranslator new visitNode: self. ir := ast ir. ^ ir compiledMethod. instantiation field store field read argument field store return return field store field read instantiation field write field read argument field write return return ... Alias * 0..1 parent child Instance ArgumentAlias FieldWriteAliasReturnAlias... 0..1 * sender Method Class Attribute Activation receiver creator Questions?

×