SlideShare ist ein Scribd-Unternehmen logo
1 von 50
Java Garbage Collection for the Polyglot
Charlie Gracie, Garbage Collection Architect
Charlie_Gracie@ca.ibm.com
@crgracie
28 October 2015
What’s in an Object?
Who am I?
 I have been working on the IBM J9 Virtual Machine since 2004
and I am currently the Garbage Collection Architect. J9 is
IBM's independent implementation of the JVM.
 I have worked on almost all aspects of the J9 JVM including
garbage collection, core interpreter, RAS and L3 service.
 My main focus areas have been improving garbage collection
scalability and de-coupling JVM components from the JVM
2
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
3
Resurgence of polyglot
4
Resurgence of polyglot
5
Resurgence of polyglot
6
Resurgence of polyglot
7
Resurgence of polyglot
8
Resurgence of polyglot
9
No shared technology between runtimes
10
 Effort in one runtime has no leverage in other runtimes
 …looking very costly to support many language runtimes
Languages on the JVM
 Leverage the investment in JVM by running on the JVM
– Cross platform support
– High performance runtime
– Production quality
– Tooling / monitoring support
– Interoperability with Java
11
Languages on the JVM
 Works great for new languages like Scala and Groovy
 Many existing languages have a vibrant non-JVM based community
– JVM implementation forks language and runtime communities
– Bridging the divide would mean migrating an entire community
 Not all languages map nicely to Java semantics
 We decided to experiment with a different approach that would allow
new and existing language communities to leverage JVM capabilities
12
13
 Announced by Mark Stoodley
at JVMLS 2015
 See the complete talk here.
IBM is going to open source runtime technology
Our vision
 Open community of contribution based around a toolkit of components that can be used to
build VMs for any language
 Efficient place for individuals, communities, and companies to safely collaborate on core
VM infrastructure
 Enable everyone to focus more energy on innovation, not on building more wheels
 More robust core technology
– Fix bugs once
– Tested in many different scenarios
 Collection of best practices and shared learning
 Lower entry barrier for new languages and VM ideas
– Test ideas faster and more reliably
14
Unlock the VM from the JVM
 Refactor J9 components to create a language-agnostic toolkit designed for
integration into language runtimes (including J9 JVM)
– Memory allocator, thread library, platform port library, event hook framework, VM and
application level trace engine, garbage collector, JIT compiler
 Not a research project: out JDK product development team aggressively
refactoring our VM, GC, and JIT technology
– Shipped IBM JDK8 from snapshot of refactored code base
– JDK9 development ongoing as we continue to experiment
15
Transplant J9 Java capabilities to other runtimes
Common
utilities
Thread
library
Port
Library
Trace GC JIT
VM
Structures
…
Core
runtime
infrastructure
16
Tool
Agents
Integrate the toolkit
 ./configure the toolkit
– Select components and features
 Copy generic language glue folder into the language
 Provide implementation for the required language glue APIs
 Call toolkit APIs from runtime
– Initialization, object allocation, file io, etc.
 Compile and link the toolkit using makefiles provided
17
Language glue
 Components are language agnostic
– Some operations still require language knowledge
 Language glue is a set of API that answer questions about the language
 Different components require different glue
18
What is in an object?
19
What is in an object?
 I do not know
20
What is in an object?
 I do not know
 Languages define the shape of objects
21
Language agnostic garbage collection
 Secret….
22
Language agnostic garbage collection
 Secret…. a lot of garbage collection operations use an opaque type
– Perform math on the actual pointer not the contents
 mark map, card table, etc.
– Store a reference to the object
 work stack, remembered set, etc.
23
Language agnostic garbage collection
 What does the garbage collector need from the language?
– object size
– object shape / layout
 Getting this information needs to be fast!!!
– iterating an objects references is on the hot path
24
Language agnostic garbage collection
 Decoupled the garbage collector from J9 JVM
1. Using an opaque object type wherever possible
2. Defining glue API to answer language questions
 Performance critical API implemented in hpp to ensure inlining
 Investigating templates to improve iterating an objects references
25
Garbage collection features
1. Allocator, work stack, parallel operation intrinsics, etc.
2. Mark / sweep global collector
3. Compactor
4. Concurrent global collector
5. Generational copying collector
6. Compressed references
26
Garbage collection features
 Pre/post calls for each garbage collection operation
– Allows the language to do any specific work it requires
 By default these calls do nothing
 Example
– When object marking is complete (all live objects found) Java needs to handle
finalizable objects
27
Integrate the garbage collector
 Make this as easy as possible
 Only require glue for enabled features
– Compile time flags control which features are enabled
 Required glue API contain #error messages
– Missing implementations cause compile failures and not runtime failures
 Provide detailed documentation and examples for glue
28
Integrate the garbage collector
 1 day
– By default object allocation and single threaded mark / sweep is enabled
– ONLY 3 glue APIs to implement
 3 days
– Enable parallelism and compaction
 5 days
– Enable concurrent marking
 7 days
– Enable generational collection
 9 days
– Enable compressed references on 64 bit platforms
 NOTE sample schedule for adding support
29
Testing the garbage collector
 Simple C application to test garbage collector functionality
– Just need to provide the appropriate glue
 Created a test framework to build object graphs
– Easy to write repeatable test cases
– Test performance of algorithm changes
 No need to bring up the entire runtime to unit test the GC
 Can force operations to happen in a particular order
– Very difficult to force operations when testing the whole system (a test written
in the language)
30
CSOM example
 C implementation of Simple Object Machine (SOM)
 SOM is a minimal Smalltalk used for teaching and research on VMs
 “Clarity of implementation over absolute performance”
 http://som-st.github.io/
 https://github.com/SOM-st/CSOM
31
VM startup and shutdown
32
void Universe_initialize(int argc, const char** argv) {
Initialize_VM(&VM, &VMThread, …);
//complete the normal startup
…
Interpreter_start();
}
File: CSOM/src/vm/universe.c
VM startup and shutdown
33
void Universe_destruct(void) {
// complete normal CSOM destruction
…
Shutdown_VM(VM, VMThread);
}
File: CSOM/src/vm/universe.c
GC allocation
34
void* gc_allocate (size_t size) {
if ((gc_get_free_heap_size() <= BUFFERSIZE_FOR_UNINTERRUPTABLE)
&& (uninterruptable_counter <= 0)) {
gc_collect();
}
return GC_Allocate(VMThread, size, 0);
}
File: CSOM/src/memory/gc.c
GC collection
35
void gc_collect() {
// delete CSOM collect code and call collection API
GC_GlobalCollect(FORCED_GLOBAL);
}
File: CSOM/src/memory/gc.c
Implement required glue
36
/**
* How big is this object
*/
uintptr_t getSizeInBytesWithHeader(objectptr_t objectPtr) {
// return object_size from som object
return ((pOOObject)objectPtr)->object_size;
}
File: CSOM/glue/ObjectModel.hpp
Implement required glue
37
/**
* Find all reference slots in objectPtr and call
* MM_MarkingScheme::markObject() on them
*/
void markingScheme_scanObject(objectptr_t objectPtr) {
// call actual CSOM function for marking on objects references
SEND((pVMObject)objectPtr, mark_references);
}
File: CSOM/glue/CollectorLanguageInterface.cpp
Implement required glue
38
extern “C” {
/**
* Provide implementation for function required by mark_references function
* in src/memory/gc.c
*/
void gc_mark_object(void *object) {
// use tls to get the current environment pointer since mark object does not pass it
MM_EnvironmentBase *env = getCurrentEnvironment();
MM_MarkingScheme *markingScheme = getMarkingScheme();
if (markingScheme->isHeapObject((objectptr_t)object)) {
markingScheme->markObject(env, (objectptr_t)object);
}
}
}
File: CSOM/glue/CollectorLanguageInterface.cpp
Implement required glue
39
/**
* This function is called by all worker threads. Be sure to
* use the synchronization APIs
*/
void markingScheme_scanRoots(MM_EnvironmentBase *env) {
// handle all roots with just one thread
if (env->_currentTask->synchronizeGCThreadsAndReleaseSingleThread(env, UNIQUE_ID)) {
// call actual CSOM function for marking roots
gc_mark_reachable_objects(); //<-- this function was not changes at all
env->_currentTask->releaseSyncrhonizedGCThreads(env);
}
}
File: CSOM/glue/CollectorLanguageInterface.cpp
CSOM results
 With this small changeset you get
– Object allocation
– Parallel mark / sweep collector
– verbose:gc output which can be consumed by GCMV
 Passes all CSOM tests and benchmarks
– Full benchmark suite is about 20% faster
40
CSOM verbose:gc output
41
<cycle-start id="2" type="global" contextid="0" timestamp="2015-10-27T17:21:58.105" intervalms="5066.731" />
<gc-start id="3" type="global" contextid="2" timestamp="2015-10-27T17:21:58.105">
<mem-info id="4" free="596848" total="4194304" percent="14">
<mem type="tenure" free="596848" total="4194304" percent="14" />
</mem-info>
</gc-start>
<allocation-stats totalBytes="3596216" >
<allocated-bytes non-tlh="720016" tlh="2876200" />
</allocation-stats>
<gc-op id="5" type="mark" timems="4.881" contextid="2" timestamp="2015-10-27T17:21:58.110">
<trace-info objectcount="8914" scancount="7208" scanbytes="288320" />
</gc-op>
<gc-op id="8" type="sweep" timems="0.688" contextid="2" timestamp="2015-10-27T17:21:58.111" />
<gc-end id="9" type="global" contextid="2" durationms="5.89" usertimems="7.99" systemtimems="1.99" timestamp="2015-10-27T17:21:58.112“ activeThreads="2">
<mem-info id="10" free="2508160" total="4194304" percent="59">
<mem type="tenure" free="2508160" total="4194304" percent="59" micro-fragmented="297048" macro-fragmented="723458" />
</mem-info>
</gc-end>
<cycle-end id="11" type="global" contextid="2" timestamp="2015-10-27T17:21:58.111" />
CSOM verbose:gc in GCMV
42
Proof points
 Integrated the toolkit into MRI and CPython
– JIT support
– Scalable garbage collection
– Monitoring tools
 Our emphasis has been on compatibility
– Consistent behaviour for compiled code vs interpreted code
– No restrictions on native code used by extension modules
– All tests that ship with both languages continue to pass
– We can run Rails
43
JIT integration
 Ruby MRI and CPython do not have JIT compilers
 Both environments are challenging for JIT compilers
– Highly dynamic
– Unmanaged direct use of internal data structures by extensions
– Design choices in the runtimes themselves (e.g., setjmp/longjmp)
 Our effort to date has particular emphases
– Compile native instructions for methods and blocksConsistent behavior for compiled code vs.
interpreted code
– No restrictions on native code used by extension modules
– No benchmark tuning or specials
 Compatibility story: We can run Rails!
 Performance story: 1.2x + on many Bench9k kernels on 3 architectures without tuning
44
Scalable garbage collection
 Integrated GC into CPython and MRI
– Type accurate, but used conservatively so extensions work as-is
 CPython investigating reference count improvements and/or removal
 MRI can move off-heap native memory into manageable heap
– Provides performance improvement by moving data closer to objects
 Perform mark and sweep operations in parallel
 Verbose:gc and GCMV support out of the box
45
MRI method profiling via Health Center
46
We are keen to hear your feedback
 Early results are very promising
 Next steps
– Open source components and features that are ready
– Balance refactoring work against improving proof points
– Engaging with communities and partners
 Open request for feedback or interest to get involved!
47
Charlie Gracie Mark Stoodley John Duimovich
O/S GC Architect O/S Project Lead CTO, IBM Runtimes
charlie_gracie@ca.ibm.com mstoodle@ca.ibm.com john_duimovich@ca.ibm.com
More information
 Daryl Maier - Wednesday, Oct 28, 1:00 p.m. | Hilton—Golden Gate 6/7/8
– Beyond the coffee cup: Leveraging Java Runtime Technologies for Polyglot [CON7547]
 Follow us on twitter
– Charlie Gracie - @crgracie
– Daryl Maier - @0xdaryl
– Mark Stoodley - @mstoodle
48
Questions??
 Any questions or comments?
49
50
Legal Notice
IBM and the IBM logo are trademarks or registered trademarks of IBM Corporation, in the United States, other
countries or both.
Java and all Java-based marks, among others, are trademarks or registered trademarks of Oracle in the United
States, other countries or both.
Other company, product and service names may be trademarks or service marks of others.
THE INFORMATION DISCUSSED IN THIS PRESENTATION IS PROVIDED FOR INFORMATIONAL
PURPOSES ONLY. WHILE EFFORTS WERE MADE TO VERIFY THE COMPLETENESS AND
ACCURACY OF THE INFORMATION, IT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, AND IBM SHALL NOT BE RESPONSIBLE FOR ANY DAMAGES ARISING OUT
OF THE USE OF, OR OTHERWISE RELATED TO, SUCH INFORMATION. ANY INFORMATION
CONCERNING IBM'S PRODUCT PLANS OR STRATEGY IS SUBJECT TO CHANGE BY IBM WITHOUT
NOTICE.

Weitere ähnliche Inhalte

Was ist angesagt?

Calling All Modularity Solutions: A Comparative Study from eBay
Calling All Modularity Solutions: A Comparative Study from eBayCalling All Modularity Solutions: A Comparative Study from eBay
Calling All Modularity Solutions: A Comparative Study from eBay
Tony Ng
 

Was ist angesagt? (20)

Java Serverless in Action - Voxxed Banff
Java Serverless in Action - Voxxed BanffJava Serverless in Action - Voxxed Banff
Java Serverless in Action - Voxxed Banff
 
12 Factor Scala
12 Factor Scala12 Factor Scala
12 Factor Scala
 
Why jakarta ee matters (ConFoo 2021)
Why jakarta ee matters (ConFoo 2021)Why jakarta ee matters (ConFoo 2021)
Why jakarta ee matters (ConFoo 2021)
 
Modern web application development with java ee 7
Modern web application development with java ee 7Modern web application development with java ee 7
Modern web application development with java ee 7
 
12-factor-jruby
12-factor-jruby12-factor-jruby
12-factor-jruby
 
A Java Implementer's Guide to Better Apache Spark Performance
A Java Implementer's Guide to Better Apache Spark PerformanceA Java Implementer's Guide to Better Apache Spark Performance
A Java Implementer's Guide to Better Apache Spark Performance
 
Apache Harmony: An Open Innovation
Apache Harmony: An Open InnovationApache Harmony: An Open Innovation
Apache Harmony: An Open Innovation
 
Simple tweaks to get the most out of your jvm
Simple tweaks to get the most out of your jvmSimple tweaks to get the most out of your jvm
Simple tweaks to get the most out of your jvm
 
Scala in the Wild
Scala in the WildScala in the Wild
Scala in the Wild
 
FAST for SharePoint Deep Dive
FAST for SharePoint Deep DiveFAST for SharePoint Deep Dive
FAST for SharePoint Deep Dive
 
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
 
Arquillian 소개
Arquillian 소개Arquillian 소개
Arquillian 소개
 
Calling All Modularity Solutions: A Comparative Study from eBay
Calling All Modularity Solutions: A Comparative Study from eBayCalling All Modularity Solutions: A Comparative Study from eBay
Calling All Modularity Solutions: A Comparative Study from eBay
 
Perl6 DBDI YAPC::EU 201008
Perl6 DBDI YAPC::EU 201008Perl6 DBDI YAPC::EU 201008
Perl6 DBDI YAPC::EU 201008
 
Javantura v4 - JVM++ The GraalVM - Martin Toshev
Javantura v4 - JVM++ The GraalVM - Martin ToshevJavantura v4 - JVM++ The GraalVM - Martin Toshev
Javantura v4 - JVM++ The GraalVM - Martin Toshev
 
Conquering AngularJS Limitations
Conquering AngularJS LimitationsConquering AngularJS Limitations
Conquering AngularJS Limitations
 
JCConf 2015 Java Embedded and Raspberry Pi
JCConf 2015 Java Embedded and Raspberry PiJCConf 2015 Java Embedded and Raspberry Pi
JCConf 2015 Java Embedded and Raspberry Pi
 
Future of Java
Future of JavaFuture of Java
Future of Java
 
Modular Java applications with OSGi on Apache Karaf
Modular Java applications with OSGi on Apache KarafModular Java applications with OSGi on Apache Karaf
Modular Java applications with OSGi on Apache Karaf
 
Is Enterprise Java Still Relevant (JavaOne 2015 session)
Is Enterprise Java Still Relevant (JavaOne 2015 session)Is Enterprise Java Still Relevant (JavaOne 2015 session)
Is Enterprise Java Still Relevant (JavaOne 2015 session)
 

Andere mochten auch

Andere mochten auch (7)

Jfokus 2016 - A JVMs Journey into Polyglot Runtimes
Jfokus 2016 - A JVMs Journey into Polyglot RuntimesJfokus 2016 - A JVMs Journey into Polyglot Runtimes
Jfokus 2016 - A JVMs Journey into Polyglot Runtimes
 
Highly Surmountable Challenges in Ruby+OMR JIT Compilation
Highly Surmountable Challenges in Ruby+OMR JIT CompilationHighly Surmountable Challenges in Ruby+OMR JIT Compilation
Highly Surmountable Challenges in Ruby+OMR JIT Compilation
 
Experiments in Sharing Java VM Technology with CRuby
Experiments in Sharing Java VM Technology with CRubyExperiments in Sharing Java VM Technology with CRuby
Experiments in Sharing Java VM Technology with CRuby
 
JavaOne 2015 CON7547 "Beyond the Coffee Cup: Leveraging Java Runtime Technolo...
JavaOne 2015 CON7547 "Beyond the Coffee Cup: Leveraging Java Runtime Technolo...JavaOne 2015 CON7547 "Beyond the Coffee Cup: Leveraging Java Runtime Technolo...
JavaOne 2015 CON7547 "Beyond the Coffee Cup: Leveraging Java Runtime Technolo...
 
Fact Or Opinion
Fact Or OpinionFact Or Opinion
Fact Or Opinion
 
Maltrato animal presentacion power point
Maltrato animal presentacion power pointMaltrato animal presentacion power point
Maltrato animal presentacion power point
 
Writing objective test items
Writing objective test itemsWriting objective test items
Writing objective test items
 

Ähnlich wie #JavaOne What's in an object?

Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx PluginGr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
Yasuharu Nakano
 

Ähnlich wie #JavaOne What's in an object? (20)

FOSDEM 2017 - Open J9 The Next Free Java VM
FOSDEM 2017 - Open J9 The Next Free Java VMFOSDEM 2017 - Open J9 The Next Free Java VM
FOSDEM 2017 - Open J9 The Next Free Java VM
 
EclipseOMRBuildingBlocks4Polyglot_TURBO18
EclipseOMRBuildingBlocks4Polyglot_TURBO18EclipseOMRBuildingBlocks4Polyglot_TURBO18
EclipseOMRBuildingBlocks4Polyglot_TURBO18
 
TechEvent Graal(VM) Performance Interoperability
TechEvent Graal(VM) Performance InteroperabilityTechEvent Graal(VM) Performance Interoperability
TechEvent Graal(VM) Performance Interoperability
 
Java performance tuning
Java performance tuningJava performance tuning
Java performance tuning
 
GraalVM - JBCNConf 2019-05-28
GraalVM - JBCNConf 2019-05-28GraalVM - JBCNConf 2019-05-28
GraalVM - JBCNConf 2019-05-28
 
(java2days) Is the Future of Java Cloudy?
(java2days) Is the Future of Java Cloudy?(java2days) Is the Future of Java Cloudy?
(java2days) Is the Future of Java Cloudy?
 
Simple tweaks to get the most out of your JVM
Simple tweaks to get the most out of your JVMSimple tweaks to get the most out of your JVM
Simple tweaks to get the most out of your JVM
 
Introduction to Java Programming, Basic Structure, variables Data type, input...
Introduction to Java Programming, Basic Structure, variables Data type, input...Introduction to Java Programming, Basic Structure, variables Data type, input...
Introduction to Java Programming, Basic Structure, variables Data type, input...
 
GraalVM - MadridJUG 2019-10-22
GraalVM - MadridJUG 2019-10-22GraalVM - MadridJUG 2019-10-22
GraalVM - MadridJUG 2019-10-22
 
GraalVM - OpenSlava 2019-10-18
GraalVM - OpenSlava 2019-10-18GraalVM - OpenSlava 2019-10-18
GraalVM - OpenSlava 2019-10-18
 
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
 
Splunking the JVM
Splunking the JVMSplunking the JVM
Splunking the JVM
 
Java unit 1
Java unit 1Java unit 1
Java unit 1
 
A Java Implementer's Guide to Boosting Apache Spark Performance by Tim Ellison.
A Java Implementer's Guide to Boosting Apache Spark Performance by Tim Ellison.A Java Implementer's Guide to Boosting Apache Spark Performance by Tim Ellison.
A Java Implementer's Guide to Boosting Apache Spark Performance by Tim Ellison.
 
Java lab lecture 1
Java  lab  lecture 1Java  lab  lecture 1
Java lab lecture 1
 
JDD2015: Towards the Fastest (J)VM on the Planet! - Jaroslav Tulach
JDD2015: Towards the Fastest (J)VM on the Planet! - Jaroslav TulachJDD2015: Towards the Fastest (J)VM on the Planet! - Jaroslav Tulach
JDD2015: Towards the Fastest (J)VM on the Planet! - Jaroslav Tulach
 
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx PluginGr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
 
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
 
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
 
All experiment of java
All experiment of javaAll experiment of java
All experiment of java
 

Kürzlich hochgeladen

%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 

Kürzlich hochgeladen (20)

Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 

#JavaOne What's in an object?

  • 1. Java Garbage Collection for the Polyglot Charlie Gracie, Garbage Collection Architect Charlie_Gracie@ca.ibm.com @crgracie 28 October 2015 What’s in an Object?
  • 2. Who am I?  I have been working on the IBM J9 Virtual Machine since 2004 and I am currently the Garbage Collection Architect. J9 is IBM's independent implementation of the JVM.  I have worked on almost all aspects of the J9 JVM including garbage collection, core interpreter, RAS and L3 service.  My main focus areas have been improving garbage collection scalability and de-coupling JVM components from the JVM 2
  • 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 3
  • 10. No shared technology between runtimes 10  Effort in one runtime has no leverage in other runtimes  …looking very costly to support many language runtimes
  • 11. Languages on the JVM  Leverage the investment in JVM by running on the JVM – Cross platform support – High performance runtime – Production quality – Tooling / monitoring support – Interoperability with Java 11
  • 12. Languages on the JVM  Works great for new languages like Scala and Groovy  Many existing languages have a vibrant non-JVM based community – JVM implementation forks language and runtime communities – Bridging the divide would mean migrating an entire community  Not all languages map nicely to Java semantics  We decided to experiment with a different approach that would allow new and existing language communities to leverage JVM capabilities 12
  • 13. 13  Announced by Mark Stoodley at JVMLS 2015  See the complete talk here. IBM is going to open source runtime technology
  • 14. Our vision  Open community of contribution based around a toolkit of components that can be used to build VMs for any language  Efficient place for individuals, communities, and companies to safely collaborate on core VM infrastructure  Enable everyone to focus more energy on innovation, not on building more wheels  More robust core technology – Fix bugs once – Tested in many different scenarios  Collection of best practices and shared learning  Lower entry barrier for new languages and VM ideas – Test ideas faster and more reliably 14
  • 15. Unlock the VM from the JVM  Refactor J9 components to create a language-agnostic toolkit designed for integration into language runtimes (including J9 JVM) – Memory allocator, thread library, platform port library, event hook framework, VM and application level trace engine, garbage collector, JIT compiler  Not a research project: out JDK product development team aggressively refactoring our VM, GC, and JIT technology – Shipped IBM JDK8 from snapshot of refactored code base – JDK9 development ongoing as we continue to experiment 15
  • 16. Transplant J9 Java capabilities to other runtimes Common utilities Thread library Port Library Trace GC JIT VM Structures … Core runtime infrastructure 16 Tool Agents
  • 17. Integrate the toolkit  ./configure the toolkit – Select components and features  Copy generic language glue folder into the language  Provide implementation for the required language glue APIs  Call toolkit APIs from runtime – Initialization, object allocation, file io, etc.  Compile and link the toolkit using makefiles provided 17
  • 18. Language glue  Components are language agnostic – Some operations still require language knowledge  Language glue is a set of API that answer questions about the language  Different components require different glue 18
  • 19. What is in an object? 19
  • 20. What is in an object?  I do not know 20
  • 21. What is in an object?  I do not know  Languages define the shape of objects 21
  • 22. Language agnostic garbage collection  Secret…. 22
  • 23. Language agnostic garbage collection  Secret…. a lot of garbage collection operations use an opaque type – Perform math on the actual pointer not the contents  mark map, card table, etc. – Store a reference to the object  work stack, remembered set, etc. 23
  • 24. Language agnostic garbage collection  What does the garbage collector need from the language? – object size – object shape / layout  Getting this information needs to be fast!!! – iterating an objects references is on the hot path 24
  • 25. Language agnostic garbage collection  Decoupled the garbage collector from J9 JVM 1. Using an opaque object type wherever possible 2. Defining glue API to answer language questions  Performance critical API implemented in hpp to ensure inlining  Investigating templates to improve iterating an objects references 25
  • 26. Garbage collection features 1. Allocator, work stack, parallel operation intrinsics, etc. 2. Mark / sweep global collector 3. Compactor 4. Concurrent global collector 5. Generational copying collector 6. Compressed references 26
  • 27. Garbage collection features  Pre/post calls for each garbage collection operation – Allows the language to do any specific work it requires  By default these calls do nothing  Example – When object marking is complete (all live objects found) Java needs to handle finalizable objects 27
  • 28. Integrate the garbage collector  Make this as easy as possible  Only require glue for enabled features – Compile time flags control which features are enabled  Required glue API contain #error messages – Missing implementations cause compile failures and not runtime failures  Provide detailed documentation and examples for glue 28
  • 29. Integrate the garbage collector  1 day – By default object allocation and single threaded mark / sweep is enabled – ONLY 3 glue APIs to implement  3 days – Enable parallelism and compaction  5 days – Enable concurrent marking  7 days – Enable generational collection  9 days – Enable compressed references on 64 bit platforms  NOTE sample schedule for adding support 29
  • 30. Testing the garbage collector  Simple C application to test garbage collector functionality – Just need to provide the appropriate glue  Created a test framework to build object graphs – Easy to write repeatable test cases – Test performance of algorithm changes  No need to bring up the entire runtime to unit test the GC  Can force operations to happen in a particular order – Very difficult to force operations when testing the whole system (a test written in the language) 30
  • 31. CSOM example  C implementation of Simple Object Machine (SOM)  SOM is a minimal Smalltalk used for teaching and research on VMs  “Clarity of implementation over absolute performance”  http://som-st.github.io/  https://github.com/SOM-st/CSOM 31
  • 32. VM startup and shutdown 32 void Universe_initialize(int argc, const char** argv) { Initialize_VM(&VM, &VMThread, …); //complete the normal startup … Interpreter_start(); } File: CSOM/src/vm/universe.c
  • 33. VM startup and shutdown 33 void Universe_destruct(void) { // complete normal CSOM destruction … Shutdown_VM(VM, VMThread); } File: CSOM/src/vm/universe.c
  • 34. GC allocation 34 void* gc_allocate (size_t size) { if ((gc_get_free_heap_size() <= BUFFERSIZE_FOR_UNINTERRUPTABLE) && (uninterruptable_counter <= 0)) { gc_collect(); } return GC_Allocate(VMThread, size, 0); } File: CSOM/src/memory/gc.c
  • 35. GC collection 35 void gc_collect() { // delete CSOM collect code and call collection API GC_GlobalCollect(FORCED_GLOBAL); } File: CSOM/src/memory/gc.c
  • 36. Implement required glue 36 /** * How big is this object */ uintptr_t getSizeInBytesWithHeader(objectptr_t objectPtr) { // return object_size from som object return ((pOOObject)objectPtr)->object_size; } File: CSOM/glue/ObjectModel.hpp
  • 37. Implement required glue 37 /** * Find all reference slots in objectPtr and call * MM_MarkingScheme::markObject() on them */ void markingScheme_scanObject(objectptr_t objectPtr) { // call actual CSOM function for marking on objects references SEND((pVMObject)objectPtr, mark_references); } File: CSOM/glue/CollectorLanguageInterface.cpp
  • 38. Implement required glue 38 extern “C” { /** * Provide implementation for function required by mark_references function * in src/memory/gc.c */ void gc_mark_object(void *object) { // use tls to get the current environment pointer since mark object does not pass it MM_EnvironmentBase *env = getCurrentEnvironment(); MM_MarkingScheme *markingScheme = getMarkingScheme(); if (markingScheme->isHeapObject((objectptr_t)object)) { markingScheme->markObject(env, (objectptr_t)object); } } } File: CSOM/glue/CollectorLanguageInterface.cpp
  • 39. Implement required glue 39 /** * This function is called by all worker threads. Be sure to * use the synchronization APIs */ void markingScheme_scanRoots(MM_EnvironmentBase *env) { // handle all roots with just one thread if (env->_currentTask->synchronizeGCThreadsAndReleaseSingleThread(env, UNIQUE_ID)) { // call actual CSOM function for marking roots gc_mark_reachable_objects(); //<-- this function was not changes at all env->_currentTask->releaseSyncrhonizedGCThreads(env); } } File: CSOM/glue/CollectorLanguageInterface.cpp
  • 40. CSOM results  With this small changeset you get – Object allocation – Parallel mark / sweep collector – verbose:gc output which can be consumed by GCMV  Passes all CSOM tests and benchmarks – Full benchmark suite is about 20% faster 40
  • 41. CSOM verbose:gc output 41 <cycle-start id="2" type="global" contextid="0" timestamp="2015-10-27T17:21:58.105" intervalms="5066.731" /> <gc-start id="3" type="global" contextid="2" timestamp="2015-10-27T17:21:58.105"> <mem-info id="4" free="596848" total="4194304" percent="14"> <mem type="tenure" free="596848" total="4194304" percent="14" /> </mem-info> </gc-start> <allocation-stats totalBytes="3596216" > <allocated-bytes non-tlh="720016" tlh="2876200" /> </allocation-stats> <gc-op id="5" type="mark" timems="4.881" contextid="2" timestamp="2015-10-27T17:21:58.110"> <trace-info objectcount="8914" scancount="7208" scanbytes="288320" /> </gc-op> <gc-op id="8" type="sweep" timems="0.688" contextid="2" timestamp="2015-10-27T17:21:58.111" /> <gc-end id="9" type="global" contextid="2" durationms="5.89" usertimems="7.99" systemtimems="1.99" timestamp="2015-10-27T17:21:58.112“ activeThreads="2"> <mem-info id="10" free="2508160" total="4194304" percent="59"> <mem type="tenure" free="2508160" total="4194304" percent="59" micro-fragmented="297048" macro-fragmented="723458" /> </mem-info> </gc-end> <cycle-end id="11" type="global" contextid="2" timestamp="2015-10-27T17:21:58.111" />
  • 43. Proof points  Integrated the toolkit into MRI and CPython – JIT support – Scalable garbage collection – Monitoring tools  Our emphasis has been on compatibility – Consistent behaviour for compiled code vs interpreted code – No restrictions on native code used by extension modules – All tests that ship with both languages continue to pass – We can run Rails 43
  • 44. JIT integration  Ruby MRI and CPython do not have JIT compilers  Both environments are challenging for JIT compilers – Highly dynamic – Unmanaged direct use of internal data structures by extensions – Design choices in the runtimes themselves (e.g., setjmp/longjmp)  Our effort to date has particular emphases – Compile native instructions for methods and blocksConsistent behavior for compiled code vs. interpreted code – No restrictions on native code used by extension modules – No benchmark tuning or specials  Compatibility story: We can run Rails!  Performance story: 1.2x + on many Bench9k kernels on 3 architectures without tuning 44
  • 45. Scalable garbage collection  Integrated GC into CPython and MRI – Type accurate, but used conservatively so extensions work as-is  CPython investigating reference count improvements and/or removal  MRI can move off-heap native memory into manageable heap – Provides performance improvement by moving data closer to objects  Perform mark and sweep operations in parallel  Verbose:gc and GCMV support out of the box 45
  • 46. MRI method profiling via Health Center 46
  • 47. We are keen to hear your feedback  Early results are very promising  Next steps – Open source components and features that are ready – Balance refactoring work against improving proof points – Engaging with communities and partners  Open request for feedback or interest to get involved! 47 Charlie Gracie Mark Stoodley John Duimovich O/S GC Architect O/S Project Lead CTO, IBM Runtimes charlie_gracie@ca.ibm.com mstoodle@ca.ibm.com john_duimovich@ca.ibm.com
  • 48. More information  Daryl Maier - Wednesday, Oct 28, 1:00 p.m. | Hilton—Golden Gate 6/7/8 – Beyond the coffee cup: Leveraging Java Runtime Technologies for Polyglot [CON7547]  Follow us on twitter – Charlie Gracie - @crgracie – Daryl Maier - @0xdaryl – Mark Stoodley - @mstoodle 48
  • 49. Questions??  Any questions or comments? 49
  • 50. 50 Legal Notice IBM and the IBM logo are trademarks or registered trademarks of IBM Corporation, in the United States, other countries or both. Java and all Java-based marks, among others, are trademarks or registered trademarks of Oracle in the United States, other countries or both. Other company, product and service names may be trademarks or service marks of others. THE INFORMATION DISCUSSED IN THIS PRESENTATION IS PROVIDED FOR INFORMATIONAL PURPOSES ONLY. WHILE EFFORTS WERE MADE TO VERIFY THE COMPLETENESS AND ACCURACY OF THE INFORMATION, IT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, AND IBM SHALL NOT BE RESPONSIBLE FOR ANY DAMAGES ARISING OUT OF THE USE OF, OR OTHERWISE RELATED TO, SUCH INFORMATION. ANY INFORMATION CONCERNING IBM'S PRODUCT PLANS OR STRATEGY IS SUBJECT TO CHANGE BY IBM WITHOUT NOTICE.

Hinweis der Redaktion

  1. A little bit of background on me….
  2. We start with our safe harbor slide that tells us basically, don’t trust anything I have to say. Don’t worry, by the end of the conference, I’m sure we’ll be sick of these slides.
  3. We are here at JavaOne because we all know and love Java. Java is a stable, performant and scalable runtime. It has decades of development into JIT, GC and other technologies Over the last few years a lot of new languages are gaining traction. With more and more applications moving to the cloud we see more developers requiring skills in more than one language How many people work Ruby??? Python??? JavaScript???? As well as java
  4. These languages all have their strengths and weaknesses More than just learning the language developers need to know how to run, tune, profiling and debug all of these languages. How do you configure options? How do you set the maximum size of the heap? Is there even a maximum size IDE, profilers, monitoring agents? "Groovy-logo" by Zorak1103 - Own work. Licensed under CC BY-SA 3.0 via Commons - https://commons.wikimedia.org/wiki/File:Groovy-logo.svg#/media/File:Groovy-logo.svg
  5. If one language is updated to take advantage of a feature like transitional memory it does not help any of the other runtimes. Another example would be platform support. Not all of these runtimes support and are optimized for platforms like arm or PPC. Add support for method profiling and a tool to display it. Each language would do this themselves.
  6. One solution would be to move all of these languages to run on the JVM You get free platform support everywhere java is supported With great JIT and GC technology Production quality. There are thousands of applications running on java every day, many of which are running critical infrastructure
  7. Scala and groovy were implemented on the JVM and work well with in the JVM consrtaints
  8. The light blue components make up the core infrastructure that is required by the other feature components The core infrastructure can be consumed on its own to provide a portability layer Port library provides a platform agnostic API to get access to features like native memory allocation, file, io, etc The feature components have no required dependencies on other feature components You could just add the GC to your runtime or just add the JIT to another runtime Components may have optional features you can use. GC component has features like mark/sweep, compaction, generational copying, concurrent marking, etc.
  9. Sounds easy right? What is the language glue?
  10. This is the title of my talk.
  11. The GC allocates memory for the language and the language fills in the data
  12. What is the secret to decoupling our garbage collection technology from the JVM?
  13. None of these operations actually need to know the contents of the object
  14. With this little bit of data the GC can actually perform all of its required operations on objects
  15. By default when you enable to GC component you get 1 and 2. As you enable the other features it will require more language glue Also the language will have to obey components contracts by calling required APIs An example of such a contract would be having an object write barrier so that the GC can track object references for genernational and concurrent collectors
  16. All of the code for a feature is control via a compile time flag for that feature. Allows you to easily sprinkle as little or as much GC on your language
  17. 3 API. Object size, scan object and mark roots Language must implement object write barriers. Need the ability to track writes to objects Generational collector requires per object flags. The language object will need to be instrumented to include space for these flags Compaction and generational could only be supported if your language permits objects to move Compressed references could only be supported if your language controls fetching a field from an object via APIs and not directly in any c-extension. Effectively requires an object read barrier
  18. I would like to show you an example of integrating our portability layer and GC into CSOM CSOM is the c implementation of SOM SOM is minimal Smalltalk used for teaching Clarity of implementation over absolute performance
  19. Part of the core architecture was generic VM structures required by the feature components. That would be the VM and VMThread paramters. The Initialize_VM function creates and initializes all of the components configured to be used.
  20. Part of the core architecture was generic VM structures required by the feature components. That would be the VM and VMThread paramters. The Initialize_VM function creates and initializes all of the components configured to be used.
  21. CSOM relies on no GCs not interrupting certain operations. So if the free memory drops below the threshold and you are not in an uninterruptable state it forces a global collection.
  22. Delete all of the collection code and directly call global collection API
  23. Normally this would use an implementation of the ObjectSlotIterator which is part of the glue but to keep this simple I left it out
  24. Normally this would use an implementation of the ObjectSlotIterator which is part of the glue but to keep this simple I left it out
  25. CSOM provided this function which would mark the object as live and then call mark_references on itself. Instead we just mark the object and let GC work stack handle processing marked objects markObject will set a bit in the mark map for this object if it was not already marked and push it on the work stack to be processed.
  26. I have the complete changesets from this example which will be available on my GITHUB account once the toolkit has been open sourced. I will also be including the changes for adding compaction support and removing the requirement to not GC during object initialization
  27. This was free. There were no changes for this.
  28. This was free. There were no changes to the tool for this
  29. Neither language had JIT support before
  30. Neither had parallel GC before
  31. Neither had parallel GC before
  32. Neither had parallel GC before