#DevoxxUS #EclipseOMR @EclipseOMR
Eclipse OMR: A Modern, Open-
Source Toolkit For Building
Language Runtimes
Daryl Maier
IBM Runtimes
maier@ca.ibm.com
#DevoxxUS #EclipseOMR @EclipseOMR 2
About me
• Senior software developer at IBM Canada
• Developing advanced compiler technology for HPC
and dynamic languages for 20+ years
• Recently led a team to open-source IBM’s Testarossa
compiler technology that underpins the J9 Java VM
and many static languages
• Currently working on contributing even more
compiler technology into Eclipse OMR and
integrating into existing language runtimes
#DevoxxUS #EclipseOMR @EclipseOMR 3
Important Disclaimers
• THE INFORMATION CONTAINED IN THIS PRESENTATION IS PROVIDED FOR INFORMATIONAL PURPOSES ONLY.
• WHILST EFFORTS WERE MADE TO VERIFY THE COMPLETENESS AND ACCURACY OF THE INFORMATION
CONTAINED IN THIS PRESENTATION, IT IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED.
• ALL PERFORMANCE DATA INCLUDED IN THIS PRESENTATION HAVE BEEN GATHERED IN A CONTROLLED
ENVIRONMENT. YOUR OWN TEST RESULTS MAY VARY BASED ON HARDWARE, SOFTWARE OR
INFRASTRUCTURE DIFFERENCES.
• ALL DATA INCLUDED IN THIS PRESENTATION ARE MEANT TO BE USED ONLY AS A GUIDE.
• IN ADDITION, THE INFORMATION CONTAINED IN THIS PRESENTATION IS BASED ON IBM’S CURRENT
PRODUCT PLANS AND STRATEGY, WHICH ARE SUBJECT TO CHANGE BY IBM, WITHOUT NOTICE.
• IBM AND ITS AFFILIATED COMPANIES SHALL NOT BE RESPONSIBLE FOR ANY DAMAGES ARISING OUT
OF THE USE OF, OR OTHERWISE RELATED TO, THIS PRESENTATION OR ANY OTHER DOCUMENTATION.
• NOTHING CONTAINED IN THIS PRESENTATION IS INTENDED TO, OR SHALL HAVE THE EFFECT OF:
• CREATING ANY WARRANT OR REPRESENTATION FROM IBM, ITS AFFILIATED COMPANIES OR ITS
OR THEIR SUPPLIERS AND/OR LICENSORS
#DevoxxUS #EclipseOMR @EclipseOMR 4
This session…
• Introduction to Eclipse OMR
• Eclipse OMR unboxing
• Projects in the wild
• Where are we going?
• How you can get involved!
#DevoxxUS #EclipseOMR @EclipseOMR
http://www.eclipse.org/omr
https://github.com/eclipse/omr
https://developer.ibm.com/open/omr/
Dual License:
Eclipse Public License V1.0
Apache 2.0
Contributors are very welcome
https://github.com/eclipse/omr/blob/master/CONTRIBUTING.md
Eclipse OMR
Created March 2016
#DevoxxUS #EclipseOMR @EclipseOMR 6
And before anyone asks…
What does OMR stand for?
#DevoxxUS #EclipseOMR @EclipseOMR 7
And before anyone asks…
• Technically, nothing: it’s not an acronym
• Historically, it stood for “Open Managed Runtime”, but the Eclipse
OMR project is not a managed runtime
• The three letters persisted, however…
What does OMR stand for?
#DevoxxUS #EclipseOMR @EclipseOMR 8
And before anyone asks…
Does it have anything to do with the Eclipse IDE?
#DevoxxUS #EclipseOMR @EclipseOMR 9
And before anyone asks…
Nope--it is simply a project at the Eclipse Foundation and is not
associated with the Eclipse IDE.
Does it have anything to do with the Eclipse IDE?
#DevoxxUS #EclipseOMR @EclipseOMR 10
What’s in a Language Runtime?
#DevoxxUS #EclipseOMR @EclipseOMR 11
Java Execution Environment
What’s in a Language Runtime for Java?
Java
Platform Abstraction Layer
Java
Garbage
Collector
Java
Diagnostic and
Monitoring Services
Source Code Bytecode/AST
Compiler
Java
Just-In-Time
Compiler
Interpreter
Java
Source
Java
Bytecode
Compiler
Java
Bytecode
Interpreter
#DevoxxUS #EclipseOMR @EclipseOMR 12
Ruby Execution Environment
What’s in a Language Runtime for Ruby?
Ruby
Platform Abstraction Layer
Ruby
Garbage
Collector
Ruby
Diagnostic and
Monitoring Services
Source Code Bytecode/AST
Compiler
Just-In-Time
Compiler
Interpreter
Ruby
Source
Ruby
Bytecode
Compiler
Ruby
Bytecode
Interpreter
#DevoxxUS #EclipseOMR @EclipseOMR 13
Javascript Execution Environment
What’s in a Language Runtime for Javascript ?
Javascript
Platform Abstraction Layer
Javascript
Garbage
Collector
Javascript
Diagnostic and
Monitoring Services
Source Code Bytecode/AST
Compiler
Just-In-Time
Compiler
Interpreter
Javascript
Source
Javascript
Bytecode
Compiler
Javascript
Bytecode
Interpreter
Javascript
Just-In-Time
Compiler
#DevoxxUS #EclipseOMR @EclipseOMR 14
Similar components, but completely different implementations
Investment in one runtime has close to zero carry over to other runtimes
Matters more as more workloads move into the cloud
#DevoxxUS #EclipseOMR @EclipseOMR 15
Cloud platforms really depend on runtimes
• Cloud platforms should be:
• Resilient
• Secure
• Efficient
• Elastic
• Consistent
• Can only build on runtime support!
• Different runtime technology means
advancing cloud platforms is
expensive, slow, and depends on
many different communities
#DevoxxUS #EclipseOMR @EclipseOMR 16
Eclipse OMR mission
Build an open reusable language runtime foundation for the cloud
• To accelerate cloud platform advancement and innovation
• In full cooperation with existing language communities
• Via a diverse community of people interested in language runtimes
• Professional developers
• Researchers
• Students
• Hobbyists
#DevoxxUS #EclipseOMR @EclipseOMR 17
Java Execution Environment
Start from the enterprise caliber IBM J9 Java runtime
J9 Java
Platform Abstraction Layer
J9 Java
Garbage
Collector
J9 Java
Diagnostic and
Monitoring Services
Source Code Bytecode/AST
Compiler
J9 Java
Just-In-Time Compiler
Interpreter
Java
Source
J9 Java
Bytecode
Compiler
J9 Java
Bytecode
Interpreter
#DevoxxUS #EclipseOMR @EclipseOMR 18
J9Java
JIT Compiler Glue
J9 Java Execution Environment
Refactor “Java”-ness into a Glue layer that adds language specifics to each core component
OMR
Platform Abstraction Layer
OMR
Garbage
Collector
OMR
Diagnostic and
Monitoring Services
Source Code Bytecode/AST
Compiler
Interpreter
Java
Source
J9 Java
Bytecode
Compiler
J9 Java
Bytecode
Interpreter
J9 Java Diagnostic and
Monitoring Glue
J9
Java
GC
Glue
OMR
Just in Time
(JIT)
Compiler
#DevoxxUS #EclipseOMR @EclipseOMR 19
Form Eclipse OMR around core components
OMR
Platform Abstraction Layer
OMR
Garbage
Collector
OMR
Diagnostic and
Monitoring Services
OMR
Just in Time
(JIT)
Compiler
#DevoxxUS #EclipseOMR @EclipseOMR 20
Goals of Eclipse OMR
1. OMR has no language semantics
2. OMR is not a language runtime
3. OMR components can be integrated into any language runtime,
new or existing, without influencing language semantics
#DevoxxUS #EclipseOMR @EclipseOMR 21
#DevoxxUS #EclipseOMR @EclipseOMR 22
port platform abstraction (porting) library
thread cross platform pthread-like threading library
vm APIs to manage per-interpreter and per-thread contexts
gc garbage collection framework for managed heaps
compiler extensible compiler framework
jitbuilder project to simplify bring up for a new JIT compiler
omrtrace library for publishing trace events for monitoring/diagnostics
omrsigcompat signal handling compatibility library
example demonstration code to show how a runtime might consume OMR components; and testing
fvtest language independent test framework built on the example glue so that components can
be tested outside of a language runtime, uses Google Test 1.7 framework
+ a few others
~800KLOC to date, more runtime technology coming!
Eclipse OMR unboxing
#DevoxxUS #EclipseOMR @EclipseOMR 23
Garbage collection technology
• Highly parallel, scalable garbage collector
• Exploits multiple cores
• Balances work for multiple threads
• Rock solid automatic memory management for language runtimes
• Used for over a decade in the IBM J9 enterprise caliber Java Virtual Machine
• Start by integrating Mark/Sweep GC
• Typically <100 lines of code
• Then, add even more advanced capabilities as needed
• Compaction
• Generational
• Concurrent
#DevoxxUS #EclipseOMR @EclipseOMR 24
What is Mark-Sweep GC?
• Periodically, garbage collector stops all active application threads
• Phase 1: Mark live objects by walking the live object graph
• Traversal begins from objects kept in a “root” set (e.g. global variables, local
variables in every active frame on every thread stack, etc.)
• Each unmarked object is marked as live, then visit any objects it points at
• Phase 2: Sweep through memory to find memory not used by live
objects
• Unused memory regions added to free list(s)
• Once all memory has been swept, application threads restarted
• Memory allocations can then take advantage of space added to free lists
#DevoxxUS #EclipseOMR @EclipseOMR 25
Hooking up the OMR Mark/Sweep Collector
1. Call OMR_Initialize_VM() at startup
2. Implement GC glue layer calls:
• getSizeInBytesWithHeader()
• CollectorLanguageInterfaceImpl::markingScheme_scanRoots()
• MM_CollectorLanguageInterfaceImpl::markingScheme_scanObject()
3. Use OMR_GC_Allocate() function to allocate objects
4. Use OMR_GC_SystemCollect() function to trigger GC cycles
5. Configure heap size at runtime
• e.g. OMR_GC_OPTIONS=“-Xmx2m”
6. Call OMR_Shutdown_VM() at shutdown
#DevoxxUS #EclipseOMR @EclipseOMR 26
Compiler technology
• Heritage is a dynamic JIT for embedded Java
• Proven its flexibility by underpinning static compilers and binary retranslators
• Clean room implementation
• Mix of C++, C, native assembler
• Design goals
• Fast startup time
• Miserly memory management
• Flexible to meet different footprint configurations
#DevoxxUS #EclipseOMR @EclipseOMR 27
Compiler technology
• Configurable high-level optimization framework
• Classic, loop, dataflow, control flow
• High performance code generation with deep platform exploitation
• X86, Power, System Z, ARMv7
• Dynamic recompilation with profile-directed feedback
• Speculative optimizations and supporting runtime framework
#DevoxxUS #EclipseOMR @EclipseOMR 28
ARM
Optimizer
Analyses and Optimizations
cold warm hot FSDscorching AOT
IL Generation
x86
POWER
Z
Code Generators
Runtime
Environment/
Configuration
•Options
•Object Model
•Memory
•Threading
•Tracing
codeMetadataRuntimeRT Helpers
very hot profiling
JITBuilder
Profile
Manager
Hardware
counters
Sampling
Thread
Interpreter
Profile Info
JIT
Profile Info
Profiler
#DevoxxUS #EclipseOMR @EclipseOMR 29
Hooking up a compiler via a native IL generator
• Produce OMR IL directly from interpreted method “bytecodes”
• Deepest exploitation with the Eclipse OMR compiler technology
 Maximize performance and functionality
 Permits greatest specialization for a host runtime
 Steeper learning curve, esp. OMR compiler intermediate language
 You assume ownership of complexity
#DevoxxUS #EclipseOMR @EclipseOMR 30
Hooking up a compiler via JITBuilder
• Prototype interface to compiler technology
• Designed to simplify work to bootstrap a JIT compiler to generate native
instructions for interpreted methods
• https://developer.ibm.com/open/2016/07/19/jitbuilder-library-and-eclipse-
omr-just-in-time-compilers-made-easy
• https://developer.ibm.com/open/2017/03/08/build-more-complicated-
methods-using-the-jitbuilder-library
 Simple API to describe method prototypes and behaviours, types,
bytecode interpretation, and compile and dispatch functionality
 Sacrifice some performance and specialization for rapid integration of
compiler technology
 Technology is a WIP, but continually improving
#DevoxxUS #EclipseOMR @EclipseOMR 31
In the wild: IBM SDKs for Java
• IBM’s production Java Virtual Machine
• High performance, scalable, high reliability, serviceable
• Independent implementation
• Origin of much of Eclipse OMR technology
• IBM SDK for Java 8 delivered in 2014
• Consumes, extends, and customizes Eclipse OMR for Java
• Demonstrates versatility and adaptability of the technology
• Important quality and performance proof points
#DevoxxUS #EclipseOMR @EclipseOMR 32
OpenJ9
• IBM to open source the J9 Java Virtual Machine in 2017
• Preparations to open source proceeding in parallel with IBM SDK for
Java 9 development
• Why open-source?
• Facilitate collaboration and enable rapid innovation
• Competition drives innovation
• Cross-platform, cross-technology innovation
#DevoxxUS #EclipseOMR @EclipseOMR 33
OpenJ9 open source project
• Most robust extension of Eclipse OMR technology
• Port Layer, Garbage collection, Compiler, Tooling, …
• Upstream repo for Java VM projects
• Open community governance
• Status: not public yet, likely around IBM Java 9 release
• http://openj9.org
#DevoxxUS #EclipseOMR @EclipseOMR 34
Ruby
• Integration of Eclipse OMR technology into CRuby VM
• GC + compiler technology -> CRuby 2.2
• Compiler technology -> CRuby 2.4
• POCs show potential, can successfully run Rails
• Goal is for Eclipse OMR to help achieve Ruby 3x3 target
• Requires better VM / JIT / GC communication of state-changing events
• Profiling, type specialization, inlining optimizations required
• Repo: https://github.com/rubyomr-preview/ruby.git
Help Wanted!
#DevoxxUS #EclipseOMR @EclipseOMR 35
Lua
• Experimental Eclipse OMR compiler integration as proof point for
technology and driving JitBuilder innovation
• Status
• Produce compiler IL for all 47 Lua instructions
• 50 LOC changes needed to integrate with PUC-Rio Lua 5.3
• ~2000 LOC Lua compiler + Eclipse OMR
• Performance: 2x performance over interpreted w/ Mandelbrot
• Repo: https://github.com/Leonardo2718/lua-vermelha
• https://fosdem.org/2017/schedule/event/eclipse_omr
Help Wanted!
#DevoxxUS #EclipseOMR @EclipseOMR 36
SOM
• Minimal Smalltalk implementation for teaching and experimentation
with virtual machines
• CSOM : proof point of simple integration of GC technology (approx
20% full benchmark speed up)
• SOM++ : proof point of simple integration with JitBuilder technology
(1 week of work yielded benchmark speedups of 2x-15x)
#DevoxxUS #EclipseOMR @EclipseOMR 37
Base9 (B9)
• Educational VM for demonstrating integration of Eclipse OMR
technology into a typical interpreted language VM
• Small bytecode set (initially!)
• Stack-based interpreter
• Primitive types
• Integration with Eclipse OMR
• JitBuilder : straightforward integration can yield 760x perf improvement over
interpreter on Fibonacci test (compilation, inlining)
• Repo: https://github.com/youngar/Base9
#DevoxxUS #EclipseOMR @EclipseOMR 38
What’s next?
• IBM actively contributing to the technology
• Pulling commits hourly into development version of J9 Java 9
• Improve onboarding experience
• Documentation, designs, sample code, how-to blogs
• Create a Discourse instance for community project discussion
• Improve testability
• Community building
• Grow the base of the Eclipse OMR project
• Work with language runtime communities to foster broader adoption and drive
improvements into the technology
• Engage with research communities
• Research projects in runtime/compiler technologies based on Eclipse OMR
• Eclipse OMR as an undergrad/graduate teaching platform for runtime technologies
#DevoxxUS #EclipseOMR @EclipseOMR 39
Getting involved
• GitHub repo contributions
• Require an account at Eclipse.org and you must sign the Eclipse ECA
• https://projects.eclipse.org/user/sign/cla
• Contribution guidelines
• https://github.com/eclipse/omr/blob/master/CONTRIBUTING.md
• Google Summer of Code
• Eclipse Foundation is a mentoring organization
• Project suggestions for prospective students: http://bit.ly/2mDGnwS
#DevoxxUS #EclipseOMR @EclipseOMR 40
More Eclipse OMR in action
Join Bjørn Vårdal’s Tools-In-Action session:
Secrets of building a debuggable runtime: Learn how
language implementors solve your runtime issues
Grand Ballroom 220A
Thursday, March 23 @ 3:30-4:00 pm
#DevoxxUS #EclipseOMR @EclipseOMR 41
http://www.eclipse.org/omr
https://github.com/eclipse/omr
https://developer.ibm.com/open/omr/
Users and contributors very welcome!
https://github.com/eclipse/omr/blob/master/CONTRIBUTING.md
Eclipse OMR
Mark Stoodley
Eclipse OMR Project Co-Lead
mstoodle@ca.ibm.com
Daryl Maier
IBM OMR Compiler Lead
maier@ca.ibm.com
Charlie Gracie
Eclipse OMR Project Co-Lead
cgracie@ca.ibm.com
Follow us @EclipseOMR
© 2017 IBM Corporation
Mission Badge #6:
SMS Text
Your mission should you
choose to accept it….
Join us at the IBM Booth for
hands-on labs, demos, games
and talk to our developers.
Text Innovation to 41411
to get one step closer to the
booth giveaway and learn
more about all the IBM
sessions & speakers.
Enter the raffle by
completing missions
for a chance to win
• a Drone
• TJBot Kit
• VR glasses
#DevoxxUS #EclipseOMR @EclipseOMR 43
Questions?

Eclipse OMR: a modern, open-source toolkit for building language runtimes

  • 1.
    #DevoxxUS #EclipseOMR @EclipseOMR EclipseOMR: A Modern, Open- Source Toolkit For Building Language Runtimes Daryl Maier IBM Runtimes maier@ca.ibm.com
  • 2.
    #DevoxxUS #EclipseOMR @EclipseOMR2 About me • Senior software developer at IBM Canada • Developing advanced compiler technology for HPC and dynamic languages for 20+ years • Recently led a team to open-source IBM’s Testarossa compiler technology that underpins the J9 Java VM and many static languages • Currently working on contributing even more compiler technology into Eclipse OMR and integrating into existing language runtimes
  • 3.
    #DevoxxUS #EclipseOMR @EclipseOMR3 Important Disclaimers • THE INFORMATION CONTAINED IN THIS PRESENTATION IS PROVIDED FOR INFORMATIONAL PURPOSES ONLY. • WHILST EFFORTS WERE MADE TO VERIFY THE COMPLETENESS AND ACCURACY OF THE INFORMATION CONTAINED IN THIS PRESENTATION, IT IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. • ALL PERFORMANCE DATA INCLUDED IN THIS PRESENTATION HAVE BEEN GATHERED IN A CONTROLLED ENVIRONMENT. YOUR OWN TEST RESULTS MAY VARY BASED ON HARDWARE, SOFTWARE OR INFRASTRUCTURE DIFFERENCES. • ALL DATA INCLUDED IN THIS PRESENTATION ARE MEANT TO BE USED ONLY AS A GUIDE. • IN ADDITION, THE INFORMATION CONTAINED IN THIS PRESENTATION IS BASED ON IBM’S CURRENT PRODUCT PLANS AND STRATEGY, WHICH ARE SUBJECT TO CHANGE BY IBM, WITHOUT NOTICE. • IBM AND ITS AFFILIATED COMPANIES SHALL NOT BE RESPONSIBLE FOR ANY DAMAGES ARISING OUT OF THE USE OF, OR OTHERWISE RELATED TO, THIS PRESENTATION OR ANY OTHER DOCUMENTATION. • NOTHING CONTAINED IN THIS PRESENTATION IS INTENDED TO, OR SHALL HAVE THE EFFECT OF: • CREATING ANY WARRANT OR REPRESENTATION FROM IBM, ITS AFFILIATED COMPANIES OR ITS OR THEIR SUPPLIERS AND/OR LICENSORS
  • 4.
    #DevoxxUS #EclipseOMR @EclipseOMR4 This session… • Introduction to Eclipse OMR • Eclipse OMR unboxing • Projects in the wild • Where are we going? • How you can get involved!
  • 5.
    #DevoxxUS #EclipseOMR @EclipseOMR http://www.eclipse.org/omr https://github.com/eclipse/omr https://developer.ibm.com/open/omr/ DualLicense: Eclipse Public License V1.0 Apache 2.0 Contributors are very welcome https://github.com/eclipse/omr/blob/master/CONTRIBUTING.md Eclipse OMR Created March 2016
  • 6.
    #DevoxxUS #EclipseOMR @EclipseOMR6 And before anyone asks… What does OMR stand for?
  • 7.
    #DevoxxUS #EclipseOMR @EclipseOMR7 And before anyone asks… • Technically, nothing: it’s not an acronym • Historically, it stood for “Open Managed Runtime”, but the Eclipse OMR project is not a managed runtime • The three letters persisted, however… What does OMR stand for?
  • 8.
    #DevoxxUS #EclipseOMR @EclipseOMR8 And before anyone asks… Does it have anything to do with the Eclipse IDE?
  • 9.
    #DevoxxUS #EclipseOMR @EclipseOMR9 And before anyone asks… Nope--it is simply a project at the Eclipse Foundation and is not associated with the Eclipse IDE. Does it have anything to do with the Eclipse IDE?
  • 10.
    #DevoxxUS #EclipseOMR @EclipseOMR10 What’s in a Language Runtime?
  • 11.
    #DevoxxUS #EclipseOMR @EclipseOMR11 Java Execution Environment What’s in a Language Runtime for Java? Java Platform Abstraction Layer Java Garbage Collector Java Diagnostic and Monitoring Services Source Code Bytecode/AST Compiler Java Just-In-Time Compiler Interpreter Java Source Java Bytecode Compiler Java Bytecode Interpreter
  • 12.
    #DevoxxUS #EclipseOMR @EclipseOMR12 Ruby Execution Environment What’s in a Language Runtime for Ruby? Ruby Platform Abstraction Layer Ruby Garbage Collector Ruby Diagnostic and Monitoring Services Source Code Bytecode/AST Compiler Just-In-Time Compiler Interpreter Ruby Source Ruby Bytecode Compiler Ruby Bytecode Interpreter
  • 13.
    #DevoxxUS #EclipseOMR @EclipseOMR13 Javascript Execution Environment What’s in a Language Runtime for Javascript ? Javascript Platform Abstraction Layer Javascript Garbage Collector Javascript Diagnostic and Monitoring Services Source Code Bytecode/AST Compiler Just-In-Time Compiler Interpreter Javascript Source Javascript Bytecode Compiler Javascript Bytecode Interpreter Javascript Just-In-Time Compiler
  • 14.
    #DevoxxUS #EclipseOMR @EclipseOMR14 Similar components, but completely different implementations Investment in one runtime has close to zero carry over to other runtimes Matters more as more workloads move into the cloud
  • 15.
    #DevoxxUS #EclipseOMR @EclipseOMR15 Cloud platforms really depend on runtimes • Cloud platforms should be: • Resilient • Secure • Efficient • Elastic • Consistent • Can only build on runtime support! • Different runtime technology means advancing cloud platforms is expensive, slow, and depends on many different communities
  • 16.
    #DevoxxUS #EclipseOMR @EclipseOMR16 Eclipse OMR mission Build an open reusable language runtime foundation for the cloud • To accelerate cloud platform advancement and innovation • In full cooperation with existing language communities • Via a diverse community of people interested in language runtimes • Professional developers • Researchers • Students • Hobbyists
  • 17.
    #DevoxxUS #EclipseOMR @EclipseOMR17 Java Execution Environment Start from the enterprise caliber IBM J9 Java runtime J9 Java Platform Abstraction Layer J9 Java Garbage Collector J9 Java Diagnostic and Monitoring Services Source Code Bytecode/AST Compiler J9 Java Just-In-Time Compiler Interpreter Java Source J9 Java Bytecode Compiler J9 Java Bytecode Interpreter
  • 18.
    #DevoxxUS #EclipseOMR @EclipseOMR18 J9Java JIT Compiler Glue J9 Java Execution Environment Refactor “Java”-ness into a Glue layer that adds language specifics to each core component OMR Platform Abstraction Layer OMR Garbage Collector OMR Diagnostic and Monitoring Services Source Code Bytecode/AST Compiler Interpreter Java Source J9 Java Bytecode Compiler J9 Java Bytecode Interpreter J9 Java Diagnostic and Monitoring Glue J9 Java GC Glue OMR Just in Time (JIT) Compiler
  • 19.
    #DevoxxUS #EclipseOMR @EclipseOMR19 Form Eclipse OMR around core components OMR Platform Abstraction Layer OMR Garbage Collector OMR Diagnostic and Monitoring Services OMR Just in Time (JIT) Compiler
  • 20.
    #DevoxxUS #EclipseOMR @EclipseOMR20 Goals of Eclipse OMR 1. OMR has no language semantics 2. OMR is not a language runtime 3. OMR components can be integrated into any language runtime, new or existing, without influencing language semantics
  • 21.
  • 22.
    #DevoxxUS #EclipseOMR @EclipseOMR22 port platform abstraction (porting) library thread cross platform pthread-like threading library vm APIs to manage per-interpreter and per-thread contexts gc garbage collection framework for managed heaps compiler extensible compiler framework jitbuilder project to simplify bring up for a new JIT compiler omrtrace library for publishing trace events for monitoring/diagnostics omrsigcompat signal handling compatibility library example demonstration code to show how a runtime might consume OMR components; and testing fvtest language independent test framework built on the example glue so that components can be tested outside of a language runtime, uses Google Test 1.7 framework + a few others ~800KLOC to date, more runtime technology coming! Eclipse OMR unboxing
  • 23.
    #DevoxxUS #EclipseOMR @EclipseOMR23 Garbage collection technology • Highly parallel, scalable garbage collector • Exploits multiple cores • Balances work for multiple threads • Rock solid automatic memory management for language runtimes • Used for over a decade in the IBM J9 enterprise caliber Java Virtual Machine • Start by integrating Mark/Sweep GC • Typically <100 lines of code • Then, add even more advanced capabilities as needed • Compaction • Generational • Concurrent
  • 24.
    #DevoxxUS #EclipseOMR @EclipseOMR24 What is Mark-Sweep GC? • Periodically, garbage collector stops all active application threads • Phase 1: Mark live objects by walking the live object graph • Traversal begins from objects kept in a “root” set (e.g. global variables, local variables in every active frame on every thread stack, etc.) • Each unmarked object is marked as live, then visit any objects it points at • Phase 2: Sweep through memory to find memory not used by live objects • Unused memory regions added to free list(s) • Once all memory has been swept, application threads restarted • Memory allocations can then take advantage of space added to free lists
  • 25.
    #DevoxxUS #EclipseOMR @EclipseOMR25 Hooking up the OMR Mark/Sweep Collector 1. Call OMR_Initialize_VM() at startup 2. Implement GC glue layer calls: • getSizeInBytesWithHeader() • CollectorLanguageInterfaceImpl::markingScheme_scanRoots() • MM_CollectorLanguageInterfaceImpl::markingScheme_scanObject() 3. Use OMR_GC_Allocate() function to allocate objects 4. Use OMR_GC_SystemCollect() function to trigger GC cycles 5. Configure heap size at runtime • e.g. OMR_GC_OPTIONS=“-Xmx2m” 6. Call OMR_Shutdown_VM() at shutdown
  • 26.
    #DevoxxUS #EclipseOMR @EclipseOMR26 Compiler technology • Heritage is a dynamic JIT for embedded Java • Proven its flexibility by underpinning static compilers and binary retranslators • Clean room implementation • Mix of C++, C, native assembler • Design goals • Fast startup time • Miserly memory management • Flexible to meet different footprint configurations
  • 27.
    #DevoxxUS #EclipseOMR @EclipseOMR27 Compiler technology • Configurable high-level optimization framework • Classic, loop, dataflow, control flow • High performance code generation with deep platform exploitation • X86, Power, System Z, ARMv7 • Dynamic recompilation with profile-directed feedback • Speculative optimizations and supporting runtime framework
  • 28.
    #DevoxxUS #EclipseOMR @EclipseOMR28 ARM Optimizer Analyses and Optimizations cold warm hot FSDscorching AOT IL Generation x86 POWER Z Code Generators Runtime Environment/ Configuration •Options •Object Model •Memory •Threading •Tracing codeMetadataRuntimeRT Helpers very hot profiling JITBuilder Profile Manager Hardware counters Sampling Thread Interpreter Profile Info JIT Profile Info Profiler
  • 29.
    #DevoxxUS #EclipseOMR @EclipseOMR29 Hooking up a compiler via a native IL generator • Produce OMR IL directly from interpreted method “bytecodes” • Deepest exploitation with the Eclipse OMR compiler technology  Maximize performance and functionality  Permits greatest specialization for a host runtime  Steeper learning curve, esp. OMR compiler intermediate language  You assume ownership of complexity
  • 30.
    #DevoxxUS #EclipseOMR @EclipseOMR30 Hooking up a compiler via JITBuilder • Prototype interface to compiler technology • Designed to simplify work to bootstrap a JIT compiler to generate native instructions for interpreted methods • https://developer.ibm.com/open/2016/07/19/jitbuilder-library-and-eclipse- omr-just-in-time-compilers-made-easy • https://developer.ibm.com/open/2017/03/08/build-more-complicated- methods-using-the-jitbuilder-library  Simple API to describe method prototypes and behaviours, types, bytecode interpretation, and compile and dispatch functionality  Sacrifice some performance and specialization for rapid integration of compiler technology  Technology is a WIP, but continually improving
  • 31.
    #DevoxxUS #EclipseOMR @EclipseOMR31 In the wild: IBM SDKs for Java • IBM’s production Java Virtual Machine • High performance, scalable, high reliability, serviceable • Independent implementation • Origin of much of Eclipse OMR technology • IBM SDK for Java 8 delivered in 2014 • Consumes, extends, and customizes Eclipse OMR for Java • Demonstrates versatility and adaptability of the technology • Important quality and performance proof points
  • 32.
    #DevoxxUS #EclipseOMR @EclipseOMR32 OpenJ9 • IBM to open source the J9 Java Virtual Machine in 2017 • Preparations to open source proceeding in parallel with IBM SDK for Java 9 development • Why open-source? • Facilitate collaboration and enable rapid innovation • Competition drives innovation • Cross-platform, cross-technology innovation
  • 33.
    #DevoxxUS #EclipseOMR @EclipseOMR33 OpenJ9 open source project • Most robust extension of Eclipse OMR technology • Port Layer, Garbage collection, Compiler, Tooling, … • Upstream repo for Java VM projects • Open community governance • Status: not public yet, likely around IBM Java 9 release • http://openj9.org
  • 34.
    #DevoxxUS #EclipseOMR @EclipseOMR34 Ruby • Integration of Eclipse OMR technology into CRuby VM • GC + compiler technology -> CRuby 2.2 • Compiler technology -> CRuby 2.4 • POCs show potential, can successfully run Rails • Goal is for Eclipse OMR to help achieve Ruby 3x3 target • Requires better VM / JIT / GC communication of state-changing events • Profiling, type specialization, inlining optimizations required • Repo: https://github.com/rubyomr-preview/ruby.git Help Wanted!
  • 35.
    #DevoxxUS #EclipseOMR @EclipseOMR35 Lua • Experimental Eclipse OMR compiler integration as proof point for technology and driving JitBuilder innovation • Status • Produce compiler IL for all 47 Lua instructions • 50 LOC changes needed to integrate with PUC-Rio Lua 5.3 • ~2000 LOC Lua compiler + Eclipse OMR • Performance: 2x performance over interpreted w/ Mandelbrot • Repo: https://github.com/Leonardo2718/lua-vermelha • https://fosdem.org/2017/schedule/event/eclipse_omr Help Wanted!
  • 36.
    #DevoxxUS #EclipseOMR @EclipseOMR36 SOM • Minimal Smalltalk implementation for teaching and experimentation with virtual machines • CSOM : proof point of simple integration of GC technology (approx 20% full benchmark speed up) • SOM++ : proof point of simple integration with JitBuilder technology (1 week of work yielded benchmark speedups of 2x-15x)
  • 37.
    #DevoxxUS #EclipseOMR @EclipseOMR37 Base9 (B9) • Educational VM for demonstrating integration of Eclipse OMR technology into a typical interpreted language VM • Small bytecode set (initially!) • Stack-based interpreter • Primitive types • Integration with Eclipse OMR • JitBuilder : straightforward integration can yield 760x perf improvement over interpreter on Fibonacci test (compilation, inlining) • Repo: https://github.com/youngar/Base9
  • 38.
    #DevoxxUS #EclipseOMR @EclipseOMR38 What’s next? • IBM actively contributing to the technology • Pulling commits hourly into development version of J9 Java 9 • Improve onboarding experience • Documentation, designs, sample code, how-to blogs • Create a Discourse instance for community project discussion • Improve testability • Community building • Grow the base of the Eclipse OMR project • Work with language runtime communities to foster broader adoption and drive improvements into the technology • Engage with research communities • Research projects in runtime/compiler technologies based on Eclipse OMR • Eclipse OMR as an undergrad/graduate teaching platform for runtime technologies
  • 39.
    #DevoxxUS #EclipseOMR @EclipseOMR39 Getting involved • GitHub repo contributions • Require an account at Eclipse.org and you must sign the Eclipse ECA • https://projects.eclipse.org/user/sign/cla • Contribution guidelines • https://github.com/eclipse/omr/blob/master/CONTRIBUTING.md • Google Summer of Code • Eclipse Foundation is a mentoring organization • Project suggestions for prospective students: http://bit.ly/2mDGnwS
  • 40.
    #DevoxxUS #EclipseOMR @EclipseOMR40 More Eclipse OMR in action Join Bjørn Vårdal’s Tools-In-Action session: Secrets of building a debuggable runtime: Learn how language implementors solve your runtime issues Grand Ballroom 220A Thursday, March 23 @ 3:30-4:00 pm
  • 41.
    #DevoxxUS #EclipseOMR @EclipseOMR41 http://www.eclipse.org/omr https://github.com/eclipse/omr https://developer.ibm.com/open/omr/ Users and contributors very welcome! https://github.com/eclipse/omr/blob/master/CONTRIBUTING.md Eclipse OMR Mark Stoodley Eclipse OMR Project Co-Lead mstoodle@ca.ibm.com Daryl Maier IBM OMR Compiler Lead maier@ca.ibm.com Charlie Gracie Eclipse OMR Project Co-Lead cgracie@ca.ibm.com Follow us @EclipseOMR
  • 42.
    © 2017 IBMCorporation Mission Badge #6: SMS Text Your mission should you choose to accept it…. Join us at the IBM Booth for hands-on labs, demos, games and talk to our developers. Text Innovation to 41411 to get one step closer to the booth giveaway and learn more about all the IBM sessions & speakers. Enter the raffle by completing missions for a chance to win • a Drone • TJBot Kit • VR glasses
  • 43.