SlideShare a Scribd company logo
1 of 31
Download to read offline
Eclipse OMR
JitBuilder
Current status and directions 2018
Mark Stoodley
An Eclipse OMR project lead and creator of JitBuilder
March 28, 2018
Agenda
• Quick introduction to the JitBuilder library
• 2018 focus areas
1. Enable JitBuilder as a multi-language native acceleration library
2. Integrate with coming-soon JIT as a Service work at Eclipse OpenJ9
3. Address some functional gaps
• Easy ways to get involved!
2
The JitBuilder Library
• JitBuilder is a native acceleration library
• Simplified API wrapping around the OMR compiler component
• Emphasis on ease of use
• Designed for use by programs to generate native code
• Easy for humans to understand, but not meant to be a programming language
• Created for writing Just In Time (JIT) compilers
• Can be used to accelerate just about anything
• JitBuilder is already very useful, but there is still lots more to do
• Currently best supports C++ clients
• Supports a wide variety of data types, arithmetic and control flow operations
3
JitBuilder features at-a-glance
• Data Types
• Primitives: Int8, Int16, Int32, Int64, Float, Double (with Vector equivalents, e.g. VectorDouble)
• Arrays and pointers, arbitrary structs of primitive values, including arrays and pointers
• Explicit type conversion via ConvertTo / UnsignedConvertTo
• Arithmetic
• Add, Sub, Mul, Div, And, Xor, (Unsigned)Shift(L,R), some ”WithOverflow” / ”WithUnsignedOverflow” variants
• Conditional
• EqualTo, NotEqualTo, LessThan, LessOrEqualTo, GreaterThan, GreaterOrEqualTo (with Unsigned variants)
• Memory
• Load, Store, StoreOver, IndexAt, LoadAt, StoreAt, LoadIndirect, StoreIndirect, VectorLoad/Store, VectorLoad/StoreAt
• CreateLocalStruct, CreateLocalArray to allocate stack memory at compile time
• Call to call any C function directly, ComputedCall for indirect calls (via function pointer or table)
• ThunkBuilder to assemble an array of arguments to call a C function by address
• Control flow
• IfThen, IfThenElse, Switch, ForLoopUp, ForLoopDown, DoWhile, WhileDo, variants with break, continue, etc.
• Return, Goto
• IfAnd and IfOr to easily build up short-circuit conditional expressions
• BytecodeBuilders: package up key operations (as “bytecodes”) and describe how to sequence them
• VirtualMachineState modelling: optimize accesses to e.g. operand stacks
• Can use local variables / hardware registers inside compiled function but synchronize VM state variable value when needed (e.g. On callout) 4
Projects using JitBuilder
1. Lua Vermelha (JIT for Lua 5.3 implementing “all but one” opcodes) ~3,000 lines of C++ code
• https://github.com/Leonardo2718/lua-vermelha
2. JIT for LPEG runtime used by Rosie Pattern Language (all opcodes used by Rosie) ~1,200 lines of C++ code
• https://github.com/mstoodle/rosie-lpeg
3. JIT for Swift (about 1/3 of SIL opcodes) ~2,000 lines of C++ code
• To be open sourced, some details here: http://www.ustream.tv/recorded/105013815
4. Smalltalk: SOM++ runtime ~2,500 lines of C++ code
• https://github.com/charliegracie/SOMpp/tree/jitbuilder_vmstate
5. Base9 JIT: Javascript-like tutorial language ~1,000 lines of C++ code
• https://github.com/b9org/b9
6. WebAssembly JIT: U of Calgary undergraduate project (144 of 177 opcodes!) ~2,000 lines of C++ code
• https://github.com/wasmjit-omr/wasmjit-omr
7. T4 JIT: experimental Javascript implementation ~2,700 lines of C++ code
• Written by John Duimovich, not yet open sourced
8. Kaleidoscope JIT: JitBuilder JIT implementation for LLVM tutorial language ~300 lines of C++ code
• Written by Mark Stoodley, some details here: http://www.ustream.tv/recorded/105013815
9. Java matrix multiply accelerator prototype with Vector math services 58 lines of Java code
• https://ibm.box.com/v/JavaJitBuilder-x86-64
5
What’s next for JitBuilder?
6
3 Focus Areas for JitBuilder in 2018
1. Enable JitBuilder as multi-language native acceleration library
2. Integrate with JIT as a Service work happening at Eclipse OpenJ9
3. Address functional gaps via OMR and new JitBuilder API
7
1. Multi-language native acceleration library
• JitBuilder is currently most easily used by C++ projects
• Mainly because Eclipse OMR compiler component is a C++ component
• Possible to hide behind a C interface, but bulk of code still needs to be C++
8
News Flash!
9
News Flash!
Not everyone likes
writing C++ code (!)
10
1. Multi-language native acceleration library
• JitBuilder is currently most easily used by C++ projects
• Mainly because Eclipse OMR compiler component is a C++ component
• Possible to hide behind a C interface, but bulk of code still needs to be C++
• 2018 goal: sustainably enable language bindings for JitBuilder API by:
1. Separate client JitBuilder API from “public” implementation API
2. Introduce a maintainable data format to describe JitBuilder API
3. Write binding generator to create multiple language “shim"s from API
description
11
Our ultimate goal is a world where:
C++ programmers can easily write a JIT for any language in C++
C programmers can easily write a JIT for any language in C
Java programmers can easily write a JIT for any language in Java
Ruby programmers can easily write a JIT for any language in Ruby
Python programmers can easily write a JIT for any language in Python
…and so on…
Leveraging a similar JitBuilder API and all backed by Eclipse OMR
So that improvements in JitBuilder and OMR can reach Everyone
12
13
Eclipse OMR
compiler
JitBuilder Implementation classes + JitBuilder API Description
C++
JitBuilder
API
C++
library
C++
program
Auto
generated
C++ JitBuilder Library
akin to what exists today
JitBuilder
like API
14
Eclipse OMR
compiler
JitBuilder Implementation classes + JitBuilder API Description
C++
JitBuilder
API
C
JitBuilder
API
C++
library
C
library
C++
program
C
program
Auto
generated
per language
JitBuilder library with
100% C interface
JitBuilder
like API
15
Eclipse OMR
compiler
JitBuilder Implementation classes + JitBuilder API Description
C++
JitBuilder
API
C
JitBuilder
API
Java
JitBuilder
API
C++
library
C
library
Java
library
C++
program
C
program
Java
program
(a JVM)
Auto
generated
per language
JitBuilder library with
100% Java interface
- Independent native code cache?
- Integrated code cache?
JitBuilder
like API
16
Eclipse OMR
compiler
JitBuilder Implementation classes + JitBuilder API Description
C++
JitBuilder
API
C
JitBuilder
API
Java
JitBuilder
API
Ruby
JitBuilder
API
C++
library
C
library
Java
library
Ruby
gem
C++
program
C
program
Java
program
(a JVM)
Ruby
program
(CRuby?)
Auto
generated
per language
JitBuilder library with
100% Ruby interface
Write any (even Ruby) JIT in
pure Ruby!
JitBuilder
like API
17
Eclipse OMR
compiler
JitBuilder Implementation classes + JitBuilder API Description
C++
JitBuilder
API
C
JitBuilder
API
Java
JitBuilder
API
Ruby
JitBuilder
API
Python
JitBuilder
API
C++
library
C
library
Java
library
Ruby
gem
Python
package
C++
program
C
program
Java
program
(a JVM)
Ruby
program
(CRuby?)
Python
program
(CPython?)
Auto
generated
per language
JitBuilder library with
100% Python interface
Write any (even Python) JIT in
pure Python
JitBuilder
like API
18
Eclipse OMR
compiler
JitBuilder Implementation classes + JitBuilder API Description
C++
JitBuilder
API
C
JitBuilder
API
Java
JitBuilder
API
Ruby
JitBuilder
API
Python
JitBuilder
API
??
JitBuilder
API
…
C++
library
C
library
Java
library
Ruby
gem
Python
package
??
“module”
C++
program
C
program
Java
program
(a JVM)
Ruby
program
(CRuby?)
Python
program
(CPython?)
??
program
(?? VM)
Auto
generated
per language
The Grand JitBuilder Vision!
JitBuilder
like API
Sadly, there will be some breakage L
• JitBuilder classes right now are, in fact, OMR compiler classes
• So: names are TR::IlBuilder, TR::MethodBuilder, TR::TypeDictionary, etc.
• Probably to become either JB::IlBuilder or JitBuilder::IlBuilder
• Preferences?
• JitBuilder services are currently capitalized (e.g. Add, Sub, IfThen, etc.)
• Capital identifies it as a “client” service versus implementation service
• No longer needed once client API classes are independent of implementation
• Should these names change? (add, sub, ifthen, etc.) ?
• Please join discussion in https://github.com/eclipse/omr/issues/2397
• Semantic versioning to be introduced: https://github.com/eclipse/omr/issues/1819
• What language do you want? https://github.com/eclipse/omr/issues/2401
19
API description example: IlBuilder class
Class( /* .doc = */ ”<Doxygen text describing IlBuilder class>",
/* .name = */ IlBuilder,
/* .shortName = */ "IB",
/* .flags = */ 0,
/* .super = */ NO_SUPER,
Fields(IlBuilder,
Field("NoType", T_IlType, IS_PUBLIC | ASSIGN_AT_CREATE)
Field("Int8", T_IlType, IS_PUBLIC | ASSIGN_AT_CREATE)
Field("Int16", T_IlType, IS_PUBLIC | ASSIGN_AT_CREATE)
Field("Int32", T_IlType, IS_PUBLIC | ASSIGN_AT_CREATE)
Field("Int64", T_IlType, IS_PUBLIC | ASSIGN_AT_CREATE)
Field("Float", T_IlType, IS_PUBLIC | ASSIGN_AT_CREATE)
Field("Double", T_IlType, IS_PUBLIC | ASSIGN_AT_CREATE)
Field("Address", T_IlType, IS_PUBLIC | ASSIGN_AT_CREATE)
Field("VectorInt8", T_IlType, IS_PUBLIC | ASSIGN_AT_CREATE)
Field("VectorInt16", T_IlType, IS_PUBLIC | ASSIGN_AT_CREATE)
Field("VectorInt32", T_IlType, IS_PUBLIC | ASSIGN_AT_CREATE)
Field("VectorInt64", T_IlType, IS_PUBLIC | ASSIGN_AT_CREATE)
Field("VectorFloat", T_IlType, IS_PUBLIC | ASSIGN_AT_CREATE)
Field("VectorDouble", T_IlType, IS_PUBLIC | ASSIGN_AT_CREATE)
Field("Word", T_IlType, IS_PUBLIC | ASSIGN_AT_CREATE)
Field("_impl", T_pointer, IS_PUBLIC )
)
…
20
Example API description for functions
Functions(IlBuilder,
…
Function(/* .doc = */ ”<Doxygen text describing Load>",
/* .name = */ Load,
/* .flags = */ IS_PUBLIC,
/* .overloadSuffix = */ "",
/* .returnType = */ T_IlValue,
/* .numParameters = */ 1,
/* .parms = */ Parms( Parm("name", T_string) ) )
Function(/* .doc = */ ”<Doxygen text describing LoadAt>",
/* .name = */ LoadAt,
/* .flags = */ IS_PUBLIC,
/* .overloadSuffix = */ "",
/* .returnType = */ T_IlValue,
/* .numParameters = */ 2,
/* .parms = */ Parms( Parm("type", T_IlType),
Parm("address", T_IlValue) )
)
…
)
) /// Class(…IlBuilder…) 21
Example (partial) language binding generator
void
CBinding::generateHeader(JBClass *clazz)
{
HeaderCFile header;
string ext(".h");
header.open(_dir, clazz->name, ext);
header.prolog(clazz->name);
header.includeFile("api/c/Common.h");
// typedefs so everyone knows about them
for ( auto it = _api.classesBegin(); it != _api.classesEnd(); ++it )
{
auto otherClass = *it;
header.typedefClass(otherClass);
}
if (clazz->hasSuper())
header.includeFile("api/c/" + clazz->super->name + ".h");
…
22
A few words about “sustainable”
• Why do this “generator” thing…sounds complicated?
• Goal: it should stay easy to add new services
• Enabling N language bindings should not always mean N times the work it is now
• With an API description, the typical work for new service should be:
• Implement the new service
• Add it to the API description, bump the version appropriately
• Re-run the generators for all existing language bindings
• Some services will require work in the binding generators too
• But we’ll try to avoid doing substantially weirder things without strong
justification
• Still that pesky “testing” challenge!
• But hopefully enablement will usually be an O(1) activity 23
2. Integrate with Jit as a Service work
• JIT as a Service == move JIT compiler out of process to a “service”
• Most of JIT compiler implementation not needed in runtime process
• Most of JIT compiler work can move to a different process, even another machine
• Much of JIT compiler footprint moves to a different process, even another machine
• Opportunity to share JIT compilation effort across multiple runtime instances
• Opportunity to identify optimization opportunities across multiple runtimes
• Some interesting service, test, and maintenance opportunities as well
• Not without challenges, of course J
• Higher latencies with added communication paths could mean slower ramp-up
• OMR compiler IL has no persistent form so IL generation can be very “chatty”
• But could be good match for low footprint runtimes that lack a JIT
24
Eclipse OpenJ9 is working on JITaaS now
• Community members at IBM Canada have a prototype implementation
• Working through some kinks
• Preparing to open source at Eclipse OpenJ9 and Eclipse OMR
• Goal: steer fundamental technology parts toward Eclipse OMR
• Establishing compiler service, communication paths, messaging mechanisms
• Rely on other open source projects where possible (e.g. gRPC, maybe flatbuffers)
• Enable more development in the open
• Open question: how can more runtimes take advantage of JIT as a Service?
25
JitBuilder to the rescue!
• OMR compiler IL (TRIL) has no fully implemented persistent form
• Very detailed and complex data structures (many of them extensible classes)
• Footprint and compile-time sensitive
• But JitBuilder API is less complicated and potentially easier to persist
• See: Provide record and replay capability for JitBuilder API at
https://github.com/eclipse/omr/issues/1818
• Define “JBIL” binary format:
• An enabler for JIT as a Service for all JitBuilder based clients
• Secondary benefit: enables OMR project testing to capture how JitBuilder
clients generate JBIL
26
Our ultimate goal is a world
where a JitBuilder client can:
Compile in-process with a statically linked compiler
Compile in-process with a dynamically linked compiler
Compile out-of-process with a remote service on same machine
Compile out-of-process with a remote service on another machine
Store JBIL and reload it to be compiled in- or out-of-process
…without modifying the client’s use of JitBuilder
27
3. Address Functional Gaps
• More work here than people I know of to resolve everything
• These items will probably get the earliest attention this year:
• Make JitBuilder work on all platforms
• https://github.com/eclipse/omr/issues/297
• https://github.com/eclipse/omr/issues/1952
• Implement an InlineCall() mechanism
• https://github.com/eclipse/omr/issues/2398
• Improve integration with OMR garbage collector component
• Define MethodMetaData: https://github.com/eclipse/omr/issues/2369
• Stack and register maps (also in https://github.com/eclipse/omr/issues/2369)
• Introduce a “managed heap pointer” IlType: https://github.com/eclipse/omr/issues/2399
• Improve code cache management: delete bodies and support recompilation
• https://github.com/eclipse/omr/issues/576
• https://github.com/eclipse/omr/issues/1187
28
Less likely to get attention soon (help wanted!)
• Profile data interface
• Expressing type relationships
• Nop-able guards and runtime assumptions
• Full On Stack Replacement interface
• Link to all open JitBuilder issues:
• https://github.com/eclipse/omr/issues?q=is%3Aissue+is%3Aopen+label%3Aji
tbuilder
29
Want to help?
• We want to grow our user base, so please let us know what you think!
• If you’re excited by what we’re doing, please let us know
• If we’re missing the mark for you, please let us know
• If you have suggestions or new ideas, please let us know
• Interested to pick up an item that’s not currently active?
• Please register your interest at https://github.com/eclipse/omr/issues/2400
• Write down your experience trying out JitBuilder and let us know how it went!
• Tell us what language you want to use JitBuilder from at
https://github.com/eclipse/omr/issues/2401
• Even just refer this project to someone you think would be interested!
• We’ll always welcome a new face/voice and look forward to growing the OMR community
30
Feedback?
• mstoodle@ca.ibm.com
• @mstoodle
• https://github.com/eclipse/omr
• 2018 JitBuilder top level issue:
• https://github.com/eclipse/omr/issues/2400
• Reach out at omr-dev mailing list:
• https://accounts.eclipse.org/mailing-list/omr-dev
31

More Related Content

What's hot

Micro servoces-choose-the-right-tools-programing-language
Micro servoces-choose-the-right-tools-programing-languageMicro servoces-choose-the-right-tools-programing-language
Micro servoces-choose-the-right-tools-programing-languageYouness Lasmak
 
AOT-compilation of JavaScript with V8
AOT-compilation of JavaScript with V8AOT-compilation of JavaScript with V8
AOT-compilation of JavaScript with V8Phil Eaton
 
Libnetwork updates
Libnetwork updatesLibnetwork updates
Libnetwork updatesMoby Project
 
Toward a gui remote-sensing environment built over OTB
Toward a gui remote-sensing environment built over OTBToward a gui remote-sensing environment built over OTB
Toward a gui remote-sensing environment built over OTBmelaneum
 
Mobile Development with Qt for Symbian
Mobile Development with Qt for SymbianMobile Development with Qt for Symbian
Mobile Development with Qt for Symbianaccount inactive
 
GraalVM - MadridJUG 2019-10-22
GraalVM - MadridJUG 2019-10-22GraalVM - MadridJUG 2019-10-22
GraalVM - MadridJUG 2019-10-22Jorge Hidalgo
 
Orthogonality: A Strategy for Reusable Code
Orthogonality: A Strategy for Reusable CodeOrthogonality: A Strategy for Reusable Code
Orthogonality: A Strategy for Reusable Codersebbe
 
CORBA Programming with TAOX11/C++11 tutorial
CORBA Programming with TAOX11/C++11 tutorialCORBA Programming with TAOX11/C++11 tutorial
CORBA Programming with TAOX11/C++11 tutorialRemedy IT
 
Comparing IDL to C++ with IDL to C++11
Comparing IDL to C++ with IDL to C++11Comparing IDL to C++ with IDL to C++11
Comparing IDL to C++ with IDL to C++11Remedy IT
 
Launchpad: Lessons Learnt
Launchpad: Lessons LearntLaunchpad: Lessons Learnt
Launchpad: Lessons LearntTim Penhey
 
Graal in GraalVM - A New JIT Compiler
Graal in GraalVM - A New JIT CompilerGraal in GraalVM - A New JIT Compiler
Graal in GraalVM - A New JIT CompilerKoichi Sakata
 
Rider - Taking ReSharper out of Process
Rider - Taking ReSharper out of ProcessRider - Taking ReSharper out of Process
Rider - Taking ReSharper out of Processcitizenmatt
 
MPI Sessions: a proposal to the MPI Forum
MPI Sessions: a proposal to the MPI ForumMPI Sessions: a proposal to the MPI Forum
MPI Sessions: a proposal to the MPI ForumJeff Squyres
 
Tech Days 2015: SPARK 2014
Tech Days 2015: SPARK 2014Tech Days 2015: SPARK 2014
Tech Days 2015: SPARK 2014AdaCore
 
'Full Stack Kotlin' Workshop at KotlinConf
'Full Stack Kotlin' Workshop at KotlinConf'Full Stack Kotlin' Workshop at KotlinConf
'Full Stack Kotlin' Workshop at KotlinConfGarth Gilmour
 

What's hot (20)

Micro servoces-choose-the-right-tools-programing-language
Micro servoces-choose-the-right-tools-programing-languageMicro servoces-choose-the-right-tools-programing-language
Micro servoces-choose-the-right-tools-programing-language
 
AOT-compilation of JavaScript with V8
AOT-compilation of JavaScript with V8AOT-compilation of JavaScript with V8
AOT-compilation of JavaScript with V8
 
Libnetwork updates
Libnetwork updatesLibnetwork updates
Libnetwork updates
 
Toward a gui remote-sensing environment built over OTB
Toward a gui remote-sensing environment built over OTBToward a gui remote-sensing environment built over OTB
Toward a gui remote-sensing environment built over OTB
 
Mobile Development with Qt for Symbian
Mobile Development with Qt for SymbianMobile Development with Qt for Symbian
Mobile Development with Qt for Symbian
 
FunScript: Why bother?
FunScript: Why bother?FunScript: Why bother?
FunScript: Why bother?
 
GCC, GNU compiler collection
GCC, GNU compiler collectionGCC, GNU compiler collection
GCC, GNU compiler collection
 
GraalVM - MadridJUG 2019-10-22
GraalVM - MadridJUG 2019-10-22GraalVM - MadridJUG 2019-10-22
GraalVM - MadridJUG 2019-10-22
 
Orthogonality: A Strategy for Reusable Code
Orthogonality: A Strategy for Reusable CodeOrthogonality: A Strategy for Reusable Code
Orthogonality: A Strategy for Reusable Code
 
CORBA Programming with TAOX11/C++11 tutorial
CORBA Programming with TAOX11/C++11 tutorialCORBA Programming with TAOX11/C++11 tutorial
CORBA Programming with TAOX11/C++11 tutorial
 
Comparing IDL to C++ with IDL to C++11
Comparing IDL to C++ with IDL to C++11Comparing IDL to C++ with IDL to C++11
Comparing IDL to C++ with IDL to C++11
 
Ruby Flavor in Swift (3min)
Ruby Flavor in Swift (3min)Ruby Flavor in Swift (3min)
Ruby Flavor in Swift (3min)
 
Launchpad: Lessons Learnt
Launchpad: Lessons LearntLaunchpad: Lessons Learnt
Launchpad: Lessons Learnt
 
Graal in GraalVM - A New JIT Compiler
Graal in GraalVM - A New JIT CompilerGraal in GraalVM - A New JIT Compiler
Graal in GraalVM - A New JIT Compiler
 
Rider - Taking ReSharper out of Process
Rider - Taking ReSharper out of ProcessRider - Taking ReSharper out of Process
Rider - Taking ReSharper out of Process
 
A soa approximation on symfony
A soa approximation on symfonyA soa approximation on symfony
A soa approximation on symfony
 
MPI Sessions: a proposal to the MPI Forum
MPI Sessions: a proposal to the MPI ForumMPI Sessions: a proposal to the MPI Forum
MPI Sessions: a proposal to the MPI Forum
 
Tech Days 2015: SPARK 2014
Tech Days 2015: SPARK 2014Tech Days 2015: SPARK 2014
Tech Days 2015: SPARK 2014
 
Hiphop - PHP
Hiphop - PHPHiphop - PHP
Hiphop - PHP
 
'Full Stack Kotlin' Workshop at KotlinConf
'Full Stack Kotlin' Workshop at KotlinConf'Full Stack Kotlin' Workshop at KotlinConf
'Full Stack Kotlin' Workshop at KotlinConf
 

Similar to Jit builder status and directions 2018 03-28

Oh the compilers you'll build
Oh the compilers you'll buildOh the compilers you'll build
Oh the compilers you'll buildMark Stoodley
 
FOSDEM 2017 - A different Lua JIT using Eclipse OMR
FOSDEM 2017 - A different Lua JIT using Eclipse OMRFOSDEM 2017 - A different Lua JIT using Eclipse OMR
FOSDEM 2017 - A different Lua JIT using Eclipse OMRCharlie Gracie
 
Comparing Next-Generation Container Image Building Tools
 Comparing Next-Generation Container Image Building Tools Comparing Next-Generation Container Image Building Tools
Comparing Next-Generation Container Image Building ToolsAkihiro Suda
 
Understand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java ApplicationsUnderstand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java ApplicationsC4Media
 
DevOps Days Boston 2017: Real-world Kubernetes for DevOps
DevOps Days Boston 2017: Real-world Kubernetes for DevOpsDevOps Days Boston 2017: Real-world Kubernetes for DevOps
DevOps Days Boston 2017: Real-world Kubernetes for DevOpsAmbassador Labs
 
.NET Core, ASP.NET Core Course, Session 3
.NET Core, ASP.NET Core Course, Session 3.NET Core, ASP.NET Core Course, Session 3
.NET Core, ASP.NET Core Course, Session 3aminmesbahi
 
Porting tometro
Porting tometroPorting tometro
Porting tometrodogra09
 
ASP.NET Session 1
ASP.NET Session 1ASP.NET Session 1
ASP.NET Session 1Sisir Ghosh
 
Kandroid for nhn_deview_20131013_v5_final
Kandroid for nhn_deview_20131013_v5_finalKandroid for nhn_deview_20131013_v5_final
Kandroid for nhn_deview_20131013_v5_finalNAVER D2
 
How to build a tool for operating Flink on Kubernetes
How to build a tool for operating Flink on KubernetesHow to build a tool for operating Flink on Kubernetes
How to build a tool for operating Flink on KubernetesAndreaMedeghini
 
Aws Deployment Tools - Overview, Details, Implementation
Aws Deployment Tools - Overview, Details, ImplementationAws Deployment Tools - Overview, Details, Implementation
Aws Deployment Tools - Overview, Details, Implementationserkancapkan
 
2.3 (Architecture) Moving to Managed Code
2.3   (Architecture) Moving to Managed Code2.3   (Architecture) Moving to Managed Code
2.3 (Architecture) Moving to Managed CodeMicro Focus
 
Why use Gitlab
Why use GitlabWhy use Gitlab
Why use Gitlababenyeung1
 
Why and How to Run Your Own Gitlab Runners as Your Company Grows
Why and How to Run Your Own Gitlab Runners as Your Company GrowsWhy and How to Run Your Own Gitlab Runners as Your Company Grows
Why and How to Run Your Own Gitlab Runners as Your Company GrowsNGINX, Inc.
 
Future of Kotlin - How agile can language development be?
Future of Kotlin - How agile can language development be?Future of Kotlin - How agile can language development be?
Future of Kotlin - How agile can language development be?Andrey Breslav
 

Similar to Jit builder status and directions 2018 03-28 (20)

Oh the compilers you'll build
Oh the compilers you'll buildOh the compilers you'll build
Oh the compilers you'll build
 
FOSDEM 2017 - A different Lua JIT using Eclipse OMR
FOSDEM 2017 - A different Lua JIT using Eclipse OMRFOSDEM 2017 - A different Lua JIT using Eclipse OMR
FOSDEM 2017 - A different Lua JIT using Eclipse OMR
 
Comparing Next-Generation Container Image Building Tools
 Comparing Next-Generation Container Image Building Tools Comparing Next-Generation Container Image Building Tools
Comparing Next-Generation Container Image Building Tools
 
Understand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java ApplicationsUnderstand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java Applications
 
DevOps Days Boston 2017: Real-world Kubernetes for DevOps
DevOps Days Boston 2017: Real-world Kubernetes for DevOpsDevOps Days Boston 2017: Real-world Kubernetes for DevOps
DevOps Days Boston 2017: Real-world Kubernetes for DevOps
 
.NET Core, ASP.NET Core Course, Session 3
.NET Core, ASP.NET Core Course, Session 3.NET Core, ASP.NET Core Course, Session 3
.NET Core, ASP.NET Core Course, Session 3
 
Porting tometro
Porting tometroPorting tometro
Porting tometro
 
ASP.NET Session 1
ASP.NET Session 1ASP.NET Session 1
ASP.NET Session 1
 
Kandroid for nhn_deview_20131013_v5_final
Kandroid for nhn_deview_20131013_v5_finalKandroid for nhn_deview_20131013_v5_final
Kandroid for nhn_deview_20131013_v5_final
 
How to build a tool for operating Flink on Kubernetes
How to build a tool for operating Flink on KubernetesHow to build a tool for operating Flink on Kubernetes
How to build a tool for operating Flink on Kubernetes
 
Mini-Training: TypeScript
Mini-Training: TypeScriptMini-Training: TypeScript
Mini-Training: TypeScript
 
Dalvik jit
Dalvik jitDalvik jit
Dalvik jit
 
Introduction to .net
Introduction to .netIntroduction to .net
Introduction to .net
 
Aws Deployment Tools - Overview, Details, Implementation
Aws Deployment Tools - Overview, Details, ImplementationAws Deployment Tools - Overview, Details, Implementation
Aws Deployment Tools - Overview, Details, Implementation
 
2.3 (Architecture) Moving to Managed Code
2.3   (Architecture) Moving to Managed Code2.3   (Architecture) Moving to Managed Code
2.3 (Architecture) Moving to Managed Code
 
Why use Gitlab
Why use GitlabWhy use Gitlab
Why use Gitlab
 
Why and How to Run Your Own Gitlab Runners as Your Company Grows
Why and How to Run Your Own Gitlab Runners as Your Company GrowsWhy and How to Run Your Own Gitlab Runners as Your Company Grows
Why and How to Run Your Own Gitlab Runners as Your Company Grows
 
Future of Kotlin - How agile can language development be?
Future of Kotlin - How agile can language development be?Future of Kotlin - How agile can language development be?
Future of Kotlin - How agile can language development be?
 
JIT Compiler
JIT CompilerJIT Compiler
JIT Compiler
 
Embedded _c_
Embedded  _c_Embedded  _c_
Embedded _c_
 

More from Mark Stoodley

Eliminating the Pauses in your Java Application
Eliminating the Pauses in your Java ApplicationEliminating the Pauses in your Java Application
Eliminating the Pauses in your Java ApplicationMark Stoodley
 
Turbo2018 workshop JIT as a Service
Turbo2018 workshop   JIT as a ServiceTurbo2018 workshop   JIT as a Service
Turbo2018 workshop JIT as a ServiceMark Stoodley
 
JavaOne 2017 - Mark Stoodley - Open Sourcing IBM J9 JVM
JavaOne 2017 - Mark Stoodley - Open Sourcing IBM J9 JVMJavaOne 2017 - Mark Stoodley - Open Sourcing IBM J9 JVM
JavaOne 2017 - Mark Stoodley - Open Sourcing IBM J9 JVMMark Stoodley
 
VMIL keynote : Lessons from a production JVM runtime developer
VMIL keynote : Lessons from a production JVM runtime developerVMIL keynote : Lessons from a production JVM runtime developer
VMIL keynote : Lessons from a production JVM runtime developerMark Stoodley
 
Under the Hood of the Testarossa JIT Compiler
Under the Hood of the Testarossa JIT CompilerUnder the Hood of the Testarossa JIT Compiler
Under the Hood of the Testarossa JIT CompilerMark Stoodley
 
Eclipse OMR: a modern toolkit for building language runtimes
Eclipse OMR: a modern toolkit for building language runtimesEclipse OMR: a modern toolkit for building language runtimes
Eclipse OMR: a modern toolkit for building language runtimesMark Stoodley
 

More from Mark Stoodley (6)

Eliminating the Pauses in your Java Application
Eliminating the Pauses in your Java ApplicationEliminating the Pauses in your Java Application
Eliminating the Pauses in your Java Application
 
Turbo2018 workshop JIT as a Service
Turbo2018 workshop   JIT as a ServiceTurbo2018 workshop   JIT as a Service
Turbo2018 workshop JIT as a Service
 
JavaOne 2017 - Mark Stoodley - Open Sourcing IBM J9 JVM
JavaOne 2017 - Mark Stoodley - Open Sourcing IBM J9 JVMJavaOne 2017 - Mark Stoodley - Open Sourcing IBM J9 JVM
JavaOne 2017 - Mark Stoodley - Open Sourcing IBM J9 JVM
 
VMIL keynote : Lessons from a production JVM runtime developer
VMIL keynote : Lessons from a production JVM runtime developerVMIL keynote : Lessons from a production JVM runtime developer
VMIL keynote : Lessons from a production JVM runtime developer
 
Under the Hood of the Testarossa JIT Compiler
Under the Hood of the Testarossa JIT CompilerUnder the Hood of the Testarossa JIT Compiler
Under the Hood of the Testarossa JIT Compiler
 
Eclipse OMR: a modern toolkit for building language runtimes
Eclipse OMR: a modern toolkit for building language runtimesEclipse OMR: a modern toolkit for building language runtimes
Eclipse OMR: a modern toolkit for building language runtimes
 

Recently uploaded

(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Intelisync
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 

Recently uploaded (20)

(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 

Jit builder status and directions 2018 03-28

  • 1. Eclipse OMR JitBuilder Current status and directions 2018 Mark Stoodley An Eclipse OMR project lead and creator of JitBuilder March 28, 2018
  • 2. Agenda • Quick introduction to the JitBuilder library • 2018 focus areas 1. Enable JitBuilder as a multi-language native acceleration library 2. Integrate with coming-soon JIT as a Service work at Eclipse OpenJ9 3. Address some functional gaps • Easy ways to get involved! 2
  • 3. The JitBuilder Library • JitBuilder is a native acceleration library • Simplified API wrapping around the OMR compiler component • Emphasis on ease of use • Designed for use by programs to generate native code • Easy for humans to understand, but not meant to be a programming language • Created for writing Just In Time (JIT) compilers • Can be used to accelerate just about anything • JitBuilder is already very useful, but there is still lots more to do • Currently best supports C++ clients • Supports a wide variety of data types, arithmetic and control flow operations 3
  • 4. JitBuilder features at-a-glance • Data Types • Primitives: Int8, Int16, Int32, Int64, Float, Double (with Vector equivalents, e.g. VectorDouble) • Arrays and pointers, arbitrary structs of primitive values, including arrays and pointers • Explicit type conversion via ConvertTo / UnsignedConvertTo • Arithmetic • Add, Sub, Mul, Div, And, Xor, (Unsigned)Shift(L,R), some ”WithOverflow” / ”WithUnsignedOverflow” variants • Conditional • EqualTo, NotEqualTo, LessThan, LessOrEqualTo, GreaterThan, GreaterOrEqualTo (with Unsigned variants) • Memory • Load, Store, StoreOver, IndexAt, LoadAt, StoreAt, LoadIndirect, StoreIndirect, VectorLoad/Store, VectorLoad/StoreAt • CreateLocalStruct, CreateLocalArray to allocate stack memory at compile time • Call to call any C function directly, ComputedCall for indirect calls (via function pointer or table) • ThunkBuilder to assemble an array of arguments to call a C function by address • Control flow • IfThen, IfThenElse, Switch, ForLoopUp, ForLoopDown, DoWhile, WhileDo, variants with break, continue, etc. • Return, Goto • IfAnd and IfOr to easily build up short-circuit conditional expressions • BytecodeBuilders: package up key operations (as “bytecodes”) and describe how to sequence them • VirtualMachineState modelling: optimize accesses to e.g. operand stacks • Can use local variables / hardware registers inside compiled function but synchronize VM state variable value when needed (e.g. On callout) 4
  • 5. Projects using JitBuilder 1. Lua Vermelha (JIT for Lua 5.3 implementing “all but one” opcodes) ~3,000 lines of C++ code • https://github.com/Leonardo2718/lua-vermelha 2. JIT for LPEG runtime used by Rosie Pattern Language (all opcodes used by Rosie) ~1,200 lines of C++ code • https://github.com/mstoodle/rosie-lpeg 3. JIT for Swift (about 1/3 of SIL opcodes) ~2,000 lines of C++ code • To be open sourced, some details here: http://www.ustream.tv/recorded/105013815 4. Smalltalk: SOM++ runtime ~2,500 lines of C++ code • https://github.com/charliegracie/SOMpp/tree/jitbuilder_vmstate 5. Base9 JIT: Javascript-like tutorial language ~1,000 lines of C++ code • https://github.com/b9org/b9 6. WebAssembly JIT: U of Calgary undergraduate project (144 of 177 opcodes!) ~2,000 lines of C++ code • https://github.com/wasmjit-omr/wasmjit-omr 7. T4 JIT: experimental Javascript implementation ~2,700 lines of C++ code • Written by John Duimovich, not yet open sourced 8. Kaleidoscope JIT: JitBuilder JIT implementation for LLVM tutorial language ~300 lines of C++ code • Written by Mark Stoodley, some details here: http://www.ustream.tv/recorded/105013815 9. Java matrix multiply accelerator prototype with Vector math services 58 lines of Java code • https://ibm.box.com/v/JavaJitBuilder-x86-64 5
  • 6. What’s next for JitBuilder? 6
  • 7. 3 Focus Areas for JitBuilder in 2018 1. Enable JitBuilder as multi-language native acceleration library 2. Integrate with JIT as a Service work happening at Eclipse OpenJ9 3. Address functional gaps via OMR and new JitBuilder API 7
  • 8. 1. Multi-language native acceleration library • JitBuilder is currently most easily used by C++ projects • Mainly because Eclipse OMR compiler component is a C++ component • Possible to hide behind a C interface, but bulk of code still needs to be C++ 8
  • 10. News Flash! Not everyone likes writing C++ code (!) 10
  • 11. 1. Multi-language native acceleration library • JitBuilder is currently most easily used by C++ projects • Mainly because Eclipse OMR compiler component is a C++ component • Possible to hide behind a C interface, but bulk of code still needs to be C++ • 2018 goal: sustainably enable language bindings for JitBuilder API by: 1. Separate client JitBuilder API from “public” implementation API 2. Introduce a maintainable data format to describe JitBuilder API 3. Write binding generator to create multiple language “shim"s from API description 11
  • 12. Our ultimate goal is a world where: C++ programmers can easily write a JIT for any language in C++ C programmers can easily write a JIT for any language in C Java programmers can easily write a JIT for any language in Java Ruby programmers can easily write a JIT for any language in Ruby Python programmers can easily write a JIT for any language in Python …and so on… Leveraging a similar JitBuilder API and all backed by Eclipse OMR So that improvements in JitBuilder and OMR can reach Everyone 12
  • 13. 13 Eclipse OMR compiler JitBuilder Implementation classes + JitBuilder API Description C++ JitBuilder API C++ library C++ program Auto generated C++ JitBuilder Library akin to what exists today JitBuilder like API
  • 14. 14 Eclipse OMR compiler JitBuilder Implementation classes + JitBuilder API Description C++ JitBuilder API C JitBuilder API C++ library C library C++ program C program Auto generated per language JitBuilder library with 100% C interface JitBuilder like API
  • 15. 15 Eclipse OMR compiler JitBuilder Implementation classes + JitBuilder API Description C++ JitBuilder API C JitBuilder API Java JitBuilder API C++ library C library Java library C++ program C program Java program (a JVM) Auto generated per language JitBuilder library with 100% Java interface - Independent native code cache? - Integrated code cache? JitBuilder like API
  • 16. 16 Eclipse OMR compiler JitBuilder Implementation classes + JitBuilder API Description C++ JitBuilder API C JitBuilder API Java JitBuilder API Ruby JitBuilder API C++ library C library Java library Ruby gem C++ program C program Java program (a JVM) Ruby program (CRuby?) Auto generated per language JitBuilder library with 100% Ruby interface Write any (even Ruby) JIT in pure Ruby! JitBuilder like API
  • 17. 17 Eclipse OMR compiler JitBuilder Implementation classes + JitBuilder API Description C++ JitBuilder API C JitBuilder API Java JitBuilder API Ruby JitBuilder API Python JitBuilder API C++ library C library Java library Ruby gem Python package C++ program C program Java program (a JVM) Ruby program (CRuby?) Python program (CPython?) Auto generated per language JitBuilder library with 100% Python interface Write any (even Python) JIT in pure Python JitBuilder like API
  • 18. 18 Eclipse OMR compiler JitBuilder Implementation classes + JitBuilder API Description C++ JitBuilder API C JitBuilder API Java JitBuilder API Ruby JitBuilder API Python JitBuilder API ?? JitBuilder API … C++ library C library Java library Ruby gem Python package ?? “module” C++ program C program Java program (a JVM) Ruby program (CRuby?) Python program (CPython?) ?? program (?? VM) Auto generated per language The Grand JitBuilder Vision! JitBuilder like API
  • 19. Sadly, there will be some breakage L • JitBuilder classes right now are, in fact, OMR compiler classes • So: names are TR::IlBuilder, TR::MethodBuilder, TR::TypeDictionary, etc. • Probably to become either JB::IlBuilder or JitBuilder::IlBuilder • Preferences? • JitBuilder services are currently capitalized (e.g. Add, Sub, IfThen, etc.) • Capital identifies it as a “client” service versus implementation service • No longer needed once client API classes are independent of implementation • Should these names change? (add, sub, ifthen, etc.) ? • Please join discussion in https://github.com/eclipse/omr/issues/2397 • Semantic versioning to be introduced: https://github.com/eclipse/omr/issues/1819 • What language do you want? https://github.com/eclipse/omr/issues/2401 19
  • 20. API description example: IlBuilder class Class( /* .doc = */ ”<Doxygen text describing IlBuilder class>", /* .name = */ IlBuilder, /* .shortName = */ "IB", /* .flags = */ 0, /* .super = */ NO_SUPER, Fields(IlBuilder, Field("NoType", T_IlType, IS_PUBLIC | ASSIGN_AT_CREATE) Field("Int8", T_IlType, IS_PUBLIC | ASSIGN_AT_CREATE) Field("Int16", T_IlType, IS_PUBLIC | ASSIGN_AT_CREATE) Field("Int32", T_IlType, IS_PUBLIC | ASSIGN_AT_CREATE) Field("Int64", T_IlType, IS_PUBLIC | ASSIGN_AT_CREATE) Field("Float", T_IlType, IS_PUBLIC | ASSIGN_AT_CREATE) Field("Double", T_IlType, IS_PUBLIC | ASSIGN_AT_CREATE) Field("Address", T_IlType, IS_PUBLIC | ASSIGN_AT_CREATE) Field("VectorInt8", T_IlType, IS_PUBLIC | ASSIGN_AT_CREATE) Field("VectorInt16", T_IlType, IS_PUBLIC | ASSIGN_AT_CREATE) Field("VectorInt32", T_IlType, IS_PUBLIC | ASSIGN_AT_CREATE) Field("VectorInt64", T_IlType, IS_PUBLIC | ASSIGN_AT_CREATE) Field("VectorFloat", T_IlType, IS_PUBLIC | ASSIGN_AT_CREATE) Field("VectorDouble", T_IlType, IS_PUBLIC | ASSIGN_AT_CREATE) Field("Word", T_IlType, IS_PUBLIC | ASSIGN_AT_CREATE) Field("_impl", T_pointer, IS_PUBLIC ) ) … 20
  • 21. Example API description for functions Functions(IlBuilder, … Function(/* .doc = */ ”<Doxygen text describing Load>", /* .name = */ Load, /* .flags = */ IS_PUBLIC, /* .overloadSuffix = */ "", /* .returnType = */ T_IlValue, /* .numParameters = */ 1, /* .parms = */ Parms( Parm("name", T_string) ) ) Function(/* .doc = */ ”<Doxygen text describing LoadAt>", /* .name = */ LoadAt, /* .flags = */ IS_PUBLIC, /* .overloadSuffix = */ "", /* .returnType = */ T_IlValue, /* .numParameters = */ 2, /* .parms = */ Parms( Parm("type", T_IlType), Parm("address", T_IlValue) ) ) … ) ) /// Class(…IlBuilder…) 21
  • 22. Example (partial) language binding generator void CBinding::generateHeader(JBClass *clazz) { HeaderCFile header; string ext(".h"); header.open(_dir, clazz->name, ext); header.prolog(clazz->name); header.includeFile("api/c/Common.h"); // typedefs so everyone knows about them for ( auto it = _api.classesBegin(); it != _api.classesEnd(); ++it ) { auto otherClass = *it; header.typedefClass(otherClass); } if (clazz->hasSuper()) header.includeFile("api/c/" + clazz->super->name + ".h"); … 22
  • 23. A few words about “sustainable” • Why do this “generator” thing…sounds complicated? • Goal: it should stay easy to add new services • Enabling N language bindings should not always mean N times the work it is now • With an API description, the typical work for new service should be: • Implement the new service • Add it to the API description, bump the version appropriately • Re-run the generators for all existing language bindings • Some services will require work in the binding generators too • But we’ll try to avoid doing substantially weirder things without strong justification • Still that pesky “testing” challenge! • But hopefully enablement will usually be an O(1) activity 23
  • 24. 2. Integrate with Jit as a Service work • JIT as a Service == move JIT compiler out of process to a “service” • Most of JIT compiler implementation not needed in runtime process • Most of JIT compiler work can move to a different process, even another machine • Much of JIT compiler footprint moves to a different process, even another machine • Opportunity to share JIT compilation effort across multiple runtime instances • Opportunity to identify optimization opportunities across multiple runtimes • Some interesting service, test, and maintenance opportunities as well • Not without challenges, of course J • Higher latencies with added communication paths could mean slower ramp-up • OMR compiler IL has no persistent form so IL generation can be very “chatty” • But could be good match for low footprint runtimes that lack a JIT 24
  • 25. Eclipse OpenJ9 is working on JITaaS now • Community members at IBM Canada have a prototype implementation • Working through some kinks • Preparing to open source at Eclipse OpenJ9 and Eclipse OMR • Goal: steer fundamental technology parts toward Eclipse OMR • Establishing compiler service, communication paths, messaging mechanisms • Rely on other open source projects where possible (e.g. gRPC, maybe flatbuffers) • Enable more development in the open • Open question: how can more runtimes take advantage of JIT as a Service? 25
  • 26. JitBuilder to the rescue! • OMR compiler IL (TRIL) has no fully implemented persistent form • Very detailed and complex data structures (many of them extensible classes) • Footprint and compile-time sensitive • But JitBuilder API is less complicated and potentially easier to persist • See: Provide record and replay capability for JitBuilder API at https://github.com/eclipse/omr/issues/1818 • Define “JBIL” binary format: • An enabler for JIT as a Service for all JitBuilder based clients • Secondary benefit: enables OMR project testing to capture how JitBuilder clients generate JBIL 26
  • 27. Our ultimate goal is a world where a JitBuilder client can: Compile in-process with a statically linked compiler Compile in-process with a dynamically linked compiler Compile out-of-process with a remote service on same machine Compile out-of-process with a remote service on another machine Store JBIL and reload it to be compiled in- or out-of-process …without modifying the client’s use of JitBuilder 27
  • 28. 3. Address Functional Gaps • More work here than people I know of to resolve everything • These items will probably get the earliest attention this year: • Make JitBuilder work on all platforms • https://github.com/eclipse/omr/issues/297 • https://github.com/eclipse/omr/issues/1952 • Implement an InlineCall() mechanism • https://github.com/eclipse/omr/issues/2398 • Improve integration with OMR garbage collector component • Define MethodMetaData: https://github.com/eclipse/omr/issues/2369 • Stack and register maps (also in https://github.com/eclipse/omr/issues/2369) • Introduce a “managed heap pointer” IlType: https://github.com/eclipse/omr/issues/2399 • Improve code cache management: delete bodies and support recompilation • https://github.com/eclipse/omr/issues/576 • https://github.com/eclipse/omr/issues/1187 28
  • 29. Less likely to get attention soon (help wanted!) • Profile data interface • Expressing type relationships • Nop-able guards and runtime assumptions • Full On Stack Replacement interface • Link to all open JitBuilder issues: • https://github.com/eclipse/omr/issues?q=is%3Aissue+is%3Aopen+label%3Aji tbuilder 29
  • 30. Want to help? • We want to grow our user base, so please let us know what you think! • If you’re excited by what we’re doing, please let us know • If we’re missing the mark for you, please let us know • If you have suggestions or new ideas, please let us know • Interested to pick up an item that’s not currently active? • Please register your interest at https://github.com/eclipse/omr/issues/2400 • Write down your experience trying out JitBuilder and let us know how it went! • Tell us what language you want to use JitBuilder from at https://github.com/eclipse/omr/issues/2401 • Even just refer this project to someone you think would be interested! • We’ll always welcome a new face/voice and look forward to growing the OMR community 30
  • 31. Feedback? • mstoodle@ca.ibm.com • @mstoodle • https://github.com/eclipse/omr • 2018 JitBuilder top level issue: • https://github.com/eclipse/omr/issues/2400 • Reach out at omr-dev mailing list: • https://accounts.eclipse.org/mailing-list/omr-dev 31