SlideShare a Scribd company logo
1 of 19
Diego Garbervetsky, LaFHIS, UBA, Argentina - Stefan Marr, JKU, Linz, Austria
Building Efficient and Highly Run-Time
Adaptable Virtual Machines
Guido Chari, LaFHIS, UBA, CONICET, Argentina
Fully-Reflective Execution Environments (FREE)
Every entity at both, the application and the VM-levels, must provide
reflective capabilities for its observation and modification at run time.
MOPFine-Grained Scoping
Global
Method
Object
point1.setX(2)
point2.setX(2)
point3.setX(2)
Read-only Example
def setX(arg)
x = arg
return x
Point 1
x
y
mo
Point 2
x
y
mo
Point 3
x
y
mo
def fieldWrite(field, value)
throw exception()
def fieldWrite(field, value)
def returnValue(val)
return val + 2
1
1
1
1
1
1
2
2
Ex
3
_NO_METAOBJECT
Starting Point
Extremely slow
Smalltalk interpreter!
Insights for optimizing
reflective systems
What are the fundamental performance overheads of a
FREE? How can we optimize them as much as possible?
def setX(arg)
x = arg
return x
Difference with Standard VMs
def IntercessionHandling(frame, operation){
if (getGlobalMetaobject(operation))
return delegateToGlobal(operation);
if (frame.getMetaobject(operation))
return delegateToFrame(operation);
if (rcvr().getMetaobject(operation))
return delegateToRcvr(operation);
executeOperationInVM;
}
It is hard for the compiler to speculate on the meta behavior because it can
not guess the current metaobject for each scope on each subsequent IH
4 Operations
1 Arg Read,
1 Field Write,
1 Field Read,
1 Return
Intercession
Handling (IH)
✤ Ubiquitous: every operation
must be intercepted.
✤ Complex: every interception
must consider scoping
conditions.
✤ Tests that depend on run-
time values and jeopardize
optimizations.
✤ Lookup and marshaling for
delegation to language-level.
Conjectures for
Optimization
✤ Stable Semantics: Moderated
dynamicity at run time.
✤ Low-local metavariability: IH
sites similar to call sites: most
monomorphic, some
polymorphic, few megamorphic.
Optimization Model
✤ Aggressive and exhaustive speculation of the meta-
model: speculate on each observed metaobject at
every scoping condition for every IH site.
✤ Mitigate as much as possible the overhead of the
speculation guards.
Rcvr
Speculate for Each Metaobject +
Scope + IH Site
def fieldWrite(field, value)
throw writeException()
def fieldWrite(field, value)
def returnValue(val)
return val + 2
def setX(arg)
x = arg
return x
def fieldWrite(field, value)
write in DB
def fieldRead(field)
read in DB
2
1
0
3
_NO_METAOBJECT
Field write
Read arg
Global Frame
30 1 0 1 2
0
Global Frame Rcvr
0 0 0
Observe the run-time behavior until become stable
Speculate For Each Metaobject +
Scope + IH Site
def fieldWrite(field, value)
throw writeException()
def fieldWrite(field, value);
def returnValue(val)
return val + 2
def setX(arg)
x = arg
return x
def fieldWrite(field, value)
write in DB
def fieldRead(field)
read in DB
2
1
0
3
_NO_METAOBJECT
Return
Field read
Global Frame Rcvr
0 0 20
Global Frame Rcvr
0 0 03
JIT Compiling the Fast Path
def IntercessionHandling(frame){
executeVMStandardArgRead Global Frame Rcvr
0 0 0
if (globalMO(writeField) == 3) write in DB;
else if (frameMO(writeField) == 1 or rcvr.MO(op) == 1)
throw writeException()
else if (rcvr.MO(writeField) == 2) Nop
else executeVMStandardWrite
Global Frame Rcvr
30 1 0 1 2
0
Global Frame Rcvr
0 0 03
if (globalMO(readField) == 3) read in DB
else executeVMStandardRead
Global Frame Rcvr
0 0 20
if (rcvr.MO(ret) == 2) return val + 2
else executeVMStandardReturn
}
Argument read
Field write
Field read
Return
Global and Frame scoping: optimizable.
Instance Scoping: still need to access memory
Mitigating Speculation Guards:
Metaobjects in Layouts
Shapes are usually needed in the context of a method
def setX(arg)
x = arg
return x
Global Frame Rcvr
0 0 0
Return
20,0 1,2
if (rcvr.shape == 1) return val + 2;
else executeVMStandardReturn
1
No extra memory access for instances
if (rcvr.MO(op) == 2) return val + 2
else executeVMStandardReturn
}
1
Inherent Peak Performance
Overhead
Mean peak performance overhead: Micro 0.97x
Baseline TruffleSOM: Truffle+ Graal: Java: ~2.7x (~V8)
TruffleMATE:
TruffleSOM +
MOP
(+) Inherent Peak Performance
Overhead
Mean peak performance overhead: Macro 1.02x
Overall peak
performance
overhead:
0.99x
Peak Performance of Using the VM
Reflective Capabilities Exhaustively
Baseline: TruffleMATE
Overall mean peak performance overhead: 1-3.4x
Breaking Assumptions
Mega 18.5x, Mono 1.10x
Severe performance degradation when assumptions do not
hold
i = 0
foreach (point in list)
i += point.x
Results
✤ Ran in most cases quite efficiently.
✤ Positive indicator for our
optimization model.
✤ Still room for improvements.
✤ High-local meta variability leads to
severe performance degradation.
Open Paths
✤ Go deeper into the VM (memory, garbage collection).
✤ Would a reflective compiler enable significant
improvements?
✤ Statistics such as code bloat, length of dispatch
chains, etc.
TruffleMATE: https://github.com/charig/truffleMate
Building Efficient and Highly Run-Time Adaptable Virtual Machines

More Related Content

What's hot

【論文紹介】Relay: A New IR for Machine Learning Frameworks
【論文紹介】Relay: A New IR for Machine Learning Frameworks【論文紹介】Relay: A New IR for Machine Learning Frameworks
【論文紹介】Relay: A New IR for Machine Learning FrameworksTakeo Imai
 
Q4.11: Using GCC Auto-Vectorizer
Q4.11: Using GCC Auto-VectorizerQ4.11: Using GCC Auto-Vectorizer
Q4.11: Using GCC Auto-VectorizerLinaro
 
Practical Two-level Homomorphic Encryption in Prime-order Bilinear Groups
Practical Two-level Homomorphic Encryption in Prime-order Bilinear GroupsPractical Two-level Homomorphic Encryption in Prime-order Bilinear Groups
Practical Two-level Homomorphic Encryption in Prime-order Bilinear GroupsMITSUNARI Shigeo
 
Fast Identification of Heavy Hitters by Cached and Packed Group Testing
Fast Identification of Heavy Hitters by Cached and Packed Group TestingFast Identification of Heavy Hitters by Cached and Packed Group Testing
Fast Identification of Heavy Hitters by Cached and Packed Group TestingRakuten Group, Inc.
 
Faster Practical Block Compression for Rank/Select Dictionaries
Faster Practical Block Compression for Rank/Select DictionariesFaster Practical Block Compression for Rank/Select Dictionaries
Faster Practical Block Compression for Rank/Select DictionariesRakuten Group, Inc.
 
Translating Classic Arcade Games to JavaScript
Translating Classic Arcade Games to JavaScriptTranslating Classic Arcade Games to JavaScript
Translating Classic Arcade Games to JavaScriptnorbert_kehrer
 
A compact zero knowledge proof to restrict message space in homomorphic encry...
A compact zero knowledge proof to restrict message space in homomorphic encry...A compact zero knowledge proof to restrict message space in homomorphic encry...
A compact zero knowledge proof to restrict message space in homomorphic encry...MITSUNARI Shigeo
 
Fast Wavelet Tree Construction in Practice
Fast Wavelet Tree Construction in PracticeFast Wavelet Tree Construction in Practice
Fast Wavelet Tree Construction in PracticeRakuten Group, Inc.
 
Java lejos-multithreading
Java lejos-multithreadingJava lejos-multithreading
Java lejos-multithreadingMr. Chanuwan
 
Happy To Use SIMD
Happy To Use SIMDHappy To Use SIMD
Happy To Use SIMDWei-Ta Wang
 
ICML2013読み会 Large-Scale Learning with Less RAM via Randomization
ICML2013読み会 Large-Scale Learning with Less RAM via RandomizationICML2013読み会 Large-Scale Learning with Less RAM via Randomization
ICML2013読み会 Large-Scale Learning with Less RAM via RandomizationHidekazu Oiwa
 
Autovectorization in llvm
Autovectorization in llvmAutovectorization in llvm
Autovectorization in llvmChangWoo Min
 
D vs OWKN Language at LLnagoya
D vs OWKN Language at LLnagoyaD vs OWKN Language at LLnagoya
D vs OWKN Language at LLnagoyaN Masahiro
 
C++ AMP 실천 및 적용 전략
C++ AMP 실천 및 적용 전략 C++ AMP 실천 및 적용 전략
C++ AMP 실천 및 적용 전략 명신 김
 
Implement a modified algorithm PF in a FPGA
Implement a modified algorithm PF in a FPGAImplement a modified algorithm PF in a FPGA
Implement a modified algorithm PF in a FPGABruno Martínez Bargiela
 
Java program-to-calculate-area-and-circumference-of-circle
Java program-to-calculate-area-and-circumference-of-circleJava program-to-calculate-area-and-circumference-of-circle
Java program-to-calculate-area-and-circumference-of-circleUniversity of Essex
 

What's hot (20)

【論文紹介】Relay: A New IR for Machine Learning Frameworks
【論文紹介】Relay: A New IR for Machine Learning Frameworks【論文紹介】Relay: A New IR for Machine Learning Frameworks
【論文紹介】Relay: A New IR for Machine Learning Frameworks
 
Q4.11: Using GCC Auto-Vectorizer
Q4.11: Using GCC Auto-VectorizerQ4.11: Using GCC Auto-Vectorizer
Q4.11: Using GCC Auto-Vectorizer
 
OpenMP
OpenMPOpenMP
OpenMP
 
Practical Two-level Homomorphic Encryption in Prime-order Bilinear Groups
Practical Two-level Homomorphic Encryption in Prime-order Bilinear GroupsPractical Two-level Homomorphic Encryption in Prime-order Bilinear Groups
Practical Two-level Homomorphic Encryption in Prime-order Bilinear Groups
 
Fast Identification of Heavy Hitters by Cached and Packed Group Testing
Fast Identification of Heavy Hitters by Cached and Packed Group TestingFast Identification of Heavy Hitters by Cached and Packed Group Testing
Fast Identification of Heavy Hitters by Cached and Packed Group Testing
 
Faster Practical Block Compression for Rank/Select Dictionaries
Faster Practical Block Compression for Rank/Select DictionariesFaster Practical Block Compression for Rank/Select Dictionaries
Faster Practical Block Compression for Rank/Select Dictionaries
 
R/C++ talk at earl 2014
R/C++ talk at earl 2014R/C++ talk at earl 2014
R/C++ talk at earl 2014
 
Translating Classic Arcade Games to JavaScript
Translating Classic Arcade Games to JavaScriptTranslating Classic Arcade Games to JavaScript
Translating Classic Arcade Games to JavaScript
 
A compact zero knowledge proof to restrict message space in homomorphic encry...
A compact zero knowledge proof to restrict message space in homomorphic encry...A compact zero knowledge proof to restrict message space in homomorphic encry...
A compact zero knowledge proof to restrict message space in homomorphic encry...
 
Fast Wavelet Tree Construction in Practice
Fast Wavelet Tree Construction in PracticeFast Wavelet Tree Construction in Practice
Fast Wavelet Tree Construction in Practice
 
Java lejos-multithreading
Java lejos-multithreadingJava lejos-multithreading
Java lejos-multithreading
 
Happy To Use SIMD
Happy To Use SIMDHappy To Use SIMD
Happy To Use SIMD
 
ICML2013読み会 Large-Scale Learning with Less RAM via Randomization
ICML2013読み会 Large-Scale Learning with Less RAM via RandomizationICML2013読み会 Large-Scale Learning with Less RAM via Randomization
ICML2013読み会 Large-Scale Learning with Less RAM via Randomization
 
OpenGL L06-Performance
OpenGL L06-PerformanceOpenGL L06-Performance
OpenGL L06-Performance
 
Autovectorization in llvm
Autovectorization in llvmAutovectorization in llvm
Autovectorization in llvm
 
Jan 2012 HUG: RHadoop
Jan 2012 HUG: RHadoopJan 2012 HUG: RHadoop
Jan 2012 HUG: RHadoop
 
D vs OWKN Language at LLnagoya
D vs OWKN Language at LLnagoyaD vs OWKN Language at LLnagoya
D vs OWKN Language at LLnagoya
 
C++ AMP 실천 및 적용 전략
C++ AMP 실천 및 적용 전략 C++ AMP 실천 및 적용 전략
C++ AMP 실천 및 적용 전략
 
Implement a modified algorithm PF in a FPGA
Implement a modified algorithm PF in a FPGAImplement a modified algorithm PF in a FPGA
Implement a modified algorithm PF in a FPGA
 
Java program-to-calculate-area-and-circumference-of-circle
Java program-to-calculate-area-and-circumference-of-circleJava program-to-calculate-area-and-circumference-of-circle
Java program-to-calculate-area-and-circumference-of-circle
 

Viewers also liked

Saludos queridos amigos
Saludos queridos amigosSaludos queridos amigos
Saludos queridos amigosbyron-kronos
 
Riesgos de la información electrónica pinto mileidy
Riesgos de la información electrónica pinto mileidyRiesgos de la información electrónica pinto mileidy
Riesgos de la información electrónica pinto mileidyyohana pinto
 
Cognitive Uncertainty: A Barrier to Better Project Risk Management
Cognitive Uncertainty: A Barrier to Better Project Risk ManagementCognitive Uncertainty: A Barrier to Better Project Risk Management
Cognitive Uncertainty: A Barrier to Better Project Risk ManagementDouglas Hutcheon, MBA
 
Linking evaluations to policy and governance igarashi asian_evaluation_week_2...
Linking evaluations to policy and governance igarashi asian_evaluation_week_2...Linking evaluations to policy and governance igarashi asian_evaluation_week_2...
Linking evaluations to policy and governance igarashi asian_evaluation_week_2...Food and Agriculture Organization (FAO)
 
32 club ecológico bio world
32  club ecológico bio world32  club ecológico bio world
32 club ecológico bio worlddec-admin
 
343.reciclando y separando
343.reciclando y separando343.reciclando y separando
343.reciclando y separandodec-admin
 
Vamos por un rinconcito feliz
Vamos por un rinconcito felizVamos por un rinconcito feliz
Vamos por un rinconcito felizdec-admin
 
El puercoespín mimoso meli rocha 1º1º
El puercoespín mimoso meli rocha 1º1ºEl puercoespín mimoso meli rocha 1º1º
El puercoespín mimoso meli rocha 1º1ºMeliRocha
 
Everyone is doing Re-targeting Wrong
Everyone is doing Re-targeting WrongEveryone is doing Re-targeting Wrong
Everyone is doing Re-targeting WrongJustin Brooke
 

Viewers also liked (12)

Saludos queridos amigos
Saludos queridos amigosSaludos queridos amigos
Saludos queridos amigos
 
Riesgos de la información electrónica pinto mileidy
Riesgos de la información electrónica pinto mileidyRiesgos de la información electrónica pinto mileidy
Riesgos de la información electrónica pinto mileidy
 
Cognitive Uncertainty: A Barrier to Better Project Risk Management
Cognitive Uncertainty: A Barrier to Better Project Risk ManagementCognitive Uncertainty: A Barrier to Better Project Risk Management
Cognitive Uncertainty: A Barrier to Better Project Risk Management
 
Smartphones
SmartphonesSmartphones
Smartphones
 
Linking evaluations to policy and governance igarashi asian_evaluation_week_2...
Linking evaluations to policy and governance igarashi asian_evaluation_week_2...Linking evaluations to policy and governance igarashi asian_evaluation_week_2...
Linking evaluations to policy and governance igarashi asian_evaluation_week_2...
 
32 club ecológico bio world
32  club ecológico bio world32  club ecológico bio world
32 club ecológico bio world
 
343.reciclando y separando
343.reciclando y separando343.reciclando y separando
343.reciclando y separando
 
Vamos por un rinconcito feliz
Vamos por un rinconcito felizVamos por un rinconcito feliz
Vamos por un rinconcito feliz
 
Banco de-lecturas-primer-ciclo-primaria
Banco de-lecturas-primer-ciclo-primariaBanco de-lecturas-primer-ciclo-primaria
Banco de-lecturas-primer-ciclo-primaria
 
El puercoespín mimoso meli rocha 1º1º
El puercoespín mimoso meli rocha 1º1ºEl puercoespín mimoso meli rocha 1º1º
El puercoespín mimoso meli rocha 1º1º
 
Everyone is doing Re-targeting Wrong
Everyone is doing Re-targeting WrongEveryone is doing Re-targeting Wrong
Everyone is doing Re-targeting Wrong
 
La modernización 1850 1930
La modernización 1850 1930 La modernización 1850 1930
La modernización 1850 1930
 

Similar to Building Efficient and Highly Run-Time Adaptable Virtual Machines

Building High-Performance Language Implementations With Low Effort
Building High-Performance Language Implementations With Low EffortBuilding High-Performance Language Implementations With Low Effort
Building High-Performance Language Implementations With Low EffortStefan Marr
 
ClojureScript loves React, DomCode May 26 2015
ClojureScript loves React, DomCode May 26 2015ClojureScript loves React, DomCode May 26 2015
ClojureScript loves React, DomCode May 26 2015Michiel Borkent
 
Beauty and the beast - Haskell on JVM
Beauty and the beast  - Haskell on JVMBeauty and the beast  - Haskell on JVM
Beauty and the beast - Haskell on JVMJarek Ratajski
 
Java Keeps Throttling Up!
Java Keeps Throttling Up!Java Keeps Throttling Up!
Java Keeps Throttling Up!José Paumard
 
Stranger in These Parts. A Hired Gun in the JS Corral (JSConf US 2012)
Stranger in These Parts. A Hired Gun in the JS Corral (JSConf US 2012)Stranger in These Parts. A Hired Gun in the JS Corral (JSConf US 2012)
Stranger in These Parts. A Hired Gun in the JS Corral (JSConf US 2012)Igalia
 
Groovy: to Infinity and Beyond -- JavaOne 2010 -- Guillaume Laforge
Groovy: to Infinity and Beyond -- JavaOne 2010 -- Guillaume LaforgeGroovy: to Infinity and Beyond -- JavaOne 2010 -- Guillaume Laforge
Groovy: to Infinity and Beyond -- JavaOne 2010 -- Guillaume LaforgeGuillaume Laforge
 
Pragmatic Optimization in Modern Programming - Demystifying the Compiler
Pragmatic Optimization in Modern Programming - Demystifying the CompilerPragmatic Optimization in Modern Programming - Demystifying the Compiler
Pragmatic Optimization in Modern Programming - Demystifying the CompilerMarina Kolpakova
 
Spark 4th Meetup Londond - Building a Product with Spark
Spark 4th Meetup Londond - Building a Product with SparkSpark 4th Meetup Londond - Building a Product with Spark
Spark 4th Meetup Londond - Building a Product with Sparksamthemonad
 
C++ exception handling
C++ exception handlingC++ exception handling
C++ exception handlingRay Song
 
Столпы функционального программирования для адептов ООП, Николай Мозговой
Столпы функционального программирования для адептов ООП, Николай МозговойСтолпы функционального программирования для адептов ООП, Николай Мозговой
Столпы функционального программирования для адептов ООП, Николай МозговойSigma Software
 
Deuce STM - CMP'09
Deuce STM - CMP'09Deuce STM - CMP'09
Deuce STM - CMP'09Guy Korland
 
RxJS101 - What you need to know to get started with RxJS tomorrow
RxJS101 - What you need to know to get started with RxJS tomorrowRxJS101 - What you need to know to get started with RxJS tomorrow
RxJS101 - What you need to know to get started with RxJS tomorrowViliam Elischer
 
JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?Doug Hawkins
 
User defined functions
User defined functionsUser defined functions
User defined functionsshubham_jangid
 

Similar to Building Efficient and Highly Run-Time Adaptable Virtual Machines (20)

Building High-Performance Language Implementations With Low Effort
Building High-Performance Language Implementations With Low EffortBuilding High-Performance Language Implementations With Low Effort
Building High-Performance Language Implementations With Low Effort
 
ClojureScript loves React, DomCode May 26 2015
ClojureScript loves React, DomCode May 26 2015ClojureScript loves React, DomCode May 26 2015
ClojureScript loves React, DomCode May 26 2015
 
Clojure And Swing
Clojure And SwingClojure And Swing
Clojure And Swing
 
Faster Python, FOSDEM
Faster Python, FOSDEMFaster Python, FOSDEM
Faster Python, FOSDEM
 
Beauty and the beast - Haskell on JVM
Beauty and the beast  - Haskell on JVMBeauty and the beast  - Haskell on JVM
Beauty and the beast - Haskell on JVM
 
Hadoop + Clojure
Hadoop + ClojureHadoop + Clojure
Hadoop + Clojure
 
Hw09 Hadoop + Clojure
Hw09   Hadoop + ClojureHw09   Hadoop + Clojure
Hw09 Hadoop + Clojure
 
Eta
EtaEta
Eta
 
Pune Clojure Course Outline
Pune Clojure Course OutlinePune Clojure Course Outline
Pune Clojure Course Outline
 
Java Keeps Throttling Up!
Java Keeps Throttling Up!Java Keeps Throttling Up!
Java Keeps Throttling Up!
 
Stranger in These Parts. A Hired Gun in the JS Corral (JSConf US 2012)
Stranger in These Parts. A Hired Gun in the JS Corral (JSConf US 2012)Stranger in These Parts. A Hired Gun in the JS Corral (JSConf US 2012)
Stranger in These Parts. A Hired Gun in the JS Corral (JSConf US 2012)
 
Groovy: to Infinity and Beyond -- JavaOne 2010 -- Guillaume Laforge
Groovy: to Infinity and Beyond -- JavaOne 2010 -- Guillaume LaforgeGroovy: to Infinity and Beyond -- JavaOne 2010 -- Guillaume Laforge
Groovy: to Infinity and Beyond -- JavaOne 2010 -- Guillaume Laforge
 
Pragmatic Optimization in Modern Programming - Demystifying the Compiler
Pragmatic Optimization in Modern Programming - Demystifying the CompilerPragmatic Optimization in Modern Programming - Demystifying the Compiler
Pragmatic Optimization in Modern Programming - Demystifying the Compiler
 
Spark 4th Meetup Londond - Building a Product with Spark
Spark 4th Meetup Londond - Building a Product with SparkSpark 4th Meetup Londond - Building a Product with Spark
Spark 4th Meetup Londond - Building a Product with Spark
 
C++ exception handling
C++ exception handlingC++ exception handling
C++ exception handling
 
Столпы функционального программирования для адептов ООП, Николай Мозговой
Столпы функционального программирования для адептов ООП, Николай МозговойСтолпы функционального программирования для адептов ООП, Николай Мозговой
Столпы функционального программирования для адептов ООП, Николай Мозговой
 
Deuce STM - CMP'09
Deuce STM - CMP'09Deuce STM - CMP'09
Deuce STM - CMP'09
 
RxJS101 - What you need to know to get started with RxJS tomorrow
RxJS101 - What you need to know to get started with RxJS tomorrowRxJS101 - What you need to know to get started with RxJS tomorrow
RxJS101 - What you need to know to get started with RxJS tomorrow
 
JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?
 
User defined functions
User defined functionsUser defined functions
User defined functions
 

Recently uploaded

Behavioral Disorder: Schizophrenia & it's Case Study.pdf
Behavioral Disorder: Schizophrenia & it's Case Study.pdfBehavioral Disorder: Schizophrenia & it's Case Study.pdf
Behavioral Disorder: Schizophrenia & it's Case Study.pdfSELF-EXPLANATORY
 
Grafana in space: Monitoring Japan's SLIM moon lander in real time
Grafana in space: Monitoring Japan's SLIM moon lander  in real timeGrafana in space: Monitoring Japan's SLIM moon lander  in real time
Grafana in space: Monitoring Japan's SLIM moon lander in real timeSatoshi NAKAHIRA
 
LIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptx
LIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptxLIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptx
LIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptxmalonesandreagweneth
 
Microphone- characteristics,carbon microphone, dynamic microphone.pptx
Microphone- characteristics,carbon microphone, dynamic microphone.pptxMicrophone- characteristics,carbon microphone, dynamic microphone.pptx
Microphone- characteristics,carbon microphone, dynamic microphone.pptxpriyankatabhane
 
Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.aasikanpl
 
RESPIRATORY ADAPTATIONS TO HYPOXIA IN HUMNAS.pptx
RESPIRATORY ADAPTATIONS TO HYPOXIA IN HUMNAS.pptxRESPIRATORY ADAPTATIONS TO HYPOXIA IN HUMNAS.pptx
RESPIRATORY ADAPTATIONS TO HYPOXIA IN HUMNAS.pptxFarihaAbdulRasheed
 
Best Call Girls In Sector 29 Gurgaon❤️8860477959 EscorTs Service In 24/7 Delh...
Best Call Girls In Sector 29 Gurgaon❤️8860477959 EscorTs Service In 24/7 Delh...Best Call Girls In Sector 29 Gurgaon❤️8860477959 EscorTs Service In 24/7 Delh...
Best Call Girls In Sector 29 Gurgaon❤️8860477959 EscorTs Service In 24/7 Delh...lizamodels9
 
Forest laws, Indian forest laws, why they are important
Forest laws, Indian forest laws, why they are importantForest laws, Indian forest laws, why they are important
Forest laws, Indian forest laws, why they are importantadityabhardwaj282
 
Call Girls in Aiims Metro Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Aiims Metro Delhi 💯Call Us 🔝9953322196🔝 💯Escort.Call Girls in Aiims Metro Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Aiims Metro Delhi 💯Call Us 🔝9953322196🔝 💯Escort.aasikanpl
 
Spermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatidSpermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatidSarthak Sekhar Mondal
 
Is RISC-V ready for HPC workload? Maybe?
Is RISC-V ready for HPC workload? Maybe?Is RISC-V ready for HPC workload? Maybe?
Is RISC-V ready for HPC workload? Maybe?Patrick Diehl
 
BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.
BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.
BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.PraveenaKalaiselvan1
 
Neurodevelopmental disorders according to the dsm 5 tr
Neurodevelopmental disorders according to the dsm 5 trNeurodevelopmental disorders according to the dsm 5 tr
Neurodevelopmental disorders according to the dsm 5 trssuser06f238
 
Manassas R - Parkside Middle School 🌎🏫
Manassas R - Parkside Middle School 🌎🏫Manassas R - Parkside Middle School 🌎🏫
Manassas R - Parkside Middle School 🌎🏫qfactory1
 
Speech, hearing, noise, intelligibility.pptx
Speech, hearing, noise, intelligibility.pptxSpeech, hearing, noise, intelligibility.pptx
Speech, hearing, noise, intelligibility.pptxpriyankatabhane
 
TOTAL CHOLESTEROL (lipid profile test).pptx
TOTAL CHOLESTEROL (lipid profile test).pptxTOTAL CHOLESTEROL (lipid profile test).pptx
TOTAL CHOLESTEROL (lipid profile test).pptxdharshini369nike
 
Transposable elements in prokaryotes.ppt
Transposable elements in prokaryotes.pptTransposable elements in prokaryotes.ppt
Transposable elements in prokaryotes.pptArshadWarsi13
 
Solution chemistry, Moral and Normal solutions
Solution chemistry, Moral and Normal solutionsSolution chemistry, Moral and Normal solutions
Solution chemistry, Moral and Normal solutionsHajira Mahmood
 
TOPIC 8 Temperature and Heat.pdf physics
TOPIC 8 Temperature and Heat.pdf physicsTOPIC 8 Temperature and Heat.pdf physics
TOPIC 8 Temperature and Heat.pdf physicsssuserddc89b
 

Recently uploaded (20)

Behavioral Disorder: Schizophrenia & it's Case Study.pdf
Behavioral Disorder: Schizophrenia & it's Case Study.pdfBehavioral Disorder: Schizophrenia & it's Case Study.pdf
Behavioral Disorder: Schizophrenia & it's Case Study.pdf
 
Grafana in space: Monitoring Japan's SLIM moon lander in real time
Grafana in space: Monitoring Japan's SLIM moon lander  in real timeGrafana in space: Monitoring Japan's SLIM moon lander  in real time
Grafana in space: Monitoring Japan's SLIM moon lander in real time
 
LIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptx
LIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptxLIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptx
LIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptx
 
Microphone- characteristics,carbon microphone, dynamic microphone.pptx
Microphone- characteristics,carbon microphone, dynamic microphone.pptxMicrophone- characteristics,carbon microphone, dynamic microphone.pptx
Microphone- characteristics,carbon microphone, dynamic microphone.pptx
 
Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
 
RESPIRATORY ADAPTATIONS TO HYPOXIA IN HUMNAS.pptx
RESPIRATORY ADAPTATIONS TO HYPOXIA IN HUMNAS.pptxRESPIRATORY ADAPTATIONS TO HYPOXIA IN HUMNAS.pptx
RESPIRATORY ADAPTATIONS TO HYPOXIA IN HUMNAS.pptx
 
Best Call Girls In Sector 29 Gurgaon❤️8860477959 EscorTs Service In 24/7 Delh...
Best Call Girls In Sector 29 Gurgaon❤️8860477959 EscorTs Service In 24/7 Delh...Best Call Girls In Sector 29 Gurgaon❤️8860477959 EscorTs Service In 24/7 Delh...
Best Call Girls In Sector 29 Gurgaon❤️8860477959 EscorTs Service In 24/7 Delh...
 
Forest laws, Indian forest laws, why they are important
Forest laws, Indian forest laws, why they are importantForest laws, Indian forest laws, why they are important
Forest laws, Indian forest laws, why they are important
 
Call Girls in Aiims Metro Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Aiims Metro Delhi 💯Call Us 🔝9953322196🔝 💯Escort.Call Girls in Aiims Metro Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Aiims Metro Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
 
Engler and Prantl system of classification in plant taxonomy
Engler and Prantl system of classification in plant taxonomyEngler and Prantl system of classification in plant taxonomy
Engler and Prantl system of classification in plant taxonomy
 
Spermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatidSpermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatid
 
Is RISC-V ready for HPC workload? Maybe?
Is RISC-V ready for HPC workload? Maybe?Is RISC-V ready for HPC workload? Maybe?
Is RISC-V ready for HPC workload? Maybe?
 
BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.
BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.
BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.
 
Neurodevelopmental disorders according to the dsm 5 tr
Neurodevelopmental disorders according to the dsm 5 trNeurodevelopmental disorders according to the dsm 5 tr
Neurodevelopmental disorders according to the dsm 5 tr
 
Manassas R - Parkside Middle School 🌎🏫
Manassas R - Parkside Middle School 🌎🏫Manassas R - Parkside Middle School 🌎🏫
Manassas R - Parkside Middle School 🌎🏫
 
Speech, hearing, noise, intelligibility.pptx
Speech, hearing, noise, intelligibility.pptxSpeech, hearing, noise, intelligibility.pptx
Speech, hearing, noise, intelligibility.pptx
 
TOTAL CHOLESTEROL (lipid profile test).pptx
TOTAL CHOLESTEROL (lipid profile test).pptxTOTAL CHOLESTEROL (lipid profile test).pptx
TOTAL CHOLESTEROL (lipid profile test).pptx
 
Transposable elements in prokaryotes.ppt
Transposable elements in prokaryotes.pptTransposable elements in prokaryotes.ppt
Transposable elements in prokaryotes.ppt
 
Solution chemistry, Moral and Normal solutions
Solution chemistry, Moral and Normal solutionsSolution chemistry, Moral and Normal solutions
Solution chemistry, Moral and Normal solutions
 
TOPIC 8 Temperature and Heat.pdf physics
TOPIC 8 Temperature and Heat.pdf physicsTOPIC 8 Temperature and Heat.pdf physics
TOPIC 8 Temperature and Heat.pdf physics
 

Building Efficient and Highly Run-Time Adaptable Virtual Machines

  • 1. Diego Garbervetsky, LaFHIS, UBA, Argentina - Stefan Marr, JKU, Linz, Austria Building Efficient and Highly Run-Time Adaptable Virtual Machines Guido Chari, LaFHIS, UBA, CONICET, Argentina
  • 2. Fully-Reflective Execution Environments (FREE) Every entity at both, the application and the VM-levels, must provide reflective capabilities for its observation and modification at run time. MOPFine-Grained Scoping Global Method Object
  • 3. point1.setX(2) point2.setX(2) point3.setX(2) Read-only Example def setX(arg) x = arg return x Point 1 x y mo Point 2 x y mo Point 3 x y mo def fieldWrite(field, value) throw exception() def fieldWrite(field, value) def returnValue(val) return val + 2 1 1 1 1 1 1 2 2 Ex 3 _NO_METAOBJECT
  • 4. Starting Point Extremely slow Smalltalk interpreter! Insights for optimizing reflective systems What are the fundamental performance overheads of a FREE? How can we optimize them as much as possible?
  • 5. def setX(arg) x = arg return x Difference with Standard VMs def IntercessionHandling(frame, operation){ if (getGlobalMetaobject(operation)) return delegateToGlobal(operation); if (frame.getMetaobject(operation)) return delegateToFrame(operation); if (rcvr().getMetaobject(operation)) return delegateToRcvr(operation); executeOperationInVM; } It is hard for the compiler to speculate on the meta behavior because it can not guess the current metaobject for each scope on each subsequent IH 4 Operations 1 Arg Read, 1 Field Write, 1 Field Read, 1 Return
  • 6. Intercession Handling (IH) ✤ Ubiquitous: every operation must be intercepted. ✤ Complex: every interception must consider scoping conditions. ✤ Tests that depend on run- time values and jeopardize optimizations. ✤ Lookup and marshaling for delegation to language-level.
  • 7. Conjectures for Optimization ✤ Stable Semantics: Moderated dynamicity at run time. ✤ Low-local metavariability: IH sites similar to call sites: most monomorphic, some polymorphic, few megamorphic.
  • 8. Optimization Model ✤ Aggressive and exhaustive speculation of the meta- model: speculate on each observed metaobject at every scoping condition for every IH site. ✤ Mitigate as much as possible the overhead of the speculation guards.
  • 9. Rcvr Speculate for Each Metaobject + Scope + IH Site def fieldWrite(field, value) throw writeException() def fieldWrite(field, value) def returnValue(val) return val + 2 def setX(arg) x = arg return x def fieldWrite(field, value) write in DB def fieldRead(field) read in DB 2 1 0 3 _NO_METAOBJECT Field write Read arg Global Frame 30 1 0 1 2 0 Global Frame Rcvr 0 0 0 Observe the run-time behavior until become stable
  • 10. Speculate For Each Metaobject + Scope + IH Site def fieldWrite(field, value) throw writeException() def fieldWrite(field, value); def returnValue(val) return val + 2 def setX(arg) x = arg return x def fieldWrite(field, value) write in DB def fieldRead(field) read in DB 2 1 0 3 _NO_METAOBJECT Return Field read Global Frame Rcvr 0 0 20 Global Frame Rcvr 0 0 03
  • 11. JIT Compiling the Fast Path def IntercessionHandling(frame){ executeVMStandardArgRead Global Frame Rcvr 0 0 0 if (globalMO(writeField) == 3) write in DB; else if (frameMO(writeField) == 1 or rcvr.MO(op) == 1) throw writeException() else if (rcvr.MO(writeField) == 2) Nop else executeVMStandardWrite Global Frame Rcvr 30 1 0 1 2 0 Global Frame Rcvr 0 0 03 if (globalMO(readField) == 3) read in DB else executeVMStandardRead Global Frame Rcvr 0 0 20 if (rcvr.MO(ret) == 2) return val + 2 else executeVMStandardReturn } Argument read Field write Field read Return Global and Frame scoping: optimizable. Instance Scoping: still need to access memory
  • 12. Mitigating Speculation Guards: Metaobjects in Layouts Shapes are usually needed in the context of a method def setX(arg) x = arg return x Global Frame Rcvr 0 0 0 Return 20,0 1,2 if (rcvr.shape == 1) return val + 2; else executeVMStandardReturn 1 No extra memory access for instances if (rcvr.MO(op) == 2) return val + 2 else executeVMStandardReturn } 1
  • 13. Inherent Peak Performance Overhead Mean peak performance overhead: Micro 0.97x Baseline TruffleSOM: Truffle+ Graal: Java: ~2.7x (~V8) TruffleMATE: TruffleSOM + MOP
  • 14. (+) Inherent Peak Performance Overhead Mean peak performance overhead: Macro 1.02x Overall peak performance overhead: 0.99x
  • 15. Peak Performance of Using the VM Reflective Capabilities Exhaustively Baseline: TruffleMATE Overall mean peak performance overhead: 1-3.4x
  • 16. Breaking Assumptions Mega 18.5x, Mono 1.10x Severe performance degradation when assumptions do not hold i = 0 foreach (point in list) i += point.x
  • 17. Results ✤ Ran in most cases quite efficiently. ✤ Positive indicator for our optimization model. ✤ Still room for improvements. ✤ High-local meta variability leads to severe performance degradation.
  • 18. Open Paths ✤ Go deeper into the VM (memory, garbage collection). ✤ Would a reflective compiler enable significant improvements? ✤ Statistics such as code bloat, length of dispatch chains, etc. TruffleMATE: https://github.com/charig/truffleMate

Editor's Notes

  1. Present myself and coauthors Next: background on FREE.
  2. Common arch: Two clear levels, application in top of Black-Box VM providing Semantics, Security, Optimizations, etc. Next: Interaction between levels.
  3. The VM interacts with the application. It must know its methods, its instances, modify their fields, etc. But the app usually has no possibility of affecting the VM behavior. So the division is more like a valve next: Our proposal, FREE.
  4. FREE allows this two-level interaction. However, the application can not do whatever it wants but a predefined API (MOPs) provides some kind of control. next: Summary of FREE, universal reflection + MOP + fine-grained scoping.
  5. This is a work about optimizing fully-reflective execution environments, a particular kind of VM we have been pushing in the last years. Summarizing, a FREE main characteristics is: Universal reflection. The flavor of FREE we have been exploring mediates the interaction between the application and the VM reflective capabilities with a special kind of API, very well known for reflective systems, a MOP. It also enables a very fine-grained scoping for VM-level redefinitions, so ideally a single instance should be able to customize how it is reclaimed from memory by the gc. Next: Example.
  6. Now a brief example for illustrating a FREE. Let’s consider we have 3 instances of Point, the first does not use reflective capabilities. The other two has different mos for implementing immutability. So let’s see how this works in the context of a very simple method that sets the x field and return its value. For point 1, it just sets 2 to x and return the value 2. For 2 it does nothing to x and throws an exception. For 3 it does nothing to x but returns 3 because the return value is also redefined. Next: Starting Point, a FREE Slow at Onward!.
  7. VMs must run fast. General Belief reflection is slow. FREE, Reflective VM with complex scoping conditions. Onwards show a FREE is feasible but slow! Next: Zero-overhead.
  8. We presented a prototype of a FREE at onward! last year implemented as an Smalltalk interpreter. It did not include any kind of compilation nor optimization and was prohibitively slow. At the same time we had Stefan’s work providing precise insights for optimizing reflective operations with dispatch chains, mainly at the language-level. next: Starting Line, Slow.
  9. Reflection at language-level can be fast. Mainly when variability is controlled. For VM just consider a tiny MOP. Far from an integral approach to VM reflection. Only behavioral. 10% inherent overhead, could it be improved? In the context of more complex scoping conditions?. No experimentation for redefining behavior application-wise. No optimizations model presented. Next: The Problem for slowness, IH.
  10. So I return to the same method for illustrating the fundamental difference regarding performance between a standard VM and a FREE. Considering only the execution of statements, we have 4 VM operations in a very simple method. A standard VM only has to decode the operation and execute the corresponding code. Instead, a FREE must execute always an IH first. Although subsequent executions of the IH may repeat the same tests, it is hard for a compiler to speculate and optimize the meta-behavior. It could not guess that metaobjects will not change for subsequent executions. Next: Summary of IH.
  11. IH ubiquitous and complex. Proliferation of tests depending on run-time values. In case of redefinitions, lookup and marshalling from VM to language and backwards. Next: Conjectures for optimization.
  12. 4.6x Inherent. This seems already quite good. Evidently, there is lot of repetition and simple comparisons in the IH. However 4.6 is still prohibitive for a sensible approach competing with standard VMs. On the other hand, using the reflective capabilities is prohibitive. Next: The meta-variability problem.
  13. FREEs enables to freely change metaobjects. A comp cannot make assumptions about the meta-level. Prevents optimizations. Example: code that accesses the mo of an object multiple times -> optimizations such as inlining may not be generally applicable any longer -> proliferation of indirections. next: Conjectures for Opt: stable semantics + low-local metavar.
  14. After our analysis of the fundamental performance overheads, we designed and implemented an optimization model for a FREE. We know from the experience obtained by dynamic systems that they need to make assumptions and optimize for the most common patterns of execution. This is because it is hard to reason about and optimize frequently changing and variable behavior. In case assumptions do not hold they ensure semantics by switching to a non optimized path. Analogously, our assumptions are: don’t expect mo to be changed often. In very rare cases many observed metaobjects will make an IH site megamorphic. Next: Optimization model -> Speculation.
  15. So, based on the aforementioned assumptions, our optimization model follows the following two main ideas: Aggressive and exhaustive speculation. Since this kind of speculation leads to a proliferation of guards to ensure sound semantics, we also want to mitigate their performance cost as much as possible. Next: Implementation high-level example.
  16. For a matter of time, I will go for a very simplified example of our model, it is just to give a big picture of our main insights. More details can be found in the paper. So, lets return once more to the setX method. I incorporate a third mo for doing persistence in a db. So, speculation depends on warming up, i.e, analyzing and caching special values of the behavior of the system for a long time, and when the system becomes stable optimize for the observed variability. Let's assume we already ran for a long-time and arrived to a stable point with these observed values for each IH site. First statement x= arg. Read arg no mo anywhere. Field write a particular combination for every different scope. Next: Second statement, return x.
  17. Second statement return x. 1 return redefinition in mo 2. Field read for persistence in DB 3. Next: Compilation stage, compiling fast path VM execution.
  18. Since we already know the operation and the meta object we know the method redefining it and we can, for instance, inline the operation and save all the delegation overheads. In addition, the compiler could factor out guards, mainly when considering frame and global guards. But we still have guards accessing memory and executing pointer equality tests. A compiler may factor out some repetitions, but, could we do better? Next: Problem of guards with receivers.
  19. Previous speculation resolves a lot. But the guards still are costly. For the global and frame we can assume that if we inline several subsequent IHs they could be factored. But the receivers may be more and also the cost to access them. next: Metaobjects in Layouts.
  20. It is common to represent objects in some OO platforms as subsequent blocks of memory and a shape describing its contents. Shapes are almost always needed for the VM to execute methods, access the class of instances for dispatching, accessing state, etc. If we put the mo in the shape, we can cache the shape + meta object, but guard only on the shape which is free. Next: Validation, Research Questions.
  21. In most OO platforms, it is common to represent objects as subsequent blocks of memory and a shape describing its contents. Also it is common that shapes are almost always needed for the VM to execute methods, access the class of instances for dispatching, accessing state, etc. If we put the mo in the shape, we can cache the shape + meta object, but guard only on the shape which is free. Next: Validation, Research Questions.
  22. next: RQ1 Inherent (micro benchs) + brief presentation of TruffleSOM/TruffleMATE.
  23. We gathered TruffleSOM an efficient VM in the same order of performance of V8, and we extend it to be a FREE for Smalltalk. We then compare the performance of running the same set of benchmarks in both VMs. In this experiment, the benchmarks do not use the meta model so we are just measuring the fundamental cost of adding the IH ubiquitously. Results: our VM ran even slightly faster. next: RQ1 + Macro.
  24. DeltaBlue more sensitive to the inlining parameters of the Graal compiler. Also made heavy use of operations on primitive types. next: RQ2 Individual + Mega/Mono.
  25. Next: RQ3, Using the meta-level: Read-only + Tracing.
  26. We also measure the performance overheads of scattering metaobjects through the whole application. We trace all the method activations of some micro and macro benchmarks. The baselines are the plain benchmarks, so the overheads include the cost of the counting logic in all activations. The results show the overheads are considerably low, ranging from 1x to 3.4x. The worst is DeltaBlue that we already mentioned present some challenges for our compiler and also executes a lot of primitive operations. Next: Breaking assumptions.
  27. Next: Breaking assumptions.
  28. Finally we decided to validate if our assumptions were sensible. We design a benchmark that walks through a list of point instances and accumulate the value of the x field. In one scenario all the point instances have the same metaobject redefining the field read. In the other, each instance has a different metaobject. So we measure the difference between a mono and a megamorphic IH site. The results valide that breaking our assumptions of low-local metavariability leads to a severe performance degradation. Next: Conclusions.
  29. Our experiments refute the general belief of slow reflection for low-level components and opens the door for more experimentation. Nonetheless, results such as those for DeltaBlue showed that there is still room for improvements. Next: Open Paths and Questions.
  30. Compiler -> Customization of compilation/inlining thresholds/ Adaptation of the structure and length of dispatch chains. Decide whether an optimization should be based on runtime or compile-time checks. Explicitly disable or < degree of dynamicity supported by a MOP Finish