Java Virtual Machine Case Study on the Design of JikesRVM.

Slides:



Advertisements
Similar presentations
Chapter 16 Java Virtual Machine. To compile a java program in Simple.java, enter javac Simple.java javac outputs Simple.class, a file that contains bytecode.
Advertisements

1 Lecture 10 Intermediate Representations. 2 front end »produces an intermediate representation (IR) for the program. optimizer »transforms the code in.
Overview Motivations Basic static and dynamic optimization methods ADAPT Dynamo.
1 1 Lecture 14 Java Virtual Machine Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung Institute of Technology.
JAVA Processors and JIT Scheduling. Overview & Literature n Formulation of the problem n JAVA introduction n Description of Caffeine * Literature: “Java.
Chapter 1 Computer System Overview Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,
Aarhus University, 2005Esmertec AG1 Implementing Object-Oriented Virtual Machines Lars Bak & Kasper Lund Esmertec AG
Figure 2.8 Compiler phases Compiling. Figure 2.9 Object module Linking.
3/17/2008Prof. Hilfinger CS 164 Lecture 231 Run-time organization Lecture 23.
Java for High Performance Computing Jordi Garcia Almiñana 14 de Octubre de 1998 de la era post-internet.
JETT 2003 Java.compareTo(C++). JAVA Java Platform consists of 4 parts: –Java Language –Java API –Java class format –Java Virtual Machine.
Computer System Overview
JVM-1 Introduction to Java Virtual Machine. JVM-2 Outline Java Language, Java Virtual Machine and Java Platform Organization of Java Virtual Machine Garbage.
Chapter 16 Java Virtual Machine. To compile a java program in Simple.java, enter javac Simple.java javac outputs Simple.class, a file that contains bytecode.
Toba Gregg M. Townsend Executable Code from Java Source.
1 Software Testing and Quality Assurance Lecture 31 – SWE 205 Course Objective: Basics of Programming Languages & Software Construction Techniques.
Load Time Structural Reflection in Java Shigeru Chiba Institute of Information Science and Electronics University of Tsukuba.
COP4020 Programming Languages
CSc 453 Interpreters & Interpretation Saumya Debray The University of Arizona Tucson.
1.3 Executing Programs. How is Computer Code Transformed into an Executable? Interpreters Compilers Hybrid systems.
Session-02. Objective In this session you will learn : What is Class Loader ? What is Byte Code Verifier? JIT & JAVA API Features of Java Java Environment.
Java Security Updated May Topics Intro to the Java Sandbox Language Level Security Run Time Security Evolution of Security Sandbox Models The Security.
Intro to Java The Java Virtual Machine. What is the JVM  a software emulation of a hypothetical computing machine that runs Java bytecodes (Java compiler.
Exploiting Prolific Types for Memory Management and Optimizations By Yefim Shuf et al.
Adaptive Optimization in the Jalapeño JVM M. Arnold, S. Fink, D. Grove, M. Hind, P. Sweeney Presented by Andrew Cove Spring 2006.
Java Security. Topics Intro to the Java Sandbox Language Level Security Run Time Security Evolution of Security Sandbox Models The Security Manager.
Compiler Construction Lecture 17 Mapping Variables to Memory.
Arpit Jain Mtech1. Outline Introduction Dalvik VM Java VM Examples Comparisons Experimental Evaluation.
P ARALLEL P ROCESSING I NSTITUTE · F UDAN U NIVERSITY 1.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 2: System Structures.
Java Bytecode What is a.class file anyway? Dan Fleck George Mason University Fall 2007.
Lecture 10 : Introduction to Java Virtual Machine
CSC 310 – Imperative Programming Languages, Spring, 2009 Virtual Machines and Threaded Intermediate Code (instead of PR Chapter 5 on Target Machine Architecture)
The Jikes RVM | Ian Rogers, The University of Manchester | Dr. Ian Rogers Jikes RVM Core Team Member Research Fellow, Advanced.
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
O VERVIEW OF THE IBM J AVA J UST - IN -T IME C OMPILER Presenters: Zhenhua Liu, Sanjeev Singh 1.
1 Introduction to JVM Based on material produced by Bill Venners.
Roopa.T PESIT, Bangalore. Source and Credits Dalvik VM, Dan Bornstein Google IO 2008 The Dalvik virtual machine Architecture by David Ehringer.
CPRG 215 Introduction to Object-Oriented Programming with Java Module 1-Introduction to Java Topic 1.1 Basics of Java Produced by Harvey Peters, 2008 Copyright.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Operating Systems Lecture 7 OS Potpourri Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard. Zhiqing Liu School of Software.
Replay Compilation: Improving Debuggability of a Just-in Time Complier Presenter: Jun Tao.
Issues Autonomic operation (fault tolerance) Minimize interference to applications Hardware support for new operating systems Resource management (global.
U NIVERSITY OF D ELAWARE C OMPUTER & I NFORMATION S CIENCES D EPARTMENT Optimizing Compilers CISC 673 Spring 2009 Overview of Compilers and JikesRVM John.
Processes CS 6560: Operating Systems Design. 2 Von Neuman Model Both text (program) and data reside in memory Execution cycle Fetch instruction Decode.
Problem: Efficient dynamic type checking for Java ƒsingle class inheritance ƒmultiple interface inheritance ƒarray subtyping Solutions ƒLeverage (JIT)
CSCI1600: Embedded and Real Time Software Lecture 18: Real Time Languages Steven Reiss, Fall 2015.
CSE 598c – Virtual Machines Survey Proposal: Improving Performance for the JVM Sandra Rueda.
Vertical Profiling : Understanding the Behavior of Object-Oriented Applications Sookmyung Women’s Univ. PsLab Sewon,Moon.
Procedures and Functions Procedures and Functions – subprograms – are named fragments of program they can be called from numerous places  within a main.
Interrupts and Exception Handling. Execution We are quite aware of the Fetch, Execute process of the control unit of the CPU –Fetch and instruction as.
Hello world !!! ASCII representation of hello.c.
RealTimeSystems Lab Jong-Koo, Lim
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
(Not too) Real-Time JVM (Progress Report)
Smalltalk Implementation Harry Porter, October 2009 Smalltalk Implementation: Optimization Techniques Prof. Harry Porter Portland State University 1.
Chapter 1 Computer System Overview
Runtime Analysis of Hotspot Java Virtual Machine
Introduction Enosis Learning.
Java Virtual Machine Complete subject details are available at:
2.1. Compilers and Interpreters
Process Virtualization. Process Process is a program that has initiated its execution. A program is a passive entity; whereas a process is an active entity.
Introduction Enosis Learning.
Java Virtual Machine : Semantics and Optimization
CSc 453 Interpreters & Interpretation
Chapter 1 Computer System Overview
M S COLLEGE ART’S, COMM., SCI. & BMS
CSc 453 Interpreters & Interpretation
JIT Compiler Design Maxine Virtual Machine Dhwani Pandya
Dynamic Binary Translators and Instrumenters
Presentation transcript:

Java Virtual Machine Case Study on the Design of JikesRVM

JVM JVM runs Java application in bytecode –Other sources can also be compiled to bytecode –JVM is a process virtual machine Hardware support exists –Execution by Interpreter JIT (just-in-time) compilation: HotSpot, JikesRVM

JikesRVM Originally Jalapeno A research compiler by IBM written mostly in Java –Why Java? Software engineering Bridging gap between runtime servers and user code Most used research JVM in academics

Design Goals Exploitation of high-performance processors SMP scalability Thread limits Continuous availability Rapid response Library usage Graceful degradation

Object Model and Memory Layout Field and array access should be fast Virtual method dispatch should be fast Null pointer checks should be performed by the hardware Other Java operations should not be prohibitively slow

Array and Scalar Object Layout

Object Header TIB (type information block) –Reference to the object’s class –An array of objects Class Compiled methods –Array of instructions Status –Locking field –Hashing field –Memory management

JTOC (JikesRVM Table of Contents)

Method Invocation Stack

Runtime Subsystem Exceptions Dynamic class loading Input/Output Reflection

Exceptions –Null pointer exception by hardware –Out of bound –Divided by zero –Method invocation stack overflow –Software-generated exceptions Handling –Caught by a C interrupt handler and pass to deliverException method –deliverException collects stack trace, transfer control to “try” block if exists

Dynamic Class Loading Java can load classes during execution In JikesRVM, when a class not loaded is referred –Generate code to load, resolve and instantiate the class before execution Subtleties for address resolution

Input and Output Use OS’ services through system routine calls

Reflection Reflection: runtime access to fields and runtime invocation of methods –For fields, JVM keep tracks type information –For method invocation, need to match the signature public int incrementField(String name, Object obj) throws... { Field field = obj.getClass().getDeclaredField(name); int value = field.getInt(obj) + 1; field.setInt(obj, value); return value; }

Threads and Synchronization JikesRVM implemenst virtual processor as pthreads –Java threads are multiplexed on virtual processors –One virtual processor for each physical processor Locks –Processor lock ( a java object with a field denting owner) –Thin lock: use lock field on an object header –Thick lock: object level lock with a queue of threads waiting for thelock

Memory Management Java is an automatic memory managed language Memory management is most critical for Java –We will spend several weeks on this topic In JikesRVM (obsolete) –A family of memory managers

Choices Copying or non-copying collectors Incremental/concurrent or stop-the-world Generational collectors –Most objects die young –Minor collection, major collection –Remember set

Compiler JikesRVM provides three compilers –Baseline compiler More of an interpreter Easy to develop and verify –Quick (fast) compiler Balance compile-time and execution time –Optimizing compiler Deliver high-quality code with likely long compilation time

Quick Compiler Compile each method as it executes for the first time Apply a few highly effective optimizations –Minimal transformation –Decorate the byte code and optimized with Copy propagation Register allocation

Optimizing Compiler For frequently executed method –Need a profiler –Dynamic versus adaptive

Optimizing Compiler Structure

Optimizations HIR (n-tuple, register-based IR) –Local optimizations: CSE, elimination of redundant load –Flow-insensitive optimizations: dead code elimination –In-lining

Optimizations LIR (adopt object layout and calling convention) –Larger than HIR –Local CSE MIR (machine specific) –Instruction selection using BURS –Live variable analysis –Register allocation (linear scan)

Compilation Speeds

Performance on SPEC JVM98

Extra Magic Boot image

Byteocde Example int align2grain(int i, int grain) { return ((i + grain-1) & ~(grain-1)); } Method int align2grain(int,int) 0 iload_1 1 iload_2 2 iadd 3 iconst_1 4 isub 5 iload_2 6 iconst_1 7 isub 8 iconst_m1 9 ixor 10 iand 11 ireturn