SlideShare una empresa de Scribd logo
1 de 31
Descargar para leer sin conexión
Virtual CPU 
ESUG, Cambridge 2014 
By Igor Stasenko & Max Mattone 
RMod, Inria 
Wednesday, August 20, 14
Highlights 
• What? 
• Why? 
• How? 
• Demo 
• To Do 
Wednesday, August 20, 14
What is VCpu? 
• a framework to write low-level code 
• can simulate & generate machine code 
• multiple backends for ARM, x86/x64 
code generation 
• 100% implemented in smalltalk 
Wednesday, August 20, 14
What is VCpu NOT 
• NOT a full-fledged compiler with 
numerous data “types”, like GCC/ 
LLVM 
• NO direct support of calling 
convention(s) 
• it is a bare-bone model of computer 
with CPU & memory.. to build on top of 
it 
Wednesday, August 20, 14
Requirements 
• expressive power of smalltalk 
• malleable 
• extensible 
• simple 
• yet powerful 
Wednesday, August 20, 14
Architecture 
Platform neutral 
RTL VCPU Interface 
Simulating CPU Generating CPU 
Low-level intermediate 
Liveness analysis 
Register allocation 
Optimizations 
AsmJIT 
Platform dependent 
Wednesday, August 20, 14
Why 
• there’s no low-level compilers for 
smalltalk 
• on inventing own wheel: adapting 
existing solutions costly as (h/w)ell 
• lets us learn as we do it 
Wednesday, August 20, 14
Don’t mode me in 
Implementing low-level semantic 
Idea Smalltalk Slang C Machine 
Idea Machine 
Wednesday, August 20, 14
A more correct picture 
Idea Machine 
Wednesday, August 20, 14
At the end of the day 
memory at: x put: y 
So, tell me, why you have to be expert in 10+ 
disciplines to do that? 
Wednesday, August 20, 14
There must be a better 
way 
• i was looking for a nice & simple 
solution since 2006 
• VCpu interface, is product of number 
of painful attempts to get there 
• Now i am pleased (almost). 
Wednesday, August 20, 14
How 
• imperative rather than declarative 
• coding with VCpu is just plain 
smalltalk 
Wednesday, August 20, 14
Imperative 
• you don’t ‘compile’ or translate code, 
you just execute own code istructing 
CPU what to do: cpu doThat 
Wednesday, August 20, 14
Dual nature 
• can be either simulated or generating 
machine code, just use different CPU 
• you free to choose any style you want 
to program it 
Wednesday, August 20, 14
Machine word 
• a facade object representing a virtual 
CPU register/variable (machine word) 
• it easy to manipulate with, since one 
can define a usual arithmetic 
operations, like #+ , #- , #*, #/ etc.. 
• serves as a basis of VCpu ‘DSL’ 
Wednesday, August 20, 14
Lets learn a new DSL 
Wednesday, August 20, 14
Step 1. Creating a new 
machine word 
word := cpu word: 10. 
Wednesday, August 20, 14
Step 2. Assigning new 
value to existing one 
word1 := cpu word: 10. 
word2 := cpu word: 4. 
... 
word2 value: word1. 
Right 
word2 := word1. Wrong!!! 
Wednesday, August 20, 14
Step 3. Arithmetic 
expressions 
word := x + y bitAnd: z 
just keep in mind, it is not ‘school’ but ‘CPU’ math 
Wednesday, August 20, 14
Step 3. Arithmetic 
expressions 
the result of expression is 
always new machine word 
word := x + y bitAnd: z 
just keep in mind, maybe you wanted: 
word value: x + y bitAnd: z 
... instead 
Wednesday, August 20, 14
Step 3. Arithmetic 
expressions 
.. expressions can be intermixed with regular 
constants 
word := x + 5 
as long as receiver is machine word 
Wednesday, August 20, 14
Step 4. Memory access 
word := address loadWord 
address writeWord: x 
Wednesday, August 20, 14
Step 5. Comparisons/ 
control flow 
a>b ifTrue: [..] ifFalse: [..] 
a to: b do: [:i |..] 
x timesRepeat: [ .. ] 
Looks familiar? 
Wednesday, August 20, 14
Thanks, we have Opal 
• disable inlining (ifTrue:/to:do: ..etc) 
expression ifTrue: [..] ifFalse: [..] 
mustBeABoolean 
this is Sparta Pharo! 
Wednesday, August 20, 14
Step 6. Call/return 
address call 
cpu return. 
cpu return: x ** 
** requires a notion of calling convention 
Wednesday, August 20, 14
End of tutorial 
Wednesday, August 20, 14
NativeBoost integration 
abs: x 
NativeBoost-style callout 
<primitive: #primitiveNativeCall module: #NativeBoostPlugin> 
^ self nbCallout 
function: #( int abs (int x ) ) 
module: NativeBoost CLibrary 
VCpu-style callout 
? 
Wednesday, August 20, 14
NativeBoost integration 
abs: x 
NativeBoost-style callout 
<primitive: #primitiveNativeCall module: #NativeBoostPlugin> 
^ self nbCallout 
function: #( int abs (int x ) ) 
module: NativeBoost CLibrary 
abs: x 
VCpu-style callout 
<primitive: #primitiveNativeCall module: #NativeBoostPlugin> 
^ self nbCallout 
function: #( int abs (int x ) ) 
module: NativeBoost CLibrary 
this is Sparta Pharo! 
Wednesday, August 20, 14
Demo 
Wednesday, August 20, 14
To Do 
• Finish optimizations 
• Test ARM Support (on real hardware) 
• Complete NativeBoost VCpu 
implementation 
• Documentation 
• Look forward for Spur integration 
Wednesday, August 20, 14
? 
Wednesday, August 20, 14

Más contenido relacionado

Similar a Virtual CPU

How to make a large C++-code base manageable
How to make a large C++-code base manageableHow to make a large C++-code base manageable
How to make a large C++-code base manageablecorehard_by
 
Metasepi team meeting #20: Start! ATS programming on MCU
Metasepi team meeting #20: Start! ATS programming on MCUMetasepi team meeting #20: Start! ATS programming on MCU
Metasepi team meeting #20: Start! ATS programming on MCUKiwamu Okabe
 
Raspberry pi performace and program by open cv
Raspberry pi performace and program by open cvRaspberry pi performace and program by open cv
Raspberry pi performace and program by open cvKazuhiko Inaba
 
Intro to the raspberry pi board
Intro to the raspberry pi boardIntro to the raspberry pi board
Intro to the raspberry pi boardThierry Gayet
 
Introduction to Raspberry Pi and GPIO
Introduction to Raspberry Pi and GPIOIntroduction to Raspberry Pi and GPIO
Introduction to Raspberry Pi and GPIOKris Findlay
 
Do It With SQL - Journey to the Center of Database Worlds
Do It With SQL - Journey to the Center of Database WorldsDo It With SQL - Journey to the Center of Database Worlds
Do It With SQL - Journey to the Center of Database WorldsNur Hidayat
 
IoT Development from Software Developer Perspective
IoT Development from Software Developer PerspectiveIoT Development from Software Developer Perspective
IoT Development from Software Developer PerspectiveAndri Yadi
 
Programming the Real World: Javascript for Makers
Programming the Real World: Javascript for MakersProgramming the Real World: Javascript for Makers
Programming the Real World: Javascript for Makerspchristensen
 
Intro - End to end ML with Kubeflow @ SignalConf 2018
Intro - End to end ML with Kubeflow @ SignalConf 2018Intro - End to end ML with Kubeflow @ SignalConf 2018
Intro - End to end ML with Kubeflow @ SignalConf 2018Holden Karau
 
Simple ETL in python 3.5+ with Bonobo - PyParis 2017
Simple ETL in python 3.5+ with Bonobo - PyParis 2017Simple ETL in python 3.5+ with Bonobo - PyParis 2017
Simple ETL in python 3.5+ with Bonobo - PyParis 2017Romain Dorgueil
 
Simple ETL in python 3.5+ with Bonobo, Romain Dorgueil
Simple ETL in python 3.5+ with Bonobo, Romain DorgueilSimple ETL in python 3.5+ with Bonobo, Romain Dorgueil
Simple ETL in python 3.5+ with Bonobo, Romain DorgueilPôle Systematic Paris-Region
 
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015Windows Developer
 
Tetuan Valley Startup School presentation
Tetuan Valley Startup School presentationTetuan Valley Startup School presentation
Tetuan Valley Startup School presentationKubide
 
第5回SCDN - Ruby Summer of Code: NArray on OpenCL
第5回SCDN - Ruby Summer of Code: NArray on OpenCL第5回SCDN - Ruby Summer of Code: NArray on OpenCL
第5回SCDN - Ruby Summer of Code: NArray on OpenCLscdn
 
EuroPython 2017 - Bonono - Simple ETL in python 3.5+
EuroPython 2017 - Bonono - Simple ETL in python 3.5+EuroPython 2017 - Bonono - Simple ETL in python 3.5+
EuroPython 2017 - Bonono - Simple ETL in python 3.5+Romain Dorgueil
 
Puppet Keynote
Puppet KeynotePuppet Keynote
Puppet KeynotePuppet
 

Similar a Virtual CPU (20)

How to make a large C++-code base manageable
How to make a large C++-code base manageableHow to make a large C++-code base manageable
How to make a large C++-code base manageable
 
Automate Yo' Self
Automate Yo' SelfAutomate Yo' Self
Automate Yo' Self
 
Metasepi team meeting #20: Start! ATS programming on MCU
Metasepi team meeting #20: Start! ATS programming on MCUMetasepi team meeting #20: Start! ATS programming on MCU
Metasepi team meeting #20: Start! ATS programming on MCU
 
Raspberry pi performace and program by open cv
Raspberry pi performace and program by open cvRaspberry pi performace and program by open cv
Raspberry pi performace and program by open cv
 
Cheap HPC
Cheap HPCCheap HPC
Cheap HPC
 
Intro to the raspberry pi board
Intro to the raspberry pi boardIntro to the raspberry pi board
Intro to the raspberry pi board
 
Introduction to Raspberry Pi and GPIO
Introduction to Raspberry Pi and GPIOIntroduction to Raspberry Pi and GPIO
Introduction to Raspberry Pi and GPIO
 
Do It With SQL - Journey to the Center of Database Worlds
Do It With SQL - Journey to the Center of Database WorldsDo It With SQL - Journey to the Center of Database Worlds
Do It With SQL - Journey to the Center of Database Worlds
 
IoT Development from Software Developer Perspective
IoT Development from Software Developer PerspectiveIoT Development from Software Developer Perspective
IoT Development from Software Developer Perspective
 
Programming the Real World: Javascript for Makers
Programming the Real World: Javascript for MakersProgramming the Real World: Javascript for Makers
Programming the Real World: Javascript for Makers
 
Intro - End to end ML with Kubeflow @ SignalConf 2018
Intro - End to end ML with Kubeflow @ SignalConf 2018Intro - End to end ML with Kubeflow @ SignalConf 2018
Intro - End to end ML with Kubeflow @ SignalConf 2018
 
Simple ETL in python 3.5+ with Bonobo - PyParis 2017
Simple ETL in python 3.5+ with Bonobo - PyParis 2017Simple ETL in python 3.5+ with Bonobo - PyParis 2017
Simple ETL in python 3.5+ with Bonobo - PyParis 2017
 
Simple ETL in python 3.5+ with Bonobo, Romain Dorgueil
Simple ETL in python 3.5+ with Bonobo, Romain DorgueilSimple ETL in python 3.5+ with Bonobo, Romain Dorgueil
Simple ETL in python 3.5+ with Bonobo, Romain Dorgueil
 
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015
 
Um2010
Um2010Um2010
Um2010
 
Tetuan Valley Startup School presentation
Tetuan Valley Startup School presentationTetuan Valley Startup School presentation
Tetuan Valley Startup School presentation
 
Tetuan Valley Startup School Presentation
Tetuan Valley Startup School PresentationTetuan Valley Startup School Presentation
Tetuan Valley Startup School Presentation
 
第5回SCDN - Ruby Summer of Code: NArray on OpenCL
第5回SCDN - Ruby Summer of Code: NArray on OpenCL第5回SCDN - Ruby Summer of Code: NArray on OpenCL
第5回SCDN - Ruby Summer of Code: NArray on OpenCL
 
EuroPython 2017 - Bonono - Simple ETL in python 3.5+
EuroPython 2017 - Bonono - Simple ETL in python 3.5+EuroPython 2017 - Bonono - Simple ETL in python 3.5+
EuroPython 2017 - Bonono - Simple ETL in python 3.5+
 
Puppet Keynote
Puppet KeynotePuppet Keynote
Puppet Keynote
 

Más de 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 programmingESUG
 
Technical documentation support in Pharo
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in PharoESUG
 
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 RoadmapESUG
 
Sequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoESUG
 
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 resultsESUG
 
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 6ESUG
 
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 GenerationESUG
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingESUG
 
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 ModesESUG
 
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 ReportESUG
 
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 APIsESUG
 
Garbage Collector Tuning
Garbage Collector TuningGarbage Collector Tuning
Garbage Collector TuningESUG
 
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 CaseESUG
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FutureESUG
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the DebuggerESUG
 
Websockets for Fencing Score
Websockets for Fencing ScoreWebsockets for Fencing Score
Websockets for Fencing ScoreESUG
 
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 JavaScriptESUG
 
Advanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocAdvanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocESUG
 
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 TransformationsESUG
 

Más de 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
 

Último

20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...Akihiro Suda
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxAndreas Kunz
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 

Último (20)

20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 

Virtual CPU

  • 1. Virtual CPU ESUG, Cambridge 2014 By Igor Stasenko & Max Mattone RMod, Inria Wednesday, August 20, 14
  • 2. Highlights • What? • Why? • How? • Demo • To Do Wednesday, August 20, 14
  • 3. What is VCpu? • a framework to write low-level code • can simulate & generate machine code • multiple backends for ARM, x86/x64 code generation • 100% implemented in smalltalk Wednesday, August 20, 14
  • 4. What is VCpu NOT • NOT a full-fledged compiler with numerous data “types”, like GCC/ LLVM • NO direct support of calling convention(s) • it is a bare-bone model of computer with CPU & memory.. to build on top of it Wednesday, August 20, 14
  • 5. Requirements • expressive power of smalltalk • malleable • extensible • simple • yet powerful Wednesday, August 20, 14
  • 6. Architecture Platform neutral RTL VCPU Interface Simulating CPU Generating CPU Low-level intermediate Liveness analysis Register allocation Optimizations AsmJIT Platform dependent Wednesday, August 20, 14
  • 7. Why • there’s no low-level compilers for smalltalk • on inventing own wheel: adapting existing solutions costly as (h/w)ell • lets us learn as we do it Wednesday, August 20, 14
  • 8. Don’t mode me in Implementing low-level semantic Idea Smalltalk Slang C Machine Idea Machine Wednesday, August 20, 14
  • 9. A more correct picture Idea Machine Wednesday, August 20, 14
  • 10. At the end of the day memory at: x put: y So, tell me, why you have to be expert in 10+ disciplines to do that? Wednesday, August 20, 14
  • 11. There must be a better way • i was looking for a nice & simple solution since 2006 • VCpu interface, is product of number of painful attempts to get there • Now i am pleased (almost). Wednesday, August 20, 14
  • 12. How • imperative rather than declarative • coding with VCpu is just plain smalltalk Wednesday, August 20, 14
  • 13. Imperative • you don’t ‘compile’ or translate code, you just execute own code istructing CPU what to do: cpu doThat Wednesday, August 20, 14
  • 14. Dual nature • can be either simulated or generating machine code, just use different CPU • you free to choose any style you want to program it Wednesday, August 20, 14
  • 15. Machine word • a facade object representing a virtual CPU register/variable (machine word) • it easy to manipulate with, since one can define a usual arithmetic operations, like #+ , #- , #*, #/ etc.. • serves as a basis of VCpu ‘DSL’ Wednesday, August 20, 14
  • 16. Lets learn a new DSL Wednesday, August 20, 14
  • 17. Step 1. Creating a new machine word word := cpu word: 10. Wednesday, August 20, 14
  • 18. Step 2. Assigning new value to existing one word1 := cpu word: 10. word2 := cpu word: 4. ... word2 value: word1. Right word2 := word1. Wrong!!! Wednesday, August 20, 14
  • 19. Step 3. Arithmetic expressions word := x + y bitAnd: z just keep in mind, it is not ‘school’ but ‘CPU’ math Wednesday, August 20, 14
  • 20. Step 3. Arithmetic expressions the result of expression is always new machine word word := x + y bitAnd: z just keep in mind, maybe you wanted: word value: x + y bitAnd: z ... instead Wednesday, August 20, 14
  • 21. Step 3. Arithmetic expressions .. expressions can be intermixed with regular constants word := x + 5 as long as receiver is machine word Wednesday, August 20, 14
  • 22. Step 4. Memory access word := address loadWord address writeWord: x Wednesday, August 20, 14
  • 23. Step 5. Comparisons/ control flow a>b ifTrue: [..] ifFalse: [..] a to: b do: [:i |..] x timesRepeat: [ .. ] Looks familiar? Wednesday, August 20, 14
  • 24. Thanks, we have Opal • disable inlining (ifTrue:/to:do: ..etc) expression ifTrue: [..] ifFalse: [..] mustBeABoolean this is Sparta Pharo! Wednesday, August 20, 14
  • 25. Step 6. Call/return address call cpu return. cpu return: x ** ** requires a notion of calling convention Wednesday, August 20, 14
  • 26. End of tutorial Wednesday, August 20, 14
  • 27. NativeBoost integration abs: x NativeBoost-style callout <primitive: #primitiveNativeCall module: #NativeBoostPlugin> ^ self nbCallout function: #( int abs (int x ) ) module: NativeBoost CLibrary VCpu-style callout ? Wednesday, August 20, 14
  • 28. NativeBoost integration abs: x NativeBoost-style callout <primitive: #primitiveNativeCall module: #NativeBoostPlugin> ^ self nbCallout function: #( int abs (int x ) ) module: NativeBoost CLibrary abs: x VCpu-style callout <primitive: #primitiveNativeCall module: #NativeBoostPlugin> ^ self nbCallout function: #( int abs (int x ) ) module: NativeBoost CLibrary this is Sparta Pharo! Wednesday, August 20, 14
  • 30. To Do • Finish optimizations • Test ARM Support (on real hardware) • Complete NativeBoost VCpu implementation • Documentation • Look forward for Spur integration Wednesday, August 20, 14