retrospective: seven vm engineering years
DESCRIPTION
Title: Retrospective: Seven VM Engineering Years Speaker: Andres Valloud Wed, August 20, 2:00pm – 2:30pm Video Part1: https://www.youtube.com/watch?v=LdDIW2lrIrU Video Part2: https://www.youtube.com/watch?v=0EcTg3shdq8 Description Abstract: In this talk the presenter will summarize the lessons learned during 7 years of virtual machine development, looking at Smalltalk from the dual perspective of a VM engineer. Bio: Andres Valloud has been lead VM engineer at Cincom from 2007 to 2014. He has also authored 3 books on Smalltalk, and currently works at LabWare.TRANSCRIPT
Retrospective Seven VM Engineering Years
Andres Valloud
A typical VM project
A typical VM project
“do something about 64 bits”
do something about 64 bits
do something about 64 bits
ImageWriter
do something about 64 bits
ImageWriter
image format
do something about 64 bits
ImageWriter
Serializationimage format
do something about 64 bits
ImageWriter
Serializationimage format
32 vs 64 bits
do something about 64 bits
ImageWriter
FFI, types
Serializationimage format
32 vs 64 bits
do something about 64 bits
ImageWriter
FFI, types
Serializationimage format
platform specs
32 vs 64 bits
do something about 64 bits
ImageWriter
FFI, types
SerializationSmallInteger
image format
platform specs
32 vs 64 bits
do something about 64 bits
ImageWriter
FFI, types
SerializationSmallInteger
image format
platform specs
32 vs 64 bits
x86 code generators
do something about 64 bits
ImageWriter
FFI, types
SerializationSmallInteger
image format
platform specs
32 vs 64 bits
x86 code generators
x86 specs
do something about 64 bits
ImageWriter
FFI, types
Serialization
Floating point
SmallIntegerimage format
platform specs
32 vs 64 bits
x86 code generators
x86 specs
do something about 64 bits
ImageWriter
FFI, types
Serialization
Floating point
SmallIntegerimage format
platform specs
32 vs 64 bits
x86 code generators
IEEE-754
x86 specs
do something about 64 bits
ImageWriter
FFI, types
Serialization
Floating point
SmallIntegerimage format
platform specs
32 vs 64 bits
x86 code generators
FPU specs
IEEE-754
x86 specs
do something about 64 bits
ImageWriter
FFI, types
Serialization
Floating point
SmallIntegerimage format
platform specs
32 vs 64 bits
x86 code generators
FPU specs
IEEE-754
SmallDouble
x86 specs
do something about 64 bits
ImageWriter
FFI, types
Serialization
Floating point
SmallIntegerimage format
platform specs
32 vs 64 bits
x86 code generators
FPU specs
IEEE-754
SmallDouble
32 bit bugs
x86 specs
do something about 64 bits
ImageWriter
FFI, types
Serialization
Floating point
SmallInteger
prim returns
image format
platform specs
32 vs 64 bits
x86 code generators
FPU specs
IEEE-754
SmallDouble
32 bit bugs
x86 specs
do something about 64 bits
ImageWriter
FFI, types
Serialization
Floating point
SmallInteger
prim returns pointer
aliasing
image format
platform specs
32 vs 64 bits
x86 code generators
FPU specs
IEEE-754
SmallDouble
32 bit bugs
x86 specs
do something about 64 bits
ImageWriter
FFI, types
Serialization
Floating point
SmallInteger
prim returns pointer
aliasing
image format
platform specs
32 vs 64 bits
x86 code generators
FPU specs
C99
compiler manuals
IEEE-754
SmallDouble
32 bit bugs
x86 specs
do something about 64 bits
ImageWriter
FFI, types
Serialization
Floating point
SmallInteger
prim returns pointer
aliasing
image format
platform specs
32 vs 64 bits
x86 code generators
FPU specs
C99
compiler manuals
IEEE-754
SmallDouble
SIGSEGV32 bit bugs
x86 specs
do something about 64 bits
ImageWriter
FFI, types
Serialization
Floating point
SmallInteger
prim returns pointer
aliasing
image format
platform specs
32 vs 64 bits
x86 code generators
FPU specs
C99
compiler manuals
IEEE-754
SmallDouble
SIGSEGVC compilers32 bit bugs
x86 specs
do something about 64 bits
ImageWriter
FFI, types
Serialization
Floating point
SmallInteger
prim returns pointer
aliasing
image format
platform specs
32 vs 64 bits
x86 code generators
FPU specs
C99
compiler manuals
IEEE-754
SmallDouble
SIGSEGVC compilers
ABI violations
32 bit bugs
x86 specs
do something about 64 bits
ImageWriter
FFI, types
Serialization
Floating point
SmallInteger
prim returns pointer
aliasingGarbage Collectors
image format
platform specs
32 vs 64 bits
x86 code generators
FPU specs
C99
compiler manuals
IEEE-754
SmallDouble
SIGSEGVC compilers
ABI violations
32 bit bugs
x86 specs
do something about 64 bits
ImageWriter
FFI, types
Serialization
Floating point
SmallInteger
prim returns pointer
aliasingGarbage Collectors
image format
platform specs
32 vs 64 bits
x86 code generators
FPU specs
C99
compiler manuals
IEEE-754
SmallDouble
SIGSEGVC compilers
ABI violations
32 bit bugs
x86 specs
Speaking of GC
Speaking of GC
“every efficient GC is a hybrid of reference counting and tracing”
Reference counting and tracing
Reference counting and tracing
New Old Perm
Eden
S1
S2
Reference counting and tracing
New Old Perm
Eden
S1
S2
RT
Reference counting and tracing
New Old Perm
Eden
S1
S2
RT Old RT
Reference counting and tracing
New Old Perm
Eden
S1
S2
RT Old RT
IGC lists
Reference counting and tracing
New Old Perm
Eden
S1
S2
RT Old RT
Class table
IGC lists
... problems...
Hardware
C
Image <primitive: 123>
... and rax, 3h...
<foo.dll bar( )>
prim123( ) {...} FFI
OS, C libraries
VM
... problems...
Hardware
C
Image <primitive: 123>
... and rax, 3h...
<foo.dll bar( )>
prim123( ) {...} FFI
OS, C libraries
VM
UD
... problems...
Hardware
C
Image <primitive: 123>
... and rax, 3h...
<foo.dll bar( )>
prim123( ) {...} FFI
OS, C libraries
VM
UD
sigevent_t
... problems...
Hardware
C
Image <primitive: 123>
... and rax, 3h...
<foo.dll bar( )>
prim123( ) {...} FFI
OS, C libraries
VM
UD
sigevent_t
port
... problems...
Hardware
C
Image <primitive: 123>
... and rax, 3h...
<foo.dll bar( )>
prim123( ) {...} FFI
OS, C libraries
VM
UD
sigevent_t macros, GetLastError()
port
Long term vision
Long term vision
“an excess of code cruft is preventing us from doing our jobs”
LOC over time
0k
80k
160k
240k
320k
400k
1990 1994 1997 2000 2003 2005 2008 2011
ObjectWorks VW 2.x VW 3.x VW 5.x VW 7.x - 2007 VW 7.x - 2014
Progress over time
-180
-120
-60
0
60
120
180
240
300
7.1 7.2 7.3 7.4 7.5 7.6 7.7 7.7.1 7.8 7.9 7.10
∆ LOC / 500 VW 7.x - 2007 VM ARs closed ∆ LOC / 500 VW 7.x - 2013
GC improvements 2010
0 sec
10,000 sec
20,000 sec
30,000 sec
40,000 sec
Ax100 Bx100 Cx400 Dx40 Ex40 Fx6 Gx6
VW 7.7 legacy VW 7.7.1 legacy sizesAtStartup VW 7.7.1 default
A: pointer garbage B: byte garbage C: point creation
Segmented container D: byte allocation E: pointer allocation
Large container F: byte allocation G: pointer allocation
GC improvements 2013
0 sec
500 sec
1,000 sec
1,500 sec
2,000 sec
Scavenge Stress GC Stress GC Deep Stack Stress Total
VW 7.7.1 VW 7.10
VW 7.10’s GC ~45% faster than VW 7.7.1 overall
The message
The message
“pauca sed matura”