Download presentation
Presentation is loading. Please wait.
Published byMilo Hicks Modified over 9 years ago
1
Constructing Accurate Application Call Graphs For Java To Model Library Callbacks Weilei Zhang, Barbara Ryder Department of Computer Science Rutgers University
2
SCAM’06 2 Motivation ● Call graphs (CG) are widely used in software engineering and compiler optimisation ● Reference analysis is used to generate CG for object-oriented programs A precise reference analysis requires a whole-program analysis, e.g. N- CFA, object sensitive analysis The constructed CG includes both application and library methods as its nodes (whole-program CG) ● In many software engineering applications, the calling relationships among library methods are NOT as interesting or important
3
SCAM’06 3 Application Call Graph ● Application CG represents calling relationships between application methods ● Two kinds of edges in application CG: direct: application method x may call y directly callback: x may call a library method that may eventually call back y through method calls in the library x→ l 1 → l 2 →.....→ l n → y (l i : a library method) ● Comparison: whole-program CG vs. application CG Whole-program CG is inaccurate in representing callback relationship between application methods Whole-program CG may contain too much information ● Library becomes larger and larger in modern software
4
SCAM’06 4 “Library” in Multi-tier Software Architecture ● Where to draw the line for java library? Narrow: java SE(EE) libraries, as used in the experimental study of this paper Broad: in a multi-tier software architecture, the subprograms in lower tiers can be considered as libraries to the upper tiers Application Middleware Java EE Platform Java SE Platform Library can be overwhelmingly large in modern software compared to the application program under investigation. Application CG is more manageable than whole-program CG.
5
SCAM’06 5 class App{ StringBuffer local; StringBuffer appendA(){ A a=new A(); return (local.append(a)); } StringBuffer appendB(){ B b=new B(); return (local.append(b)); } class A{ String toString(){...} } class B{ String toString(){...} } Library Calls Whole-program CG Is Inaccurate in Representing Callback Relationship
6
SCAM’06 6 class App{ StringBuffer local; StringBuffer appendA(){ A a=new A(); return (local.append(a)); } StringBuffer appendB(){ B b=new B(); return (local.append(b)); } class A{ String toString(){...} } class B{ String toString(){...} } App.appendA() StringBuffer.append(Object ) String.valueOf(Object) A.toString() Library callback App.appendA() A.toString() Whole-program CG Is Inaccurate in Representing Callback Relationship
7
SCAM’06 7 class App{ StringBuffer local; StringBuffer appendA(){ A a=new A(); return (local.append(a)); } StringBuffer appendB(){ B b=new B(); return (local.append(b)); } class A{ String toString(){...} } class B{ String toString(){...} } App.appendB( ) StringBuffer.append(Object ) String.valueOf(Object) B.toString() Library callback App.appendB( ) B.toString() Whole-program CG Is Inaccurate in Representing Callback Relationship
8
SCAM’06 8 Whole-program CG Is Inaccurate in Representing Callback Relationship App.appendA() App.appendB( ) StringBuffer.append(Object ) String.valueOf(Object) A.toString()B.toString() Library callback App.appendA() App.appendB( ) A.toString()B.toString() class App{ StringBuffer local; StringBuffer appendA(){ A a=new A(); return (local.append(a)); } StringBuffer appendB(){ B b=new B(); return (local.append(b)); } class A{ String toString(){...} } class B{ String toString(){...} }
9
SCAM’06 V a -DataReach ft to Resolve Callbacks Accurately and Automatically App.appendA() App.appendB( ) StringBuffer.append(Object ) String.valueOf(Object) A.toString()B.toString() Library callback App.appendA() App.appendB( ) A.toString()B.toString() ● DataReach(Fu et al. TSE 2005): to resolve control-flow (call path) reachability via data reachability analysis Call paths requiring receiver objects of a specific type can be shown to be infeasible, if those types of objects are not reachable through dereferences at the relevant call site. ● V a -DataReach ft (SCAM 2006): a call-site specific reference analysis and escape analysis are performed at the same time for each library call to derive callbacks automatically Object.toString() append(a)append(b)
10
SCAM’06 10 Contributions ● A new variant of the data reachability algorithm is proposed (V a - DataReach) and fine tuned specifically to resolve library callbacks accurately (V a -DataReach ft ) ● The algorithm is implemented and experimented. The experimental study shows that the algorithm is practical and eliminates a large amount of spurious callback edges For all spec-jvm98 benchmarks, on average, the number of callback edges is reduced from whole program call graph (generated by a points- to analysis) by 74.97% The algorithm finishes in reasonable time (the longest is 781 seconds, for javac, which has 2432 library calls)
11
SCAM’06 11 Thanks!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.