Complex, concurrent software. Precision (no false positives) Find real bugs in real executions

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

Managed runtimes & garbage collection

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

Efficient Context Sensitivity for Dynamic Analyses via Calling Context Uptrees and Customized Memory Management

Towards Lean 4: Sebastian Ullrich 1, Leonardo de Moura 2.

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

Accelerating Ruby with LLVM

Running class Timing on Java HotSpot VM, 1

Experiences with Multi-threading and Dynamic Class Loading in a Java Just-In-Time Compiler

<Insert Picture Here> Symmetric multilanguage VM architecture: Running Java and JavaScript in Shared Environment on a Mobile Phone

A program execution is memory safe so long as memory access errors never occur:

Compiler construction 2009

CS842: Automatic Memory Management and Garbage Collection. Mark and sweep

NUMA in High-Level Languages. Patrick Siegler Non-Uniform Memory Architectures Hasso-Plattner-Institut

Write Barrier Removal by Static Analysis

A JAVA VIRTUAL MACHINE FOR RISC-V PORTING THE JIKES RESEARCH VM

JAVA PERFORMANCE. PR SW2 S18 Dr. Prähofer DI Leopoldseder

Dynamic Binary Translation: from Dynamite to Java

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

SABLEJIT: A Retargetable Just-In-Time Compiler for a Portable Virtual Machine p. 1

Compiler construction 2009

Shenandoah: An ultra-low pause time garbage collector for OpenJDK. Christine Flood Roman Kennke Principal Software Engineers Red Hat

Optimization Techniques

Harmony GC Source Code

Virtual Machine Design

SSA Based Mobile Code: Construction and Empirical Evaluation

Glacier: A Garbage Collection Simulation System

High-Level Language VMs

Towards Parallel, Scalable VM Services

Efficient Runtime Tracking of Allocation Sites in Java

DNWSH - Version: 2.3..NET Performance and Debugging Workshop

COMP31212: Concurrency A Review of Java Concurrency. Giles Reger

Review. Partitioning: Divide heap, use different strategies per heap Generational GC: Partition by age Most objects die young

<Insert Picture Here> Maxine: A JVM Written in Java

Overview. 1/13/ Preliminary Product Brief

Hybrid Static Dynamic Analysis for Region Serializability

JamaicaVM Java for Embedded Realtime Systems

Jupiter: A Modular and Extensible JVM

Bugs in Deployed Software

Java Performance: The Definitive Guide

Overview. 3//5/ Preliminary Product Brief

Expressing high level optimizations within LLVM. Artur Pilipenko

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

IBM Monitoring and Diagnostic Tools for Java TM...

A Trace-based Java JIT Compiler Retrofitted from a Method-based Compiler

A new Mono GC. Paolo Molaro October 25, 2006

Design and Implementation of a Baseline port of the Jikes Research Virtual Machine to the IA-64 Architecture

New Features Overview

Compact and Efficient Strings for Java

Myths and Realities: The Performance Impact of Garbage Collection

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

Method-Level Phase Behavior in Java Workloads

Pointer Analysis in the Presence of Dynamic Class Loading

Emulating the ARM Architecture. Using a Java Dynamic Binary Translator. University of Manchester School of Computer Science

Shenandoah: Theory and Practice. Christine Flood Roman Kennke Principal Software Engineers Red Hat

Administration CS 412/413. Why build a compiler? Compilers. Architectural independence. Source-to-source translator

Software Speculative Multithreading for Java

Multi-threaded programming in Java

Eventrons: A Safe Programming Construct for High-Frequency Hard Real-Time Applications

CMSC 430 Introduction to Compilers. Fall Language Virtual Machines

Implementing Higher-Level Languages. Quick tour of programming language implementation techniques. From the Java level to the C level.

CHAPTER 1. Introduction to JAVA Programming

DoubleChecker: Efficient Sound and Precise Atomicity Checking

Delft-Java Link Translation Buffer

<Insert Picture Here>

Secure Virtual Architecture: Using LLVM to Provide Memory Safety to the Entire Software Stack

Java Concurrency in practice

September 15th, Finagle + Java. A love story (

CONFIGURABLE JVM THREADING

The Java Memory Model

Dealing with Issues for Interprocess Communication

JCTools: Pit Of Performance Nitsan Copyright - TTNR Labs Limited 2018

Java Internals. Frank Yellin Tim Lindholm JavaSoft

G52CON: Concepts of Concurrency

Trace-based JIT Compilation

CSE 2021: Computer Organization

Trace Compilation. Christian Wimmer September 2009

Memory Management in JikesNode Operating System

Hazard Pointers. Number of threads unbounded time to check hazard pointers also unbounded! difficult dynamic bookkeeping! thread B - hp1 - hp2

Pause-Less GC for Improving Java Responsiveness. Charlie Gracie IBM Senior Software charliegracie

Fault Tolerant Java Virtual Machine. Roy Friedman and Alon Kama Technion Haifa, Israel

Fiji VM Safety Critical Java

Advanced programming for Java platform. Introduction

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

Zing Vision. Answering your toughest production Java performance questions

Welcome to the session...

Vertical Profiling: Understanding the Behavior of Object-Oriented Applications

JVM Independent Replay in Java

code://rubinius/technical

Visual Amortization Analysis of Recompilation Strategies

Detecting and Fixing Memory-Related Performance Problems in Managed Languages

CMSC 430 Introduction to Compilers. Spring Intermediate Representations and Bytecode Formats

JVM Continuations. Lukas Stadler. Johannes Kepler University Linz, Austria

CSE 410 Final Exam 6/09/09. Suppose we have a memory and a direct-mapped cache with the following characteristics.

The benefits and costs of writing a POSIX kernel in a high-level language

Operating Systems. read the warning about the size of the project make sure you get the 6 th edition (or later) of the book

Java On Steroids: Sun s High-Performance Java Implementation. History

Where we are. What makes a good IR? Intermediate Code. CS 4120 Introduction to Compilers

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

CMSC 132: Object-Oriented Programming II. Threads in Java

Transcription:

Harry Xu May 2012

Complex, concurrent software Precision (no false positives) Find real bugs in real executions

Need to modify JVM (e.g., object layout, GC, or ISA-level code) Need to demonstrate realism (usually performance)

Otherwise use RoadRunner, BCEL, Pin, LLVM,

Keeping track of stuff as the program executes? Change application behavior (add instrumentation) Store per-object/per-field metadata Piggyback on GC

Keeping track of stuff as the program executes? JVM written in Java?! Change application behavior (add instrumentation) Store per-object/per-field metadata Piggyback on GC Uninterruptible code

Jikes RVM { Guide Research Archive Research mailing list

Jikes RVM { Guide Research Archive Research mailing list

Jikes RVM source code Boot image writer Dynamic compilers

Jikes RVM source code Boot image writer Run with another JVM Dynamic compilers

Jikes RVM source code Boot image writer Run with another JVM Dynamic compilers Boot image (native code + initial heap space)

Jikes RVM source code Boot image writer Run with another JVM Build configurations: BaseBase BaseAdaptive FullAdaptive FastAdaptive Dynamic compilers Boot image (native code + initial heap space)

Jikes RVM source code Boot image writer Run with another JVM Build configurations: BaseBase (prototype) BaseAdaptive (prototype-opt) FullAdaptive (development) FastAdaptive (production) Dynamic compilers Boot image (native code + initial heap space)

Jikes RVM source code Boot image writer Run with another JVM Build configurations: BaseBase BaseAdaptive FullAdaptive FastAdaptive Testing Dynamic compilers Boot image (native code + initial heap space)

Jikes RVM source code Boot image writer Run with another JVM Build configurations: BaseBase BaseAdaptive FullAdaptive FastAdaptive Faster builds Dynamic compilers Boot image (native code + initial heap space)

Jikes RVM source code Boot image writer Run with another JVM Build configurations: BaseBase BaseAdaptive FullAdaptive FastAdaptive Faster runs Dynamic compilers Boot image (native code + initial heap space)

Jikes RVM source code Boot image writer Run with another JVM Build configurations: BaseBase BaseAdaptive FullAdaptive FastAdaptive Performance Dynamic compilers Boot image (native code + initial heap space)

Jikes RVM source code Boot image writer Run with another JVM Dynamic compilers Boot image (native code + initial heap space)

Jikes RVM source code Boot image writer Run with another JVM Edit with Eclipse (see Guide) Dynamic compilers Boot image (native code + initial heap space)

Keeping track of stuff as the program executes? Change application behavior (add instrumentation) Store per-object/per-field metadata Piggyback on GC

Bytecode Baseline compiler Native code

Bytecode Baseline compiler Native code Each bytecode several x86 instructions (BaselineCompilerImpl.java)

Bytecode Baseline compiler Native code Each bytecode several x86 instructions (BaselineCompilerImpl.java)

Bytecode Baseline compiler Native code Profiling Adaptive optimization system

Bytecode Baseline compiler Native code Profiling Optimizing compiler (Faster) native code Adaptive optimization system

Bytecode Baseline compiler Native code Profiling Optimizing compiler (Faster) native code Adaptive optimization system

Bytecode Optimizing compiler (Faster) native code

Bytecode HIR Resembles bytecode Resembles typical compiler IR (3-address code) LIR (Faster) native code Resembles assembly code MIR

Bytecode HIR Opt levels: 0, 1, 2 LIR (Faster) native code MIR (Even faster) native code

Bytecode HIR Add instrumentation at reads, writes, allocation, synchronization ExpandRuntimeServices.java LIR (Faster) native code MIR

Keeping track of stuff as the program executes? Change application behavior (add instrumentation) Store per-object/per-field metadata Piggyback on GC

header field0 field1 field2 Low address High address

Object reference type info block locking & GC field0 field1 field2

Object reference type info block locking & GC field0 field1 field2 Object reference type info block locking & GC Array length elem0 elem1

Object reference type info block locking & GC field0 field1 field2 Steal bits

Object reference misc type info block locking & GC field0 field1 field2 MiscHeader.java

Object reference counter type info block locking & GC field0 field1 field2

Object reference counter type info block locking & GC field0 field1 field2 Magic! Compiles down to three x86 instructions

Object reference counter type info block locking & GC field0 field1 field2 2 Gotcha: can t actually use LSB of leftmost word

Object reference counter type info block locking & GC field0 field1 field2 2 What s the problem with this code?

Object reference counter type info block locking & GC field0 field1 field2 2

Object reference not used type info block locking & GC field0 field1 field2

Object reference not used type info block locking & GC field0 field1 field2 Compiles down to three x86 instructions

Object reference misc type info block locking & GC field0 field1 field2

Object reference misc type info block locking & GC field0 field1 field2 What if GC moves object? What if GC collects object?

Keeping track of stuff as the program executes? Change application behavior (add instrumentation) Store per-object/per-field metadata Piggyback on GC

Object reference type info block locking & GC field0 field1 field2 // Initially worklist populated with roots while worklist has elements Object obj = worklist.pop() foreach reference field obj.f obj.f = markandpossiblycopy(obj.f) worklist.push(obj.f)

Object reference type info block locking & GC field0 field1 field2 // Initially worklist populated with roots while worklist has elements Object obj = worklist.pop() foreach reference field obj.f obj.f = markandpossiblycopy(obj.f) worklist.push(obj.f)

Object reference type info block locking & GC field0 field1 field2 // Initially worklist populated with roots while worklist has elements Object obj = worklist.pop() foreach reference field obj.f obj.f = markandpossiblycopy(obj.f) worklist.push(obj.f)

Object reference misc type info block locking & GC field0 field1 field2 // Initially worklist populated with roots while worklist has elements Object obj = worklist.pop() foreach reference field obj.f obj.f = markandpossiblycopy(obj.f) worklist.push(obj.f) obj.misc = markandpossiblycopy(obj.f) worklist.push(obj.misc)

Object reference misc type info block locking & GC field0 field1 field2 // Initially worklist populated with roots while worklist has elements Object obj = worklist.pop() foreach reference field obj.f obj.f = markandpossiblycopy(obj.f) worklist.push(obj.f) obj.misc = markandpossiblycopy(obj.f) worklist.push(obj.misc)

Object reference misc type info block locking & GC field0 field1 field2 // Initially worklist populated with roots while worklist has elements Object obj = worklist.pop() foreach reference field obj.f obj.f = markandpossiblycopy(obj.f) worklist.push(obj.f) obj.misc = markandpossiblycopy(obj.f) worklist.push(obj.misc) TraceLocal.scanObject()

Object reference type info block locking & GC field0 field1 field2 // Initially worklist populated with roots while worklist has elements Object obj = worklist.pop() foreach reference field obj.f obj.f = markandpossiblycopy(obj.f) worklist.push(obj.f)

Object reference type info block locking & GC field0 field1 field2 // Initially worklist populated with roots while worklist has elements Object obj = worklist.pop() foreach reference field obj.f obj.f = markandpossiblycopy(obj.f) worklist.push(obj.f) TraceLocal.processNode()

Keeping track of stuff as the program executes? Change application behavior (add instrumentation) Store per-object/per-field metadata Piggyback on GC Uninterruptible code

Normal application code can be interrupted Allocation GC Synchronization & yield points join a GC Some VM code shouldn t be interrupted Heap etc. in inconsistent state Most instrumentation can t be interrupted Reads & writes aren t GC-safe points

@Uninterruptible static void mymethod(object o) { } // No allocation or synchronization // No calls to interruptible methods

@Uninterruptible static void mymethod(object o) { currentthread.defergc = true; Metadata m = new Metadata(); currentthread.defergc = false; } setmischeader(o, offset, m);

Need to modify JVM internals Need to demonstrate realism Guide Overview of other tasks & components Jikes RVM Research Archive Dynamic analysis examples Research mailing list Help (especially for novices)

Object layout Extra bits or words in header Stealing bits from references Discuss magic here Adding instrumentation Baseline & optimizing compilers Allocation sites; reads & writes Inlining instrumentation Garbage collection Piggybacking on GC New spaces Low-level stuff Uninterruptible code Walking the stack Concurrency Atomic stores Thread-local data