SlideShare uma empresa Scribd logo
1 de 45
Baixar para ler offline
COG
Back to the Future, Part II
faster open source VMs for
Croquet, Squeak & Newspeak
1
Why?
What?
Where to & when?
2
Qwaq Forums
SAS
Client experience
Why Cog?
3
Small part of a larger whole
Why Cog?
cog•no•men ¦kägnōmən; kägnəmən¦
noun
an extra personal name given to an ancient Roman citizen,
functioning rather like a nickname and typically passed down
from father to son.
• a name; a nickname.
4
Success is 99% failure
Why Cog?
5
MARKETING GIRL:
When you have been in marketing as long as I have, you’ll know
that before any new product can be developed,
it has to be properly researched.
I mean yes, yes we’ve got to find out what people want from fire,
I mean how do they relate to it, the image -
FORD:
Oh, stick it up your nose.
MARKETING GIRL:
Yes which is precisely the sort of thing we need to know, I mean
do people want fire that can be fitted nasally?
get the marketing out of the way early...
6
a logo!
What’s Cog?
7
What’s Cog?
a blog
http://www.mirandabanda.org/cogblog
Community Organised Graft
Contributions Over<->taken Gratefully
8
What’s Cog?
a series of VM evolutions
bytecode sets
object representations
execution technology
DTSSTCPW/KISS/Evolve
not a new compiler
not a replacement VM
no new GC, new CompiledMethod, etc
9
Where to?
Targets:
HPS style fast JIT
Self style quick JIT
Integrate with Hydra
Integrate with Spoon
10
fast car
11
quick car
12
Where to?
Targets:
HPS style fast JIT
Self style quick JIT
Prerequisites
Closures
Internal stack organization
polymorphous Inline Caches
13
14
baby steps
Closures + Closure VM
extend existing compiler
front-end, new back-end
5 new bytecodes
sionara BlockContext
has ANSI block syntax
nicely familiar
less work
Croquet 1.0, Squeak 3.9
www.mirandabanda.org/downloads
Deployed internally at Qwaq
15
closures enable stack representation
inject: aValue into: binaryBlock
| next |
next := aValue.
self do: [:each| next := binaryBlock value: next value: each].
^next
inject: aValue into: binaryBlock
| tempVector |
tempVector := Array new: 1.
tempVector at: 1 put: aValue.
self do: [:each|
tempVector
at: 1
put: (binaryBlock value: (tempVector at: 1) value: each)].
^tempVector at: 1
16
- BlockClosure - BlockContext + BlockClosure
Object variableSubclass: #BlockClosure
instanceVariableNames: 'outerContext startpc numArgs'
BlockClosure methods for evaluating
value[:value:value:value:]
valueWithArguments:
ContextPart variableSubclass: #MethodContext
instanceVariableNames: 'method receiverMap closureOrNil receiver'
baby steps
17
closure activation
inject:into:
sender
pc
stackp
method
closureOrNil
receiver 'Hi!'
aValue 0
binaryBlock
temp vector
[] in inject:into:
sender
pc
stackp
method
closureOrNil
receiver
$H
temp ...
[] in inject:into:
outerContext
startpc
numArgs
binaryBlock
temp vector
do:
sender
pc
stackp
method
closureOrNil
receiver
arg ...
temp ...
an Array
nextValue
18
baby steps
5 new bytecodes
pushNewArrayOfSize:/pushConsArrayWithElements:
pushClosureCopyNumCopiedValues:numArgs:blockSize:
pushRemoteTemp:inVectorAt:
popRemoteTemp:inVectorAt:
storeRemoteTemp:inVectorAt:
change return bytecode to do non-local return if
closureOrNil not nil
19
Stack Interpreter
Closure VM + Internal Stack Organization
activations are stack frames on stack pages
contexts on heap are proxies for stack frames
Streamlined GC, no pop/pushRemappableOop:
20
stack frame
no argument copying
lazy context creation
slower argument access!! (in interpreter, not in JIT)
epsilon away from fast JIT organization (maybe coexist)
receiver/closure
arg...
caller saved ip/base frame caller context
caller saved fp (0 for base frame)
method
flag bytes: numArgs, hasContext, isClosureActivation
thisContext (uninitialized garbage in new frame)
receiver
temp...
stack value...
framePointer
stackPointer
21
stack activation
‘Hi!’ inject: 0 into:
! [:sum :char| sum + char asInteger]
inject: thisValue into: binaryBlock
! | nextValue |
! nextValue := thisValue.
! self do:
! ! [:each |
! ! nextValue := binaryBlock value: nextValue value: each].
! ^nextValue
rcvr: 'Hi!'
initialValue: 0
binaryBlock: [] in DoItsp
22
stack activation
‘Hi!’ inject: 0 into:
! [:sum :char| sum + char asInteger]
inject: thisValue into: binaryBlock
! | nextValue |
! nextValue := thisValue.
! self do:
! ! [:each |
! ! nextValue := binaryBlock value: nextValue value: each].
! ^nextValue
rcvr: 'Hi!'
initialValue: 0
binaryBlock: [] in DoIt
caller saved ip
caller saved fp
method (inject:into:)
2, false, false
%$&^*#@!
self: 'Hi!'
temp vector: nil
rcvr: 'Hi!'sp
fp
23
stack activation
‘Hi!’ inject: 0 into:
! [:sum :char| sum + char asInteger]
inject: thisValue into: binaryBlock
! | nextValue |
! nextValue := thisValue.
! self do:
! ! [:each |
! ! nextValue := binaryBlock value: nextValue value: each].
! ^nextValue
rcvr: 'Hi!'
initialValue: 0
binaryBlock: [] in DoIt
caller saved ip
caller saved fp
method (inject:into:)
2, false, false
%$&^*#@!
self: 'Hi!'
temp vector
rcvr: 'Hi!'
Array
nextValue: 0
sp
fp
24
stack activationrcvr: 'Hi!'
initialValue: 0
binaryBlock: [] in DoIt
caller saved ip
caller saved fp
method (inject:into:)
2, false, true
thisContext
self: 'Hi!'
temp vector
rcvr: 'Hi!'
[] in inject:into:
BlockClosure
outerContext
startpc
numArgs: 1
binaryBlock: [] in DoIt
temp vector
MethodContext
sender: fp
pc: caller saved fp
stackp: 2
method: inject:into:
closureOrNil: nil
self: ‘Hi!’
temp vector
binaryBlock: [] in DoIt
%$&^*#@!
...
%$&^*#@!
Array
nextValue: 0
sp
fp
25
stack activationrcvr: 'Hi!'
initialValue: 0
binaryBlock: [] in DoIt
caller saved ip
caller saved fp
method (inject:into:)
2, false, true
thisContext
self: 'Hi!'
temp vector
rcvr: 'Hi!'
[] in inject:into:
caller saved ip
caller saved fp
method (do:)
1, false, false
%$&^*#@!
self: 'Hi!'
index: 1
BlockClosure
outerContext
startpc
numArgs: 1
binaryBlock: [] in DoIt
temp vector
MethodContext
sender: fp
pc: caller saved fp
stackp: 2
method: inject:into:
closureOrNil: nil
self: ‘Hi!’
temp vector
binaryBlock: [] in DoIt
%$&^*#@!
...
%$&^*#@!
Array
nextValue: 0
sp
fp
26
stack activationrcvr: 'Hi!'
initialValue: 0
binaryBlock: [] in DoIt
caller saved ip
caller saved fp
method (inject:into:)
2, false, true
thisContext
self: 'Hi!'
temp vector
rcvr: 'Hi!'
[] in inject:into:
caller saved ip
caller saved fp
method (do:)
1, false, false
%$&^*#@!
self: 'Hi!'
index: 1
clsr: [] in inject:into:
each: $H
caller saved ip
caller saved fp
method (inject:into:)
1, true, false
%$&^*#@!
self: ‘Hi’
[] in DoIt
temp vector
BlockClosure
outerContext
startpc
numArgs: 1
binaryBlock: [] in DoIt
temp vector
MethodContext
sender: fp
pc: caller saved fp
stackp: 2
method: inject:into:
closureOrNil: nil
self: ‘Hi!’
temp vector
binaryBlock: [] in DoIt
%$&^*#@!
...
%$&^*#@!
Array
nextValue: 0
⇐sp
⇐fp
27
Stack Interpreter
Nowish
Detailed blog posts + code real soon now™
Underwhelming Performance
≈ 10% 68% faster benchmark performance
as yet no faster for client experience
bit of a mystery...
28
the VM gardener’s spade
many a mickle ... .
... makes a muckle
29
fast JIT
April 2009 (for x86)
a la HPS
simple deferred code gen (stack => register)
three register (self + 2 args) calling convention
most kernel prims all in regs (at: at:put: + * etc)
in-line caches: open & closed PICs
two word object header
“open” translator
retain interpreter
30
The life-cycle of the lesser
spotted Inline Cache
egg -> monomorph -> polymorph -> megamorph
the egg is one of many instructions laid by the
JIT when it “compiles” a bytecode method into a
native code method
<B0> send #=
movl %rCache,#=
call linkSend1Args
31
The life-cycle of the lesser
spotted Inline Cache
if executed the egg hatches into a larval
monomorphic inline cache. Typically only 70% of eggs
will hatch
#(true false nil 0 0.0 #zero 'zero' $0 #()) select:
[:each| each = 0]
movl %rCache,#=!! !! movl %rCache,True
call linkSend1Args! !! call Object.=.entry
32
The life-cycle of the lesser
spotted Inline Cache
movl %rCache,True
call Object.=.entry
Object.=.entry:
mov %rTemp,%rSelf
and %rTemp,#3
jnz L1
mov %rTemp,%rSelf[#ClassOffset]
L1: cmp %rTemp,%rCache
jnz LCallFixSendFailure
Object.=.noCheckEntry:
rock and roll
33
The life-cycle of the lesser
spotted Inline Cache
if the monomorph encounters another kind it
changes into a nymph polymorphic cache with 2
cases. Only 10% of monomorphs will
metamorphose into Closed PICs
movl %rCache,True! !! movl %rCache,True
call Object.=.entry! !! call aClosedPIC.=.entry
34
The life-cycle of the lesser
spotted Inline Cache
aClosedPIC.=.entry:
mov %rTemp,%rSelf
and %rTemp,#3
jnz L1
mov %rTemp,%rSelf[#ClassOffset]
L1: cmp %rTemp,%rCache
jz Object.=.noCheckEntry
cmp %rCache, #False
jz Object.=.noCheckEntry
jmp extendClosedPIC
....
35
The life-cycle of the lesser
spotted Inline Cache
aClosedPIC.=.entry:
mov %rTemp,%rSelf
and %rTemp,#3
jnz L1
mov %rTemp,%rSelf[#ClassOffset]
L1: cmp %rTemp,%rCache
jz Object.=.noCheckEntry
cmp %rCache, #False
jz Object.=.noCheckEntry
cmp %rCache, #UndefinedObject
jz Object.=.noCheckEntry
cmp %rCache, #SmallInteger
jz SmallInteger.=.noCheckEntry
jmp extendClosedPIC
36
The life-cycle of the lesser
spotted Inline Cache
if the nymph polymorph has a rich enough life and
encounters more than (say) 8 classes of self then it
blossoms into a magnificent Open PIC
movl %rCache,True !! ! !! movl %rCache,True
call aClosedPIC.=.entry! !! call anOpenPIC.=.entry
37
The life-cycle of the lesser
spotted Inline Cache
An adult Open PIC is adept at probing the first-
level method lookup cache to find the target
method for each self
Since the Open PIC started life for a single selector
it knows the constant value of its slector and its
selector’s hash
Only 1% of monomorphs will complete the arduous
journey to Open PIC
38
The epiphenomena of the
lesser spotted Inline Cache
in the steady state there is no code modification
monomorphs and closed PICs eliminate indirect
branches, allowing the processor’s prefetch logic to
gorge itself on instructions beyond each branch
eggs, monomorphs and polymorphs record concrete
type information that an be harvested by an
adaptive optimizer that speculatively inlines target
methods
39
two-word object header
“common” 32-bit/64-bit object header
classTableIndex is lookup key in in-line caches
& first-level method lookup caches. GC doesn’t
move them => simplified inline cache mgmt
index sparse class table with classTableIndex
only for class hierarchy search & class primitive
no table access to instantiate known classes
A class’s id hash is its classTableIndex =>
no lookup to classTableIndex for new:
class... ...table... ...index flags etc
identity... ...hash... ...field slot size
e.g.
40
“Open” fast JIT
bytecode set translation via a table of
functions not a switch statement
object model is an ADT
should be able to configure JIT for different
bytecode sets, different GCs, object
representations
hence Croquet, Squeak and Newspeak
and...?
41
quick DT JIT
target: good floating-point performance
AOStA again... Adaptive Optimization =>
SIStA Speculative Inlining
reify PIC state
count conditional branches
6x less frequent than sends
taken & untaken counts => basic block frequency
image-level optimizer
42
quick DT JIT
image-level optimizer (many benefits)
VM extended with go-faster no-check primitive
bytecodes, e.g.
add known non-overflowing SmallIntegers
in-bounds pointer at: known SmallInteger index
could marry well with LLVM
43
quick DT JIT
model for good floating-point performance:
OptimizedContext has two stacks object & byte data
VM extended with unboxed float bytecodes, e.g.
bdsDoubleAt:putProductOfBdsDblAt:andBdsDblAt:
pushBoxDbsDoubleAt:
code gen maps byte data stack to floating-point regs
44
quick DT JIT
2010, 2011?
Sooner if you join the Cognoscenti...
45

Mais conteúdo relacionado

Mais procurados

Create your own PHP extension, step by step - phpDay 2012 Verona
Create your own PHP extension, step by step - phpDay 2012 VeronaCreate your own PHP extension, step by step - phpDay 2012 Verona
Create your own PHP extension, step by step - phpDay 2012 VeronaPatrick Allaert
 
The Kumofs Project and MessagePack-RPC
The Kumofs Project and MessagePack-RPCThe Kumofs Project and MessagePack-RPC
The Kumofs Project and MessagePack-RPCSadayuki Furuhashi
 
Supercharging reflective libraries with InvokeDynamic
Supercharging reflective libraries with InvokeDynamicSupercharging reflective libraries with InvokeDynamic
Supercharging reflective libraries with InvokeDynamicIan Robertson
 
Switch case and looping kim
Switch case and looping kimSwitch case and looping kim
Switch case and looping kimkimberly_Bm10203
 
Php Extensions for Dummies
Php Extensions for DummiesPhp Extensions for Dummies
Php Extensions for DummiesElizabeth Smith
 
Bridge TensorFlow to run on Intel nGraph backends (v0.4)
Bridge TensorFlow to run on Intel nGraph backends (v0.4)Bridge TensorFlow to run on Intel nGraph backends (v0.4)
Bridge TensorFlow to run on Intel nGraph backends (v0.4)Mr. Vengineer
 
Евгений Крутько, Многопоточные вычисления, современный подход.
Евгений Крутько, Многопоточные вычисления, современный подход.Евгений Крутько, Многопоточные вычисления, современный подход.
Евгений Крутько, Многопоточные вычисления, современный подход.Platonov Sergey
 
PHP Tips for certification - OdW13
PHP Tips for certification - OdW13PHP Tips for certification - OdW13
PHP Tips for certification - OdW13julien pauli
 
Kamil witecki asynchronous, yet readable, code
Kamil witecki asynchronous, yet readable, codeKamil witecki asynchronous, yet readable, code
Kamil witecki asynchronous, yet readable, codeKamil Witecki
 
Threads and Callbacks for Embedded Python
Threads and Callbacks for Embedded PythonThreads and Callbacks for Embedded Python
Threads and Callbacks for Embedded PythonYi-Lung Tsai
 
Concurrency in go
Concurrency in goConcurrency in go
Concurrency in goborderj
 
typemap in Perl/XS
typemap in Perl/XS  typemap in Perl/XS
typemap in Perl/XS charsbar
 
T-121-5300 (2008) User Interface Design 10 - UIML
T-121-5300 (2008) User Interface Design 10 - UIMLT-121-5300 (2008) User Interface Design 10 - UIML
T-121-5300 (2008) User Interface Design 10 - UIMLmniemi
 
Quick tour of PHP from inside
Quick tour of PHP from insideQuick tour of PHP from inside
Quick tour of PHP from insidejulien pauli
 
Clojure Interoperability
Clojure InteroperabilityClojure Interoperability
Clojure Interoperabilityrik0
 

Mais procurados (20)

Create your own PHP extension, step by step - phpDay 2012 Verona
Create your own PHP extension, step by step - phpDay 2012 VeronaCreate your own PHP extension, step by step - phpDay 2012 Verona
Create your own PHP extension, step by step - phpDay 2012 Verona
 
The Kumofs Project and MessagePack-RPC
The Kumofs Project and MessagePack-RPCThe Kumofs Project and MessagePack-RPC
The Kumofs Project and MessagePack-RPC
 
C tutorial
C tutorialC tutorial
C tutorial
 
Supercharging reflective libraries with InvokeDynamic
Supercharging reflective libraries with InvokeDynamicSupercharging reflective libraries with InvokeDynamic
Supercharging reflective libraries with InvokeDynamic
 
Switch case and looping kim
Switch case and looping kimSwitch case and looping kim
Switch case and looping kim
 
Php Extensions for Dummies
Php Extensions for DummiesPhp Extensions for Dummies
Php Extensions for Dummies
 
C++ Core Guidelines
C++ Core GuidelinesC++ Core Guidelines
C++ Core Guidelines
 
Building Custom PHP Extensions
Building Custom PHP ExtensionsBuilding Custom PHP Extensions
Building Custom PHP Extensions
 
Bridge TensorFlow to run on Intel nGraph backends (v0.4)
Bridge TensorFlow to run on Intel nGraph backends (v0.4)Bridge TensorFlow to run on Intel nGraph backends (v0.4)
Bridge TensorFlow to run on Intel nGraph backends (v0.4)
 
Евгений Крутько, Многопоточные вычисления, современный подход.
Евгений Крутько, Многопоточные вычисления, современный подход.Евгений Крутько, Многопоточные вычисления, современный подход.
Евгений Крутько, Многопоточные вычисления, современный подход.
 
PHP Tips for certification - OdW13
PHP Tips for certification - OdW13PHP Tips for certification - OdW13
PHP Tips for certification - OdW13
 
clang-intro
clang-introclang-intro
clang-intro
 
Kamil witecki asynchronous, yet readable, code
Kamil witecki asynchronous, yet readable, codeKamil witecki asynchronous, yet readable, code
Kamil witecki asynchronous, yet readable, code
 
Threads and Callbacks for Embedded Python
Threads and Callbacks for Embedded PythonThreads and Callbacks for Embedded Python
Threads and Callbacks for Embedded Python
 
Concurrency in go
Concurrency in goConcurrency in go
Concurrency in go
 
typemap in Perl/XS
typemap in Perl/XS  typemap in Perl/XS
typemap in Perl/XS
 
T-121-5300 (2008) User Interface Design 10 - UIML
T-121-5300 (2008) User Interface Design 10 - UIMLT-121-5300 (2008) User Interface Design 10 - UIML
T-121-5300 (2008) User Interface Design 10 - UIML
 
Quick tour of PHP from inside
Quick tour of PHP from insideQuick tour of PHP from inside
Quick tour of PHP from inside
 
Php engine
Php enginePhp engine
Php engine
 
Clojure Interoperability
Clojure InteroperabilityClojure Interoperability
Clojure Interoperability
 

Semelhante a COG Back to the Future, Part II

NYU hacknight, april 6, 2016
NYU hacknight, april 6, 2016NYU hacknight, april 6, 2016
NYU hacknight, april 6, 2016Mikhail Sosonkin
 
CppCat Checks OpenMW: Not All is Fine in the Morrowind Universe
CppCat Checks OpenMW: Not All is Fine in the Morrowind UniverseCppCat Checks OpenMW: Not All is Fine in the Morrowind Universe
CppCat Checks OpenMW: Not All is Fine in the Morrowind UniverseAndrey Karpov
 
100 bugs in Open Source C/C++ projects
100 bugs in Open Source C/C++ projects 100 bugs in Open Source C/C++ projects
100 bugs in Open Source C/C++ projects Andrey Karpov
 
Knee-deep in C++ s... code
Knee-deep in C++ s... codeKnee-deep in C++ s... code
Knee-deep in C++ s... codePVS-Studio
 
Checking the Cross-Platform Framework Cocos2d-x
Checking the Cross-Platform Framework Cocos2d-xChecking the Cross-Platform Framework Cocos2d-x
Checking the Cross-Platform Framework Cocos2d-xAndrey Karpov
 
Analyzing the Dolphin-emu project
Analyzing the Dolphin-emu projectAnalyzing the Dolphin-emu project
Analyzing the Dolphin-emu projectPVS-Studio
 
A Slipshod Check of the Visual C++ 2013 Library (update 3)
A Slipshod Check of the Visual C++ 2013 Library (update 3)A Slipshod Check of the Visual C++ 2013 Library (update 3)
A Slipshod Check of the Visual C++ 2013 Library (update 3)Andrey Karpov
 
Tetcon2016 160104
Tetcon2016 160104Tetcon2016 160104
Tetcon2016 160104Bordeaux I
 
Exploring the Cryptol Toolset
Exploring the Cryptol ToolsetExploring the Cryptol Toolset
Exploring the Cryptol ToolsetUlisses Costa
 
2013 syscan360 yuki_chen_syscan360_exploit your java native vulnerabilities o...
2013 syscan360 yuki_chen_syscan360_exploit your java native vulnerabilities o...2013 syscan360 yuki_chen_syscan360_exploit your java native vulnerabilities o...
2013 syscan360 yuki_chen_syscan360_exploit your java native vulnerabilities o...chen yuki
 
DEF CON 23 - COLIN O'FLYNN - dont whisper my chips
DEF CON 23 - COLIN O'FLYNN - dont whisper my chipsDEF CON 23 - COLIN O'FLYNN - dont whisper my chips
DEF CON 23 - COLIN O'FLYNN - dont whisper my chipsFelipe Prado
 
The Unicorn's Travel to the Microcosm
The Unicorn's Travel to the MicrocosmThe Unicorn's Travel to the Microcosm
The Unicorn's Travel to the MicrocosmAndrey Karpov
 
Picking Mushrooms after Cppcheck
Picking Mushrooms after CppcheckPicking Mushrooms after Cppcheck
Picking Mushrooms after CppcheckAndrey Karpov
 
Intel IPP Samples for Windows - error correction
Intel IPP Samples for Windows - error correctionIntel IPP Samples for Windows - error correction
Intel IPP Samples for Windows - error correctionAndrey Karpov
 
Intel IPP Samples for Windows - error correction
Intel IPP Samples for Windows - error correctionIntel IPP Samples for Windows - error correction
Intel IPP Samples for Windows - error correctionPVS-Studio
 
PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017
PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017
PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017Andrey Karpov
 
64-Bit Code in 2015: New in the Diagnostics of Possible Issues
64-Bit Code in 2015: New in the Diagnostics of Possible Issues64-Bit Code in 2015: New in the Diagnostics of Possible Issues
64-Bit Code in 2015: New in the Diagnostics of Possible IssuesPVS-Studio
 
Symfony & Javascript. Combining the best of two worlds
Symfony & Javascript. Combining the best of two worldsSymfony & Javascript. Combining the best of two worlds
Symfony & Javascript. Combining the best of two worldsIgnacio Martín
 
NativeBoost
NativeBoostNativeBoost
NativeBoostESUG
 
Machine Learning on Code - SF meetup
Machine Learning on Code - SF meetupMachine Learning on Code - SF meetup
Machine Learning on Code - SF meetupsource{d}
 

Semelhante a COG Back to the Future, Part II (20)

NYU hacknight, april 6, 2016
NYU hacknight, april 6, 2016NYU hacknight, april 6, 2016
NYU hacknight, april 6, 2016
 
CppCat Checks OpenMW: Not All is Fine in the Morrowind Universe
CppCat Checks OpenMW: Not All is Fine in the Morrowind UniverseCppCat Checks OpenMW: Not All is Fine in the Morrowind Universe
CppCat Checks OpenMW: Not All is Fine in the Morrowind Universe
 
100 bugs in Open Source C/C++ projects
100 bugs in Open Source C/C++ projects 100 bugs in Open Source C/C++ projects
100 bugs in Open Source C/C++ projects
 
Knee-deep in C++ s... code
Knee-deep in C++ s... codeKnee-deep in C++ s... code
Knee-deep in C++ s... code
 
Checking the Cross-Platform Framework Cocos2d-x
Checking the Cross-Platform Framework Cocos2d-xChecking the Cross-Platform Framework Cocos2d-x
Checking the Cross-Platform Framework Cocos2d-x
 
Analyzing the Dolphin-emu project
Analyzing the Dolphin-emu projectAnalyzing the Dolphin-emu project
Analyzing the Dolphin-emu project
 
A Slipshod Check of the Visual C++ 2013 Library (update 3)
A Slipshod Check of the Visual C++ 2013 Library (update 3)A Slipshod Check of the Visual C++ 2013 Library (update 3)
A Slipshod Check of the Visual C++ 2013 Library (update 3)
 
Tetcon2016 160104
Tetcon2016 160104Tetcon2016 160104
Tetcon2016 160104
 
Exploring the Cryptol Toolset
Exploring the Cryptol ToolsetExploring the Cryptol Toolset
Exploring the Cryptol Toolset
 
2013 syscan360 yuki_chen_syscan360_exploit your java native vulnerabilities o...
2013 syscan360 yuki_chen_syscan360_exploit your java native vulnerabilities o...2013 syscan360 yuki_chen_syscan360_exploit your java native vulnerabilities o...
2013 syscan360 yuki_chen_syscan360_exploit your java native vulnerabilities o...
 
DEF CON 23 - COLIN O'FLYNN - dont whisper my chips
DEF CON 23 - COLIN O'FLYNN - dont whisper my chipsDEF CON 23 - COLIN O'FLYNN - dont whisper my chips
DEF CON 23 - COLIN O'FLYNN - dont whisper my chips
 
The Unicorn's Travel to the Microcosm
The Unicorn's Travel to the MicrocosmThe Unicorn's Travel to the Microcosm
The Unicorn's Travel to the Microcosm
 
Picking Mushrooms after Cppcheck
Picking Mushrooms after CppcheckPicking Mushrooms after Cppcheck
Picking Mushrooms after Cppcheck
 
Intel IPP Samples for Windows - error correction
Intel IPP Samples for Windows - error correctionIntel IPP Samples for Windows - error correction
Intel IPP Samples for Windows - error correction
 
Intel IPP Samples for Windows - error correction
Intel IPP Samples for Windows - error correctionIntel IPP Samples for Windows - error correction
Intel IPP Samples for Windows - error correction
 
PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017
PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017
PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017
 
64-Bit Code in 2015: New in the Diagnostics of Possible Issues
64-Bit Code in 2015: New in the Diagnostics of Possible Issues64-Bit Code in 2015: New in the Diagnostics of Possible Issues
64-Bit Code in 2015: New in the Diagnostics of Possible Issues
 
Symfony & Javascript. Combining the best of two worlds
Symfony & Javascript. Combining the best of two worldsSymfony & Javascript. Combining the best of two worlds
Symfony & Javascript. Combining the best of two worlds
 
NativeBoost
NativeBoostNativeBoost
NativeBoost
 
Machine Learning on Code - SF meetup
Machine Learning on Code - SF meetupMachine Learning on Code - SF meetup
Machine Learning on Code - SF meetup
 

Mais 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
 

Mais 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

How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 

Último (20)

How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 

COG Back to the Future, Part II

  • 1. COG Back to the Future, Part II faster open source VMs for Croquet, Squeak & Newspeak 1
  • 4. Small part of a larger whole Why Cog? cog•no•men ¦kägnōmən; kägnəmən¦ noun an extra personal name given to an ancient Roman citizen, functioning rather like a nickname and typically passed down from father to son. • a name; a nickname. 4
  • 5. Success is 99% failure Why Cog? 5
  • 6. MARKETING GIRL: When you have been in marketing as long as I have, you’ll know that before any new product can be developed, it has to be properly researched. I mean yes, yes we’ve got to find out what people want from fire, I mean how do they relate to it, the image - FORD: Oh, stick it up your nose. MARKETING GIRL: Yes which is precisely the sort of thing we need to know, I mean do people want fire that can be fitted nasally? get the marketing out of the way early... 6
  • 8. What’s Cog? a blog http://www.mirandabanda.org/cogblog Community Organised Graft Contributions Over<->taken Gratefully 8
  • 9. What’s Cog? a series of VM evolutions bytecode sets object representations execution technology DTSSTCPW/KISS/Evolve not a new compiler not a replacement VM no new GC, new CompiledMethod, etc 9
  • 10. Where to? Targets: HPS style fast JIT Self style quick JIT Integrate with Hydra Integrate with Spoon 10
  • 13. Where to? Targets: HPS style fast JIT Self style quick JIT Prerequisites Closures Internal stack organization polymorphous Inline Caches 13
  • 14. 14
  • 15. baby steps Closures + Closure VM extend existing compiler front-end, new back-end 5 new bytecodes sionara BlockContext has ANSI block syntax nicely familiar less work Croquet 1.0, Squeak 3.9 www.mirandabanda.org/downloads Deployed internally at Qwaq 15
  • 16. closures enable stack representation inject: aValue into: binaryBlock | next | next := aValue. self do: [:each| next := binaryBlock value: next value: each]. ^next inject: aValue into: binaryBlock | tempVector | tempVector := Array new: 1. tempVector at: 1 put: aValue. self do: [:each| tempVector at: 1 put: (binaryBlock value: (tempVector at: 1) value: each)]. ^tempVector at: 1 16
  • 17. - BlockClosure - BlockContext + BlockClosure Object variableSubclass: #BlockClosure instanceVariableNames: 'outerContext startpc numArgs' BlockClosure methods for evaluating value[:value:value:value:] valueWithArguments: ContextPart variableSubclass: #MethodContext instanceVariableNames: 'method receiverMap closureOrNil receiver' baby steps 17
  • 18. closure activation inject:into: sender pc stackp method closureOrNil receiver 'Hi!' aValue 0 binaryBlock temp vector [] in inject:into: sender pc stackp method closureOrNil receiver $H temp ... [] in inject:into: outerContext startpc numArgs binaryBlock temp vector do: sender pc stackp method closureOrNil receiver arg ... temp ... an Array nextValue 18
  • 19. baby steps 5 new bytecodes pushNewArrayOfSize:/pushConsArrayWithElements: pushClosureCopyNumCopiedValues:numArgs:blockSize: pushRemoteTemp:inVectorAt: popRemoteTemp:inVectorAt: storeRemoteTemp:inVectorAt: change return bytecode to do non-local return if closureOrNil not nil 19
  • 20. Stack Interpreter Closure VM + Internal Stack Organization activations are stack frames on stack pages contexts on heap are proxies for stack frames Streamlined GC, no pop/pushRemappableOop: 20
  • 21. stack frame no argument copying lazy context creation slower argument access!! (in interpreter, not in JIT) epsilon away from fast JIT organization (maybe coexist) receiver/closure arg... caller saved ip/base frame caller context caller saved fp (0 for base frame) method flag bytes: numArgs, hasContext, isClosureActivation thisContext (uninitialized garbage in new frame) receiver temp... stack value... framePointer stackPointer 21
  • 22. stack activation ‘Hi!’ inject: 0 into: ! [:sum :char| sum + char asInteger] inject: thisValue into: binaryBlock ! | nextValue | ! nextValue := thisValue. ! self do: ! ! [:each | ! ! nextValue := binaryBlock value: nextValue value: each]. ! ^nextValue rcvr: 'Hi!' initialValue: 0 binaryBlock: [] in DoItsp 22
  • 23. stack activation ‘Hi!’ inject: 0 into: ! [:sum :char| sum + char asInteger] inject: thisValue into: binaryBlock ! | nextValue | ! nextValue := thisValue. ! self do: ! ! [:each | ! ! nextValue := binaryBlock value: nextValue value: each]. ! ^nextValue rcvr: 'Hi!' initialValue: 0 binaryBlock: [] in DoIt caller saved ip caller saved fp method (inject:into:) 2, false, false %$&^*#@! self: 'Hi!' temp vector: nil rcvr: 'Hi!'sp fp 23
  • 24. stack activation ‘Hi!’ inject: 0 into: ! [:sum :char| sum + char asInteger] inject: thisValue into: binaryBlock ! | nextValue | ! nextValue := thisValue. ! self do: ! ! [:each | ! ! nextValue := binaryBlock value: nextValue value: each]. ! ^nextValue rcvr: 'Hi!' initialValue: 0 binaryBlock: [] in DoIt caller saved ip caller saved fp method (inject:into:) 2, false, false %$&^*#@! self: 'Hi!' temp vector rcvr: 'Hi!' Array nextValue: 0 sp fp 24
  • 25. stack activationrcvr: 'Hi!' initialValue: 0 binaryBlock: [] in DoIt caller saved ip caller saved fp method (inject:into:) 2, false, true thisContext self: 'Hi!' temp vector rcvr: 'Hi!' [] in inject:into: BlockClosure outerContext startpc numArgs: 1 binaryBlock: [] in DoIt temp vector MethodContext sender: fp pc: caller saved fp stackp: 2 method: inject:into: closureOrNil: nil self: ‘Hi!’ temp vector binaryBlock: [] in DoIt %$&^*#@! ... %$&^*#@! Array nextValue: 0 sp fp 25
  • 26. stack activationrcvr: 'Hi!' initialValue: 0 binaryBlock: [] in DoIt caller saved ip caller saved fp method (inject:into:) 2, false, true thisContext self: 'Hi!' temp vector rcvr: 'Hi!' [] in inject:into: caller saved ip caller saved fp method (do:) 1, false, false %$&^*#@! self: 'Hi!' index: 1 BlockClosure outerContext startpc numArgs: 1 binaryBlock: [] in DoIt temp vector MethodContext sender: fp pc: caller saved fp stackp: 2 method: inject:into: closureOrNil: nil self: ‘Hi!’ temp vector binaryBlock: [] in DoIt %$&^*#@! ... %$&^*#@! Array nextValue: 0 sp fp 26
  • 27. stack activationrcvr: 'Hi!' initialValue: 0 binaryBlock: [] in DoIt caller saved ip caller saved fp method (inject:into:) 2, false, true thisContext self: 'Hi!' temp vector rcvr: 'Hi!' [] in inject:into: caller saved ip caller saved fp method (do:) 1, false, false %$&^*#@! self: 'Hi!' index: 1 clsr: [] in inject:into: each: $H caller saved ip caller saved fp method (inject:into:) 1, true, false %$&^*#@! self: ‘Hi’ [] in DoIt temp vector BlockClosure outerContext startpc numArgs: 1 binaryBlock: [] in DoIt temp vector MethodContext sender: fp pc: caller saved fp stackp: 2 method: inject:into: closureOrNil: nil self: ‘Hi!’ temp vector binaryBlock: [] in DoIt %$&^*#@! ... %$&^*#@! Array nextValue: 0 ⇐sp ⇐fp 27
  • 28. Stack Interpreter Nowish Detailed blog posts + code real soon now™ Underwhelming Performance ≈ 10% 68% faster benchmark performance as yet no faster for client experience bit of a mystery... 28
  • 29. the VM gardener’s spade many a mickle ... . ... makes a muckle 29
  • 30. fast JIT April 2009 (for x86) a la HPS simple deferred code gen (stack => register) three register (self + 2 args) calling convention most kernel prims all in regs (at: at:put: + * etc) in-line caches: open & closed PICs two word object header “open” translator retain interpreter 30
  • 31. The life-cycle of the lesser spotted Inline Cache egg -> monomorph -> polymorph -> megamorph the egg is one of many instructions laid by the JIT when it “compiles” a bytecode method into a native code method <B0> send #= movl %rCache,#= call linkSend1Args 31
  • 32. The life-cycle of the lesser spotted Inline Cache if executed the egg hatches into a larval monomorphic inline cache. Typically only 70% of eggs will hatch #(true false nil 0 0.0 #zero 'zero' $0 #()) select: [:each| each = 0] movl %rCache,#=!! !! movl %rCache,True call linkSend1Args! !! call Object.=.entry 32
  • 33. The life-cycle of the lesser spotted Inline Cache movl %rCache,True call Object.=.entry Object.=.entry: mov %rTemp,%rSelf and %rTemp,#3 jnz L1 mov %rTemp,%rSelf[#ClassOffset] L1: cmp %rTemp,%rCache jnz LCallFixSendFailure Object.=.noCheckEntry: rock and roll 33
  • 34. The life-cycle of the lesser spotted Inline Cache if the monomorph encounters another kind it changes into a nymph polymorphic cache with 2 cases. Only 10% of monomorphs will metamorphose into Closed PICs movl %rCache,True! !! movl %rCache,True call Object.=.entry! !! call aClosedPIC.=.entry 34
  • 35. The life-cycle of the lesser spotted Inline Cache aClosedPIC.=.entry: mov %rTemp,%rSelf and %rTemp,#3 jnz L1 mov %rTemp,%rSelf[#ClassOffset] L1: cmp %rTemp,%rCache jz Object.=.noCheckEntry cmp %rCache, #False jz Object.=.noCheckEntry jmp extendClosedPIC .... 35
  • 36. The life-cycle of the lesser spotted Inline Cache aClosedPIC.=.entry: mov %rTemp,%rSelf and %rTemp,#3 jnz L1 mov %rTemp,%rSelf[#ClassOffset] L1: cmp %rTemp,%rCache jz Object.=.noCheckEntry cmp %rCache, #False jz Object.=.noCheckEntry cmp %rCache, #UndefinedObject jz Object.=.noCheckEntry cmp %rCache, #SmallInteger jz SmallInteger.=.noCheckEntry jmp extendClosedPIC 36
  • 37. The life-cycle of the lesser spotted Inline Cache if the nymph polymorph has a rich enough life and encounters more than (say) 8 classes of self then it blossoms into a magnificent Open PIC movl %rCache,True !! ! !! movl %rCache,True call aClosedPIC.=.entry! !! call anOpenPIC.=.entry 37
  • 38. The life-cycle of the lesser spotted Inline Cache An adult Open PIC is adept at probing the first- level method lookup cache to find the target method for each self Since the Open PIC started life for a single selector it knows the constant value of its slector and its selector’s hash Only 1% of monomorphs will complete the arduous journey to Open PIC 38
  • 39. The epiphenomena of the lesser spotted Inline Cache in the steady state there is no code modification monomorphs and closed PICs eliminate indirect branches, allowing the processor’s prefetch logic to gorge itself on instructions beyond each branch eggs, monomorphs and polymorphs record concrete type information that an be harvested by an adaptive optimizer that speculatively inlines target methods 39
  • 40. two-word object header “common” 32-bit/64-bit object header classTableIndex is lookup key in in-line caches & first-level method lookup caches. GC doesn’t move them => simplified inline cache mgmt index sparse class table with classTableIndex only for class hierarchy search & class primitive no table access to instantiate known classes A class’s id hash is its classTableIndex => no lookup to classTableIndex for new: class... ...table... ...index flags etc identity... ...hash... ...field slot size e.g. 40
  • 41. “Open” fast JIT bytecode set translation via a table of functions not a switch statement object model is an ADT should be able to configure JIT for different bytecode sets, different GCs, object representations hence Croquet, Squeak and Newspeak and...? 41
  • 42. quick DT JIT target: good floating-point performance AOStA again... Adaptive Optimization => SIStA Speculative Inlining reify PIC state count conditional branches 6x less frequent than sends taken & untaken counts => basic block frequency image-level optimizer 42
  • 43. quick DT JIT image-level optimizer (many benefits) VM extended with go-faster no-check primitive bytecodes, e.g. add known non-overflowing SmallIntegers in-bounds pointer at: known SmallInteger index could marry well with LLVM 43
  • 44. quick DT JIT model for good floating-point performance: OptimizedContext has two stacks object & byte data VM extended with unboxed float bytecodes, e.g. bdsDoubleAt:putProductOfBdsDblAt:andBdsDblAt: pushBoxDbsDoubleAt: code gen maps byte data stack to floating-point regs 44
  • 45. quick DT JIT 2010, 2011? Sooner if you join the Cognoscenti... 45