Finding Your Cronies: Static Analysis for Dynamic Object Colocation Samuel Z. Guyer Kathryn S. McKinley T H E U N I V E R S I T Y O F T E X A S A T A U.

Slides:



Advertisements
Similar presentations
Garbage collection David Walker CS 320. Where are we? Last time: A survey of common garbage collection techniques –Manual memory management –Reference.
Advertisements

ASSUMPTION HIERARCHY FOR A CHA CALL GRAPH CONSTRUCTION ALGORITHM JASON SAWIN & ATANAS ROUNTEV.
P3 / 2004 Register Allocation. Kostis Sagonas 2 Spring 2004 Outline What is register allocation Webs Interference Graphs Graph coloring Spilling Live-Range.
The University of Adelaide, School of Computer Science
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.
Automatic Memory Management Noam Rinetzky Schreiber 123A /seminar/seminar1415a.html.
Compilation 2011 Static Analysis Johnni Winther Michael I. Schwartzbach Aarhus University.
COMPILERS Register Allocation hussein suleman uct csc305w 2004.
Register Allocation CS 671 March 27, CS 671 – Spring Register Allocation - Motivation Consider adding two numbers together: Advantages: Fewer.
Prof. Necula CS 164 Lecture 141 Run-time Environments Lecture 8.
MC 2 : High Performance GC for Memory-Constrained Environments - Narendran Sachindran, J. Eliot B. Moss, Emery D. Berger Sowmiya Chocka Narayanan.
Garbage Collection  records not reachable  reclaim to allow reuse  performed by runtime system (support programs linked with the compiled code) (support.
Garbage Collection CSCI 2720 Spring Static vs. Dynamic Allocation Early versions of Fortran –All memory was static C –Mix of static and dynamic.
MC 2 : High Performance GC for Memory-Constrained Environments N. Sachindran, E. Moss, E. Berger Ivan JibajaCS 395T *Some of the graphs are from presentation.
380C Where are we & where we are going – Managed languages Dynamic compilation Inlining Garbage collection What else can you do when you examine the heap.
Chapter 8 Runtime Support. How program structures are implemented in a computer memory? The evolution of programming language design has led to the creation.
Memory Management. History Run-time management of dynamic memory is a necessary activity for modern programming languages Lisp of the 1960’s was one of.
Free-Me: A Static Analysis for Individual Object Reclamation Samuel Z. Guyer Tufts University Kathryn S. McKinley University of Texas at Austin Daniel.
Generational Stack Collection And Profile driven Pretenuring Perry Cheng Robert Harper Peter Lee Presented By Moti Alperovitch
CS 536 Spring Run-time organization Lecture 19.
3/17/2008Prof. Hilfinger CS 164 Lecture 231 Run-time organization Lecture 23.
Connectivity-Based Garbage Collection Presenter Feng Xian Author Martin Hirzel, et.al Published in OOPSLA’2003.
Code Generation Simple Register Allocation Mooly Sagiv html:// Chapter
Previous finals up on the web page use them as practice problems look at them early.
Run-Time Storage Organization
An Adaptive, Region-based Allocator for Java Feng Qian & Laurie Hendren 2002.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science Garbage Collection Without Paging Matthew Hertz, Yi Feng, Emery Berger University.
Chapter 9: Subprogram Control
1 Reducing Generational Copy Reserve Overhead with Fallback Compaction Phil McGachey and Antony L. Hosking June 2006.
Run-time Environment and Program Organization
1 CSCI 360 Survey Of Programming Languages 9 – Implementing Subprograms Spring, 2008 Doug L Hoffman, PhD.
Chapter 10 Implementing Subprograms. Copyright © 2007 Addison-Wesley. All rights reserved. 1–2 Semantics of Call and Return The subprogram call and return.
Flexible Reference-Counting-Based Hardware Acceleration for Garbage Collection José A. Joao * Onur Mutlu ‡ Yale N. Patt * * HPS Research Group University.
Exploiting Prolific Types for Memory Management and Optimizations By Yefim Shuf et al.
ISBN Chapter 10 Implementing Subprograms.
Connectivity-Based Garbage Collection Martin Hirzel University of Colorado at Boulder Collaborators: Amer Diwan, Michael Hind, Hal Gabow, Johannes Henkel,
380C Lecture 17 Where are we & where we are going –Managed languages Dynamic compilation Inlining Garbage collection –Why you need to care about workloads.
Ulterior Reference Counting: Fast Garbage Collection without a Long Wait Author: Stephen M Blackburn Kathryn S McKinley Presenter: Jun Tao.
Institute of Computing Technology On Improving Heap Memory Layout by Dynamic Pool Allocation Zhenjiang Wang Chenggang Wu Institute of Computing Technology,
Compiler Construction
Fast Conservative Garbage Collection Rifat Shahriyar Stephen M. Blackburn Australian National University Kathryn S. M cKinley Microsoft Research.
Dynamic Object Sampling for Pretenuring Maria Jump Department of Computer Sciences The University of Texas at Austin Stephen M. Blackburn.
Copyright (c) 2004 Borys Bradel Myths and Realities: The Performance Impact of Garbage Collection Paper: Stephen M. Blackburn, Perry Cheng, and Kathryn.
Free-Me: A Static Analysis for Automatic Individual Object Reclamation Samuel Z. Guyer, Kathryn McKinley, Daniel Frampton Presented by: Dimitris Prountzos.
Pointer Analysis as a System of Linear Equations. Rupesh Nasre (CSA). Advisor: Prof. R. Govindarajan. Jan 22, 2010.
September 11, 2003 Beltway: Getting Around GC Gridlock Steve Blackburn, Kathryn McKinley Richard Jones, Eliot Moss Modified by: Weiming Zhao Oct
Implementing Subprograms What actions must take place when subprograms are called and when they terminate? –calling a subprogram has several associated.
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
380C lecture 19 Where are we & where we are going –Managed languages Dynamic compilation Inlining Garbage collection –Opportunity to improve data locality.
PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Merging Equivalent Contexts for Scalable Heap-cloning-based Points-to.
1 Garbage Collection Advantage: Improving Program Locality Xianglong Huang (UT) Stephen M Blackburn (ANU), Kathryn S McKinley (UT) J Eliot B Moss (UMass),
Data Flow Analysis for Software Prefetching Linked Data Structures in Java Brendon Cahoon Dept. of Computer Science University of Massachusetts Amherst,
Register Allocation CS 471 November 12, CS 471 – Fall 2007 Register Allocation - Motivation Consider adding two numbers together: Advantages: Fewer.
Pointer and Escape Analysis for Multithreaded Programs Alexandru Salcianu Martin Rinard Laboratory for Computer Science Massachusetts Institute of Technology.
1 GC Advantage: Improving Program Locality Xianglong Huang, Zhenlin Wang, Stephen M Blackburn, Kathryn S McKinley, J Eliot B Moss, Perry Cheng.
Implementing Subprograms
Points-to Analysis as a System of Linear Equations Rupesh Nasre. Computer Science and Automation Indian Institute of Science Advisor: Prof. R. Govindarajan.
GC Assertions: Using the Garbage Collector To Check Heap Properties Samuel Z. Guyer Tufts University Edward Aftandilian Tufts University.
ISBN Chapter 10 Implementing Subprograms.
LECTURE 19 Subroutines and Parameter Passing. ABSTRACTION Recall: Abstraction is the process by which we can hide larger or more complex code fragments.
Runtime Environments Chapter 7. Support of Execution  Activation Tree  Control Stack  Scope  Binding of Names –Data object (values in storage) –Environment.
1 The Garbage Collection Advantage: Improving Program Locality Xianglong Huang (UT), Stephen M Blackburn (ANU), Kathryn S McKinley (UT) J Eliot B Moss.
Cork: Dynamic Memory Leak Detection with Garbage Collection
CS 153: Concepts of Compiler Design November 28 Class Meeting
José A. Joao* Onur Mutlu‡ Yale N. Patt*
Chapter 10-1: Dynamic Memory Allocation
Garbage Collection Advantage: Improving Program Locality
Program-level Adaptive Memory Management
Presentation transcript:

Finding Your Cronies: Static Analysis for Dynamic Object Colocation Samuel Z. Guyer Kathryn S. McKinley T H E U N I V E R S I T Y O F T E X A S A T A U S T I N

OOPSLA, Oct 27, 2004Guyer, McKinley 2 Motivation Modern garbage collectors use multiple spaces Generational collectors: Allocate new objects in nursery space Many objects die young – collection is cheap Copy survivors into mature space – “promotion” Problem: longer-lived objects always copied javac : 25% (47 MB out of 185 MB) nurserymature space

OOPSLA, Oct 27, 2004Guyer, McKinley 3 Avoiding promotion Solution: skip nursery Allocate objects that will survive in mature space How do we predict nursery survivors? Look at why objects survive... Most objects survive because they are connected to older objects javac: 10% stack, 90% mature space nurserymature space p

OOPSLA, Oct 27, 2004Guyer, McKinley 4 Exploiting connectivity Pointers predict survival Create new object – point to it from mature space New object will be promoted Instead: colocate new object... Anticipate the pointer Allocate pointer target in same space as source nurserymature space

OOPSLA, Oct 27, 2004Guyer, McKinley 5 Dynamic Object Colocation Key: a cooperative approach... Run-time: new allocation routine coalloc() takes a Object argument – the colocator Allocates new object in same space as colocator Compile-time: static analysis Determine if a new object will be a pointer target At allocation site: pass pointer source as colocator Connected objects end up in the same space

OOPSLA, Oct 27, 2004Guyer, McKinley 6 Outline Motivation Dynamic object colocation Colocators Static analysis for finding colocators Run-time system Results Related work Conclusions

OOPSLA, Oct 27, 2004Guyer, McKinley 7 Simple Example The new B object will live as long as A * Colocate new B with A Run-time value of p determines behavior: void Simple(A p){ B newB = new B(); p.f = newB; } void Simple(A p){ B newB = coalloc B(p); p.f = newB; } A newB nurserymature space A newB A * Unless p.f is overwritten

OOPSLA, Oct 27, 2004Guyer, McKinley 8 Complex Example Problem: new C cannot be colocator for new B Solution: use p as colocator for both Connectivity is transitive – so is survival Simplifies task of finding colocators void BottomUp(A p){ B newB = new B(); C newC = new C(); newC.f = newB; p.f = newC; } void BottomUp(A p){ B newB = coalloc B(p); C newC = coalloc C(p); newC.f = newB; p.f = newC; } A newB newC

OOPSLA, Oct 27, 2004Guyer, McKinley 9 Finding colocators Use formal parameters Likely to refer to older objects Order of creation/connection doesn’t matter Goal: for each allocation site… Will the new object end up connected to a parameter? (Directly or indirectly) Find colocators using custom pointer analysis Determine connectivity using points-to graph

OOPSLA, Oct 27, 2004Guyer, McKinley 10 Analysis algorithm Points-to graph Node for each parameter, alloc site Edges represent “may point-to” Visit each instruction in IR Keep track of variable bindings Add edges at putfield and astore Find colocators using graph Test reachability of allocation nodes from parameters One method at a time newC newE newD newF void foo(A p, B q) {...} AB pq newG newE p

OOPSLA, Oct 27, 2004Guyer, McKinley 11 Interprocedural analysis Common case: local analysis good enough Problem: allocation, connection in different methods For example, container classes Connector methods Record how method connects arguments Apply summary at call sites Factory methods Treat calls to factory as allocations at call sites Helpful, but not required... p = new Element(); list.add(p);

OOPSLA, Oct 27, 2004Guyer, McKinley 12 Analysis features Observation: Allocation doesn’t affect correctness Colocation analysis can be unsound Simplify algorithm One pass – no fixed-point computation No conservative assumptions (parameter aliasing) No closed-world assumption Works with class loading, reflection, native methods Ignore some connections Heuristics to identify volatile pointers * Unless p.f is overwritten *

OOPSLA, Oct 27, 2004Guyer, McKinley 13 Volatility heuristics Some connections should not cause colocation Mistakes can fill the mature space with garbage Prune them out of the graph... void bar(Container c) { for (...) { c.add(new String(...)); } c.clear(); } New string is conditionally stored Heuristic: store must post- dominate allocation Container object is immediately cleared Heuristic: skip connections that have null assignments void foo(Container c, Value v) { String value_name = new String(v); if ( ! c.contains(value_name)) c.add(value_name); }

OOPSLA, Oct 27, 2004Guyer, McKinley 14 Run-time Coalloc routine – generational collector Factory methods At call site save the colocator At start of method retrieve the colocator Colocation depends on calling context VM_Address coalloc(int bytes, VM_Address colocator) { if (! colocator.isZero() && colocator.LT(NURSERY_START)) return matureAlloc(bytes); else return nursery.alloc(bytes); } If the colocator is non- null and resides in the mature space… … allocate the new object directly in the mature space. … otherwise, allocate the object in the nursery.

OOPSLA, Oct 27, 2004Guyer, McKinley 15 Methodology JikesRVM using MMTk 3.2 GHz Pentium 4, 1 GB memory, Linux Generational collectors – 4 MB bounded nursery GenCopy – copying older space GenMS – mark/sweep older space Benchmarks: SPECJVM98 + pseudojbb Compile all methods ahead of time (+ 5-10%) Goals: Reduce nursery promotion – GC time Avoid filling up the mature space with garbage

OOPSLA, Oct 27, 2004Guyer, McKinley 16 Nursery survival % 50% 150% jessraytracedbjavacmtrtjackpseudojbb Base Coloc Bytes in mature space (normalized) MB promotedMB mature space alloc BaseColocBaseColocBaseColocBaseColocBaseColocBaseColoc 13.8

OOPSLA, Oct 27, 2004Guyer, McKinley 17 GC Time: javac 62% 57%

OOPSLA, Oct 27, 2004Guyer, McKinley 18 GC Time: jbb -24% 40% 35% 55%

OOPSLA, Oct 27, 2004Guyer, McKinley 19 GC Time: average % speedup

OOPSLA, Oct 27, 2004Guyer, McKinley 20 Runtime: javac 4% 8%

OOPSLA, Oct 27, 2004Guyer, McKinley 21 Runtime: average % speedup

OOPSLA, Oct 27, 2004Guyer, McKinley 22 Runtime: db % speedup

OOPSLA, Oct 27, 2004Guyer, McKinley 23 Related Work Co-allocation for locality [Chilimbi 99] Manually add coalloc() calls Pretenuring [Blackburn 01] Static decision – needs alloc-site homogeneity Connectivity-based GC [Hirzel 03] Statically partitions objects Requires sound pointer analysis Our approach combines static and dynamic

OOPSLA, Oct 27, 2004Guyer, McKinley 24 Conclusions Dynamic object colocation overcomes limitations of static approaches Static analysis for garbage collection Complex property (object lifetime) predicted by simple information (local connectivity) Use aggressive, unconventional points-to analysis Cooperative approach Exploit different strengths of compiler and run-time

OOPSLA, Oct 27, 2004Guyer, McKinley 25 Thank You

OOPSLA, Oct 27, 2004Guyer, McKinley 26 GC Time: jbb % speedup

OOPSLA, Oct 27, 2004Guyer, McKinley 27 Conclusions Compiler can assist garbage collector Compiler can discover useful information Complex property (lifetime) predicted by simple information (connectivity) Cooperative approach Static analysis to identify opportunities Run-time system handles dynamic behavior Low cost and effective Generalizes to other multi-space collectors