Presentation is loading. Please wait.

Presentation is loading. Please wait.

Compiler Optimizations for Nondeferred Reference-Counting Garbage Collection Pramod G. Joisha Microsoft Research, Redmond.

Similar presentations


Presentation on theme: "Compiler Optimizations for Nondeferred Reference-Counting Garbage Collection Pramod G. Joisha Microsoft Research, Redmond."— Presentation transcript:

1 Compiler Optimizations for Nondeferred Reference-Counting Garbage Collection Pramod G. Joisha Microsoft Research, Redmond

2 ISMM’06 1 Classic Reference-Counting (RC) Garbage Collection All references (stack, statics, heap) tallied Based on the nondeferred RC invariant –Nonzero means at least one incident reference and zero means garbage High processing costs –Counts need to be updated on every mutation

3 ISMM’06 2 Past Solution to High Overhead Count only a subset of references –Deferred RC collection (1976) –Ulterior RC collection (2003) Based on the deferred RC invariant –Nonzero means at least one incident reference but zero means maybe garbage Faster, but –more “floating” garbage –longer pauses

4 ISMM’06 3 Our Solution Program analyses –Idea: Eliminate redundant RC updates Redundancy with respect to RC invariant –Advantages Reclamation characteristics unchanged Pause time no worse than unoptimized case

5 ISMM’06 4 Talk Outline Optimizations (and related analyses) –RC subsumption –Acyclic object RC update specialization Experimental results –Impact on execution times –Comparison with deferred RC collection Conclusions

6 ISMM’06 5 Optimizations Fall into three categories –Data-centric (immortal RC update elision, acyclic object RC update specialization) –Program-centric (RC subsumption, RC update coalescing, null-check omission) –RC update-centric (RC update inlining)

7 ISMM’06 6 RC Subsumption: Intuition

8 ISMM’06 7 Flow-Insensitive RC Subsumption y is always RC subsumed by x if 1.All live ranges of y are contained in x 2.The variable y is never live through a redefinition of either y or x 3.Everything reachable from y is also reachable from x y x

9 ISMM’06 8 Live Range Webs x :=... y := x... y...... x...... y... x :=... y := x

10 ISMM’06 9 Provision 1: Live-Range Subsumption Graph Directed graph G L – Nodes represent local references – Edges denote live-range containment – ( y, x ) means “ y is always contained in x ” Quadratic algorithm –Start with G = (V,E) –Add ( u, v ) if u is live and v dead at point P –Complement of G is G L

11 ISMM’06 10 A Contingent Opportunity

12 ISMM’06 11 Provision 2: Uncut Live-Range Subsumption Graph Handles redefinition provision Directed graph G E –Start with G L –Find live thru (s) and defs may (s) –Then live rdef (s) = live thru (s)  defs may (s) –Delete ( u, x ) if u  live rdef (s) –Delete ( y, u ) if y  live thru (s) and u  live rdef (s)

13 ISMM’06 12 Overlooking Roots stack v u A B u := v u := v.g ( g is a read-only field) u := v[ e ] ( v is thread local and v[ e ] isn’t written into before v dies) u := v.f ( v is thread local and v.f isn’t written into before v dies)

14 ISMM’06 13 Start with G E Delete ( u, v ), where u  v – nothing overlooks u at its definition – u is overlooked by w and ( w, v )  G R Delete until fixed point is reached Approximate overlooking roots’ set used Provision 3: RC Subsumption Graph u w v

15 ISMM’06 14 Talk Outline Optimizations (and related analyses) –RC subsumption –Acyclic object RC update specialization Experimental results –Impact on execution times –Comparison with deferred RC collection Conclusions

16 ISMM’06 15 The Problem of Garbage Cycles Reference counting can’t capture cycles Three solutions: –Programming paradigms –Back-up tracing collector –Local tracing solution: trial deletion

17 ISMM’06 16 Background on Trial Deletion Decremented references buffered Trial deletion adds overheads –Bookkeeping memory (PLC buffer, PLC link) –Extra processing in RC updates Idea: Statically identify acyclic objects

18 ISMM’06 17 Determine types that are always acyclic Type hierarchy and field information –Type connectivity (TC) graph SCC decomposition of TC graph Acyclic Type Analysis y w v x z

19 ISMM’06 18 Building the TC Graph Separate compilation Immortal object optimization Array subtyping issues

20 ISMM’06 19 Other Optimizations RC updates on immortal objects –vtables, string literals, GC tables Coalescing of RC updates Non-null operand RC update specialization RC update inlining

21 ISMM’06 20 Talk Outline Optimizations (and related analyses) –RC subsumption –Acyclic object RC update specialization Experimental results –Impact on execution times –Comparison with deferred RC collection Conclusions

22 ISMM’06 21 Benchmarks

23 ISMM’06 22 Optimization Effects

24 ISMM’06 23 Overlooking Roots’ Set Effects

25 ISMM’06 24 RC Update Distributions

26 ISMM’06 25 Summary High overheads can be drastically reduced without compromising on benefits! –Key: a new analysis called RC subsumption Improvements due to it alone often significant –Execution times on a par with deferred RC collection on a number of programs –Challenges wisdom on classic RC efficiency Scope for further improvement exists Future Work: Multithreading


Download ppt "Compiler Optimizations for Nondeferred Reference-Counting Garbage Collection Pramod G. Joisha Microsoft Research, Redmond."

Similar presentations


Ads by Google