SlideShare a Scribd company logo
Tail Call Elimination in Opensmalltalk
Matthew Ralston Dave Mason
Department of Computer Science
Ryerson University
c 2019 Matthew Ralston
Agenda
What is a Tail Call?
Tail Call Elimination
Stack Interpreter Implementation
Cog VM JIT Implementation
Results
Conclusions and Future Work
What is a Tail Call?
Call followed by a return
Smalltalk Example
Array class>>new: sizeRequested
^ self basicNew: sizeRequested
Call to basicNew: is a tail call
Immediately followed by a return
What is a Tail Call?
Call followed by a return
Smalltalk Example
Array class>>new: sizeRequested
^ self basicNew: sizeRequested
Call to basicNew: is a tail call
Immediately followed by a return
What is a Tail Call?
Call followed by a return
Smalltalk Example
Array class>>new: sizeRequested
^ self basicNew: sizeRequested
Call to basicNew: is a tail call
Immediately followed by a return
What is a Tail Call?
Call followed by a return
Smalltalk Example
Array class>>new: sizeRequested
^ self basicNew: sizeRequested
Call to basicNew: is a tail call
Immediately followed by a return
Tail call in Bytecode
Bytecode for Array class»new:
self
pushTemp: 0
send: basicNew:
returnTop
Calling new without TCE
Stack after calling new:
new:’s stack frame
new:’s argument
Sender of new:’s frame
Calling new without TCE
Stack after calling new:
new:’s stack frame
new:’s argument
Sender of new:’s frame
Calling new without TCE - cont.
Stack after calling basicNew:
basicNew:’s stack frame
basicNew:’s argument
new:’s stack frame
new:’s argument
Sender of new:’s frame
Calling new without TCE - cont.
Stack after calling basicNew:
basicNew:’s stack frame
basicNew:’s argument
new:’s stack frame
new:’s argument
Sender of new:’s frame
Calling new without TCE - cont.
Stack after returning from basicNew:
basicNew:’s result
new:’s stack frame
new:’s argument
Sender of new:’s frame
Calling new without TCE - cont.
Stack after returning from basicNew:
basicNew:’s result
new:’s stack frame
new:’s argument
Sender of new:’s frame
Calling new without TCE - cont.
Stack after returning from new:
new:’s result
Sender of new:’s frame
Calling new without TCE - cont.
Stack after returning from new:
new:’s result
Sender of new:’s frame
Tail Call Elimination
Why return to new:?
Why keep new:’s stack frame?
Tail Call Elimination
Why return to new:?
Why keep new:’s stack frame?
Calling new with TCE
new:’s stack frame
new:’s argument
Sender of new:’s frame
Calling new with TCE - cont’d
basicNew:’s stack frame
basicNew:’s argument
Sender of new:’s frame
Calling new with TCE - cont’d
basicNew:’s return
Sender of new:’s frame
Tail Recursion Elimination
Special Case of Tail Call Elimination
Recursive Call is also a Tail Call
Tail Recursion Elimination
Special Case of Tail Call Elimination
Recursive Call is also a Tail Call
Motivation
Well Known Optimization
Support in functional languages, CLR, etc.
Not supported in JVM, Python
Necessary for functional languages
Can be useful for OO as well
In common patterns like Visitor Pattern
Iteration in Smalltalk
Motivation
Well Known Optimization
Support in functional languages, CLR, etc.
Not supported in JVM, Python
Necessary for functional languages
Can be useful for OO as well
In common patterns like Visitor Pattern
Iteration in Smalltalk
Motivation
Well Known Optimization
Support in functional languages, CLR, etc.
Not supported in JVM, Python
Necessary for functional languages
Can be useful for OO as well
In common patterns like Visitor Pattern
Iteration in Smalltalk
Motivation
Well Known Optimization
Support in functional languages, CLR, etc.
Not supported in JVM, Python
Necessary for functional languages
Can be useful for OO as well
In common patterns like Visitor Pattern
Iteration in Smalltalk
Motivation
Well Known Optimization
Support in functional languages, CLR, etc.
Not supported in JVM, Python
Necessary for functional languages
Can be useful for OO as well
In common patterns like Visitor Pattern
Iteration in Smalltalk
Motivation
Well Known Optimization
Support in functional languages, CLR, etc.
Not supported in JVM, Python
Necessary for functional languages
Can be useful for OO as well
In common patterns like Visitor Pattern
Iteration in Smalltalk
Motivation
Well Known Optimization
Support in functional languages, CLR, etc.
Not supported in JVM, Python
Necessary for functional languages
Can be useful for OO as well
In common patterns like Visitor Pattern
Iteration in Smalltalk
Frequency of Tail Calls
Static Frequency
Platform Packages Tail Calls Total Percentage
Squeak - All 25162 407971 6.17
Squeak - Compiler 863 8747 9.87
Higher Dynamic Frequency
Action Tail Calls Total Percentage
Startup 47669 219054 21.76
Recompile 92041349 551250016 16.70
Frequency of Tail Calls
Static Frequency
Platform Packages Tail Calls Total Percentage
Squeak - All 25162 407971 6.17
Squeak - Compiler 863 8747 9.87
Higher Dynamic Frequency
Action Tail Calls Total Percentage
Startup 47669 219054 21.76
Recompile 92041349 551250016 16.70
Implementations
Stack Interpreter
Cog VM
Implementations
Stack Interpreter
Cog VM
Stack Interpreter
Interpreter only
Look ahead to next bytecode for return
Switch to tail call eliminating implementation
Remove the existing stack frame and arguments
Pushes the new arguments and calls the next method
Stack Interpreter
Interpreter only
Look ahead to next bytecode for return
Switch to tail call eliminating implementation
Remove the existing stack frame and arguments
Pushes the new arguments and calls the next method
Stack Interpreter
Interpreter only
Look ahead to next bytecode for return
Switch to tail call eliminating implementation
Remove the existing stack frame and arguments
Pushes the new arguments and calls the next method
Stack Interpreter
Interpreter only
Look ahead to next bytecode for return
Switch to tail call eliminating implementation
Remove the existing stack frame and arguments
Pushes the new arguments and calls the next method
Stack Interpreter
Interpreter only
Look ahead to next bytecode for return
Switch to tail call eliminating implementation
Remove the existing stack frame and arguments
Pushes the new arguments and calls the next method
Cog JIT Compiler
Not optimizing interpreted calls
JIT compile tail calls as jumps
Cost of tail call check moved to JIT compile time
Cog JIT Compiler
Not optimizing interpreted calls
JIT compile tail calls as jumps
Cost of tail call check moved to JIT compile time
Cog JIT Compiler
Not optimizing interpreted calls
JIT compile tail calls as jumps
Cost of tail call check moved to JIT compile time
Cog VM - Inline Caching
Cog VM - levels of inline caching
No Inline Cache
Monomorphic Send Sites
Polymorphic Send Sites
Megamorphic Send Sites
Cog VM - Inline Caching
Cog VM - levels of inline caching
No Inline Cache
Monomorphic Send Sites
Polymorphic Send Sites
Megamorphic Send Sites
Cog VM - Inline Caching
Cog VM - levels of inline caching
No Inline Cache
Monomorphic Send Sites
Polymorphic Send Sites
Megamorphic Send Sites
Cog VM - Inline Caching
Cog VM - levels of inline caching
No Inline Cache
Monomorphic Send Sites
Polymorphic Send Sites
Megamorphic Send Sites
Cog VM - Inline Caching
Cog VM - levels of inline caching
No Inline Cache
Monomorphic Send Sites
Polymorphic Send Sites
Megamorphic Send Sites
Cog VM - Inline Caching - cont.
Bypass for unlinked send sites
Activate for monomorphic send sites
Bypass for polymorphic and megamorphic send sites
Need tail call and non-tail call JIT code for each send
Copy method lookup code to sender in tail calls
Cog VM - Inline Caching - cont.
Bypass for unlinked send sites
Activate for monomorphic send sites
Bypass for polymorphic and megamorphic send sites
Need tail call and non-tail call JIT code for each send
Copy method lookup code to sender in tail calls
Cog VM - Inline Caching - cont.
Bypass for unlinked send sites
Activate for monomorphic send sites
Bypass for polymorphic and megamorphic send sites
Need tail call and non-tail call JIT code for each send
Copy method lookup code to sender in tail calls
Cog VM - Inline Caching - cont.
Bypass for unlinked send sites
Activate for monomorphic send sites
Bypass for polymorphic and megamorphic send sites
Need tail call and non-tail call JIT code for each send
Copy method lookup code to sender in tail calls
Cog VM - Inline Caching - cont.
Bypass for unlinked send sites
Activate for monomorphic send sites
Bypass for polymorphic and megamorphic send sites
Need tail call and non-tail call JIT code for each send
Copy method lookup code to sender in tail calls
Results
Tail Recursive Tests
Real World Tests
Results
Tail Recursive Tests
Real World Tests
Factorial 500 x 1000
si
sitce
cog
cogtce0
50
100
150
200
250
Time(milliseconds)
Version Mean %Imp %SD Std Dev Median
si 258.43 1.41 258.00
sitce 251.61 2.6 0.7 1.02 251.00
cog 223.18 15.46 217.00
cogtce 199.01 10.8 6.9 1.04 199.00
Factorial 5000
si
sitce
cog
cogtce
0
2,000
4,000
6,000
Time(milliseconds)
Version Mean %Imp %SD Std Dev Median
si 6284.60 12.52 6283.00
sitce 1372.40 78.2 0.4 21.88 1356.00
cog 6587.72 16.45 6591.00
cogtce 1333.28 79.8 0.5 27.36 1314.00
Factorial 5000 Memory
si
sitce
cog
cogtce
0
20
40
60
MemoryUsage(megabytes)
Version Mean %Imp %SD Std Dev Median
si 61.11 3.28 60.33
sitce 47.37 22.5 7.7 3.35 47.22
cog 61.92 6.17 59.50
cogtce 46.99 24.1 11.3 3.33 46.89
Compile All Execution
si
sitce
cog
cogtce0
50
100
150
Time(seconds)
Version Mean %Imp %SD Std Dev Median
si 136.49 2.30 135.52
sitce 129.68 5.0 1.7 0.33 129.60
cog 109.59 0.90 109.29
cogtce 105.86 3.4 0.9 0.45 105.84
Browse Number Class Execution
si
sitce
cog
cogtce0
500
1,000
1,500
2,000
Time(milliseconds)
Version Mean %Imp %SD Std Dev Median
si 1842.60 51.99 1850.00
sitce 1759.90 4.5 4.2 56.60 1754.00
cog 1115.40 62.26 1124.00
cogtce 1127.20 -1.1 7.5 55.21 1124.00
Method Analyzer Execution
si
sitce
cog
cogtce
0
200
400
600
800
1,000
1,200
Time(milliseconds)
Version Mean %Imp %SD Std Dev Median
si 1215.38 29.02 1200.00
sitce 1180.62 2.9 3.1 23.67 1169.00
cog 254.14 38.37 243.00
cogtce 247.10 2.8 21.1 37.33 237.00
Conclusions
Significant improvements in execution time for tail recursive cases
Improvements in execution time for most general applications
Memory usage is only significantly affected for deep recursive call
chains
Stack Interpreter outperforms Cog in some tests
Stack Interpreter supports polymorphic calls
Increased JIT compiled method size leads to overhead
Conclusions
Significant improvements in execution time for tail recursive cases
Improvements in execution time for most general applications
Memory usage is only significantly affected for deep recursive call
chains
Stack Interpreter outperforms Cog in some tests
Stack Interpreter supports polymorphic calls
Increased JIT compiled method size leads to overhead
Conclusions
Significant improvements in execution time for tail recursive cases
Improvements in execution time for most general applications
Memory usage is only significantly affected for deep recursive call
chains
Stack Interpreter outperforms Cog in some tests
Stack Interpreter supports polymorphic calls
Increased JIT compiled method size leads to overhead
Conclusions
Significant improvements in execution time for tail recursive cases
Improvements in execution time for most general applications
Memory usage is only significantly affected for deep recursive call
chains
Stack Interpreter outperforms Cog in some tests
Stack Interpreter supports polymorphic calls
Increased JIT compiled method size leads to overhead
Conclusions
Significant improvements in execution time for tail recursive cases
Improvements in execution time for most general applications
Memory usage is only significantly affected for deep recursive call
chains
Stack Interpreter outperforms Cog in some tests
Stack Interpreter supports polymorphic calls
Increased JIT compiled method size leads to overhead
Conclusions
Significant improvements in execution time for tail recursive cases
Improvements in execution time for most general applications
Memory usage is only significantly affected for deep recursive call
chains
Stack Interpreter outperforms Cog in some tests
Stack Interpreter supports polymorphic calls
Increased JIT compiled method size leads to overhead
Conclusions and Future Work
Support polymorphic caches (partially complete!)
Reduce redundant code generation for Cog
Conclusions and Future Work
Support polymorphic caches (partially complete!)
Reduce redundant code generation for Cog
Questions?

More Related Content

What's hot

A Taste of Pharo 7.0
A Taste of Pharo 7.0A Taste of Pharo 7.0
A Taste of Pharo 7.0
ESUG
 
Part II: LLVM Intermediate Representation
Part II: LLVM Intermediate RepresentationPart II: LLVM Intermediate Representation
Part II: LLVM Intermediate Representation
Wei-Ren Chen
 
PIL - A Platform Independent Language
PIL - A Platform Independent LanguagePIL - A Platform Independent Language
PIL - A Platform Independent Language
zefhemel
 
Jit complier
Jit complierJit complier
Jit complier
Kaya Ota
 
Test-driven language development
Test-driven language developmentTest-driven language development
Test-driven language development
lennartkats
 
Ola Bini Evolving The Java Platform
Ola Bini Evolving The Java PlatformOla Bini Evolving The Java Platform
Ola Bini Evolving The Java Platform
deimos
 
GraalVM - OpenSlava 2019-10-18
GraalVM - OpenSlava 2019-10-18GraalVM - OpenSlava 2019-10-18
GraalVM - OpenSlava 2019-10-18
Jorge Hidalgo
 
Php7
Php7Php7
Lecture 1 Compiler design , computation
Lecture 1 Compiler design , computation Lecture 1 Compiler design , computation
Lecture 1 Compiler design , computation
Rebaz Najeeb
 
Build Great Networked APIs with Swift, OpenAPI, and gRPC
Build Great Networked APIs with Swift, OpenAPI, and gRPCBuild Great Networked APIs with Swift, OpenAPI, and gRPC
Build Great Networked APIs with Swift, OpenAPI, and gRPC
Tim Burks
 
PHP Development Tools 2.0 - Success Story
PHP Development Tools 2.0 - Success StoryPHP Development Tools 2.0 - Success Story
PHP Development Tools 2.0 - Success Story
Michael Spector
 
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
Jung Kim
 
just in time JIT compiler
just in time JIT compilerjust in time JIT compiler
just in time JIT compiler
Mohit kumar
 
Yang in OpenDaylight
Yang in OpenDaylightYang in OpenDaylight
Yang in OpenDaylight
Gunjan Patel
 
Thesis - LLVM toolchain support as a plug-in for Eclipse CDT
Thesis - LLVM toolchain support as a plug-in for Eclipse CDTThesis - LLVM toolchain support as a plug-in for Eclipse CDT
Thesis - LLVM toolchain support as a plug-in for Eclipse CDT
TuononenP
 
Single Sourcing RCP and RAP
Single Sourcing RCP and RAPSingle Sourcing RCP and RAP
Single Sourcing RCP and RAP
Chris Aniszczyk
 
CocoaConf: The Language of Mobile Software is APIs
CocoaConf: The Language of Mobile Software is APIsCocoaConf: The Language of Mobile Software is APIs
CocoaConf: The Language of Mobile Software is APIs
Tim Burks
 
Lab3 s2
Lab3 s2Lab3 s2
Source-to-Source Compiler
Source-to-Source CompilerSource-to-Source Compiler
Source-to-Source Compiler
Mintoo Jakhmola
 
FOSDEM2016 - Ruby and OMR
FOSDEM2016 - Ruby and OMRFOSDEM2016 - Ruby and OMR
FOSDEM2016 - Ruby and OMR
Charlie Gracie
 

What's hot (20)

A Taste of Pharo 7.0
A Taste of Pharo 7.0A Taste of Pharo 7.0
A Taste of Pharo 7.0
 
Part II: LLVM Intermediate Representation
Part II: LLVM Intermediate RepresentationPart II: LLVM Intermediate Representation
Part II: LLVM Intermediate Representation
 
PIL - A Platform Independent Language
PIL - A Platform Independent LanguagePIL - A Platform Independent Language
PIL - A Platform Independent Language
 
Jit complier
Jit complierJit complier
Jit complier
 
Test-driven language development
Test-driven language developmentTest-driven language development
Test-driven language development
 
Ola Bini Evolving The Java Platform
Ola Bini Evolving The Java PlatformOla Bini Evolving The Java Platform
Ola Bini Evolving The Java Platform
 
GraalVM - OpenSlava 2019-10-18
GraalVM - OpenSlava 2019-10-18GraalVM - OpenSlava 2019-10-18
GraalVM - OpenSlava 2019-10-18
 
Php7
Php7Php7
Php7
 
Lecture 1 Compiler design , computation
Lecture 1 Compiler design , computation Lecture 1 Compiler design , computation
Lecture 1 Compiler design , computation
 
Build Great Networked APIs with Swift, OpenAPI, and gRPC
Build Great Networked APIs with Swift, OpenAPI, and gRPCBuild Great Networked APIs with Swift, OpenAPI, and gRPC
Build Great Networked APIs with Swift, OpenAPI, and gRPC
 
PHP Development Tools 2.0 - Success Story
PHP Development Tools 2.0 - Success StoryPHP Development Tools 2.0 - Success Story
PHP Development Tools 2.0 - Success Story
 
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
 
just in time JIT compiler
just in time JIT compilerjust in time JIT compiler
just in time JIT compiler
 
Yang in OpenDaylight
Yang in OpenDaylightYang in OpenDaylight
Yang in OpenDaylight
 
Thesis - LLVM toolchain support as a plug-in for Eclipse CDT
Thesis - LLVM toolchain support as a plug-in for Eclipse CDTThesis - LLVM toolchain support as a plug-in for Eclipse CDT
Thesis - LLVM toolchain support as a plug-in for Eclipse CDT
 
Single Sourcing RCP and RAP
Single Sourcing RCP and RAPSingle Sourcing RCP and RAP
Single Sourcing RCP and RAP
 
CocoaConf: The Language of Mobile Software is APIs
CocoaConf: The Language of Mobile Software is APIsCocoaConf: The Language of Mobile Software is APIs
CocoaConf: The Language of Mobile Software is APIs
 
Lab3 s2
Lab3 s2Lab3 s2
Lab3 s2
 
Source-to-Source Compiler
Source-to-Source CompilerSource-to-Source Compiler
Source-to-Source Compiler
 
FOSDEM2016 - Ruby and OMR
FOSDEM2016 - Ruby and OMRFOSDEM2016 - Ruby and OMR
FOSDEM2016 - Ruby and OMR
 

Similar to Tail Call Elimination in Open Smalltalk

From V8 to Modern Compilers
From V8 to Modern CompilersFrom V8 to Modern Compilers
From V8 to Modern Compilers
Min-Yih Hsu
 
Node.js - Advanced Basics
Node.js - Advanced BasicsNode.js - Advanced Basics
Node.js - Advanced Basics
Doug Jones
 
JVM Under The Hood WDI.pdf
JVM Under The Hood WDI.pdfJVM Under The Hood WDI.pdf
JVM Under The Hood WDI.pdf
Bartłomiej Żyliński
 
oVirt CI Package Managenent
oVirt CI Package ManagenentoVirt CI Package Managenent
oVirt CI Package Managenent
Barak Korren
 
Tuning and development with SIP Servlets on Mobicents
Tuning and development with SIP Servlets on MobicentsTuning and development with SIP Servlets on Mobicents
Tuning and development with SIP Servlets on Mobicents
Jean Deruelle
 
the grinder testing certification
the grinder testing certificationthe grinder testing certification
the grinder testing certification
Vskills
 
Pharo Optimising JIT Internals
Pharo Optimising JIT InternalsPharo Optimising JIT Internals
Pharo Optimising JIT Internals
ESUG
 
Android RenderScript on LLVM
Android RenderScript on LLVMAndroid RenderScript on LLVM
Android RenderScript on LLVM
John Lee
 
Introduction to JVM JIT Optimizations
Introduction to JVM JIT OptimizationsIntroduction to JVM JIT Optimizations
Introduction to JVM JIT Optimizations
diegosoftware
 
Kostiantyn Yelisavenko "Mastering Macro Benchmarking in .NET"
Kostiantyn Yelisavenko "Mastering Macro Benchmarking in .NET"Kostiantyn Yelisavenko "Mastering Macro Benchmarking in .NET"
Kostiantyn Yelisavenko "Mastering Macro Benchmarking in .NET"
LogeekNightUkraine
 
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
Fwdays
 
The value of reactive
The value of reactiveThe value of reactive
The value of reactive
Stéphane Maldini
 
The Value of Reactive
The Value of ReactiveThe Value of Reactive
The Value of Reactive
VMware Tanzu
 
Pyruvate, a reasonably fast, non-blocking, multithreaded WSGI server
Pyruvate, a reasonably fast, non-blocking, multithreaded WSGI serverPyruvate, a reasonably fast, non-blocking, multithreaded WSGI server
Pyruvate, a reasonably fast, non-blocking, multithreaded WSGI server
PloneFoundation
 
JRuby 9000 - Taipei Ruby User's Group 2015
JRuby 9000 - Taipei Ruby User's Group 2015JRuby 9000 - Taipei Ruby User's Group 2015
JRuby 9000 - Taipei Ruby User's Group 2015
Charles Nutter
 
Native Java with GraalVM
Native Java with GraalVMNative Java with GraalVM
Native Java with GraalVM
Sylvain Wallez
 
open sta testing Certification
open sta testing Certificationopen sta testing Certification
open sta testing Certification
Vskills
 
Clipper: A Low-Latency Online Prediction Serving System
Clipper: A Low-Latency Online Prediction Serving SystemClipper: A Low-Latency Online Prediction Serving System
Clipper: A Low-Latency Online Prediction Serving System
Databricks
 
Fisl - Deployment
Fisl - DeploymentFisl - Deployment
Fisl - Deployment
Fabio Akita
 
Kubernetes 1001
Kubernetes 1001Kubernetes 1001
Kubernetes 1001
HungWei Chiu
 

Similar to Tail Call Elimination in Open Smalltalk (20)

From V8 to Modern Compilers
From V8 to Modern CompilersFrom V8 to Modern Compilers
From V8 to Modern Compilers
 
Node.js - Advanced Basics
Node.js - Advanced BasicsNode.js - Advanced Basics
Node.js - Advanced Basics
 
JVM Under The Hood WDI.pdf
JVM Under The Hood WDI.pdfJVM Under The Hood WDI.pdf
JVM Under The Hood WDI.pdf
 
oVirt CI Package Managenent
oVirt CI Package ManagenentoVirt CI Package Managenent
oVirt CI Package Managenent
 
Tuning and development with SIP Servlets on Mobicents
Tuning and development with SIP Servlets on MobicentsTuning and development with SIP Servlets on Mobicents
Tuning and development with SIP Servlets on Mobicents
 
the grinder testing certification
the grinder testing certificationthe grinder testing certification
the grinder testing certification
 
Pharo Optimising JIT Internals
Pharo Optimising JIT InternalsPharo Optimising JIT Internals
Pharo Optimising JIT Internals
 
Android RenderScript on LLVM
Android RenderScript on LLVMAndroid RenderScript on LLVM
Android RenderScript on LLVM
 
Introduction to JVM JIT Optimizations
Introduction to JVM JIT OptimizationsIntroduction to JVM JIT Optimizations
Introduction to JVM JIT Optimizations
 
Kostiantyn Yelisavenko "Mastering Macro Benchmarking in .NET"
Kostiantyn Yelisavenko "Mastering Macro Benchmarking in .NET"Kostiantyn Yelisavenko "Mastering Macro Benchmarking in .NET"
Kostiantyn Yelisavenko "Mastering Macro Benchmarking in .NET"
 
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
 
The value of reactive
The value of reactiveThe value of reactive
The value of reactive
 
The Value of Reactive
The Value of ReactiveThe Value of Reactive
The Value of Reactive
 
Pyruvate, a reasonably fast, non-blocking, multithreaded WSGI server
Pyruvate, a reasonably fast, non-blocking, multithreaded WSGI serverPyruvate, a reasonably fast, non-blocking, multithreaded WSGI server
Pyruvate, a reasonably fast, non-blocking, multithreaded WSGI server
 
JRuby 9000 - Taipei Ruby User's Group 2015
JRuby 9000 - Taipei Ruby User's Group 2015JRuby 9000 - Taipei Ruby User's Group 2015
JRuby 9000 - Taipei Ruby User's Group 2015
 
Native Java with GraalVM
Native Java with GraalVMNative Java with GraalVM
Native Java with GraalVM
 
open sta testing Certification
open sta testing Certificationopen sta testing Certification
open sta testing Certification
 
Clipper: A Low-Latency Online Prediction Serving System
Clipper: A Low-Latency Online Prediction Serving SystemClipper: A Low-Latency Online Prediction Serving System
Clipper: A Low-Latency Online Prediction Serving System
 
Fisl - Deployment
Fisl - DeploymentFisl - Deployment
Fisl - Deployment
 
Kubernetes 1001
Kubernetes 1001Kubernetes 1001
Kubernetes 1001
 

More from ESUG

Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programming
ESUG
 
Technical documentation support in Pharo
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in Pharo
ESUG
 
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and Roadmap
ESUG
 
Sequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in Pharo
ESUG
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...
ESUG
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early results
ESUG
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
ESUG
 
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationA Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test Generation
ESUG
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic Programming
ESUG
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
ESUG
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience Report
ESUG
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIs
ESUG
 
Garbage Collector Tuning
Garbage Collector TuningGarbage Collector Tuning
Garbage Collector Tuning
ESUG
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
ESUG
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and Future
ESUG
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the Debugger
ESUG
 
Websockets for Fencing Score
Websockets for Fencing ScoreWebsockets for Fencing Score
Websockets for Fencing Score
ESUG
 
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ESUG
 
Advanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocAdvanced Object- Oriented Design Mooc
Advanced Object- Oriented Design Mooc
ESUG
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and Transformations
ESUG
 

More from ESUG (20)

Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programming
 
Technical documentation support in Pharo
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in Pharo
 
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and Roadmap
 
Sequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in Pharo
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early results
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
 
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationA Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test Generation
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic Programming
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience Report
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIs
 
Garbage Collector Tuning
Garbage Collector TuningGarbage Collector Tuning
Garbage Collector Tuning
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and Future
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the Debugger
 
Websockets for Fencing Score
Websockets for Fencing ScoreWebsockets for Fencing Score
Websockets for Fencing Score
 
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
 
Advanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocAdvanced Object- Oriented Design Mooc
Advanced Object- Oriented Design Mooc
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and Transformations
 

Recently uploaded

Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
Octavian Nadolu
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Julian Hyde
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
Sven Peters
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfTop Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
VALiNTRY360
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
Philip Schwarz
 
Lecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptxLecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptx
TaghreedAltamimi
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
Green Software Development
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
Hornet Dynamics
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
SQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure MalaysiaSQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure Malaysia
GohKiangHock
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
ICS
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
mz5nrf0n
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
Green Software Development
 

Recently uploaded (20)

Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfTop Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
 
Lecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptxLecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptx
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
SQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure MalaysiaSQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure Malaysia
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
 

Tail Call Elimination in Open Smalltalk

  • 1. Tail Call Elimination in Opensmalltalk Matthew Ralston Dave Mason Department of Computer Science Ryerson University c 2019 Matthew Ralston
  • 2. Agenda What is a Tail Call? Tail Call Elimination Stack Interpreter Implementation Cog VM JIT Implementation Results Conclusions and Future Work
  • 3. What is a Tail Call? Call followed by a return Smalltalk Example Array class>>new: sizeRequested ^ self basicNew: sizeRequested Call to basicNew: is a tail call Immediately followed by a return
  • 4. What is a Tail Call? Call followed by a return Smalltalk Example Array class>>new: sizeRequested ^ self basicNew: sizeRequested Call to basicNew: is a tail call Immediately followed by a return
  • 5. What is a Tail Call? Call followed by a return Smalltalk Example Array class>>new: sizeRequested ^ self basicNew: sizeRequested Call to basicNew: is a tail call Immediately followed by a return
  • 6. What is a Tail Call? Call followed by a return Smalltalk Example Array class>>new: sizeRequested ^ self basicNew: sizeRequested Call to basicNew: is a tail call Immediately followed by a return
  • 7. Tail call in Bytecode Bytecode for Array class»new: self pushTemp: 0 send: basicNew: returnTop
  • 8. Calling new without TCE Stack after calling new: new:’s stack frame new:’s argument Sender of new:’s frame
  • 9. Calling new without TCE Stack after calling new: new:’s stack frame new:’s argument Sender of new:’s frame
  • 10. Calling new without TCE - cont. Stack after calling basicNew: basicNew:’s stack frame basicNew:’s argument new:’s stack frame new:’s argument Sender of new:’s frame
  • 11. Calling new without TCE - cont. Stack after calling basicNew: basicNew:’s stack frame basicNew:’s argument new:’s stack frame new:’s argument Sender of new:’s frame
  • 12. Calling new without TCE - cont. Stack after returning from basicNew: basicNew:’s result new:’s stack frame new:’s argument Sender of new:’s frame
  • 13. Calling new without TCE - cont. Stack after returning from basicNew: basicNew:’s result new:’s stack frame new:’s argument Sender of new:’s frame
  • 14. Calling new without TCE - cont. Stack after returning from new: new:’s result Sender of new:’s frame
  • 15. Calling new without TCE - cont. Stack after returning from new: new:’s result Sender of new:’s frame
  • 16. Tail Call Elimination Why return to new:? Why keep new:’s stack frame?
  • 17. Tail Call Elimination Why return to new:? Why keep new:’s stack frame?
  • 18. Calling new with TCE new:’s stack frame new:’s argument Sender of new:’s frame
  • 19. Calling new with TCE - cont’d basicNew:’s stack frame basicNew:’s argument Sender of new:’s frame
  • 20. Calling new with TCE - cont’d basicNew:’s return Sender of new:’s frame
  • 21. Tail Recursion Elimination Special Case of Tail Call Elimination Recursive Call is also a Tail Call
  • 22. Tail Recursion Elimination Special Case of Tail Call Elimination Recursive Call is also a Tail Call
  • 23. Motivation Well Known Optimization Support in functional languages, CLR, etc. Not supported in JVM, Python Necessary for functional languages Can be useful for OO as well In common patterns like Visitor Pattern Iteration in Smalltalk
  • 24. Motivation Well Known Optimization Support in functional languages, CLR, etc. Not supported in JVM, Python Necessary for functional languages Can be useful for OO as well In common patterns like Visitor Pattern Iteration in Smalltalk
  • 25. Motivation Well Known Optimization Support in functional languages, CLR, etc. Not supported in JVM, Python Necessary for functional languages Can be useful for OO as well In common patterns like Visitor Pattern Iteration in Smalltalk
  • 26. Motivation Well Known Optimization Support in functional languages, CLR, etc. Not supported in JVM, Python Necessary for functional languages Can be useful for OO as well In common patterns like Visitor Pattern Iteration in Smalltalk
  • 27. Motivation Well Known Optimization Support in functional languages, CLR, etc. Not supported in JVM, Python Necessary for functional languages Can be useful for OO as well In common patterns like Visitor Pattern Iteration in Smalltalk
  • 28. Motivation Well Known Optimization Support in functional languages, CLR, etc. Not supported in JVM, Python Necessary for functional languages Can be useful for OO as well In common patterns like Visitor Pattern Iteration in Smalltalk
  • 29. Motivation Well Known Optimization Support in functional languages, CLR, etc. Not supported in JVM, Python Necessary for functional languages Can be useful for OO as well In common patterns like Visitor Pattern Iteration in Smalltalk
  • 30. Frequency of Tail Calls Static Frequency Platform Packages Tail Calls Total Percentage Squeak - All 25162 407971 6.17 Squeak - Compiler 863 8747 9.87 Higher Dynamic Frequency Action Tail Calls Total Percentage Startup 47669 219054 21.76 Recompile 92041349 551250016 16.70
  • 31. Frequency of Tail Calls Static Frequency Platform Packages Tail Calls Total Percentage Squeak - All 25162 407971 6.17 Squeak - Compiler 863 8747 9.87 Higher Dynamic Frequency Action Tail Calls Total Percentage Startup 47669 219054 21.76 Recompile 92041349 551250016 16.70
  • 34. Stack Interpreter Interpreter only Look ahead to next bytecode for return Switch to tail call eliminating implementation Remove the existing stack frame and arguments Pushes the new arguments and calls the next method
  • 35. Stack Interpreter Interpreter only Look ahead to next bytecode for return Switch to tail call eliminating implementation Remove the existing stack frame and arguments Pushes the new arguments and calls the next method
  • 36. Stack Interpreter Interpreter only Look ahead to next bytecode for return Switch to tail call eliminating implementation Remove the existing stack frame and arguments Pushes the new arguments and calls the next method
  • 37. Stack Interpreter Interpreter only Look ahead to next bytecode for return Switch to tail call eliminating implementation Remove the existing stack frame and arguments Pushes the new arguments and calls the next method
  • 38. Stack Interpreter Interpreter only Look ahead to next bytecode for return Switch to tail call eliminating implementation Remove the existing stack frame and arguments Pushes the new arguments and calls the next method
  • 39. Cog JIT Compiler Not optimizing interpreted calls JIT compile tail calls as jumps Cost of tail call check moved to JIT compile time
  • 40. Cog JIT Compiler Not optimizing interpreted calls JIT compile tail calls as jumps Cost of tail call check moved to JIT compile time
  • 41. Cog JIT Compiler Not optimizing interpreted calls JIT compile tail calls as jumps Cost of tail call check moved to JIT compile time
  • 42. Cog VM - Inline Caching Cog VM - levels of inline caching No Inline Cache Monomorphic Send Sites Polymorphic Send Sites Megamorphic Send Sites
  • 43. Cog VM - Inline Caching Cog VM - levels of inline caching No Inline Cache Monomorphic Send Sites Polymorphic Send Sites Megamorphic Send Sites
  • 44. Cog VM - Inline Caching Cog VM - levels of inline caching No Inline Cache Monomorphic Send Sites Polymorphic Send Sites Megamorphic Send Sites
  • 45. Cog VM - Inline Caching Cog VM - levels of inline caching No Inline Cache Monomorphic Send Sites Polymorphic Send Sites Megamorphic Send Sites
  • 46. Cog VM - Inline Caching Cog VM - levels of inline caching No Inline Cache Monomorphic Send Sites Polymorphic Send Sites Megamorphic Send Sites
  • 47. Cog VM - Inline Caching - cont. Bypass for unlinked send sites Activate for monomorphic send sites Bypass for polymorphic and megamorphic send sites Need tail call and non-tail call JIT code for each send Copy method lookup code to sender in tail calls
  • 48. Cog VM - Inline Caching - cont. Bypass for unlinked send sites Activate for monomorphic send sites Bypass for polymorphic and megamorphic send sites Need tail call and non-tail call JIT code for each send Copy method lookup code to sender in tail calls
  • 49. Cog VM - Inline Caching - cont. Bypass for unlinked send sites Activate for monomorphic send sites Bypass for polymorphic and megamorphic send sites Need tail call and non-tail call JIT code for each send Copy method lookup code to sender in tail calls
  • 50. Cog VM - Inline Caching - cont. Bypass for unlinked send sites Activate for monomorphic send sites Bypass for polymorphic and megamorphic send sites Need tail call and non-tail call JIT code for each send Copy method lookup code to sender in tail calls
  • 51. Cog VM - Inline Caching - cont. Bypass for unlinked send sites Activate for monomorphic send sites Bypass for polymorphic and megamorphic send sites Need tail call and non-tail call JIT code for each send Copy method lookup code to sender in tail calls
  • 54. Factorial 500 x 1000 si sitce cog cogtce0 50 100 150 200 250 Time(milliseconds) Version Mean %Imp %SD Std Dev Median si 258.43 1.41 258.00 sitce 251.61 2.6 0.7 1.02 251.00 cog 223.18 15.46 217.00 cogtce 199.01 10.8 6.9 1.04 199.00
  • 55. Factorial 5000 si sitce cog cogtce 0 2,000 4,000 6,000 Time(milliseconds) Version Mean %Imp %SD Std Dev Median si 6284.60 12.52 6283.00 sitce 1372.40 78.2 0.4 21.88 1356.00 cog 6587.72 16.45 6591.00 cogtce 1333.28 79.8 0.5 27.36 1314.00
  • 56. Factorial 5000 Memory si sitce cog cogtce 0 20 40 60 MemoryUsage(megabytes) Version Mean %Imp %SD Std Dev Median si 61.11 3.28 60.33 sitce 47.37 22.5 7.7 3.35 47.22 cog 61.92 6.17 59.50 cogtce 46.99 24.1 11.3 3.33 46.89
  • 57. Compile All Execution si sitce cog cogtce0 50 100 150 Time(seconds) Version Mean %Imp %SD Std Dev Median si 136.49 2.30 135.52 sitce 129.68 5.0 1.7 0.33 129.60 cog 109.59 0.90 109.29 cogtce 105.86 3.4 0.9 0.45 105.84
  • 58. Browse Number Class Execution si sitce cog cogtce0 500 1,000 1,500 2,000 Time(milliseconds) Version Mean %Imp %SD Std Dev Median si 1842.60 51.99 1850.00 sitce 1759.90 4.5 4.2 56.60 1754.00 cog 1115.40 62.26 1124.00 cogtce 1127.20 -1.1 7.5 55.21 1124.00
  • 59. Method Analyzer Execution si sitce cog cogtce 0 200 400 600 800 1,000 1,200 Time(milliseconds) Version Mean %Imp %SD Std Dev Median si 1215.38 29.02 1200.00 sitce 1180.62 2.9 3.1 23.67 1169.00 cog 254.14 38.37 243.00 cogtce 247.10 2.8 21.1 37.33 237.00
  • 60. Conclusions Significant improvements in execution time for tail recursive cases Improvements in execution time for most general applications Memory usage is only significantly affected for deep recursive call chains Stack Interpreter outperforms Cog in some tests Stack Interpreter supports polymorphic calls Increased JIT compiled method size leads to overhead
  • 61. Conclusions Significant improvements in execution time for tail recursive cases Improvements in execution time for most general applications Memory usage is only significantly affected for deep recursive call chains Stack Interpreter outperforms Cog in some tests Stack Interpreter supports polymorphic calls Increased JIT compiled method size leads to overhead
  • 62. Conclusions Significant improvements in execution time for tail recursive cases Improvements in execution time for most general applications Memory usage is only significantly affected for deep recursive call chains Stack Interpreter outperforms Cog in some tests Stack Interpreter supports polymorphic calls Increased JIT compiled method size leads to overhead
  • 63. Conclusions Significant improvements in execution time for tail recursive cases Improvements in execution time for most general applications Memory usage is only significantly affected for deep recursive call chains Stack Interpreter outperforms Cog in some tests Stack Interpreter supports polymorphic calls Increased JIT compiled method size leads to overhead
  • 64. Conclusions Significant improvements in execution time for tail recursive cases Improvements in execution time for most general applications Memory usage is only significantly affected for deep recursive call chains Stack Interpreter outperforms Cog in some tests Stack Interpreter supports polymorphic calls Increased JIT compiled method size leads to overhead
  • 65. Conclusions Significant improvements in execution time for tail recursive cases Improvements in execution time for most general applications Memory usage is only significantly affected for deep recursive call chains Stack Interpreter outperforms Cog in some tests Stack Interpreter supports polymorphic calls Increased JIT compiled method size leads to overhead
  • 66. Conclusions and Future Work Support polymorphic caches (partially complete!) Reduce redundant code generation for Cog
  • 67. Conclusions and Future Work Support polymorphic caches (partially complete!) Reduce redundant code generation for Cog