320 likes | 475 Views
Dynamic Object Sampling for Pretenuring. Maria Jump Department of Computer Sciences The University of Texas at Austin mjump@cs.utexas.edu. Stephen M. Blackburn Department of Computer Science Australia National University Steve.Blackburn@anu.edu.au. Kathryn S. McKinley
E N D
Dynamic Object Sampling for Pretenuring Maria Jump Department of Computer Sciences The University of Texas at Austin mjump@cs.utexas.edu Stephen M. Blackburn Department of Computer Science Australia National University Steve.Blackburn@anu.edu.au Kathryn S. McKinley Department of Computer Sciences The University of Texas at Austin mckinley@cs.utexas.edu
Current Trends • Object-oriented languages • Lots of small objects • Runtime system treats them uniformly • Objects have distinctive properties • Lifetime, access frequency, locality, calling context, thread usage, etc. • PROBLEM: How can we discover and exploit object properties? Jump, Blackburn, McKinley
Gathering Object Statistics • Offline statistics • Inconsistent with Java • Obscure phase behavior • Online statistics • Profiling all objects • Dynamic Object Sampling • Statistics only for selected objects • Use to estimate behavior of all objects Jump, Blackburn, McKinley
Example: Using Object Lifetimes for Pretenuring PROBLEM: Long-lived objects are allocated into the nursery SOLUTION: Allocate long-lived objects directly into mature space CHALLENGE: Correlating lifetime behavior with allocation site Jump, Blackburn, McKinley
Outline • Motivation • Dynamic Object Sampling • Mechanism • Dynamic Lifetime Prediction • Accuracy vs. Cost • Dynamic Pretenuring • Allocation Survival Phases • Coverage, Accuracy, and Performance • Conclusions Jump, Blackburn, McKinley
128 256 384 Dynamic Object Sampling • Modify a bump-pointer allocator • Sample one object every n bytes Memory chunk: Sample Tag (for n=128) Bump Pointer Jump, Blackburn, McKinley
VM_Address alloc(int bytes) throws VM_PragmaInline { VM_Addresss oldCursor = cursor; VM_Address newCursor = oldCursor.add(bytes); if (newCursor.GT(limit)) return allocSlow(bytes); cursor = newCursor; return oldCursor; } Bump-Pointer Allocator VM_Address alloc(int bytes) throws VM_PragmaInline { VM_Addresss oldCursor = cursor; VM_Address newCursor = oldCursor.add(bytes); if (newCursor.GT(sampleLimit)) return sample(bytes); cursor = newCursor; return oldCursor; } Slow Path Sample Path (Intermediate): 1) adds sample tag 2) collects statistics Jump, Blackburn, McKinley
During Garbage Collection • Use GC to update statistics • Trace live objects • Update transient and total statistics survivor What’s in the Sample Tag? SAMPLE TAG FOUND! 1. decode tag word 2. collect statistics Jump, Blackburn, McKinley
Dynamic Lifetime Prediction • Encode allocation site identifier into the object sampling sample tag • Allocation site is a good lifetime predictor [Blackburn et al.] • Compiler maps identifiers to sites • Accuracy vs. Cost tradeoff Jump, Blackburn, McKinley
Implementation and Experimental Methodology • Jikes RVM 2.3.0.1 with MMTk • SPEC JVM benchmarks, SPEC JBB 2000 with constant workload • 3.2 GHz Intel Pentium 4 w/ hyperthreading, 1GB main memory, Linux 2.6.0 • Generational/Mark-Sweep (GenMS) • 4MB bounded nursery • Pseudoadaptive compilation • Report application time only [Eeckhout et al.] • 2nd run methodology Jump, Blackburn, McKinley
Accuracy of Sampling javac Accuracy 92.5% Jump, Blackburn, McKinley
Cost of Sampling Jump, Blackburn, McKinley
if (survival rate >= threshold)then change the allocation target Pretenure: Object Sampling forDynamic Pretenuring • Accurately and efficiently estimate allocation-site lifetimes • At garbage collection time • Calculate survival rate per allocation site • Compute transient and total statistics Jump, Blackburn, McKinley
Dynamic Allocation Target case NURSERY_SPACE: table lookup if (shortLived(site)) region = nursery.alloc(…); else region = matureAlloc(…); break; region = nursery.alloc(…); break; Jump, Blackburn, McKinley
Dynamic Allocation Target Overhead Jump, Blackburn, McKinley
Dynamic Pretenuring Overhead Jump, Blackburn, McKinley
Allocation Phases • Current survival rate is not a guarantee of future survival • Sampling in older space is ineffective • Collections are infrequent • Small amount of allocation Periodically allocate site in nurseryBACKSAMPLING Jump, Blackburn, McKinley
Backsample Trigger * f n = Backsampling • Protects the system from bad choices • Reduces effectiveness of good choices When to Backsample? Growth function: Constant Linear Exponential Number of allocations for pretenuring decision Jump, Blackburn, McKinley
Dynamic Pretenuring Policies Jump, Blackburn, McKinley
Long-Lived Pretenured Pretenuring Threshold None 100% 95% 90% 85% 80% 75% Coverage: How much? Jump, Blackburn, McKinley
Incorrect Correct Pretenuring Threshold None 100% 95% 90% 85% 80% 75% Accuracy: Are we right? Jump, Blackburn, McKinley
GC Time: javac Jump, Blackburn, McKinley
Total Time: javac Jump, Blackburn, McKinley
Conclusions • Lifetime estimation for dynamic pretenuring • Accurately and efficiently estimates allocation-site lifetimes • Pretenuring long-lived allocation-sites can improve runtime • Few opportunities in our programs • Dynamic Object Sampling • Low-overhead • High accuracy • Generic mechanism Jump, Blackburn, McKinley
Questions? Thank You Jump, Blackburn, McKinley
GC Time: jess Jump, Blackburn, McKinley
Total Time: jess Jump, Blackburn, McKinley
Coverage: How much? Jump, Blackburn, McKinley
Accuracy: Are we right? Jump, Blackburn, McKinley
Coverage: How much? Jump, Blackburn, McKinley
Coverage: How much? Jump, Blackburn, McKinley
Coverage: How much? Jump, Blackburn, McKinley