SlideShare ist ein Scribd-Unternehmen logo
1 von 31
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Ähnlich wie 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
 

Ähnlich wie 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
 

Mehr von 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
 

Mehr von 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
 

Kürzlich hochgeladen

Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
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
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
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
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
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
 
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
 
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
 
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
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
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
 

Kürzlich hochgeladen (20)

Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
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
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
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...
 
Odoo Development Company in India | Devintelle Consulting Service
Odoo Development Company in India | Devintelle Consulting ServiceOdoo Development Company in India | Devintelle Consulting Service
Odoo Development Company in India | Devintelle Consulting Service
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
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
 
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...
 
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
 
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...
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Advantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your BusinessAdvantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your Business
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
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
 

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