vmkit : a substrate for virtual machinesthomas_g/research/biblio/2009/...llvm posix threads dwarf...

1
VMKit : a Substrate for Virtual Machines Nicolas Geoffray, Gaël Thomas, Charles Clément, Bertil Folliot and Gilles Muller Design of VMKit Virtual Machines optimizations require a huge amount of time. Although they share some common principles, such as a Just In Time Compiler or a Garbage Collector, this opportunity for sharing has not been exploited in current VMs. VMKit is a first attempt to build a common substrate that eases the development of high-level VMs by reusing existing projects: LLVM, GNU Classpath, Mono Library, Boehm GC, GCC, Posix Threads. JnJVM GNU Classpath Virtual Machine Substrate LLVM Posix Threads Dwarf Boehm or Home made GC Glibc Java Initial Class Loader Class Type Verifier .class LLVM IR Translator N3 Lisp VM Mono Library Assembly Loader Class Type Verifier Ass.LLVM IR Translator Home made Initial methods Lisp Lexer/Parser (build AST) Type inference AST LLVM IR Translator Applicative Memory Not included in locs 20’000 locs 20’000 locs 5’000 locs VMKit has been successfully used to build three VMs: a Java Virtual Machine (JnJVM), a Common Language Runtime (N3) and a Lisp-like runtime with type inference. Our high level VMs are only 20,000 lines of code, it took one of the author a month to develop a Common Language Runtime and implementing new ideas in the VMs was remarkably easy [IJVM - DSN09]. VM Library Just In Time Compiler or Interpreter Thread Exception Memory Manager Input/Ouput Intermediate Representation Loader Intermediate Representation Verifier Load Compile Native Applicative Methods Method Stub (load/compile) Generated Code 1 Generate Use Manage Invoke main Generated Code 2 Generated Code 3 Applicative Objects add, call create, join read socket throw , catch gcmalloc Unified API Invoke Invoke Invoke Invoke Invoke Intermediate Representation Translator Virtual Machine Substrate High Level Virtual Machine Implementation of three VMs 0 0,2 0,4 0,6 0,8 1 1,2 1,4 1,6 N3 Mono 25,8 4,56 3,79 3,7 3,5 2,53 2,43 1,06 10 Instruc7on Selec7on Live Variable Analysis Linear Scan Register Allocator Live Interval Analysis Predicate Simplifier Java bytecode to LLVM IR Global Value Numbering X86 Machine Code EmiPer Other 0 1 2 3 4 5 6 JnJVM IBM OpenJDK Jikes RVM Cacao Performance (Linux 2.6/1.5GHz/512Mo) + LLVM excellent for CPU intensive Java and .Net applications + Fast VM development + Ahead of Time Compiler Ongoing work for a baseline JIT Ongoing work to use MMTk Ongoing work to optimize exceptions Results Contact [email protected] [email protected] Homepage http://vmkit.llvm.org Compilation overhead (Tomcat 6.0.16) : OpenJDK 8s, JnJVM 75s Scimark (C#) JavaGrande Forum Sec 3, SpecJVM98 and SpecJBB05 GC GC GC GC Exceptions Exceptions Array Bounds Check

Upload: others

Post on 30-Jan-2021

0 views

Category:

Documents


0 download

TRANSCRIPT

  • VMKit : a Substrate for Virtual Machines Nicolas Geoffray, Gaël Thomas, Charles Clément, Bertil Folliot and Gilles Muller

    Design of VMKit
Virtual Machines optimizations require a huge amount of time. Although they share some common principles, such as a Just In Time Compiler or a Garbage Collector, this opportunity for sharing has not been exploited in current VMs.

    VMKit is a first attempt to build a common substrate that eases the development of high-level VMs by reusing existing projects: LLVM, GNU Classpath, Mono Library, Boehm GC, GCC, Posix Threads.

    JnJVM

    GNU Classpath

    Virtual Machine Substrate

    LLVM Posix Threads Dwarf Boehm or Home made GC Glibc

    Java Initial Class Loader

    Class Type Verifier

    .class → LLVM IR Translator

    N3 Lisp VM

    Mono Library

    Assembly Loader

    Class Type Verifier

    Ass.→ LLVM IR Translator

    Home made Initial methods

    Lisp Lexer/Parser (build AST)

    Type inference

    AST → LLVM IR Translator

    Applicative Memory

    Not included in locs

    ∼ 20’000 locs ∼ 20’000 locs ∼ 5’000 locs VMKit has been successfully used to build three VMs: a Java Virtual Machine (JnJVM), a Common Language Runtime (N3) and a Lisp-like runtime with type inference. Our high level VMs are only 20,000 lines of code, it took one of the author a month to develop a Common Language Runtime and implementing new ideas in the VMs was remarkably easy [IJVM - DSN09].

    VM Library

    Just In Time Compiler or Interpreter

    Thread Exception Memory Manager Input/Ouput

    Intermediate Representation

    Loader

    Intermediate Representation

    Verifier

    Load

    Compile

    Native Applicative

    Methods

    Method Stub (load/compile)

    Generated Code 1

    Generate Use

    Manage

    Invoke main

    Generated Code 2

    Generated Code 3

    Applicative Objects

    add, call

    create, join

    read socket

    throw, catch

    gcmalloc

    Unified API

    Invoke Invoke Invoke

    Invoke

    Invoke

    Intermediate Representation

    Translator

    Virtual Machine Substrate

    High Level Virtual Machine

    Implementation of three VMs


    0


    0,2


    0,4


    0,6


    0,8


    1


    1,2


    1,4


    1,6


    N3


    Mono


    25,8


    4,56
3,79


    3,7


    3,5


    2,53


    2,43


    1,06


    10
 Instruc7on
Selec7on


    Live
Variable
Analysis


    Linear
Scan
Register
Allocator


    Live
Interval
Analysis


    Predicate
Simplifier


    Java
bytecode
to
LLVM
IR


    Global
Value
Numbering


    X86
Machine
Code
EmiPer


    Other


    0


    1


    2


    3


    4


    5


    6


    JnJVM


    IBM


    OpenJDK


    Jikes
RVM


    Cacao


    Performance (Linux 2.6/1.5GHz/512Mo)


    +  LLVM excellent for CPU intensive Java and .Net applications

    +  Fast VM development +  Ahead of Time Compiler

    −  Ongoing work for a baseline JIT −  Ongoing work to use MMTk −  Ongoing work to optimize exceptions

    Results


    Contact
[email protected]

    [email protected]

    Homepage


    http://vmkit.llvm.org

    Compilation overhead (Tomcat 6.0.16) : OpenJDK 8s, JnJVM 75s

    Scimark (C#)

    JavaGrande Forum Sec 3, SpecJVM98 and SpecJBB05

    GC GC GC

    GC

    Exceptions

    Exceptions

    Array Bounds Check