SlideShare a Scribd company logo
1 of 35
Download to read offline
eliot@cadence.com 
Spur 
Confused images 
and mixed metaphors 
for Squeak Pharo 
and Newspeak 
Wednesday, 20 August 2014
Three Parts 
VM Evolution 
Lazy Forwarding/ 
Partial Read Barrier 
Spur Memory Manager 
Wednesday, 20 August 2014
Spur isA: MemoryManager new 
faster 
more powerful 
64-bit ready 
Wednesday, 20 August 2014
Spur isAn: Evolution 
Sista 
64-bit HPS 7 Spur 
HPS 5 
HPS 
BrouHaHa-TC 
BrouHaHa 
Cog v1 
PS Squeak 
Dorado Berkeley 
Stack 
Smalltalk/V 
Cog v2 
Wednesday, 20 August 2014
inherited traits 
class table 
64-bit HPS 7 Spur 
HPS 5 
HPS 
ephemerons 
64-bits 
BrouHaHa-TC 
BrouHaHa 
Cog v1 
SSlaimnugl abtroort haenrds 
icna-clihnee JIT 
PS Squeak V1 
oibnjdeircet cttaiobnle 
Dorado Berkeley 
Stack 
Smalltalk/V 
contexts 
stack-to-register 
mapping JIT 
direct pointers 
context-to-stack 
mapping 
mceatchhoed 
Cog v2 
weakness object-oriented 
Wednesday, 20 August 2014
object-oriented?? Object 
Memory 
NewObject 
Memory 
Stack 
Interpreter 
CoInterpreter SpurMemory 
Manager 
Spur32Bit 
MemMgr 
SpurGeneration 
Scavenger 
SpurSegment 
Manager 
Cogit 
VMStruct 
Type 
SimpleStack 
BasedCogit 
StackToRegister 
MappingCogit 
Spur64Bit 
MemMgr 
CogObject 
Representation 
CogObjRepFor 
SqueakV3 
CogObjRepFor 
Spur 
CogObjRepFor 
32BitSpur 
CogObjRepFor 
64BitSpur 
teleology 
Wednesday, 20 August 2014
oops 
BS Direct Pointers 
size...flags...hash 
class 
inst vars 
... 
refcount 
HPS Object Table Indirection 
size...flags...hash 
class 
indirection 
inst vars 
... 
D-machine OTE 
20-bit address 
size 
class 
inst vars 
... 
Wednesday, 20 August 2014
oops! yeah, right... 
size...flags...hash 
class 
indirection 
inst vars 
... 
size...flags...inst size...hash...class index 
indirection 
inst vars 
... 
64-bit HPS 7 
sparse 
class 
table 
Wednesday, 20 August 2014
class indices/class tags 
class index is index of class in class table 
class’s identity hash is its index in class table 
∴ its instances’ class tag 
Behavior>>identityHash (& Behavior>>new) 
use them in method caches; resolve to class 
object on #class or full method lookup 
constants, never moved by GC 
cheap allocation of well-known objects 
puns & special non-objects 
#slots identityHash fmt class index 
Wednesday, 20 August 2014
evolution 
top-down selection pressure 
(≈tests) 
bottom-up refinement 
(≈≈ pink plane) 
exaptation 
(≈ blue plane) 
Wednesday, 20 August 2014
Aquatic Ape Hypothesis 
Wednesday, 20 August 2014
The VM System 
heap 
lcoaockhuep prims irnetteerrp gc & 
alloc 
Wednesday, 20 August 2014
The VM System 
heap 
lcoaockhuep zcoodnee sztoancek 
prims irnetteerrp jit gc & 
alloc 
Wednesday, 20 August 2014
method lookup 
findNewMethod 
! "Find the compiled method to be run when the current 
messageSelector is sent to the class lkupClass, setting 
the values of newMethod and primitiveIndex." 
! <inline: true> 
! | ok | 
! ok := self lookupInMethodCacheSel: messageSelector class: lkupClass. 
! ok ifFalse: "entry was not found in the cache; look it up the hard way" 
! ! [self lookupMethodInClass: lkupClass. 
! ! self addNewMethodToCache] 
Wednesday, 20 August 2014
Exapt 
method cache probe 
class tags 
stack zone 
primitives 
Wednesday, 20 August 2014
Exaptation 
become lazy 
all objects can be forwarders 
forwarded class tag fails method cache probe 
follow on message lookup 
stack zone scan avoids inst var access read barrier 
Wednesday, 20 August 2014
become 
size flags hash class index 
inst var 0 inst var 1 
..... 
size flags hash class index 
inst var 0 inst var 1 
..... 
Wednesday, 20 August 2014
become 
size flags forwarded index 
forwarding ptr 
copy copy 
size flags hash class index 
inst var 0 inst var 1 
..... 
size flags forwarded index 
forwarding ptr 
size flags hash class index 
inst var 0 inst var 1 
..... 
Wednesday, 20 August 2014
follow 
followForwarded: objOop 
! | referent | 
! referent := self fetchPointer: 0 ofMaybeForwardedObject: objOop. 
! [(self isOopForwarded: referent)] whileTrue: 
! ! [referent := self fetchPointer: 0 ofMaybeForwardedObject: referent]. 
! ^referent 
followField: fieldIndex ofObject: anObject 
! | objOop | 
! objOop := self fetchPointer: fieldIndex ofObject: anObject. 
! (self isOopForwarded: objOop) ifTrue: 
! ! [objOop := self followForwarded: objOop. 
self storePointer: fieldIndex ofObject: anObject withValue: objOop]. 
! ^objOop 
ObjectMemory>>followField: fieldIndex ofObject: anObject 
! ^self fetchPointer: fieldIndex ofObject: anObject 
Wednesday, 20 August 2014
lazy forwarding issues 
inst var access 
(& method access in interpreter) 
message sends 
class hierarchy method lookup 
global var access (including super sends) 
primitives 
Wednesday, 20 August 2014
lazy forwarding: inst vars 
partial read barrier 
size flags forwarded index 
forwarding ptr 
copy copy 
size flags hash class index 
inst var 0 inst var 1 
..... 
size flags forwarded index 
forwarding ptr 
size flags hash class index 
inst var 0 inst var 1 
..... 
+ if became pointer or method object, 
scan stack zone to follow forwarding pointers 
Wednesday, 20 August 2014
lazy forwarding: sends 
findNewMethod 
! (self lookupInMethodCacheSel: selector classTag: lkupClassTag) ifFalse: 
! ! [((heap isOopForwarded: selector) 
! ! or: [heap isForwardedClassTag: lkupClassTag]) ifTrue: 
! ! ! [(heap isOopForwarded: selector) ifTrue: 
! ! ! ! [selector := self handleForwardedSelectorFault: selector]. 
! ! ! (heap isForwardedClassTag: lkupClassTag) ifTrue: 
! ! ! ! [lkupClassTag := self handleForwardedTagFault: lkupClassTag]. 
! ! ! (self lookupInMethodCacheSel: selector classTag: lkupClassTag) 
! ! ! ! ifTrue: [^self]]. 
! ! lkupClass := heap classForClassTag: lkupClassTag. 
! ! self lookupMethodInClass: lkupClass. 
! ! self addNewMethodToCache: lkupClass] 
Wednesday, 20 August 2014
lazy forwarding: 
class hierarchy method lookup 
after any pointer become could scan 
every class in class table 
every method on entry to stack zone 
KISS 
read barrier on access 
superclassOf: classObj 
! "Read barrier here costs very little because lookup is rare, 
& class and superclass almost certainly share a cache line." 
^objectMemory followField: SuperclassIndex ofObject: classObj 
Wednesday, 20 August 2014
lazy forwarding: 
global variable access 
after any pointer or method become could scan 
every method in stack & code zones 
every method on entry to stack zone 
KISS 
read barrier on access 
pushLiteralVariable: literalIndex 
! | litVar | 
! litVar := self literal: literalIndex. 
! (heap isForwarded: litVar) ifTrue: 
! ! [litVar := heap followForwarded: litVar]. 
! self push: (heap fetchPointer: ValueIndex ofObject: litVar) 
Wednesday, 20 August 2014
lazy forwarding: primitives 
bits 
width 
height 
depth 
offset 
mask 
x 
y 
bits 
width 
height 
depth 
offset 
self validate 
ifTrue: [self operate] 
ifFalse: [self fail] 
x 
y 
Wednesday, 20 August 2014
primitives self validate 
ifTrue: [self operate] 
ifFalse: [self fail] 
slowPrimitiveResponse 
! primFailCode := 0. 
! self perform: primitiveFunctionPointer. 
! self successful ifFalse: 
! [self checkForAndFollowForwardedPrimitiveState ifTrue: 
! ! [primFailCode := 0. 
! ! self perform: primitiveFunctionPointer]] 
checkForAndFollowForwardedPrimitiveState 
| depth | 
! depth := primitiveAccessorDepths at: 
(self primitveIndexOf: newMethod). 
^accessorDepth >= 0 
and: [self followStackedArgumentsToDepth: accessorDepth] 
Wednesday, 20 August 2014
Spur Memory Manager 
Spur 
Memory 
Manager 
Spur 
Generation 
Scavenger 
Spur 
Segment 
Manager 
ephemerons 
object representation & heap walking 
pig compaction 
pinning, bridges and segments 
debugging 
Wednesday, 20 August 2014
ephemerons 
processEphemerons 
! "There are ephemerons to be scavenged. Scavenge them and fire any whose keys are 
! still in pastSpace and/or eden. The unscavenged ephemerons in this cycle can only be 
! fired if all the unscavenged ephemerons in this cycle are firable, because references 
! to ephemeron keys from unfired ephemerons should prevent the ephemerons with 
! those keys from firing. So scavenge ephemerons with surviving keys, and only if none 
! are found, fire ephemerons with unreferenced keys, and scavenge them. Read the 
! class comment for a more in-depth description of the algorithm." 
! | unfiredEphemeronsScavenged | 
! unfiredEphemeronsScavenged := self scavengeUnfiredEphemeronsInRememberedSet. 
! self scavengeUnfiredEphemeronsOnEphemeronList ifTrue: 
! ! [unfiredEphemeronsScavenged := true]. 
! unfiredEphemeronsScavenged ifFalse: 
! ! [self fireEphemeronsInRememberedSet. 
! ! self fireEphemeronsOnEphemeronList] 
Wednesday, 20 August 2014
object size/heap walk 
8 22 5 22 
<= 254 identityHash fmt class index 
at least one slot 
255 slot count 
255 identityHash fmt class index 
Wednesday, 20 August 2014
pig compaction 
if you have a hammer... 
Wednesday, 20 August 2014
another two finger 
at least one slot 
=> use the xor trick 
free 
space 
free 
space 
free 
space 
Wednesday, 20 August 2014
pins, segments and bridges 
255 span 
255 1 bits bridge 
first segment 
isPinned 
Wednesday, 20 August 2014
achieving inner peace 
A garbage collector is a 
destructive graph rewriter 
when it goes wrong... 
Wednesday, 20 August 2014
kill more lemmings 
Wednesday, 20 August 2014
status -35% = 1/(1-0.35) 
performance 
functionality 
availability 
www.mirandabanda.org 
64-bits 
= 1/0.65 = 1.54x 
-40% = 1/0.6 = 1.6 . 
-50% = 2x 
(new-old)/old 
Wednesday, 20 August 2014

More Related Content

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

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

办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
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
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
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
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
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
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....kzayra69
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 

Recently uploaded (20)

办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
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
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
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
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
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
 
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
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 

Spur, a new object representation for Cog

  • 1. eliot@cadence.com Spur Confused images and mixed metaphors for Squeak Pharo and Newspeak Wednesday, 20 August 2014
  • 2. Three Parts VM Evolution Lazy Forwarding/ Partial Read Barrier Spur Memory Manager Wednesday, 20 August 2014
  • 3. Spur isA: MemoryManager new faster more powerful 64-bit ready Wednesday, 20 August 2014
  • 4. Spur isAn: Evolution Sista 64-bit HPS 7 Spur HPS 5 HPS BrouHaHa-TC BrouHaHa Cog v1 PS Squeak Dorado Berkeley Stack Smalltalk/V Cog v2 Wednesday, 20 August 2014
  • 5. inherited traits class table 64-bit HPS 7 Spur HPS 5 HPS ephemerons 64-bits BrouHaHa-TC BrouHaHa Cog v1 SSlaimnugl abtroort haenrds icna-clihnee JIT PS Squeak V1 oibnjdeircet cttaiobnle Dorado Berkeley Stack Smalltalk/V contexts stack-to-register mapping JIT direct pointers context-to-stack mapping mceatchhoed Cog v2 weakness object-oriented Wednesday, 20 August 2014
  • 6. object-oriented?? Object Memory NewObject Memory Stack Interpreter CoInterpreter SpurMemory Manager Spur32Bit MemMgr SpurGeneration Scavenger SpurSegment Manager Cogit VMStruct Type SimpleStack BasedCogit StackToRegister MappingCogit Spur64Bit MemMgr CogObject Representation CogObjRepFor SqueakV3 CogObjRepFor Spur CogObjRepFor 32BitSpur CogObjRepFor 64BitSpur teleology Wednesday, 20 August 2014
  • 7. oops BS Direct Pointers size...flags...hash class inst vars ... refcount HPS Object Table Indirection size...flags...hash class indirection inst vars ... D-machine OTE 20-bit address size class inst vars ... Wednesday, 20 August 2014
  • 8. oops! yeah, right... size...flags...hash class indirection inst vars ... size...flags...inst size...hash...class index indirection inst vars ... 64-bit HPS 7 sparse class table Wednesday, 20 August 2014
  • 9. class indices/class tags class index is index of class in class table class’s identity hash is its index in class table ∴ its instances’ class tag Behavior>>identityHash (& Behavior>>new) use them in method caches; resolve to class object on #class or full method lookup constants, never moved by GC cheap allocation of well-known objects puns & special non-objects #slots identityHash fmt class index Wednesday, 20 August 2014
  • 10. evolution top-down selection pressure (≈tests) bottom-up refinement (≈≈ pink plane) exaptation (≈ blue plane) Wednesday, 20 August 2014
  • 11. Aquatic Ape Hypothesis Wednesday, 20 August 2014
  • 12. The VM System heap lcoaockhuep prims irnetteerrp gc & alloc Wednesday, 20 August 2014
  • 13. The VM System heap lcoaockhuep zcoodnee sztoancek prims irnetteerrp jit gc & alloc Wednesday, 20 August 2014
  • 14. method lookup findNewMethod ! "Find the compiled method to be run when the current messageSelector is sent to the class lkupClass, setting the values of newMethod and primitiveIndex." ! <inline: true> ! | ok | ! ok := self lookupInMethodCacheSel: messageSelector class: lkupClass. ! ok ifFalse: "entry was not found in the cache; look it up the hard way" ! ! [self lookupMethodInClass: lkupClass. ! ! self addNewMethodToCache] Wednesday, 20 August 2014
  • 15. Exapt method cache probe class tags stack zone primitives Wednesday, 20 August 2014
  • 16. Exaptation become lazy all objects can be forwarders forwarded class tag fails method cache probe follow on message lookup stack zone scan avoids inst var access read barrier Wednesday, 20 August 2014
  • 17. become size flags hash class index inst var 0 inst var 1 ..... size flags hash class index inst var 0 inst var 1 ..... Wednesday, 20 August 2014
  • 18. become size flags forwarded index forwarding ptr copy copy size flags hash class index inst var 0 inst var 1 ..... size flags forwarded index forwarding ptr size flags hash class index inst var 0 inst var 1 ..... Wednesday, 20 August 2014
  • 19. follow followForwarded: objOop ! | referent | ! referent := self fetchPointer: 0 ofMaybeForwardedObject: objOop. ! [(self isOopForwarded: referent)] whileTrue: ! ! [referent := self fetchPointer: 0 ofMaybeForwardedObject: referent]. ! ^referent followField: fieldIndex ofObject: anObject ! | objOop | ! objOop := self fetchPointer: fieldIndex ofObject: anObject. ! (self isOopForwarded: objOop) ifTrue: ! ! [objOop := self followForwarded: objOop. self storePointer: fieldIndex ofObject: anObject withValue: objOop]. ! ^objOop ObjectMemory>>followField: fieldIndex ofObject: anObject ! ^self fetchPointer: fieldIndex ofObject: anObject Wednesday, 20 August 2014
  • 20. lazy forwarding issues inst var access (& method access in interpreter) message sends class hierarchy method lookup global var access (including super sends) primitives Wednesday, 20 August 2014
  • 21. lazy forwarding: inst vars partial read barrier size flags forwarded index forwarding ptr copy copy size flags hash class index inst var 0 inst var 1 ..... size flags forwarded index forwarding ptr size flags hash class index inst var 0 inst var 1 ..... + if became pointer or method object, scan stack zone to follow forwarding pointers Wednesday, 20 August 2014
  • 22. lazy forwarding: sends findNewMethod ! (self lookupInMethodCacheSel: selector classTag: lkupClassTag) ifFalse: ! ! [((heap isOopForwarded: selector) ! ! or: [heap isForwardedClassTag: lkupClassTag]) ifTrue: ! ! ! [(heap isOopForwarded: selector) ifTrue: ! ! ! ! [selector := self handleForwardedSelectorFault: selector]. ! ! ! (heap isForwardedClassTag: lkupClassTag) ifTrue: ! ! ! ! [lkupClassTag := self handleForwardedTagFault: lkupClassTag]. ! ! ! (self lookupInMethodCacheSel: selector classTag: lkupClassTag) ! ! ! ! ifTrue: [^self]]. ! ! lkupClass := heap classForClassTag: lkupClassTag. ! ! self lookupMethodInClass: lkupClass. ! ! self addNewMethodToCache: lkupClass] Wednesday, 20 August 2014
  • 23. lazy forwarding: class hierarchy method lookup after any pointer become could scan every class in class table every method on entry to stack zone KISS read barrier on access superclassOf: classObj ! "Read barrier here costs very little because lookup is rare, & class and superclass almost certainly share a cache line." ^objectMemory followField: SuperclassIndex ofObject: classObj Wednesday, 20 August 2014
  • 24. lazy forwarding: global variable access after any pointer or method become could scan every method in stack & code zones every method on entry to stack zone KISS read barrier on access pushLiteralVariable: literalIndex ! | litVar | ! litVar := self literal: literalIndex. ! (heap isForwarded: litVar) ifTrue: ! ! [litVar := heap followForwarded: litVar]. ! self push: (heap fetchPointer: ValueIndex ofObject: litVar) Wednesday, 20 August 2014
  • 25. lazy forwarding: primitives bits width height depth offset mask x y bits width height depth offset self validate ifTrue: [self operate] ifFalse: [self fail] x y Wednesday, 20 August 2014
  • 26. primitives self validate ifTrue: [self operate] ifFalse: [self fail] slowPrimitiveResponse ! primFailCode := 0. ! self perform: primitiveFunctionPointer. ! self successful ifFalse: ! [self checkForAndFollowForwardedPrimitiveState ifTrue: ! ! [primFailCode := 0. ! ! self perform: primitiveFunctionPointer]] checkForAndFollowForwardedPrimitiveState | depth | ! depth := primitiveAccessorDepths at: (self primitveIndexOf: newMethod). ^accessorDepth >= 0 and: [self followStackedArgumentsToDepth: accessorDepth] Wednesday, 20 August 2014
  • 27. Spur Memory Manager Spur Memory Manager Spur Generation Scavenger Spur Segment Manager ephemerons object representation & heap walking pig compaction pinning, bridges and segments debugging Wednesday, 20 August 2014
  • 28. ephemerons processEphemerons ! "There are ephemerons to be scavenged. Scavenge them and fire any whose keys are ! still in pastSpace and/or eden. The unscavenged ephemerons in this cycle can only be ! fired if all the unscavenged ephemerons in this cycle are firable, because references ! to ephemeron keys from unfired ephemerons should prevent the ephemerons with ! those keys from firing. So scavenge ephemerons with surviving keys, and only if none ! are found, fire ephemerons with unreferenced keys, and scavenge them. Read the ! class comment for a more in-depth description of the algorithm." ! | unfiredEphemeronsScavenged | ! unfiredEphemeronsScavenged := self scavengeUnfiredEphemeronsInRememberedSet. ! self scavengeUnfiredEphemeronsOnEphemeronList ifTrue: ! ! [unfiredEphemeronsScavenged := true]. ! unfiredEphemeronsScavenged ifFalse: ! ! [self fireEphemeronsInRememberedSet. ! ! self fireEphemeronsOnEphemeronList] Wednesday, 20 August 2014
  • 29. object size/heap walk 8 22 5 22 <= 254 identityHash fmt class index at least one slot 255 slot count 255 identityHash fmt class index Wednesday, 20 August 2014
  • 30. pig compaction if you have a hammer... Wednesday, 20 August 2014
  • 31. another two finger at least one slot => use the xor trick free space free space free space Wednesday, 20 August 2014
  • 32. pins, segments and bridges 255 span 255 1 bits bridge first segment isPinned Wednesday, 20 August 2014
  • 33. achieving inner peace A garbage collector is a destructive graph rewriter when it goes wrong... Wednesday, 20 August 2014
  • 34. kill more lemmings Wednesday, 20 August 2014
  • 35. status -35% = 1/(1-0.35) performance functionality availability www.mirandabanda.org 64-bits = 1/0.65 = 1.54x -40% = 1/0.6 = 1.6 . -50% = 2x (new-old)/old Wednesday, 20 August 2014