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

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

P3 / 2004 Register Allocation. Kostis Sagonas 2 Spring 2004 Outline What is register allocation Webs Interference Graphs Graph coloring Spilling Live-Range.
Introduction to Memory Management. 2 General Structure of Run-Time Memory.
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.
Context-Sensitive Interprocedural Points-to Analysis in the Presence of Function Pointers Presentation by Patrick Kaleem Justin.
Register Allocation CS 671 March 27, CS 671 – Spring Register Allocation - Motivation Consider adding two numbers together: Advantages: Fewer.
On-the-Fly Garbage Collection Using Sliding Views Erez Petrank Technion – Israel Institute of Technology Joint work with Yossi Levanoni, Hezi Azatchi,
Lecture 10: Heap Management CS 540 GMU Spring 2009.
Garbage Collection  records not reachable  reclaim to allow reuse  performed by runtime system (support programs linked with the compiled code) (support.
Memory Management Tom Roeder CS fa. Motivation Recall unmanaged code eg C: { double* A = malloc(sizeof(double)*M*N); for(int i = 0; i < M*N; i++)
Chapter 8, Part I Graph Algorithms.
Advanced Data Structures
On-the-Fly Garbage Collection: An Exercise in Cooperation Edsget W. Dijkstra, Leslie Lamport, A.J. Martin and E.F.M. Steffens Communications of the ACM,
By Jacob SeligmannSteffen Grarup Presented By Leon Gendler Incremental Mature Garbage Collection Using the Train Algorithm.
Efficient Concurrent Mark-Sweep Cycle Collection Daniel Frampton, Stephen Blackburn, Luke Quinane and John Zigman (Pending submission) Presented by Jose.
CS 326 Programming Languages, Concepts and Implementation Instructor: Mircea Nicolescu Lecture 18.
CPSC 388 – Compiler Design and Construction
Increasing Memory Usage in Real-Time GC Tobias Ritzau and Peter Fritzson Department of Computer and Information Science Linköpings universitet
Mark and Sweep Algorithm Reference Counting Memory Related PitFalls
Using Prefetching to Improve Reference-Counting Garbage Collectors Harel Paz IBM Haifa Research Lab Erez Petrank Microsoft Research and Technion.
MOSTLY PARALLEL GARBAGE COLLECTION Authors : Hans J. Boehm Alan J. Demers Scott Shenker XEROX PARC Presented by:REVITAL SHABTAI.
Honors Compilers Addressing of Local Variables Mar 19 th, 2002.
Connectivity-Based Garbage Collection Presenter Feng Xian Author Martin Hirzel, et.al Published in OOPSLA’2003.
Memory Allocation and Garbage Collection. Why Dynamic Memory? We cannot know memory requirements in advance when the program is written. We cannot know.
Age-Oriented Concurrent Garbage Collection Harel Paz, Erez Petrank – Technion, Israel Steve Blackburn – ANU, Australia April 05 Compiler Construction Scotland.
1 An Efficient On-the-Fly Cycle Collection Harel Paz, Erez Petrank - Technion, Israel David F. Bacon, V. T. Rajan - IBM T.J. Watson Research Center Elliot.
Uniprocessor Garbage Collection Techniques Paul R. Wilson.
UniProcessor Garbage Collection Techniques Paul R. Wilson University of Texas Presented By Naomi Sapir Tel-Aviv University.
Garbage Collection Memory Management Garbage Collection –Language requirement –VM service –Performance issue in time and space.
SEG Advanced Software Design and Reengineering TOPIC L Garbage Collection Algorithms.
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.
Fast, Effective Code Generation in a Just-In-Time Java Compiler Rejin P. James & Roshan C. Subudhi CSE Department USC, Columbia.
Introduction to Data Structures. Definition Data structure is representation of the logical relationship existing between individual elements of data.
Ulterior Reference Counting: Fast Garbage Collection without a Long Wait Author: Stephen M Blackburn Kathryn S McKinley Presenter: Jun Tao.
Fast Conservative Garbage Collection Rifat Shahriyar Stephen M. Blackburn Australian National University Kathryn S. M cKinley Microsoft Research.
Copyright (c) 2004 Borys Bradel Myths and Realities: The Performance Impact of Garbage Collection Paper: Stephen M. Blackburn, Perry Cheng, and Kathryn.
1 Real-Time Replication Garbage Collection Scott Nettles and James O’Toole PLDI 93 Presented by: Roi Amir.
A Principled Approach to Nondeferred Reference-Counting Garbage Collection † Pramod G. Joisha HP Labs, Palo Alto † This work was done when the author was.
11/26/2015IT 3271 Memory Management (Ch 14) n Dynamic memory allocation Language systems provide an important hidden player: Runtime memory manager – Activation.
UniProcessor Garbage Collection Techniques Paul R. Wilson University of Texas Presented By Naomi Sapir Tel-Aviv University.
Dynamic Analysis and Visualizing of Data Structures in Java Programs Presented by Sokhom Pheng (Supervisor: Clark Verbrugge) McGill University February.
A REAL-TIME GARBAGE COLLECTOR WITH LOW OVERHEAD AND CONSISTENT UTILIZATION David F. Bacon, Perry Cheng, and V.T. Rajan IBM T.J. Watson Research Center.
Register Allocation CS 471 November 12, CS 471 – Fall 2007 Register Allocation - Motivation Consider adding two numbers together: Advantages: Fewer.
2/4/20161 GC16/3011 Functional Programming Lecture 20 Garbage Collection Techniques.
® July 21, 2004GC Summer School1 Cycles to Recycle: Copy GC Without Stopping the World The Sapphire Collector Richard L. Hudson J. Eliot B. Moss Originally.
CS412/413 Introduction to Compilers and Translators April 21, 1999 Lecture 30: Garbage collection.
Reference Counting. Reference Counting vs. Tracing Advantages ✔ Immediate ✔ Object-local ✔ Overhead distributed ✔ Very simple Trivial implementation for.
An Efficient, Incremental, Automatic Garbage Collector P. Deutsch and D. Bobrow Ivan JibajaCS 395T.
Eliminating External Fragmentation in a Non-Moving Garbage Collector for Java Author: Fridtjof Siebert, CASES 2000 Michael Sallas Object-Oriented Languages.
1 Compiler Construction (CS-636) Muhammad Bilal Bashir UIIT, Rawalpindi.
Garbage Collecting the World Presentation: Mark Mastroieni Authors: Bernard Lang, Christian Queinne, Jose Piquer.
Dynamic Compilation Vijay Janapa Reddi
Compositional Pointer and Escape Analysis for Java Programs
Seminar in automatic tools for analyzing programs with dynamic memory
Rifat Shahriyar Stephen M. Blackburn Australian National University
CS 153: Concepts of Compiler Design November 28 Class Meeting
Concepts of programming languages
Cycle Tracing Chapter 4, pages , From: "Garbage Collection and the Case for High-level Low-level Programming," Daniel Frampton, Doctoral Dissertation,
Ulterior Reference Counting Fast GC Without The Wait
Arrays and Linked Lists
Strategies for automatic memory management
Memory Management Kathryn McKinley.
José A. Joao* Onur Mutlu‡ Yale N. Patt*
Created By: Asst. Prof. Ashish Shah, J.M.Patel College, Goregoan West
CS703 - Advanced Operating Systems
Reference Counting.
CMPE 152: Compiler Design May 2 Class Meeting
Reference Counting vs. Tracing
Presentation transcript:

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

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

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

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

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

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)

ISMM’06 6 RC Subsumption: Intuition

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

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

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

ISMM’06 10 A Contingent Opportunity

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)

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)

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

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

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

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

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

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

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

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

ISMM’06 21 Benchmarks

ISMM’06 22 Optimization Effects

ISMM’06 23 Overlooking Roots’ Set Effects

ISMM’06 24 RC Update Distributions

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