An Adaptive, Region-based Allocator for Java Feng Qian, Laurie Hendren {fqian, Sable Research Group School of Computer Science McGill.

Slides:



Advertisements
Similar presentations
Chapter 4 Memory Management Basic memory management Swapping
Advertisements

Memory.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 1 MC 2 –Copying GC for Memory Constrained Environments Narendran Sachindran J. Eliot.
Steve Blackburn Department of Computer Science Australian National University Perry Cheng TJ Watson Research Center IBM Research Kathryn McKinley Department.
1 Write Barrier Elision for Concurrent Garbage Collectors Martin T. Vechev Cambridge University David F. Bacon IBM T.J.Watson Research Center.
1 Error-Free Garbage Collection Traces: How to Cheat and Not Get Caught ACM SIGMETRICS, 2002.
An On-the-Fly Mark and Sweep Garbage Collector Based on Sliding Views Hezi Azatchi - IBM Yossi Levanoni - Microsoft Harel Paz – Technion Erez Petrank –
Hastings Purify: Fast Detection of Memory Leaks and Access Errors.
Using DSVM to Implement a Distributed File System Ramon Lawrence Dept. of Computer Science
By Jacob SeligmannSteffen Grarup Presented By Leon Gendler Incremental Mature Garbage Collection Using the Train Algorithm.
CS 326 Programming Languages, Concepts and Implementation Instructor: Mircea Nicolescu Lecture 18.
Increasing Memory Usage in Real-Time GC Tobias Ritzau and Peter Fritzson Department of Computer and Information Science Linköpings universitet
Chapter 8 Runtime Support. How program structures are implemented in a computer memory? The evolution of programming language design has led to the creation.
Free-Me: A Static Analysis for Individual Object Reclamation Samuel Z. Guyer Tufts University Kathryn S. McKinley University of Texas at Austin Daniel.
1 The Compressor: Concurrent, Incremental and Parallel Compaction. Haim Kermany and Erez Petrank Technion – Israel Institute of Technology.
Connectivity-Based Garbage Collection Presenter Feng Xian Author Martin Hirzel, et.al Published in OOPSLA’2003.
Java for High Performance Computing Jordi Garcia Almiñana 14 de Octubre de 1998 de la era post-internet.
U NIVERSITY OF M ASSACHUSETTS Department of Computer Science Automatic Heap Sizing Ting Yang, Matthew Hertz Emery Berger, Eliot Moss University of Massachusetts.
JVM-1 Introduction to Java Virtual Machine. JVM-2 Outline Java Language, Java Virtual Machine and Java Platform Organization of Java Virtual Machine Garbage.
An Adaptive, Region-based Allocator for Java Feng Qian & Laurie Hendren 2002.
Memory Management 1 CS502 Spring 2006 Memory Management CS-502 Spring 2006.
CS-3013 & CS-502, Summer 2006 Memory Management1 CS-3013 & CS-502 Summer 2006.
Compile-Time Deallocation of Individual Objects Sigmund Cherem and Radu Rugina International Symposium on Memory Management June, 2006.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science Garbage Collection Without Paging Matthew Hertz, Yi Feng, Emery Berger University.
The environment of the computation Declarations introduce names that denote entities. At execution-time, entities are bound to values or to locations:
Comparison of JVM Phases on Data Cache Performance Shiwen Hu and Lizy K. John Laboratory for Computer Architecture The University of Texas at Austin.
1 Presenter: Chien-Chih Chen Proceedings of the 2002 workshop on Memory system performance.
The College of William and Mary 1 Influence of Program Inputs on the Selection of Garbage Collectors Feng Mao, Eddy Zheng Zhang and Xipeng Shen.
Virtual Memory Chantha Thoeun. Overview  Purpose:  Use the hard disk as an extension of RAM.  Increase the available address space of a process. 
Exploiting Prolific Types for Memory Management and Optimizations By Yefim Shuf et al.
Taking Off The Gloves With Reference Counting Immix
Operating System Chapter 7. Memory Management Lynn Choi School of Electrical Engineering.
Lecture 10 : Introduction to Java Virtual Machine
Adaptive Optimization with On-Stack Replacement Stephen J. Fink IBM T.J. Watson Research Center Feng Qian (presenter) Sable Research Group, McGill University.
P ath & E dge P rofiling Michael Bond, UT Austin Kathryn McKinley, UT Austin Continuous Presented by: Yingyi Bu.
Chapter 5: Programming Languages and Constructs by Ravi Sethi Activation Records Dolores Zage.
Dynamic Object Sampling for Pretenuring Maria Jump Department of Computer Sciences The University of Texas at Austin Stephen M. Blackburn.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 1 Automatic Heap Sizing: Taking Real Memory into Account Ting Yang, Emery Berger,
September 11, 2003 Beltway: Getting Around GC Gridlock Steve Blackburn, Kathryn McKinley Richard Jones, Eliot Moss Modified by: Weiming Zhao Oct
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming.  To allocate scarce memory.
CSE 425: Control Abstraction I Functions vs. Procedures It is useful to differentiate functions vs. procedures –Procedures have side effects but usually.
380C lecture 19 Where are we & where we are going –Managed languages Dynamic compilation Inlining Garbage collection –Opportunity to improve data locality.
Runtime System CS 153: Compilers. Runtime System Runtime system: all the stuff that the language implicitly assumes and that is not described in the program.
UniProcessor Garbage Collection Techniques Paul R. Wilson University of Texas Presented By Naomi Sapir Tel-Aviv University.
Transparent Pointer Compression for Linked Data Structures June 12, 2005 MSP Chris Lattner Vikram Adve.
1 Garbage Collection Advantage: Improving Program Locality Xianglong Huang (UT) Stephen M Blackburn (ANU), Kathryn S McKinley (UT) J Eliot B Moss (UMass),
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Virtual Memory Hardware.
David F. Bacon Perry Cheng V.T. Rajan IBM T.J. Watson Research Center ControllingFragmentation and Space Consumption in the Metronome.
Object-Relative Addressing: Compressed Pointers in 64-bit Java Virtual Machines Kris Venstermans, Lieven Eeckhout, Koen De Bosschere Department of Electronics.
Pointer and Escape Analysis for Multithreaded Programs Alexandru Salcianu Martin Rinard Laboratory for Computer Science Massachusetts Institute of Technology.
Virtual Memory Pranav Shah CS147 - Sin Min Lee. Concept of Virtual Memory Purpose of Virtual Memory - to use hard disk as an extension of RAM. Personal.
1 The Garbage Collection Advantage: Improving Program Locality Xianglong Huang (UT), Stephen M Blackburn (ANU), Kathryn S McKinley (UT) J Eliot B Moss.
Eliminating External Fragmentation in a Non-Moving Garbage Collector for Java Author: Fridtjof Siebert, CASES 2000 Michael Sallas Object-Oriented Languages.
A Single Intermediate Language That Supports Multiple Implemtntation of Exceptions Delvin Defoe Washington University in Saint Louis Department of Computer.
Topic: Java Garbage Collection
Java 9: The Quest for Very Large Heaps
Compositional Pointer and Escape Analysis for Java Programs
Chapter 9 – Real Memory Organization and Management
Paging and Segmentation
David F. Bacon, Perry Cheng, and V.T. Rajan
Lecture 32 Syed Mansoor Sarwar
CS399 New Beginnings Jonathan Walpole.
Strategies for automatic memory management
Adaptive Code Unloading for Resource-Constrained JVMs
Closure Representations in Higher-Order Programming Languages
Lecture 3: Main Memory.
Lecture 7: Flexible Address Translation
Garbage Collection Advantage: Improving Program Locality
Program-level Adaptive Memory Management
Presentation transcript:

An Adaptive, Region-based Allocator for Java Feng Qian, Laurie Hendren {fqian, Sable Research Group School of Computer Science McGill University

Motivation ● Reduce GC work by object stack- allocation ● Drawbacks of previous approach for Java – whole-program escape analyses – restrictions on stackable objects: ● trivial finalize method ● limited sizes of arrays ● non-overlapping lifetime in a loop

Goals ● Reduce GC work by cheaply reclaiming non-escaping objects, but: – should not rely on expensive program analyses – overcome restrictions of stack-allocation ● Preserve full semantics of Java Virtual Machines ● Explore runtime information of Java programs

Road Map ● Motivation & Introduction  Region-based Allocator ● Experimental Results ● Conclusion & Future work

Proposal ● Use write barriers to dynamically categorize allocation sites as local or non-local ● Allocate objects in regions instead of stack frames ● Adaptively change allocation decisions

R2 Thread Stack From Space To Space Heap Global Region R1 R2

Thread Stack From Space To Space Heap R1 Global Region R2

Definitions ● Escaping Object: An object escapes its allocation region if and only if it is referenced by an object in another region ● Non-local Allocation Site: An allocation site becomes non-local when an object created by that site escapes

Heap Organization ● Heaps are managed as regions consisting of a set of pages: – A Global region contains escaping objects and objects created from non-local sites – A Free list links free pages – Local regions act as extensions of stack frames, allocate spaces for objects created from local sites

Allocation Sites and Objects ● Each allocation site has one unique index, with one of two states: – local, creates objects in local regions – non-local, creates object in the Global region ● An object header contains: – the index of its allocation site (sharing space with thin locks) – an escaping bit

a = new A(); a.1 1: a = local_new A();b.f = a 1: a = global_new A(); ba.1

Region Allocation ● Method prologue and epilogue have instructions allocating and releasing regions ● A region has one of two states: – clean: pages are reclaimed when the host stack frame popped – dirty: pages are appended to the Global region collected by GC

Write Barriers ● Objects may escape local regions by four types of byte codes: putstatic, putfield, aastore, and areturn ● Write barriers capturing escaping objects have two purposes: – safety: marking regions as dirty – adaptation: marking allocation sites as non- local

Put Them Together ● Initially, all allocation sites in a method are in the local state ● As the program proceeds, some become non-local, and will create future objects in the Global region ● The local regions of future activations are more likely to be clean ● Write barriers guarantee the safety

Specific Issues for Java ● areturn instruction ● exceptions (and athrow instruction) ● finalize method

Road Map ● Motivation & Introduction ● Region-based Allocator  Experimental Results ● Conclusion & Future work

Prototype Implementation ● Jikes RVM: we choose the baseline compiler, and a semi-space copying collector ● Settings: – Fixed page size – Did not use large object heap – Objects straddling multiple pages

Experimental Results ● Behavior study of SPECjvm98 & soot-c: – Allocation behavior – Effect of regions and page sizes on collections and fragmentation – Behavior of write barriers – Effect of adaptation – Impact on thin locks

R2R1 b a c

Allocation Distribution

Effect of Regions and Page Sizes Dynamic measurement of: ● number of collections ● froth rate (unused bytes on pages)

# collections froth rate BASE2561K4K2561K4K compress777 (13%)70.03%0.11%0.47% db444 ( 0%)40.05%0.23%1.05% jack978 (23%)91.29%5.97%27.52% javac12 15 ( 9%)254.96%29.41%130.42% jess ( 7%)110.13%0.53%2.19% mpeg000 (28%)00.62%2.10%9.05% mtrt711 (81%)10.03%0.09%0.38% soot-c (19%)151.09%4.89%23.49% * 50M total heap space with ~25M in each semi-space

Behavior of Write Barriers Write barriers for putfield, aastore :

Region Allocation at Runtime

Effect of Adaptation

Effect of Adaptation (Cont.)

More on Adaptation with adaptationwithout adaptation #collectionsfroth#collectionsfroth javac1529%96589% jess11 1% 2 9% Current scheme predicts future objects will escape after one object from that site escapes Without adaptation predicts future objects non-escaping

Impact on Thin Locks ● Share space with thin locks in a two- word object header. ● Less than 5% of thin locks require one additional check on common path ● One additional check on uncommon path (see the paper for details)

Related Work ● Escape analysis and stack allocation for Java programs – Gay et.al. [CC’00], Choi et.al. [OOPSLA’99], Blanchet [OOPSLA’99], Whaley et.al. [OOPSLA’99], … ● Memory Management with Regions (Scoped memory regions) – Tofte et.al.[IC’97], Gay et.al. [PLDI’98], Deters et.al. [ISMM’02], …

Conclusions ● We have presented the idea of using regions to reduce the work of GC in Java Virtual Machines ● We have implemented the prototype in a real virtual machine and proposed several techniques to reduce the overhead ● Our study of allocation behavior validates the idea

Future Work ● Relax definition of escaping by using stack discipline and region hierarchy ● Look for better prediction schemes (calling context) ● Optimize write barriers with cheap analyses ● Combine the allocator with other types of GC

?