picojava TM : A Hardware Implementation of the Java Virtual Machine



Similar documents
1 The Java Virtual Machine

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

The Java Virtual Machine (JVM) Pat Morin COMP 3002

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

Chapter 7D The Java Virtual Machine

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

CPU Organization and Assembly Language

Hardware/Software Co-Design of a Java Virtual Machine

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

Chapter 4 Lecture 5 The Microarchitecture Level Integer JAVA Virtual Machine

CHAPTER 7: The CPU and Memory

General Introduction

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

VLIW Processors. VLIW Processors

ADVANCED PROCESSOR ARCHITECTURES AND MEMORY ORGANISATION Lesson-12: ARM

1. Overview of the Java Language

Instruction Folding in a Hardware-Translation Based Java Virtual Machine

An Overview of Stack Architecture and the PSC 1000 Microprocessor

Real-time Java Processor for Monitoring and Test

02 B The Java Virtual Machine

Restraining Execution Environments

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

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives

Overview. CISC Developments. RISC Designs. CISC Designs. VAX: Addressing Modes. Digital VAX

The Design of the Inferno Virtual Machine. Introduction

Developing Embedded Software in Java Part 1: Technology and Architecture

PART IV Performance oriented design, Performance testing, Performance tuning & Performance solutions. Outline. Performance oriented design

An Overview of Java. overview-1

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

Crash Course in Java

Fachbereich Informatik und Elektrotechnik SunSPOT. Ubiquitous Computing. Ubiquitous Computing, Helmut Dispert

2 Introduction to Java. Introduction to Programming 1 1

Java Card. Smartcards. Demos. . p.1/30

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

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

Habanero Extreme Scale Software Research Project

Computer Architecture Lecture 3: ISA Tradeoffs. Prof. Onur Mutlu Carnegie Mellon University Spring 2013, 1/18/2013

Processor Architectures

Jonathan Worthington Scarborough Linux User Group

The Hotspot Java Virtual Machine: Memory and Architecture

Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner.

Cloud Computing. Up until now

Java Card TM Open Platform for Smart Cards

Instruction Set Design

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

İSTANBUL AYDIN UNIVERSITY

JPURE - A PURIFIED JAVA EXECUTION ENVIRONMENT FOR CONTROLLER NETWORKS 1

Instruction Set Architecture. or How to talk to computers if you aren t in Star Trek

Multi-core Programming System Overview

Instruction Set Architecture (ISA) Design. Classification Categories

Chapter 3: Operating-System Structures. Common System Components

Operating System Overview. Otto J. Anshus

Microprocessor & Assembly Language

Computer Architecture Lecture 2: Instruction Set Principles (Appendix A) Chih Wei Liu 劉 志 尉 National Chiao Tung University

INTRODUCTION TO JAVA PROGRAMMING LANGUAGE

This Unit: Putting It All Together. CIS 501 Computer Architecture. Sources. What is Computer Architecture?

Smart Cards a(s) Safety Critical Systems

Design Cycle for Microprocessors

Lecture 1 Introduction to Android

MICROPROCESSOR AND MICROCOMPUTER BASICS

12. Introduction to Virtual Machines

Instruction Set Architecture (ISA)

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

Java Garbage Collection Basics

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C

Solution: start more than one instruction in the same clock cycle CPI < 1 (or IPC > 1, Instructions per Cycle) Two approaches:

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

a storage location directly on the CPU, used for temporary storage of small amounts of data during processing.

Mobile Application Languages XML, Java, J2ME and JavaCard Lesson 04 Java

ARM Microprocessor and ARM-Based Microcontrollers

Computer Architecture Basics

CSE 452: Programming Languages. Acknowledgements. Contents. Java and its Evolution

Chapter 3 Operating-System Structures

System i Architecture Part 1. Module 2

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

Next Generation GPU Architecture Code-named Fermi

Azul Compute Appliances

Computer Organization and Architecture

CS 152 Computer Architecture and Engineering. Lecture 22: Virtual Machines

Week 1 out-of-class notes, discussions and sample problems

UNIVERSITY OF CALIFORNIA, DAVIS Department of Electrical and Computer Engineering. EEC180B Lab 7: MISP Processor Design Spring 1995

Instruction Set Architecture

Virtual Machine Learning: Thinking Like a Computer Architect

Implementation Aspects of OO-Languages

A Survey on ARM Cortex A Processors. Wei Wang Tanima Dey

Mobile Operating Systems. Week I

A Java Virtual Machine Architecture for Very Small Devices

System Structures. Services Interface Structure

Module 2. Embedded Processors and Memory. Version 2 EE IIT, Kharagpur 1

Central Processing Unit (CPU)

Reconfigurable Architecture Requirements for Co-Designed Virtual Machines

Instruction Set Architecture. Datapath & Control. Instruction. LC-3 Overview: Memory and Registers. CIT 595 Spring 2010

CSC 2405: Computer Systems II

Chapter 5, The Instruction Set Architecture Level

Compiling Object Oriented Languages. What is an Object-Oriented Programming Language? Implementation: Dynamic Binding

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

Transcription:

picojava TM : A Hardware Implementation of the Java Virtual Machine Marc Tremblay and Michael O Connor Sun Microelectronics Slide 1

The Java picojava Synergy Java s origins lie in improving the consumer embedded market picojava is a low cost microprocessor dedicated to executing Java -based bytecodes Best system price/performance It is a processor core for: Network computer Internet chip for network appliances Cellular phone & telco processors Traditional embedded applications Slide 2

Java in Embedded Devices Products in the embedded market require: Robust programs Graceful recovery vs. crash Increasingly complex programs with multiple programmers Object-oriented language and development environment Re-using code from one product generation to the next Portable code Safe connectivity to applets For networked devices (PDA, pagers, cell phones) Slide 3

Important Factors to Consider in the Embedded World Low system cost Processor, ROM, DRAM, etc. Good performance Time-to-market Low power consumption Slide 4

Various Ways of Implementing the Java Virtual Machine HotJava APIs Applets Virtual Machine Host Porting Interface Adaptor Browser Adaptor Adaptor OS OS OS JavaOS Hardware Architecture Hardware Architecture Hardware Architecture picojava Slide 5

picojava Directly executes bytecodes Excellent performance Eliminates the need for an interpreter or a JIT compiler Small memory footprint Simple core Legacy blocks and circuits are not present Hardware support for the runtime Addresses overall system performance Slide 6

Java Virtual Machine What the virtual machine specifies: Instruction set Data types Operand stack Constant pool Method area Heap for runtime data Format of the class file Slide 7

Virtual Machine Instruction Set Data types: byte, short, int, long float, double, char, object, returnaddress All opcodes have 8 bits, but are followed by a variable number of operands (0, 1, 2, 3, ) Opcodes 200 assigned 25 quick variations 3 reserved Slide 8

Java Virtual Machine Code Size Java -based bytecodes are small No register specifiers Local variable accessed relative to a base pointer (VARS) This results in very compact code Average JVM instruction is 1.8 bytes RISC instructions typically require 4 bytes Slide 9

Instruction Length 100% 80% 60% 40% 20% others 3 bytes 2 bytes 1 byte 0% Javac Tomcat Compr. Ray Dhrys. Pento. Hot Java Slide 10

Java Virtual Machine Code Size Java bytecodes are about 2X smaller than the RISC code from the C++ compiler A large application (2500+lines) coded in both the C++ and Java languages Slide 11

JVM Instruction Set RISCy Some instructions are simple bipush value iadd fadd ifeq iload offset :push signed integer :integer add :single float add :branch if equal to O :load integer from :local variable Slide 12

JVM Instruction Set CISCy Some instructions are complex lookupswitch: traditional switch statement byte 1 byte 2 byte 3 byte 4 opcode (171) 0..3 byte padding default offset numbers of pairs that follow (N) match 1 jump offset 1 match 2 jump offset 2...... match N jump offset N Slide 13

Interpreter Loop loop: 1: fetch bytecodes 2: indirect jump to emulation code Emulation Code 1: get operands 2: perform operation 3: increment PC 4: go to loop Slide 14

JVM: Stack-Based Architecture Operands typically accessed from the stack, put back on the stack Example integer add: Add top 2 entries in the stack and put the result on top of the stack Typical emulation on a RISC processor 1: load tos 2: load tos-1 3: add 4: store tos-1 Slide 15

How to Best Execute Bytecodes? Leverage RISC techniques developed over the past 15 years Implement in hardware only those instructions that make a difference Trap for costly instructions that do not occur often State machines for high frequency/medium complexity instructions Slide 16

Dynamic Instruction Distribution 100% 90% 80% 70% 60% 50% 40% 30% 20% 10% 0% calls/ret compute st object ld object stack ops Javac Compr Ray Dhryst. Pento Hot Java Slide 17

Composite Instruction Mix Stack ops: dup, push, loads and stores to local variables compute: ALU, FP, compute branches calls/ret: method invocation virtual and non-virtual ld/st object: access to objects on the heap and array accesses compute 28% st object 5% calls/ret 7% ld object 17% stack ops 43% Slide 18

Loads from Local Variables compute 36% calls/ret 8% st object 6% stack ops 29% ld object 21% Loads from local variables move data within the chip Target register is often consume immediately Up to 60% of them can be hidden Resulting instruction distribution looks closer to a RISC processor Slide 19

Pipeline Design RISC pipeline attributes Stages based on fundamental paths (e.g. cache access, ALU path, registers access) No operation on cache/memory data Hardwire all simple operations Enhance classic pipeline Support for method invocations Support for hiding loads from local variables Slide 20

Implementation of Critical Instructions getfield_quick offset iadd Fetch field from object Executes as a load [object + offset] on picojava Fully pipelined Executes in a single cycle Stack objectref value...... value1 result value2...... Before After Slide 21

Typical Small Benchmarks (Caffeinemarks, Pentonimo, etc.) Few objects, few calls, few threads 95% 5% Interpreter Run Time Speeding up the Interpreter by 30X results in: 95 3.2 5 5 8.2 =>Speedup of ~12X Slide 22

Representative Applications Lots of Objects Threaded Code 60-80% 40-20% Interpreter Synchronization Garbage Collection Object Creation Speeding up the Interpreter by 30X results in: 60 2 40 40 => 42 Speedup of ~2X Slide 23

Percentage of Calls 12 10 8 6 4 2 0 Varies dramatically according to benchmark type Slide 24

picojava: A System Performance Approach Accelerates object-oriented programs simple pipeline with enhancements for features specific.to bytecodes support for method invocation Accelerates runtime (gc.c, monitor.c, threadruntime.c, etc.) Support for threads Support for garbage collection Simple but efficient, non-invasive, hardware support Slide 25

System Programming Instructions added to support system programming available only under the hood operating system functions access to I/O devices access to the internals of picojava Slide 26

picojava - Summary Best system price/performance for running Java -powered applications in embedded markets Embedded market very sensitive to system cost and power consumption Interpreter and/or JIT compiler eliminated Excellent system performance Efficient implementation through use of the same methodology, process and circuit techniques developed for RISC processors Slide 27