The Cog VM evolution
Video: https://youtu.be/Gi0WiIxvJ60
Thu, August 25, 11:30am – 12:00pm
First Name: Clement
Last Name: Bera
Email: bera.clement@gmail.com
Title: The Cog VM evolution
Type: Talk
Abstract: In 2008, the Squeak VM repository made by Dan Ingalls was
forked to give birth to the high-performance Cog VM, which is now the
default VM for multiple Smalltalk dialects such as Pharo, Squeak or
Cuis. Since the fork, new features and performance enhancements have
been introduced every year. This talk sums up all the main features
and main performance tweaks that were added to the Cog VM in
chronological order from 2008 to today. The focus is on the execution
engine: Memory management, interpretation, JIT compilation and FFI.
The talk lastly discusses the current work in-progress and short-term
future work.
Bio: Clément Béra is a PhD student working on virtual machines for
object oriented languages at Inria, Lille. He is now focusing on
runtime optimisations for the Cog virtual machine and its Smalltalk
clients.
6. Evolution
• User and Customer driven
• Where did we start ?
• What problems did we solve ?
Thursday, August 25, 16
7. Starting blocks
• InterpreterVM
• Made by Dan Ingalls Team
• Simple Interpreter
• Spaghetti stack
• Smart but simple Memory Manager
Thursday, August 25, 16
10. • Context-to-stack Mapping
• 85% of context allocation removed
• No copying of arguments
• New hash logic
• Primitive function caching
StackVM
Thursday, August 25, 16
11. Issue
• Closure implementation
• No temporaries
• BlockAlreadyEvaluated error
• Non obvious bugs
• New implementation
Thursday, August 25, 16
24. Newspeak support ?
• Multiple bytecode set support
• Newspeak specific operations
• Interpreter
• Machine code generation
Thursday, August 25, 16
25. 64 bits ?
Images larger than 1 or 2 Gb ?
Moving objects during FFI call-backs ?
Even more performance !
Ephemerons ?
Become is so slow it cannot be used.
Thursday, August 25, 16
26. 64 bits ?
Images larger than 1 or 2 Gb ?
Moving objects during FFI call-backs ?
Even more performance !
Ephemerons ?
Become is so slow it cannot be used.
Short-term delivery
Thursday, August 25, 16
27. 64 bits ?
Images larger than 1 or 2 Gb ?
Moving objects during FFI call-backs ?
Even more performance !
Ephemerons ?
Become is so slow it cannot be used.
Short-term delivery
• New Memory Manager
Thursday, August 25, 16
28. Spur Memory Manager
• Class-table (efficient caches and compactness)
• Efficient scavenging
• Fast become
• New object layouts (Ephemerons, ShortArrays)
• Memory representation 64-bits compatible
• Pinned objects
• Segmented Memory
Thursday, August 25, 16
58. • C generated from Slang
• Many were fixed
• Towards compilation with -WAll -WError
C compiler warning ?
Thursday, August 25, 16
59. • LargeInteger plugin more efficient
• Computation moved from 8bits to 32 bits
• Different compilation flags
Faster arithmetic ?
Thursday, August 25, 16
62. CogVM team
• Started with Eliot Miranda
• Many more contributors now:
• Tim Rowledge
• Clément Béra (myself)
• Nicolas Cellier
• Fabio Niephaus & Tim Felgentreff
• Ryan Macnak
Thursday, August 25, 16
63. Conclusion
• Lots of new features and improvements over years
• A lot more is incoming
• If you want to support, talk to us !
• ARMv8 ?
• Incremental GC ?
• Performance (escaping, floats) ?
Thursday, August 25, 16