220 likes | 332 Views
Characterizing the Usage of Temporaries in Framework-intensive Java Applications. +. +. Temporaries. Framework-intensive applications. Application. Middleware, Libraries & Frameworks. Application “Iceberg”. Research Goals. Determine why temporaries are created
E N D
Characterizing the Usage of Temporaries in Framework-intensive Java Applications
+ + Temporaries Framework-intensive applications Application Middleware, Libraries & Frameworks Application “Iceberg”
Research Goals • Determine why temporaries are created • Characterize temporary usage • Characterize regions allocating temporaries • Help programmers understand usage of temporaries • Long-term: Eliminate object churn • Establish best practices for API design/usage • Introduce local caching • Specialize frameworks for common usage
Safe All executions Low runtime overhead Difficult to scale Reflection poorly handled Poor support for dynamically generated classes Unsafe Single execution High runtime overhead Easy to scale Reflection easily handled Good support for dynamically generated classes Possible Approaches Static Analysis Dynamic Analysis
Execution Trace Loaded Classes Reflection Models Blended Analysis (ISSTA’07) Java Application Call Graph Static Analysis
w = new A() z = C.m() Pruning Control Flow Graphs Allocated types: {B} Observed targets: {D.m} Entry x = new B() y = D.m() Exit
Globally escaping Non-escaping Arg-escaping Escape Analysis Connection graph public X identity(X obj1) { return obj1; } public X escape(X obj2) { G.global = obj2; return obj2; } obj1 return public void f() { X inst; if (cond) inst = identity(new Y()); else inst = escape(new Z()); } Phantom Object #1
Globally escaping Non-escaping Arg-escaping Escape Analysis Connection graph public X identity(X obj1) { return obj1; } public X escape(X obj2) { G.global = obj2; return obj2; } G obj2 return public void f() { X inst; if (cond) inst = identity(new Y()); else inst = escape(new Z()); } global Phantom Object #2
return obj1 Phantom Object #1 Globally escaping Non-escaping Arg-escaping Escape Analysis Connection graph public X identity(X obj1) { return obj1; } G inst public X escape(X obj2) { G.global = obj2; return obj2; } global Z Y public void f() { X inst; if (cond) inst = identity(new Y()); else inst = escape(new Z()); } obj2 return Phantom Object #2
f() g() X X h() X Blended Escape Analysis • Based on Choi et. al. analysis [TOPLAS’03] • Abstract objects are allocation sites • Modified to keep a distinct escape state for each object at each method in the call graph • Modified to use declared types [Lhotàk & Hendren, CC’03] X clone = x.clone();
Reduced Connection Graphs Java Application Profiler Dynamic CCT + instances Visible objects Reduced Conn Graphs on CCT Dynamic Call Graph Blended Escape Analysis Connection Graphs
BigInteger.writeObject(…) • No CFG pruning • Captures 27 instances
BigInteger.writeObject(…) • CFG pruning • Captures 135 instances
Benchmarks App Trade 6 / WAS Eclipse • Trade 6 parameters: • Runtime mode (database): JDBC (Direct), Enterprise Java Beans (EJB) • Web services: off (Std), on (WS)
Related Work • Framework-intensive systems • Ammons et. al. [ECOOP’04] • Srinivas & Srinivasan [FSE ’05] • Mitchell et. al. [ECOOP ’06] • Combined static & dynamic analyses • Gupta et. al. [TOSEM ’97] • Groce et. al. [TACAS ’06] • Artzi et. al. [ASE’07] • Characterization of data structures in Java • Mitchell [ECOOP ’06], Mitchell & Sevitsky [ECOOP ’03] • Blackburn et. al. [OOPSLA’06] • Buytaert et. al. [ACES’05]
Conclusions • Temporaries are a real performance problem • Tool support is necessary to identify them • Research contributions: • New optimized blended analysis • New metrics for characterization of temporaries • Empirical study on real, framework-intensive Java applications • Blended analysis shows potential for solving the object churn problem