retrospective: seven vm engineering years

47
Retrospective Seven VM Engineering Years Andres Valloud

Upload: esug

Post on 20-May-2015

137 views

Category:

Software


0 download

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

Page 1: Retrospective: Seven VM Engineering Years

Retrospective Seven VM Engineering Years

Andres Valloud

Page 2: Retrospective: Seven VM Engineering Years

A typical VM project

Page 3: Retrospective: Seven VM Engineering Years

A typical VM project

“do something about 64 bits”

Page 4: Retrospective: Seven VM Engineering Years

do something about 64 bits

Page 5: Retrospective: Seven VM Engineering Years

do something about 64 bits

ImageWriter

Page 6: Retrospective: Seven VM Engineering Years

do something about 64 bits

ImageWriter

image format

Page 7: Retrospective: Seven VM Engineering Years

do something about 64 bits

ImageWriter

Serializationimage format

Page 8: Retrospective: Seven VM Engineering Years

do something about 64 bits

ImageWriter

Serializationimage format

32 vs 64 bits

Page 9: Retrospective: Seven VM Engineering Years

do something about 64 bits

ImageWriter

FFI, types

Serializationimage format

32 vs 64 bits

Page 10: Retrospective: Seven VM Engineering Years

do something about 64 bits

ImageWriter

FFI, types

Serializationimage format

platform specs

32 vs 64 bits

Page 11: Retrospective: Seven VM Engineering Years

do something about 64 bits

ImageWriter

FFI, types

SerializationSmallInteger

image format

platform specs

32 vs 64 bits

Page 12: Retrospective: Seven VM Engineering Years

do something about 64 bits

ImageWriter

FFI, types

SerializationSmallInteger

image format

platform specs

32 vs 64 bits

x86 code generators

Page 13: Retrospective: Seven VM Engineering Years

do something about 64 bits

ImageWriter

FFI, types

SerializationSmallInteger

image format

platform specs

32 vs 64 bits

x86 code generators

x86 specs

Page 14: Retrospective: Seven VM Engineering Years

do something about 64 bits

ImageWriter

FFI, types

Serialization

Floating point

SmallIntegerimage format

platform specs

32 vs 64 bits

x86 code generators

x86 specs

Page 15: Retrospective: Seven VM Engineering Years

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

Page 16: Retrospective: Seven VM Engineering Years

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

Page 17: Retrospective: Seven VM Engineering Years

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

Page 18: Retrospective: Seven VM Engineering Years

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

Page 19: Retrospective: Seven VM Engineering Years

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

Page 20: Retrospective: Seven VM Engineering Years

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

Page 21: Retrospective: Seven VM Engineering Years

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

Page 22: Retrospective: Seven VM Engineering Years

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

Page 23: Retrospective: Seven VM Engineering Years

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

Page 24: Retrospective: Seven VM Engineering Years

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

Page 25: Retrospective: Seven VM Engineering Years

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

Page 26: Retrospective: Seven VM Engineering Years

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

Page 27: Retrospective: Seven VM Engineering Years

Speaking of GC

Page 28: Retrospective: Seven VM Engineering Years

Speaking of GC

“every efficient GC is a hybrid of reference counting and tracing”

Page 29: Retrospective: Seven VM Engineering Years

Reference counting and tracing

Page 30: Retrospective: Seven VM Engineering Years

Reference counting and tracing

New Old Perm

Eden

S1

S2

Page 31: Retrospective: Seven VM Engineering Years

Reference counting and tracing

New Old Perm

Eden

S1

S2

RT

Page 32: Retrospective: Seven VM Engineering Years

Reference counting and tracing

New Old Perm

Eden

S1

S2

RT Old RT

Page 33: Retrospective: Seven VM Engineering Years

Reference counting and tracing

New Old Perm

Eden

S1

S2

RT Old RT

IGC lists

Page 34: Retrospective: Seven VM Engineering Years

Reference counting and tracing

New Old Perm

Eden

S1

S2

RT Old RT

Class table

IGC lists

Page 35: Retrospective: Seven VM Engineering Years

... problems...

Hardware

C

Image <primitive: 123>

... and rax, 3h...

<foo.dll bar( )>

prim123( ) {...} FFI

OS, C libraries

VM

Page 36: Retrospective: Seven VM Engineering Years

... problems...

Hardware

C

Image <primitive: 123>

... and rax, 3h...

<foo.dll bar( )>

prim123( ) {...} FFI

OS, C libraries

VM

UD

Page 37: Retrospective: Seven VM Engineering Years

... problems...

Hardware

C

Image <primitive: 123>

... and rax, 3h...

<foo.dll bar( )>

prim123( ) {...} FFI

OS, C libraries

VM

UD

sigevent_t

Page 38: Retrospective: Seven VM Engineering Years

... problems...

Hardware

C

Image <primitive: 123>

... and rax, 3h...

<foo.dll bar( )>

prim123( ) {...} FFI

OS, C libraries

VM

UD

sigevent_t

port

Page 39: Retrospective: Seven VM Engineering Years

... problems...

Hardware

C

Image <primitive: 123>

... and rax, 3h...

<foo.dll bar( )>

prim123( ) {...} FFI

OS, C libraries

VM

UD

sigevent_t macros, GetLastError()

port

Page 40: Retrospective: Seven VM Engineering Years

Long term vision

Page 41: Retrospective: Seven VM Engineering Years

Long term vision

“an excess of code cruft is preventing us from doing our jobs”

Page 42: Retrospective: Seven VM Engineering Years

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

Page 43: Retrospective: Seven VM Engineering Years

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

Page 44: Retrospective: Seven VM Engineering Years

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

Page 45: Retrospective: Seven VM Engineering Years

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

Page 46: Retrospective: Seven VM Engineering Years

The message

Page 47: Retrospective: Seven VM Engineering Years

The message

“pauca sed matura”