Object Flow Analysis – Taking an Object-centric View on Dynamic Analysis Adrian Lienhard 1 , Stéphane Ducasse 2 and T udor Gîrba 1 1 Software Composition Group, University of Bern, Switzerland 2 LISTIC, University of Savoie, France
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? Object Flow Analysis — T aking an Object-centric View on Dynamic Analysis : : 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 Object Flow Analysis — T aking an Object-centric View on Dynamic Analysis : : Adrian Lienhard : : lienhard@iam.unibe.ch
1) the method execution perspective MethodNode>>generate ASTTranslator class>>new ... ... IRBuilder>>initialize “How is the IRMethod IRMethod class>>new instance passed to ... ? ASTTranslator>>visitNode: MethodNode?” ASTTranslator>>ir IRMethod>>compiledMethod IRTranlator class>new Object Flow Analysis — T aking an Object-centric View on Dynamic Analysis : : Adrian Lienhard : : lienhard@iam.unibe.ch
2) the object interrelationship perspective :IRMethod :MethodNode :IRBuilder :IRSequence :ASTTranslator Object Flow Analysis — T aking an Object-centric View on Dynamic Analysis : : Adrian Lienhard : : lienhard@iam.unibe.ch
2) the object interrelationship perspective ? “How is the IRMethod :IRMethod :MethodNode instance passed to MethodNode?” :IRBuilder :IRSequence :ASTTranslator Object Flow Analysis — T aking an Object-centric View on Dynamic Analysis : : Adrian Lienhard : : lienhard@iam.unibe.ch
MethodNode>>generate ASTTranslator class>>new ? ... ... :IRMethod :MethodNode IRBuilder>>initialize IRMethod class>>new interdependency? ... ? ASTTranslator>>visitNode: :IRBuilder :IRSequence ASTTranslator>>ir IRMethod>>compiledMethod IRTranlator class>new :ASTTranslator Object Flow Analysis track the transfer of object references Object Flow Analysis — T aking an Object-centric View on Dynamic Analysis : : Adrian Lienhard : : lienhard@iam.unibe.ch
Object Flow IRBuilder>>initialize instantiation ir := IRMethod new. field store Analysis ... IRBuilder>>startNewSequence newSequence := IRSequence new. field read newSequence method: ir. argument IRSequence>>method: aMethod field store method := aMethod. a) capture all ASTTranslator>>ir ^ builder ir. return references of an MethodNode>>generate object ast := ASTTranslator new visitNode: self. return ir := ast ir. field store ^ ir compiledMethod. field read b) track the IRMethod>>compiledMethod ^ compiledMethod := IRTranslator new transfer of interpret: self; compiledMethod. references argument IRTranslator>>interpret: ir ... Object Flow Analysis — T aking an Object-centric View on Dynamic Analysis : : Adrian Lienhard : : lienhard@iam.unibe.ch
Object Flow IRBuilder>>initialize instantiation instantiation ir := IRMethod new. field write field write Analysis ... IRBuilder>>startNewSequence newSequence := IRSequence new. field read field read newSequence method: ir. argument argument IRSequence>>method: aMethod field write field write method := aMethod. a) capture all ASTTranslator>>ir return ^ builder ir. return references of an MethodNode>>generate object ast := ASTTranslator new visitNode: self. return return ir := ast ir. field write field write ^ ir compiledMethod. field read field read b) track the IRMethod>>compiledMethod ^ compiledMethod := IRTranslator new transfer of interpret: self; compiledMethod. references argument IRTranslator>>interpret: ir argument ... Object Flow Analysis — T aking an Object-centric View on Dynamic Analysis : : Adrian Lienhard : : lienhard@iam.unibe.ch
Object Flow IRBuilder>>initialize IRBuilder>>initialize instantiation instantiation instantiation instantiation ir := IRMethod new. ir := IRMethod new. 1 field store field write field write field write Analysis ... ... 1 IRBuilder>>startNewSequence IRBuilder>>startNewSequence newSequence := IRSequence new. newSequence := IRSequence new. field read field read field read field read newSequence method: ir. newSequence method: ir. 2 2 argument argument argument argument IRSequence>>method: aMethod IRSequence>>method: aMethod field write field write field store field write method := aMethod. method := aMethod. “How is the IRMethod ASTTranslator>>ir ASTTranslator>>ir return return return ^ builder ir. ^ builder ir. return instance passed to 3 3 MethodNode>>generate MethodNode>>generate MethodNode?” ast := ASTTranslator new visitNode: self. ast := ASTTranslator new visitNode: self. return return return return ir := ast ir. ir := ast ir. field store field write field write field write ^ ir compiledMethod. ^ ir compiledMethod. field read field read field read field read IRMethod>>compiledMethod IRMethod>>compiledMethod ^ compiledMethod := IRTranslator new ^ compiledMethod := IRTranslator new interpret: self; interpret: self; compiledMethod. compiledMethod. argument argument argument argument IRTranslator>>interpret: ir IRTranslator>>interpret: ir ... ... Object Flow Analysis — T aking an Object-centric View on Dynamic Analysis : : Adrian Lienhard : : lienhard@iam.unibe.ch
Application How do classes exchange objects? Object Flow Analysis — T aking an Object-centric View on Dynamic Analysis : : Adrian Lienhard : : lienhard@iam.unibe.ch
Inter-unit flow view classes containedInPackage: ’ AST-Nodes ’ mapTo: ’ AST ’ . classes hierarchyRootedIn: ’ IRInstruction ’ mapTo: ’ Intermediate-Representation ’ Object Flow Analysis — T aking an Object-centric View on Dynamic Analysis : : Adrian Lienhard : : lienhard@iam.unibe.ch
Chronological propagation Object Flow Analysis — T aking an Object-centric View on Dynamic Analysis : : Adrian Lienhard : : lienhard@iam.unibe.ch
Parser (4) Spanning flows Object Flow Analysis — T aking an Object-centric View on Dynamic Analysis : : Adrian Lienhard : : lienhard@iam.unibe.ch
Spanning flows IRBuilder Object Flow Analysis — T aking an Object-centric View on Dynamic Analysis : : Adrian Lienhard : : lienhard@iam.unibe.ch
objects created in objects passed IRBuilder through directly objects passed out multiple times objects stored in an instance variable timeline Object Flow Analysis — T aking an Object-centric View on Dynamic Analysis : : Adrian Lienhard : : lienhard@iam.unibe.ch
Representing object flows IRBuilder>>initialize instantiation instantiation ir := IRMethod new. field write field store ... IRBuilder>>startNewSequence newSequence := IRSequence new. field read field read newSequence method: ir. argument argument IRSequence>>method: aMethod field write field store method := aMethod. ASTTranslator>>ir return return ^ builder ir. MethodNode>>generate ast := ASTTranslator new visitNode: self. return return ir := ast ir. field store ^ ir compiledMethod. field read ... Object Flow Analysis — T aking an Object-centric View on Dynamic Analysis : : Adrian Lienhard : : lienhard@iam.unibe.ch
Representing object flows IRBuilder>>initialize instantiation instantiation ir := IRMethod new. Instance field write field store ... IRBuilder>>startNewSequence newSequence := IRSequence new. parent field read field read newSequence method: ir. 0..1 Alias argument argument IRSequence>>method: aMethod * field store field write method := aMethod. child ASTTranslator>>ir return return ^ builder ir. MethodNode>>generate ast := ASTTranslator new visitNode: self. return return ir := ast ir. field store ^ ir compiledMethod. field read ... Object Flow Analysis — T aking an Object-centric View on Dynamic Analysis : : Adrian Lienhard : : lienhard@iam.unibe.ch
Representing object flows instantiation instantiation Instance field write field store parent field read field read 0..1 Alias argument argument * field store field write child return return ... ArgumentAlias ReturnAlias FieldWriteAlias ranslator new visitNode: self. return return field store field read ... Object Flow Analysis — T aking an Object-centric View on Dynamic Analysis : : Adrian Lienhard : : lienhard@iam.unibe.ch
Representing object flows Instance Class sender 0..1 parent * receiver 0..1 Activation Alias Method * creator child Attribute return return ... ArgumentAlias ReturnAlias FieldWriteAlias return return eld store eld read Object Flow Analysis — T aking an Object-centric View on Dynamic Analysis : : Adrian Lienhard : : lienhard@iam.unibe.ch
Recommend
More recommend