Compositional Pointer and Escape Analysis for Java Programs

Size: px
Start display at page:

Download "Compositional Pointer and Escape Analysis for Java Programs"

Transcription

1 Compositional Pointer and Escape Analysis for Java Programs based on the paper by John Whaley and Martin Rinard presented by Natalia Prytkova Universität des Saarlandes

2 Motivation The aim: Optimization Two critical moments: 1 Memory allocation 2 Syncronization The main question: How to eliminate the overhead related with synchronization and allocation of objects in the heap?

3 The First Problem Memory

4 Storage in Java Register The stack The heap Constant storage Solution Objects that would otherwise be allocated in the heap and then reclaimed using garbage collection are allocated in an activation record on the stack and automatically (and cheaply) reclaimed when the activation record is popped off the stack. (Young Gil Park and Benjamin Goldberg Escape Analysis on Lists)

5 Storage in Java Register The stack The heap Constant storage Solution Objects that would otherwise be allocated in the heap and then reclaimed using garbage collection are allocated in an activation record on the stack and automatically (and cheaply) reclaimed when the activation record is popped off the stack. (Young Gil Park and Benjamin Goldberg Escape Analysis on Lists)

6 Storage in Java Register The stack The heap Constant storage Solution Objects that would otherwise be allocated in the heap and then reclaimed using garbage collection are allocated in an activation record on the stack and automatically (and cheaply) reclaimed when the activation record is popped off the stack. (Young Gil Park and Benjamin Goldberg Escape Analysis on Lists)

7 Storage in Java Register The stack The heap Constant storage Solution Objects that would otherwise be allocated in the heap and then reclaimed using garbage collection are allocated in an activation record on the stack and automatically (and cheaply) reclaimed when the activation record is popped off the stack. (Young Gil Park and Benjamin Goldberg Escape Analysis on Lists)

8 Storage in Java Register The stack The heap Constant storage Solution Objects that would otherwise be allocated in the heap and then reclaimed using garbage collection are allocated in an activation record on the stack and automatically (and cheaply) reclaimed when the activation record is popped off the stack. (Young Gil Park and Benjamin Goldberg Escape Analysis on Lists)

9 Example: Return Values

10 Example: Return Values

11 Example: Return Values

12 Example: Analysis Result for multiplyadd

13 Example: Analysis Result for multiplyadd The node that product points to is accessible only via the local variable product. Lifetime of the object is equal to the lifetime of the method invocation product can be allocated in the activation record of the multiplyadd method.

14 Example: Analysis Result for multiplyadd The node that product points to is accessible only via the local variable product. Lifetime of the object is equal to the lifetime of the method invocation product can be allocated in the activation record of the multiplyadd method.

15 Escaped objects When we can not allocate an object in the stack? A reference to the object was passed as a parameter into the current method A reference to the object was written into a static class variable A reference to the object was passed as a parameter to an invoked method, and there is no information about what the invoked method did with the object. The object is a thread object In these situations we say, that an object escapes the current method.

16 Escaped objects When we can not allocate an object in the stack? A reference to the object was passed as a parameter into the current method A reference to the object was written into a static class variable A reference to the object was passed as a parameter to an invoked method, and there is no information about what the invoked method did with the object. The object is a thread object In these situations we say, that an object escapes the current method.

17 Escaped objects When we can not allocate an object in the stack? A reference to the object was passed as a parameter into the current method A reference to the object was written into a static class variable A reference to the object was passed as a parameter to an invoked method, and there is no information about what the invoked method did with the object. The object is a thread object In these situations we say, that an object escapes the current method.

18 Escaped objects When we can not allocate an object in the stack? A reference to the object was passed as a parameter into the current method A reference to the object was written into a static class variable A reference to the object was passed as a parameter to an invoked method, and there is no information about what the invoked method did with the object. The object is a thread object In these situations we say, that an object escapes the current method.

19 The Second Problem Synchronization

20 Synchronization Why and when do we need synchronization? To prevent the problem of thread collision. If you are writing a variable that might next be read by another thread or reading the variable that might have last been written by another thread, you must use synchronization. (Bruce Eckel, Thinking in Java)

21 Synchronization Why and when do we need synchronization? To prevent the problem of thread collision. If you are writing a variable that might next be read by another thread or reading the variable that might have last been written by another thread, you must use synchronization. (Bruce Eckel, Thinking in Java) Overhead of Synchronization (Aldrich et al. Static Analyses for Eliminating Unnecessary Synchronization from Java Programs)

22 Synchronization Why and when do we need synchronization? To prevent the problem of thread collision. If you are writing a variable that might next be read by another thread or reading the variable that might have last been written by another thread, you must use synchronization. (Bruce Eckel, Thinking in Java) Solution If an object does not escape a thread, it is legal to remove the lock acquire and release operations from synchronized methods that execute on that object.

23 Example: Synchronization

24 Example: Synchronization

25 Analysis Algorithm What is to analyse? The algorithm analyses the program at the granularity of methods. How to analyse? Represent a program (interprocedural level) Represent an object (intraprocedural level)

26 Analysis Algorithm What is to analyse? The algorithm analyses the program at the granularity of methods. How to analyse? Represent a program (interprocedural level) Represent an object (intraprocedural level)

27 Program representation

28 Program representation

29 Program representation

30 Program representation

31 Program representation Analysis objects Set of classes cl Cl Set of object fields f F Set of local variables l L Set of formal parameters p P

32 Program representation Statements that affect points-to and escape information A copy statement l = v A load statement l 1 = l 2.f A store statement l 1.f = l 2 A global load statement l = cl.f A global store statement cl.f = l A return statement return l An object creation l = new cl A method invocation l = l 0.op(l 1,... l k )

33 Object representation

34 Object representation Types of nodes Set of inside nodes N I Set of thread nodes N T, N T N I Set of outside nodes N O Set of parameter nodes N P, N P N O Set of global nodes N G, N G N O Set of load nodes N L, N L N O Set of return nodes N R, N R N O

35 Points-to Escape Graph Is a quadruple O, I, e, r O is a set of outside edges O (N F ) (N L N G ) I is a set of inside edges I (V (N F )) N e : N 2 M is an escape function r N is a return set

36 Points-to Escape Graph O = I = { this, N this, a, N a, b, N b, product, N product, sum, N sum } e = {(b a.multiply(b)), (product this.add(product))} r = {N sum }

37 Intraprocedural Analysis: Example Line #20 O = I = { this, N this, a, N a, b, N b } n e 0 (n) = r =

38 Intraprocedural Analysis: Example Line #22 Kill I = edges(i, product) Gen I = {product} I(a.multiply(b)) I = (I Kill I ) Gen I = I + { product, a.multiply(b) }

39 Intraprocedural Analysis: Example Line #23 Kill I = edges(i, sum) Gen I = {sum} I(this.add(product)) I = (I Kill I ) Gen I = I + { sum, this.add(product) }

40 Intraprocedural Analysis: Example Line #24 r = I(sum) = {N sum }

41 Intraprocedural Analysis: Copy Statement l = v Kill I = edges(i, l) Gen I = {l} I(v) I = (I Kill I ) Gen I

42 Intraprocedural Analysis: Load Statement l 1 = l 2.f, 1st Case Kill I = edges(i, l 1 ) Gen I = {l 1 } {I(l 2 ) {f}} I = (I Kill I ) Gen I

43 Intraprocedural Analysis: Load Statement l 1 = l 2.f, 2nd Case Kill I = edges(i, l 1 ) Gen I = {l 1 } {I(l 2 ) {f}} I = (I Kill I ) Gen I Gen O = {I(l 2 ) {f}} n O = O Gen O

44 Intraprocedural Analysis: Store Statement l 1.f = l 2 Gen I = {I(l 1 ) {f}} I(l 2 ) I = I Gen I

45 Intraprocedural Analysis: Global Load Statement l = cl.f Kill I = edges(i, l) Gen I = {l} (O I)(cl, f) I = (I Kill I ) Gen I

46 Intraprocedural Analysis: Global Store Statement cl.f = l Gen I = { cl, f } I(l) I = I Gen I

47 Intraprocedural Analysis: Object Creation Sites l = new cl Kill I = edges(i, l) Gen I = { l, n } I = (I Kill I ) Gen I

48 Intraprocedural Analysis: Return Statement return l r = I(l)

49 Intraprocedural Analysis We analyse a method line by line, statement by statement Analysis Result Before Statement α( st) = {α(st ) : st pred(st)} Analysis Result After Statement α(st ) = [st](α( st)) Analysis Result Before Method Invocation α( enter op ) = O 0, I 0, e 0, r 0 Analysis Result After Method Invocation α(exit op ) = O, I, e, r = remove(s, O, I, e, r ) where S = {n N : not reachable (O I, CL P r, n)}

50 Intraprocedural Analysis We analyse a method line by line, statement by statement Analysis Result Before Statement α( st) = {α(st ) : st pred(st)} Analysis Result After Statement α(st ) = [st](α( st)) Analysis Result Before Method Invocation α( enter op ) = O 0, I 0, e 0, r 0 Analysis Result After Method Invocation α(exit op ) = O, I, e, r = remove(s, O, I, e, r ) where S = {n N : not reachable (O I, CL P r, n)}

51 Intraprocedural Analysis We analyse a method line by line, statement by statement Analysis Result Before Statement α( st) = {α(st ) : st pred(st)} Analysis Result After Statement α(st ) = [st](α( st)) Analysis Result Before Method Invocation α( enter op ) = O 0, I 0, e 0, r 0 Analysis Result After Method Invocation α(exit op ) = O, I, e, r = remove(s, O, I, e, r ) where S = {n N : not reachable (O I, CL P r, n)}

52 Intraprocedural Analysis We analyse a method line by line, statement by statement Analysis Result Before Statement α( st) = {α(st ) : st pred(st)} Analysis Result After Statement α(st ) = [st](α( st)) Analysis Result Before Method Invocation α( enter op ) = O 0, I 0, e 0, r 0 Analysis Result After Method Invocation α(exit op ) = O, I, e, r = remove(s, O, I, e, r ) where S = {n N : not reachable (O I, CL P r, n)}

53 Interprocedural Analysis At each method invocation site, the analysis has the option of either skipping the site or analysing the site. Skipped Method Invocation Sites l = l 0.op(l 1... l k ), return node n R O, I, e, r = [m]( O, I, e, r ) I = (I edges(i, l)) { l, n R } { e {e(n) m if 0 i k : n I(l i ) (n) = e(n) otherwise Analysed Method Invocation Sites l = l 0.op(l 1... l k ) O, I, e, r = [m]( O, I, e, r ) O, I, e, r = {map(m, O, I, e, r, op) : op callees(m)}

54 Mapping Algorithm We have 3 different points-to escape graphs: The old graph (before method invocation)

55 Mapping Algorithm We have 3 different points-to escape graphs: The incoming graph (the analysis result for the invoked method)

56 Mapping Algorithm We have 3 different points-to escape graphs: The incoming graph (the analysis result for the invoked method)

57 Mapping Algorithm We have 3 different points-to escape graphs: The new graph (after method invocation)

58 Mapping Algorithm: Rule 1 The new graph (after the method invocation) extends the old: where

59 Mapping Algorithm: Rule 2 Map each parameter node to the node in the old graph: where

60 Mapping Algorithm: Rule 2 Map each parameter node to the node in the old graph: where

61 Mapping Algorithm: Rule 2 Map each parameter node to the node in the old graph: where

62 Mapping Algorithm: Rule 3 Map the return nodes from incoming to the new graph: where

63 Mapping Algorithm: Rule 3 Map the return nodes from incoming to the new graph: where

64 Mapping Algorithm: Rule 4 Map each outside edge in the incoming graph to the corresponding inside edge in the old graph:

65 Mapping Algorithm: Rule 4 Map each outside edge in the incoming graph to the corresponding inside edge in the old graph:

66 Mapping Algorithm: Rule 4 Map each outside edge in the incoming graph to the corresponding inside edge in the old graph:

67 Mapping Algorithm: Rule 4 Map each outside edge in the incoming graph to the corresponding inside edge in the old graph:

68 Mapping Algorithm: Rule 5 Map all inside nodes that are reachable from some node in the new graph:

69 Mapping Algorithm: Rule 5 Map all inside nodes that are reachable from some node in the new graph:

70 Mapping Algorithm: Rule 5 Map all inside nodes that are reachable from some node in the new graph:

71 Mapping Algorithm: Rule 6 All nodes passed into unanalysed methods are marked in the escape function:

72 Mapping Algorithm: Rule 6 All nodes passed into unanalysed methods are marked in the escape function: e = {(n1 function5(n1))}

73 Results: Synchronization Elimination

74 Results: Stack Allocation

75 Analysis Properties Interprocedural Compositional Partial

76 Related Works Pointer analysis Escape Analysis Synchronization Optimization

77 Summary Now we are able: To analyse an object-oriented program with help of points-to escape graphs To analyse program parts independently To allocate up to 95% of objects in the stack To eliminate unnecessary synchronization up to 67%

Lecture 15 Garbage Collection

Lecture 15 Garbage Collection Lecture 15 Garbage Collection I. Introduction to GC -- Reference Counting -- Basic Trace-Based GC II. Copying Collectors III. Break Up GC in Time (Incremental) IV. Break Up GC in Space (Partial) Readings:

More information

Field Analysis. Last time Exploit encapsulation to improve memory system performance

Field Analysis. Last time Exploit encapsulation to improve memory system performance Field Analysis Last time Exploit encapsulation to improve memory system performance This time Exploit encapsulation to simplify analysis Two uses of field analysis Escape analysis Object inlining April

More information

Write Barrier Removal by Static Analysis

Write Barrier Removal by Static Analysis Write Barrier Removal by Static Analysis Karen Zee and Martin Rinard Laboratory for Computer Science Massachusetts Institute of Technology Cambridge, MA 02139 {kkz, rinard@lcs.mit.edu ABSTRACT We present

More information

Lecture 9 Dynamic Compilation

Lecture 9 Dynamic Compilation Lecture 9 Dynamic Compilation I. Motivation & Background II. Overview III. Compilation Policy IV. Partial Method Compilation V. Partial Dead Code Elimination VI. Escape Analysis VII. Results Partial Method

More information

Escape Analysis for Java

Escape Analysis for Java Escape Analysis for Java Michael Bohn Based on the paper by Jong-Deok Choi, Manish Gupta, Mauricio Serrano, Vugranam Sreedhar and Sam Midkiff Escape Analysis? What is Escape Analysis and why do I need

More information

Managed runtimes & garbage collection. CSE 6341 Some slides by Kathryn McKinley

Managed runtimes & garbage collection. CSE 6341 Some slides by Kathryn McKinley Managed runtimes & garbage collection CSE 6341 Some slides by Kathryn McKinley 1 Managed runtimes Advantages? Disadvantages? 2 Managed runtimes Advantages? Reliability Security Portability Performance?

More information

Garbage Collection. Steven R. Bagley

Garbage Collection. Steven R. Bagley Garbage Collection Steven R. Bagley Reference Counting Counts number of pointers to an Object deleted when the count hits zero Eager deleted as soon as it is finished with Problem: Circular references

More information

Managed runtimes & garbage collection

Managed runtimes & garbage collection Managed runtimes Advantages? Managed runtimes & garbage collection CSE 631 Some slides by Kathryn McKinley Disadvantages? 1 2 Managed runtimes Portability (& performance) Advantages? Reliability Security

More information

Write Barrier Removal by Static Analysis

Write Barrier Removal by Static Analysis Write Barrier Removal by Static Analysis Karen Zee Martin Rinard MIT Laboratory for Computer Science Research Goal Use static program analysis to identify and remove unnecessary write barriers in programs

More information

Stack Allocation and Synchronization Optimizations for Java Using Escape Analysis

Stack Allocation and Synchronization Optimizations for Java Using Escape Analysis Stack Allocation and Synchronization Optimizations for Java Using Escape Analysis JONG-DEOK CHOI, MANISH GUPTA, MAURICIO J. SERRANO, VUGRANAM C. SREEDHAR and SAMUEL P. MIDKIFF This article presents an

More information

Pointer and Escape Analysis for Multithreaded Programs

Pointer and Escape Analysis for Multithreaded Programs Pointer and Escape Analysis for Multithreaded Programs Alexandru Sălcianu Laboratory for Computer Science Massachusetts Institute of Technology Cambridge, MA 02139 salcianu@lcs.mit.edu Martin Rinard Laboratory

More information

Stack Allocation and Synchronization Optimizations for Java Using Escape Analysis

Stack Allocation and Synchronization Optimizations for Java Using Escape Analysis Stack Allocation and Synchronization Optimizations for Java Using Escape Analysis JONG-DEOK CHOI, MANISH GUPTA, MAURICIO J. SERRANO, and VUGRANAM C. SREEDHAR IBM SAMUEL P. MIDKIFF Purdue University This

More information

Eliminating Synchronization Bottlenecks Using Adaptive Replication

Eliminating Synchronization Bottlenecks Using Adaptive Replication Eliminating Synchronization Bottlenecks Using Adaptive Replication MARTIN C. RINARD Massachusetts Institute of Technology and PEDRO C. DINIZ University of Southern California This article presents a new

More information

Run-time Environments

Run-time Environments Run-time Environments Status We have so far covered the front-end phases Lexical analysis Parsing Semantic analysis Next come the back-end phases Code generation Optimization Register allocation Instruction

More information

Run-time Environments

Run-time Environments Run-time Environments Status We have so far covered the front-end phases Lexical analysis Parsing Semantic analysis Next come the back-end phases Code generation Optimization Register allocation Instruction

More information

Garbage Collection. Hwansoo Han

Garbage Collection. Hwansoo Han Garbage Collection Hwansoo Han Heap Memory Garbage collection Automatically reclaim the space that the running program can never access again Performed by the runtime system Two parts of a garbage collector

More information

COMP 202 Recursion. CONTENTS: Recursion. COMP Recursion 1

COMP 202 Recursion. CONTENTS: Recursion. COMP Recursion 1 COMP 202 Recursion CONTENTS: Recursion COMP 202 - Recursion 1 Recursive Thinking A recursive definition is one which uses the word or concept being defined in the definition itself COMP 202 - Recursion

More information

Glacier: A Garbage Collection Simulation System

Glacier: A Garbage Collection Simulation System Glacier: A Garbage Collection Simulation System Bruno Dufour Sable Research Group McGill University Glacier: A Garbage Collection Simulation System p.1/19 Outline Introduction Objectives & motivation Requirements

More information

Compiler Construction

Compiler Construction Compiler Construction Lecture 18: Code Generation V (Implementation of Dynamic Data Structures) Thomas Noll Lehrstuhl für Informatik 2 (Software Modeling and Verification) noll@cs.rwth-aachen.de http://moves.rwth-aachen.de/teaching/ss-14/cc14/

More information

Garbage Collection. Akim D le, Etienne Renault, Roland Levillain. May 15, CCMP2 Garbage Collection May 15, / 35

Garbage Collection. Akim D le, Etienne Renault, Roland Levillain. May 15, CCMP2 Garbage Collection May 15, / 35 Garbage Collection Akim Demaille, Etienne Renault, Roland Levillain May 15, 2017 CCMP2 Garbage Collection May 15, 2017 1 / 35 Table of contents 1 Motivations and Definitions 2 Reference Counting Garbage

More information

Processes. CS 416: Operating Systems Design, Spring 2011 Department of Computer Science Rutgers University

Processes. CS 416: Operating Systems Design, Spring 2011 Department of Computer Science Rutgers University Processes Design, Spring 2011 Department of Computer Science Von Neuman Model Both text (program) and data reside in memory Execution cycle Fetch instruction Decode instruction Execute instruction CPU

More information

C11: Garbage Collection and Constructors

C11: Garbage Collection and Constructors CISC 3120 C11: Garbage Collection and Constructors Hui Chen Department of Computer & Information Science CUNY Brooklyn College 10/5/2017 CUNY Brooklyn College 1 Outline Recap Project progress and lessons

More information

C10: Garbage Collection and Constructors

C10: Garbage Collection and Constructors CISC 3120 C10: Garbage Collection and Constructors Hui Chen Department of Computer & Information Science CUNY Brooklyn College 3/5/2018 CUNY Brooklyn College 1 Outline Recap OOP in Java: composition &

More information

OMEN: A Strategy for Testing Object-Oriented Software

OMEN: A Strategy for Testing Object-Oriented Software OMEN: A Strategy for Testing Object-Oriented Software Amie L. Souter Computer and Information Sciences University of Delaware Newark, DE 19716 souter@cis.udel.edu Lori L. Pollock Computer and Information

More information

Java Memory Management

Java Memory Management Java Memory Management Memory Allocation in Java When a program is being executed, separate areas of memory are allocated for each code (classes and interfaces) objects running methods 1-2 Memory Areas

More information

Lesson 2 Dissecting Memory Problems

Lesson 2 Dissecting Memory Problems Lesson 2 Dissecting Memory Problems Poonam Parhar JVM Sustaining Engineer Oracle Agenda 1. Symptoms of Memory Problems 2. Causes of Memory Problems 3. OutOfMemoryError messages 3 Lesson 2-1 Symptoms of

More information

The Perfect Getaway: Using Escape Analysis in Embedded Real-Time Systems

The Perfect Getaway: Using Escape Analysis in Embedded Real-Time Systems The Perfect Getaway: Using Escape Analysis in Embedded Real-Time Systems ISABELLA STILKERICH, CLEMENS LANG, CHRISTOPH ERHARDT, CHRISTIAN BAY, and MICHAEL STILKERICH, Friedrich-Alexander-University Erlangen-Nuremberg

More information

Contents. 8-1 Copyright (c) N. Afshartous

Contents. 8-1 Copyright (c) N. Afshartous Contents 1. Introduction 2. Types and Variables 3. Statements and Control Flow 4. Reading Input 5. Classes and Objects 6. Arrays 7. Methods 8. Scope and Lifetime 9. Utility classes 10 Introduction to Object-Oriented

More information

Compiler Construction

Compiler Construction Compiler Construction Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ss-16/cc/ Recap: Static Data Structures Outline of Lecture 18 Recap:

More information

Compilers and Code Optimization EDOARDO FUSELLA

Compilers and Code Optimization EDOARDO FUSELLA Compilers and Code Optimization EDOARDO FUSELLA Contents Data memory layout Instruction selection Register allocation Data memory layout Memory Hierarchy Capacity vs access speed Main memory Classes of

More information

Algorithms for Dynamic Memory Management (236780) Lecture 4. Lecturer: Erez Petrank

Algorithms for Dynamic Memory Management (236780) Lecture 4. Lecturer: Erez Petrank Algorithms for Dynamic Memory Management (236780) Lecture 4 Lecturer: Erez Petrank!1 March 24, 2014 Topics last week The Copying Garbage Collector algorithm: Basics Cheney s collector Additional issues:

More information

Effective Static Race Detection for Java. Part I. Chord. Chord. Chord. Chord - Overview. Problems addressed

Effective Static Race Detection for Java. Part I. Chord. Chord. Chord. Chord - Overview. Problems addressed Eective Static Race Detection or Java Mayer Naik, Alex Aiken, John Whaley Part I Introduction to Chord and Preliminaries presented by Matt McGill Chord Chord Chord is a static (data) race detection tool

More information

Name, Scope, and Binding. Outline [1]

Name, Scope, and Binding. Outline [1] Name, Scope, and Binding In Text: Chapter 3 Outline [1] Variable Binding Storage bindings and lifetime Type bindings Type Checking Scope Lifetime vs. Scope Referencing Environments N. Meng, S. Arthur 2

More information

CA Compiler Construction

CA Compiler Construction CA4003 - Compiler Construction David Sinclair When procedure A calls procedure B, we name procedure A the caller and procedure B the callee. A Runtime Environment, also called an Activation Record, is

More information

Pointer Analysis in the Presence of Dynamic Class Loading. Hind Presented by Brian Russell

Pointer Analysis in the Presence of Dynamic Class Loading. Hind Presented by Brian Russell Pointer Analysis in the Presence of Dynamic Class Loading Martin Hirzel, Amer Diwan and Michael Hind Presented by Brian Russell Claim: First nontrivial pointer analysis dealing with all Java language features

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Organization of Programming Languages Memory Management and Garbage Collection CMSC 330 - Spring 2013 1 Memory Attributes! Memory to store data in programming languages has the following lifecycle

More information

Agenda. CSE P 501 Compilers. Java Implementation Overview. JVM Architecture. JVM Runtime Data Areas (1) JVM Data Types. CSE P 501 Su04 T-1

Agenda. CSE P 501 Compilers. Java Implementation Overview. JVM Architecture. JVM Runtime Data Areas (1) JVM Data Types. CSE P 501 Su04 T-1 Agenda CSE P 501 Compilers Java Implementation JVMs, JITs &c Hal Perkins Summer 2004 Java virtual machine architecture.class files Class loading Execution engines Interpreters & JITs various strategies

More information

What goes inside when you declare a variable?

What goes inside when you declare a variable? Stack, heap, value types, reference types, boxing, and unboxing Introduction This article will explain six important concepts: stack, heap, value types, reference types, boxing, and unboxing. This article

More information

Parallel GC. (Chapter 14) Eleanor Ainy December 16 th 2014

Parallel GC. (Chapter 14) Eleanor Ainy December 16 th 2014 GC (Chapter 14) Eleanor Ainy December 16 th 2014 1 Outline of Today s Talk How to use parallelism in each of the 4 components of tracing GC: Marking Copying Sweeping Compaction 2 Introduction Till now

More information

Estimating the Impact of Heap Liveness Information on Space Consumption in Java

Estimating the Impact of Heap Liveness Information on Space Consumption in Java Estimating the Impact of Heap Liveness Information on Space Consumption in Java by R. Shaham, E. Kolodner and M. Sagiv first presented at ISSM'02 presentation: Adrian Moos Contents what is this about?

More information

Chapter 4: Multithreaded Programming

Chapter 4: Multithreaded Programming Chapter 4: Multithreaded Programming Silberschatz, Galvin and Gagne 2013! Chapter 4: Multithreaded Programming Overview Multicore Programming Multithreading Models Threading Issues Operating System Examples

More information

CMSC330 Fall 2013 Practice Problems 6 Solutions

CMSC330 Fall 2013 Practice Problems 6 Solutions CMSC330 Fall 2013 Practice Problems 6 Solutions 1. Programming languages a. Describe how functional programming may be used to simulate OOP. An object may be simulated as a tuple, where each element of

More information

Thread-Sensitive Points-to Analysis for Multithreaded Java Programs

Thread-Sensitive Points-to Analysis for Multithreaded Java Programs Thread-Sensitive Points-to Analysis for Multithreaded Java Programs Byeong-Mo Chang 1 and Jong-Deok Choi 2 1 Dept. of Computer Science, Sookmyung Women s University, Seoul 140-742, Korea chang@sookmyung.ac.kr

More information

inerementalized Pointer and Escape Analysis*

inerementalized Pointer and Escape Analysis* inerementalized Pointer and Escape Analysis* Fred6ric Vivien ICPS/LSIIT Universit6 Louis Pasteur Strasbourg, France vivien @ icps. u-strasbg.fr Martin Rinard Laboratory for Computer Science Massachusetts

More information

Hard Real-Time Garbage Collection in Java Virtual Machines

Hard Real-Time Garbage Collection in Java Virtual Machines Hard Real-Time Garbage Collection in Java Virtual Machines... towards unrestricted real-time programming in Java Fridtjof Siebert, IPD, University of Karlsruhe 1 Jamaica Systems Structure Exisiting GC

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Organization of Programming Languages Memory Management and Garbage Collection CMSC 330 Spring 2017 1 Memory Attributes Memory to store data in programming languages has the following lifecycle

More information

Enabling Persistent Memory Use in Java. Steve Dohrmann Sr. Staff Software Engineer, Intel

Enabling Persistent Memory Use in Java. Steve Dohrmann Sr. Staff Software Engineer, Intel Enabling Persistent Memory Use in Java Steve Dohrmann Sr. Staff Software Engineer, Intel Motivation Java is a very popular language on servers, especially for databases, data grids, etc., e.g. Apache projects:

More information

Threads SPL/2010 SPL/20 1

Threads SPL/2010 SPL/20 1 Threads 1 Today Processes and Scheduling Threads Abstract Object Models Computation Models Java Support for Threads 2 Process vs. Program processes as the basic unit of execution managed by OS OS as any

More information

Pointers II. Class 31

Pointers II. Class 31 Pointers II Class 31 Compile Time all of the variables we have seen so far have been declared at compile time they are written into the program code you can see by looking at the program how many variables

More information

Escape Analysis for Java

Escape Analysis for Java Escape Analysis for Java Jong-Deok Choi Manish Gupta Mauricio Serrano Vugranam C. Sreedhar Sam Midkiff IBM T. J. Watson Research Center P. O. Box 218, Yorktown Heights, NY 10598 dchoi, mgupta, mserrano,

More information

Principles of Programming Languages Topic: Scope and Memory Professor Louis Steinberg Fall 2004

Principles of Programming Languages Topic: Scope and Memory Professor Louis Steinberg Fall 2004 Principles of Programming Languages Topic: Scope and Memory Professor Louis Steinberg Fall 2004 CS 314, LS,BR,LTM: Scope and Memory 1 Review Functions as first-class objects What can you do with an integer?

More information

Programming Languages Third Edition. Chapter 7 Basic Semantics

Programming Languages Third Edition. Chapter 7 Basic Semantics Programming Languages Third Edition Chapter 7 Basic Semantics Objectives Understand attributes, binding, and semantic functions Understand declarations, blocks, and scope Learn how to construct a symbol

More information

Allocating memory in a lock-free manner

Allocating memory in a lock-free manner Allocating memory in a lock-free manner Anders Gidenstam, Marina Papatriantafilou and Philippas Tsigas Distributed Computing and Systems group, Department of Computer Science and Engineering, Chalmers

More information

Escape Analysis. Applications to ML and Java TM

Escape Analysis. Applications to ML and Java TM Escape Analysis. Applications to ML and Java TM Bruno Blanchet INRIA Rocquencourt Bruno.Blanchet@inria.fr December 2000 Overview 1. Introduction: escape analysis and applications. 2. Escape analysis 2.a

More information

Azul Systems, Inc.

Azul Systems, Inc. 1 Stack Based Allocation in the Azul JVM Dr. Cliff Click cliffc@azulsystems.com 2005 Azul Systems, Inc. Background The Azul JVM is based on Sun HotSpot a State-of-the-Art Java VM Java is a GC'd language

More information

Performance of Non-Moving Garbage Collectors. Hans-J. Boehm HP Labs

Performance of Non-Moving Garbage Collectors. Hans-J. Boehm HP Labs Performance of Non-Moving Garbage Collectors Hans-J. Boehm HP Labs Why Use (Tracing) Garbage Collection to Reclaim Program Memory? Increasingly common Java, C#, Scheme, Python, ML,... gcc, w3m, emacs,

More information

Computing Approximate Happens-Before Order with Static and Dynamic Analysis

Computing Approximate Happens-Before Order with Static and Dynamic Analysis Department of Distributed and Dependable Systems Technical report no. D3S-TR-2013-06 May 7, 2018 Computing Approximate Happens-Before Order with Static and Dynamic Analysis Pavel Parízek, Pavel Jančík

More information

Rob Legrand, and Ron K Cytron Washington University in St Louis 1 Brookings Dr Saint Louis, MO

Rob Legrand, and Ron K Cytron Washington University in St Louis 1 Brookings Dr Saint Louis, MO Delvin C. Defoe Rose-Hulman Inst. of Technology 5500 Wabash Ave Terre Haute, IN Rob Legrand, and Ron K Cytron Washington University in St Louis 1 Brookings Dr Saint Louis, MO Research funded by DARPA under

More information

Zing Vision. Answering your toughest production Java performance questions

Zing Vision. Answering your toughest production Java performance questions Zing Vision Answering your toughest production Java performance questions Outline What is Zing Vision? Where does Zing Vision fit in your Java environment? Key features How it works Using ZVRobot Q & A

More information

Certified Memory Usage Analysis

Certified Memory Usage Analysis Certified Memory Usage Analysis David Cachera, Thomas Jensen, David Pichardie, Gerardo Schneider IRISA, ENS Cachan Bretagne, France Context Embedded devices (smart cards, mobile phones) memory is limited

More information

CSE P 501 Compilers. Java Implementation JVMs, JITs &c Hal Perkins Winter /11/ Hal Perkins & UW CSE V-1

CSE P 501 Compilers. Java Implementation JVMs, JITs &c Hal Perkins Winter /11/ Hal Perkins & UW CSE V-1 CSE P 501 Compilers Java Implementation JVMs, JITs &c Hal Perkins Winter 2008 3/11/2008 2002-08 Hal Perkins & UW CSE V-1 Agenda Java virtual machine architecture.class files Class loading Execution engines

More information

! Those values must be stored somewhere! Therefore, variables must somehow be bound. ! How?

! Those values must be stored somewhere! Therefore, variables must somehow be bound. ! How? A Binding Question! Variables are bound (dynamically) to values Subprogram Activation! Those values must be stored somewhere! Therefore, variables must somehow be bound to memory locations! How? Function

More information

A Dynamic Evaluation of the Precision of Static Heap Abstractions

A Dynamic Evaluation of the Precision of Static Heap Abstractions A Dynamic Evaluation of the Precision of Static Heap Abstractions OOSPLA - Reno, NV October 20, 2010 Percy Liang Omer Tripp Mayur Naik Mooly Sagiv UC Berkeley Tel-Aviv Univ. Intel Labs Berkeley Tel-Aviv

More information

Non-blocking Array-based Algorithms for Stacks and Queues. Niloufar Shafiei

Non-blocking Array-based Algorithms for Stacks and Queues. Niloufar Shafiei Non-blocking Array-based Algorithms for Stacks and Queues Niloufar Shafiei Outline Introduction Concurrent stacks and queues Contributions New algorithms New algorithms using bounded counter values Correctness

More information

CO444H. Ben Livshits. Datalog Pointer analysis

CO444H. Ben Livshits. Datalog Pointer analysis CO444H Ben Livshits Datalog Pointer analysis 1 Call Graphs Class analysis: Given a reference variable x, what are the classes of the objects that x refers to at runtime? We saw CHA and RTA Deal with polymorphic/virtual

More information

Compiler Analyses for Improved Return Value Prediction

Compiler Analyses for Improved Return Value Prediction Compiler Analyses for Improved Return Value Prediction Christopher J.F. Pickett Clark Verbrugge {cpicke,clump}@sable.mcgill.ca School of Computer Science, McGill University Montréal, Québec, Canada H3A

More information

CMSC 330: Organization of Programming Languages. Memory Management and Garbage Collection

CMSC 330: Organization of Programming Languages. Memory Management and Garbage Collection CMSC 330: Organization of Programming Languages Memory Management and Garbage Collection CMSC330 Fall 2018 1 Memory Attributes Memory to store data in programming languages has the following lifecycle

More information

CS1150 Principles of Computer Science Methods

CS1150 Principles of Computer Science Methods CS1150 Principles of Computer Science Methods Yanyan Zhuang Department of Computer Science http://www.cs.uccs.edu/~yzhuang CS1150 UC. Colorado Springs Opening Problem Find the sum of integers from 1 to

More information

Lecture 3: C Programm

Lecture 3: C Programm 0 3 E CS 1 Lecture 3: C Programm ing Reading Quiz Note the intimidating red border! 2 A variable is: A. an area in memory that is reserved at run time to hold a value of particular type B. an area in memory

More information

Static Program Analysis Part 9 pointer analysis. Anders Møller & Michael I. Schwartzbach Computer Science, Aarhus University

Static Program Analysis Part 9 pointer analysis. Anders Møller & Michael I. Schwartzbach Computer Science, Aarhus University Static Program Analysis Part 9 pointer analysis Anders Møller & Michael I. Schwartzbach Computer Science, Aarhus University Agenda Introduction to points-to analysis Andersen s analysis Steensgaards s

More information

Java Internals. Frank Yellin Tim Lindholm JavaSoft

Java Internals. Frank Yellin Tim Lindholm JavaSoft Java Internals Frank Yellin Tim Lindholm JavaSoft About This Talk The JavaSoft implementation of the Java Virtual Machine (JDK 1.0.2) Some companies have tweaked our implementation Alternative implementations

More information

Programming Languages Third Edition. Chapter 10 Control II Procedures and Environments

Programming Languages Third Edition. Chapter 10 Control II Procedures and Environments Programming Languages Third Edition Chapter 10 Control II Procedures and Environments Objectives Understand the nature of procedure definition and activation Understand procedure semantics Learn parameter-passing

More information

Index. object lifetimes, and ownership, use after change by an alias errors, use after drop errors, BTreeMap, 309

Index. object lifetimes, and ownership, use after change by an alias errors, use after drop errors, BTreeMap, 309 A Arithmetic operation floating-point arithmetic, 11 12 integer numbers, 9 11 Arrays, 97 copying, 59 60 creation, 48 elements, 48 empty arrays and vectors, 57 58 executable program, 49 expressions, 48

More information

Process. Heechul Yun. Disclaimer: some slides are adopted from the book authors slides with permission

Process. Heechul Yun. Disclaimer: some slides are adopted from the book authors slides with permission Process Heechul Yun Disclaimer: some slides are adopted from the book authors slides with permission 1 Recap OS services Resource (CPU, memory) allocation, filesystem, communication, protection, security,

More information

Programming II (CS300)

Programming II (CS300) 1 Programming II (CS300) Chapter 02: Using Objects MOUNA KACEM mouna@cs.wisc.edu Fall 2018 Using Objects 2 Introduction to Object Oriented Programming Paradigm Objects and References Memory Management

More information

Runtime. The optimized program is ready to run What sorts of facilities are available at runtime

Runtime. The optimized program is ready to run What sorts of facilities are available at runtime Runtime The optimized program is ready to run What sorts of facilities are available at runtime Compiler Passes Analysis of input program (front-end) character stream Lexical Analysis token stream Syntactic

More information

Chapter 3:: Names, Scopes, and Bindings

Chapter 3:: Names, Scopes, and Bindings Chapter 3:: Names, Scopes, and Bindings Programming Language Pragmatics Michael L. Scott Some more things about NFAs/DFAs We said that a regular expression can be: A character (base case) A concatenation

More information

KESO Functional Safety and the Use of Java in Embedded Systems

KESO Functional Safety and the Use of Java in Embedded Systems KESO Functional Safety and the Use of Java in Embedded Systems Isabella S1lkerich, Bernhard Sechser Embedded Systems Engineering Kongress 05.12.2012 Lehrstuhl für Informa1k 4 Verteilte Systeme und Betriebssysteme

More information

A Parameterized Type System for Race-Free Java Programs

A Parameterized Type System for Race-Free Java Programs A Parameterized Type System for Race-Free Java Programs Chandrasekhar Boyapati Martin Rinard Laboratory for Computer Science Massachusetts Institute of Technology {chandra, rinard@lcs.mit.edu Data races

More information

Acknowledgements These slides are based on Kathryn McKinley s slides on garbage collection as well as E Christopher Lewis s slides

Acknowledgements These slides are based on Kathryn McKinley s slides on garbage collection as well as E Christopher Lewis s slides Garbage Collection Last time Compiling Object-Oriented Languages Today Motivation behind garbage collection Garbage collection basics Garbage collection performance Specific example of using GC in C++

More information

MEMORY MANAGEMENT HEAP, STACK AND GARBAGE COLLECTION

MEMORY MANAGEMENT HEAP, STACK AND GARBAGE COLLECTION MEMORY MANAGEMENT HEAP, STACK AND GARBAGE COLLECTION 2 1. What is the Heap Size: 2 2. What is Garbage Collection: 3 3. How are Java objects stored in memory? 3 4. What is the difference between stack and

More information

CS 571 Operating Systems. Midterm Review. Angelos Stavrou, George Mason University

CS 571 Operating Systems. Midterm Review. Angelos Stavrou, George Mason University CS 571 Operating Systems Midterm Review Angelos Stavrou, George Mason University Class Midterm: Grading 2 Grading Midterm: 25% Theory Part 60% (1h 30m) Programming Part 40% (1h) Theory Part (Closed Books):

More information

Garbage Collection (1)

Garbage Collection (1) Garbage Collection (1) Advanced Operating Systems Lecture 7 This work is licensed under the Creative Commons Attribution-NoDerivatives 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nd/4.0/

More information

Overview COMP Microprocessors and Embedded Systems. Lectures 18 : Pointers & Arrays in C/ Assembly

Overview COMP Microprocessors and Embedded Systems. Lectures 18 : Pointers & Arrays in C/ Assembly COMP 3221 Microprocessors and Embedded Systems Lectures 18 : Pointers & Arrays in C/ Assembly http://www.cse.unsw.edu.au/~cs3221 Overview Arrays, Pointers, Functions in C Example Pointers, Arithmetic,

More information

Review: Easy Piece 1

Review: Easy Piece 1 CS 537 Lecture 10 Threads Michael Swift 10/9/17 2004-2007 Ed Lazowska, Hank Levy, Andrea and Remzi Arpaci-Dussea, Michael Swift 1 Review: Easy Piece 1 Virtualization CPU Memory Context Switch Schedulers

More information

Programming Languages

Programming Languages TECHNISCHE UNIVERSITÄT MÜNCHEN FAKULTÄT FÜR INFORMATIK Programming Languages Concurrency: Atomic Executions, Locks and Monitors Dr. Michael Petter Winter term 2016 Atomic Executions, Locks and Monitors

More information

PennBench: A Benchmark Suite for Embedded Java

PennBench: A Benchmark Suite for Embedded Java WWC5 Austin, TX. Nov. 2002 PennBench: A Benchmark Suite for Embedded Java G. Chen, M. Kandemir, N. Vijaykrishnan, And M. J. Irwin Penn State University http://www.cse.psu.edu/~mdl Outline Introduction

More information

ECE 2035 Programming HW/SW Systems Fall problems, 5 pages Exam Three 28 November 2012

ECE 2035 Programming HW/SW Systems Fall problems, 5 pages Exam Three 28 November 2012 Instructions: This is a closed book, closed note exam. Calculators are not permitted. If you have a question, raise your hand and I will come to you. Please work the exam in pencil and do not separate

More information

Heap Compression for Memory-Constrained Java

Heap Compression for Memory-Constrained Java Heap Compression for Memory-Constrained Java CSE Department, PSU G. Chen M. Kandemir N. Vijaykrishnan M. J. Irwin Sun Microsystems B. Mathiske M. Wolczko OOPSLA 03 October 26-30 2003 Overview PROBLEM:

More information

Variables and Java vs C++

Variables and Java vs C++ Variables and Java vs C++ 1 What can be improved? (variables) public void godirection(string directionname) { boolean wenttoroom = false; for (Direction direction : currentroom.getdirections()) { if (direction.getdirectionname().equalsignorecase(directionname))

More information

Free-Me: A Static Analysis for Automatic Individual Object Reclamation

Free-Me: A Static Analysis for Automatic Individual Object Reclamation Free-Me: A Static Analysis for Automatic Individual Object Reclamation Samuel Z. Guyer, Kathryn McKinley, Daniel Frampton Presented by: Jason VanFickell Thanks to Dimitris Prountzos for slides adapted

More information

Sustainable Memory Use Allocation & (Implicit) Deallocation (mostly in Java)

Sustainable Memory Use Allocation & (Implicit) Deallocation (mostly in Java) COMP 412 FALL 2017 Sustainable Memory Use Allocation & (Implicit) Deallocation (mostly in Java) Copyright 2017, Keith D. Cooper & Zoran Budimlić, all rights reserved. Students enrolled in Comp 412 at Rice

More information

Predictable Interrupt Management and Scheduling in the Composite Component-based System

Predictable Interrupt Management and Scheduling in the Composite Component-based System Predictable Interrupt Management and Scheduling in the Composite Component-based System Gabriel Parmer and Richard West Computer Science Department Boston University Boston, MA 02215 {gabep1, richwest}@cs.bu.edu

More information

Lecture Notes on Garbage Collection

Lecture Notes on Garbage Collection Lecture Notes on Garbage Collection 15-411: Compiler Design Frank Pfenning Lecture 21 November 4, 2014 These brief notes only contain a short overview, a few pointers to the literature with detailed descriptions,

More information

MultiJav: A Distributed Shared Memory System Based on Multiple Java Virtual Machines. MultiJav: Introduction

MultiJav: A Distributed Shared Memory System Based on Multiple Java Virtual Machines. MultiJav: Introduction : A Distributed Shared Memory System Based on Multiple Java Virtual Machines X. Chen and V.H. Allan Computer Science Department, Utah State University 1998 : Introduction Built on concurrency supported

More information

Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology

Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology exam Compiler Construction in4303 April 9, 2010 14.00-15.30 This exam (6 pages) consists of 52 True/False

More information

High-Level Language VMs

High-Level Language VMs High-Level Language VMs Outline Motivation What is the need for HLL VMs? How are these different from System or Process VMs? Approach to HLL VMs Evolutionary history Pascal P-code Object oriented HLL VMs

More information

Concurrency Control. Synchronization. Brief Preview of Scheduling. Motivating Example. Motivating Example (Cont d) Interleaved Schedules

Concurrency Control. Synchronization. Brief Preview of Scheduling. Motivating Example. Motivating Example (Cont d) Interleaved Schedules Brief Preview of Scheduling Concurrency Control Nan Niu (nn@cs.toronto.edu) CSC309 -- Summer 2008 Multiple threads ready to run Some mechanism for switching between them Context switches Some policy for

More information

Run-time Environments. Lecture 13. Prof. Alex Aiken Original Slides (Modified by Prof. Vijay Ganesh) Lecture 13

Run-time Environments. Lecture 13. Prof. Alex Aiken Original Slides (Modified by Prof. Vijay Ganesh) Lecture 13 Run-time Environments Lecture 13 by Prof. Vijay Ganesh) Lecture 13 1 What have we covered so far? We have covered the front-end phases Lexical analysis (Lexer, regular expressions,...) Parsing (CFG, Top-down,

More information

Cooperative Memory Management in Embedded Systems

Cooperative Memory Management in Embedded Systems ooperative Memory Management in Embedded Systems, Philip Taffner, hristoph Erhardt, hris7an Dietrich, Michael S7lkerich Department of omputer Science 4 Distributed Systems and Opera7ng Systems 1 2 Motivation

More information