java processors and jit scheduling

12
JAVA Processors and JAVA Processors and JIT Scheduling JIT Scheduling

Upload: lihua

Post on 06-Jan-2016

43 views

Category:

Documents


3 download

DESCRIPTION

JAVA Processors and JIT Scheduling. Overview & Literature. Formulation of the problem JAVA introduction Description of Caffeine Literature: “Java Bytecode to Native Code Translation: The Caffeine Prototype and Preliminary Results” written by Hsieh, Gyllenhaal and Hwu, 1996. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: JAVA Processors and JIT Scheduling

JAVA Processors and JIT JAVA Processors and JIT SchedulingScheduling

Page 2: JAVA Processors and JIT Scheduling

Overview & LiteratureOverview & Literature

Formulation of the problemFormulation of the problem JAVA introductionJAVA introduction Description of CaffeineDescription of Caffeine

Literature: “Java Bytecode to Native Literature: “Java Bytecode to Native Code Translation: The Caffeine Prototype Code Translation: The Caffeine Prototype and Preliminary Results” written by and Preliminary Results” written by Hsieh, Gyllenhaal and Hwu, 1996Hsieh, Gyllenhaal and Hwu, 1996

Page 3: JAVA Processors and JIT Scheduling

Formulation of the Formulation of the problemproblem

JAVA is a very well language which JAVA is a very well language which runs on different platforms, but runs on different platforms, but executing an application is much executing an application is much slower than that it is written in C.slower than that it is written in C.

The goal is to achieve a faster The goal is to achieve a faster translation from JAVA-bytecode to translation from JAVA-bytecode to native code.native code.

Page 4: JAVA Processors and JIT Scheduling

Intro: JAVAIntro: JAVA

import java.awg.Frame;

class GraphWindowextends Frame {

.

.

.

CA FE BA BE 0003 00 2D

.

.

.

.

.

JAVACompiler

JAVA Sourcecode JAVA Bytecodes

Page 5: JAVA Processors and JIT Scheduling

Intro: JAVAIntro: JAVA

In a classfile

Medium (e.g. internet)

* Classloader* Bytecode verificator* JIT Compiler

Pentium / PowerPC Alpha / …native code

CA FE BA BE 0003 00 2D

.

.

.

.

.

JAVA Bytecodes

OS-dependent

Machine-dependent

* Classloader* Bytecode verificator* Interpreter (JVM)

Pentium / PowerPC Alpha / …native code

OS-dependent

Machine-dependent

Page 6: JAVA Processors and JIT Scheduling

JAVA: CaffeineJAVA: Caffeine

Bytecode

OptimizedMachine-Specific

IR

Optimized Native Code

OptimizedMachine-Indep.

IR

Machine-Indep.IR (Lcode)

JAVAIR

IR = Instruction Representation

Medium

Optimizing native code translators

Page 7: JAVA Processors and JIT Scheduling

Caffeine: OverviewCaffeine: Overview

Stack to Virtual Register MappingStack to Virtual Register Mapping Stack AnalysisStack Analysis Run-time Memory OrganisationRun-time Memory Organisation

Page 8: JAVA Processors and JIT Scheduling

Stack to Virtual Register Stack to Virtual Register Mapping (1)Mapping (1)

Stack Computation ModelStack Computation Model– operand stackoperand stack– local variable arraylocal variable array– eliminating some loads and storeseliminating some loads and stores

Register MappingRegister Mapping– assign stack locations to unique virtual assign stack locations to unique virtual

register numbersregister numbers– allocate virtual registers to physical regs.allocate virtual registers to physical regs.

Improvement: 2.8 times faster than JITImprovement: 2.8 times faster than JIT

Page 9: JAVA Processors and JIT Scheduling

Stack to Virtual Register Stack to Virtual Register Mapping (2)Mapping (2)

Example

StackOperations

Translatedcode withoutregistermapping

Translatedcode withregistermapping

After copyprop. & deadcode removal

Push APush BAdd

Push APush BR2 <- pop (B)R1 <- pop (A)R3 <- R1 + R2Push R3

R1 <- AR2 <- BR1 <- R1 add R2

R1 <- A add B

Page 10: JAVA Processors and JIT Scheduling

Stack AnalysisStack Analysis

If #pushes == #pops in a path of If #pushes == #pops in a path of blocks ---> register mapping blocks ---> register mapping possiblepossible

Else: use the standard stack-model Else: use the standard stack-model (thus no optimization possible)(thus no optimization possible)

Take live range (LR) of stack Take live range (LR) of stack locations into accountlocations into account

Improvement: 55%Improvement: 55%

Page 11: JAVA Processors and JIT Scheduling

Run-time Memory Run-time Memory OrganisationOrganisation

JAVA has two types of objects:JAVA has two types of objects:– classclass objects objects– arrayarray objects objects

Interpreter: there is an 8-byte Interpreter: there is an 8-byte handler between object and datahandler between object and data

Caffeine: no handlerCaffeine: no handler Improvement: 7%Improvement: 7%

Page 12: JAVA Processors and JIT Scheduling

Conclusion / ComparisonConclusion / Comparison

0

10

20

30

40

50

60

70

Overall Benchmark

SUN (interpreter)

Symantec (J IT)

Caffeine (Register Mapping)

Caffeine (Stack Analysis)

Caffeine (Memory Organisation)

Percentage of C Performance

Caffeine does improve the performance of JAVA-programs, and it is able to reach the goal

to make translating JAVAbytecode to native code faster.