Uses of the Java Virtual Machine

Similar documents
Interpreters and virtual machines. Interpreters. Interpreters. Why interpreters? Tree-based interpreters. Text-based interpreters

language 1 (source) compiler language 2 (target) Figure 1: Compiling a program

1/20/2016 INTRODUCTION

Habanero Extreme Scale Software Research Project

Jonathan Worthington Scarborough Linux User Group

Optimising Cloud Computing with SBSE

HOTPATH VM. An Effective JIT Compiler for Resource-constrained Devices

Use of profilers for studying Java dynamic optimizations

Lab Experience 17. Programming Language Translation

Virtual Machine Learning: Thinking Like a Computer Architect

CSCI 3136 Principles of Programming Languages

The Design of the Inferno Virtual Machine. Introduction

Stack machines The MIPS assembly language A simple source language Stack-machine implementation of the simple language Readings:

The Java Virtual Machine and Mobile Devices. John Buford, Ph.D. Oct 2003 Presented to Gordon College CS 311

Advanced compiler construction. General course information. Teacher & assistant. Course goals. Evaluation. Grading scheme. Michel Schinz

Tachyon: a Meta-circular Optimizing JavaScript Virtual Machine

Performance Improvement In Java Application

Ch. 10 Software Development. (Computer Programming)

Can You Trust Your JVM Diagnostic Tools?

- Applet java appaiono di frequente nelle pagine web - Come funziona l'interprete contenuto in ogni browser di un certo livello? - Per approfondire

02 B The Java Virtual Machine

C Compiler Targeting the Java Virtual Machine

İSTANBUL AYDIN UNIVERSITY

Lecture 1: Introduction

Instruction Set Architecture (ISA)

Lecture Outline. Stack machines The MIPS assembly language. Code Generation (I)

n Introduction n Art of programming language design n Programming language spectrum n Why study programming languages? n Overview of compilation

Chapter 1. Dr. Chris Irwin Davis Phone: (972) Office: ECSS CS-4337 Organization of Programming Languages

Chapter 13 Computer Programs and Programming Languages. Discovering Computers Your Interactive Guide to the Digital World

Language Evaluation Criteria. Evaluation Criteria: Readability. Evaluation Criteria: Writability. ICOM 4036 Programming Languages

Java (Micro) Performance Measuring

Optimizing compilers. CS Modern Compilers: Theory and Practise. Optimization. Compiler structure. Overview of different optimizations

LaTTe: An Open-Source Java VM Just-in Compiler

1 The Java Virtual Machine

Wiggins/Redstone: An On-line Program Specializer

Stack Allocation. Run-Time Data Structures. Static Structures

Waratek Cloud VM for Java. Technical Architecture Overview

JRuby Now and Future Charles Oliver Nutter JRuby Guy Sun Microsystems

High-Level Programming Languages. Nell Dale & John Lewis (adaptation by Michael Goldwasser)

Java Programming. Binnur Kurt Istanbul Technical University Computer Engineering Department. Java Programming. Version 0.0.

picojava TM : A Hardware Implementation of the Java Virtual Machine

Linear Scan Register Allocation on SSA Form

Evolution of the Major Programming Languages

University of Twente. A simulation of the Java Virtual Machine using graph grammars

PROBLEMS (Cap. 4 - Istruzioni macchina)

Advanced Computer Architecture-CS501. Computer Systems Design and Architecture 2.1, 2.2, 3.2

Armed E-Bunny: A Selective Dynamic Compiler for Embedded Java Virtual Machine Targeting ARM Processors

Programming Language Pragmatics

Language Based Virtual Machines... or why speed matters. by Lars Bak, Google Inc

General Introduction

Cambridge International AS and A Level Computer Science

Chapter 3: Operating-System Structures. Common System Components

Processor Architectures

One VM to Rule Them All

Monitoring, Tracing, Debugging (Under Construction)

Chapter 12 Programming Concepts and Languages

Why have SSA? Birth Points (cont) Birth Points (a notion due to Tarjan)

Chapter 1 Fundamentals of Java Programming

2) Write in detail the issues in the design of code generator.

Section 1.4. Java s Magic: Bytecode, Java Virtual Machine, JIT,

How Java Software Solutions Outperform Hardware Accelerators

The Smalltalk Programming Language. Beatrice Åkerblom

From Bytecode to Javascript: the Js of ocaml Compiler

Instruction Set Architecture (ISA) Design. Classification Categories

HVM TP : A Time Predictable and Portable Java Virtual Machine for Hard Real-Time Embedded Systems JTRES 2014

Connect Here. Go Anywhere.

Chapter 7D The Java Virtual Machine

Lecture 32: The Java Virtual Machine. The Java Virtual Machine

Time Limit: X Flags: -std=gnu99 -w -O2 -fomitframe-pointer. Time Limit: X. Flags: -std=c++0x -w -O2 -fomit-frame-pointer - lm

ASSEMBLY PROGRAMMING ON A VIRTUAL COMPUTER

Volume SYSLOG JUNCTION. User s Guide. User s Guide

Monitoring Software using Sun Spots. Corey Andalora February 19, 2008

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

The CompCert verified C compiler

An Introduction to Assembly Programming with the ARM 32-bit Processor Family

CompuScholar, Inc. Alignment to Utah's Computer Programming II Standards

Introduction to Eclipse

Obfuscation: know your enemy

Java and Real Time Storage Applications

Embedded Software development Process and Tools:

Report on the Examination

The Hotspot Java Virtual Machine: Memory and Architecture

Roos Instruments, Inc.

PCF: A Portable Circuit Format For Scalable Two-Party Secure Computation

Levels of Programming Languages. Gerald Penn CSC 324

Characteristics of Java (Optional) Y. Daniel Liang Supplement for Introduction to Java Programming

================================================================

Instruction Folding in a Hardware-Translation Based Java Virtual Machine

Habanero Extreme Scale Software Research Project

CSC 2405: Computer Systems II

Compilers I - Chapter 4: Generating Better Code

Automatically Finding Performance Problems with Feedback-Directed Learning Software Testing

Kernel Types System Calls. Operating Systems. Autumn 2013 CS4023

MONITORING PERFORMANCE IN WINDOWS 7

Data Structures and Algorithms V Otávio Braga

Vivek Sarkar Rice University. Work done at IBM during

Java Virtual Machine: the key for accurated memory prefetching


Transcription:

Uses of the Java Virtual Machine The Java byte code is used for several languages other than Java: Scala Ruby Python Lisp Scheme Jonas Skeppstedt (js@cs.lth.se) Optimizing Compilers 2016 1 / 10

HotSpot The HotSpot virtual machine originates from the Strongtalk virtual machine for the Smalltalk language. It was used by Sun research for the Self language. The first release as a Java virtual machine was in 1999. It is the default virtual machine from Sun/Oracle since Java 1.3. Hotspot is written in C++ some assembler, and consist of 250,000 lines. Due to HotSpot is partly written in assembler it has triggered the IcedTea project based on HotSpot but without assembler code. Available for example for Power and ARM processors and others. Jonas Skeppstedt (js@cs.lth.se) Optimizing Compilers 2016 2 / 10

The Java Byte Code Machine Model The JVM is a stack machine. This means a byte code instruction pops operands from a stack and pushes the result back to the stack. At about the same time as the JVM was designed Bell Labs also designed a virtual machine (for their Inferno operating system) which instead is a register-based virtual machine. Register-based virtual machines are easier to produce faster code for, and therefore HotSpot translates the byte code to that. Jonas Skeppstedt (js@cs.lth.se) Optimizing Compilers 2016 3 / 10

HotSpot JVM Execution Execution of a method starts by interpreting the byte code and after the execution count of the method has reached a limit, optimization is used. The whole method is optimized. Different optimization levels are used depending on whether the JVM is for desktops (clients) or servers. Servers are expected to run for longer time and enables more time-consuming optimizations. In addition to the method invocation counter, there are loop iteration counters which also can trigger optimization. Jonas Skeppstedt (js@cs.lth.se) Optimizing Compilers 2016 4 / 10

Deoptimization The optimization can make guesses and perform better optimizations as long as the guesses are correct. For this, runtime checks are inserted to validate the guesses. If a guess was wrong, the method is deoptimized and interpreted again, but can be optimized later. Deoptimization can also be needed after a new class has been loaded. Jonas Skeppstedt (js@cs.lth.se) Optimizing Compilers 2016 5 / 10

Client Optimization First the control flow graph of a method is constructed by inspecting the byte codes. Then the instructions of a basic block are created by simulating the the JVM execution stack. The stack-based execution model of the JVM is thus replaced with the SSA representation. This is called the HIR representation, or the high-level intermediate representation. Client JVM optimizations on SSA Form include Constant folding Value numbering Inlining Jonas Skeppstedt (js@cs.lth.se) Optimizing Compilers 2016 6 / 10

Low-level intermediate representation Not SSA Form Essentially symbolic assembler code, as in Bell Labs Inferno Unlimited number of machine registers before register allocation Jonas Skeppstedt (js@cs.lth.se) Optimizing Compilers 2016 7 / 10

Server HotSpot JVM Execution The server JVM also uses SSA Form. In addition to the control flow graph, control and data dependencies are analyzed. Additional optimizations include: Constant propagation Dead code elimination Instruction scheduling Graph coloring register allocation Loop unrolling Loop invariant code motion Jonas Skeppstedt (js@cs.lth.se) Optimizing Compilers 2016 8 / 10

EDA230 Optimizing Compilers in September 2013 If you are interested in optimizing compilers, there is the course EDA230 in September. It is focused on SSA Form and you will start with a subset C compiler which first compiles and then simulates the input C program. There you will implement: Lengauer-Tarjan dominance analysis Translation to/from SSA Form Constant propagation on SSA Form Dead code elimination on SSA Form Jonas Skeppstedt (js@cs.lth.se) Optimizing Compilers 2016 9 / 10