SlideShare una empresa de Scribd logo
1 de 27
Descargar para leer sin conexión
Copyright © 2015 Instantiations, Inc.
23rd ESUG Conference
Brescia, Italy
July 13-19, 2015
Dino2
The Evolution of the
VA Smalltalk Virtual Machine
John O’Keefe
Chief Technical Officer
Instantiations, Inc.
Copyright © 2015 Instantiations, Inc.
Dino2
• Why am I giving the presentation instead of a
real VM guy?
Copyright © 2014 Instantiations, Inc.
Dino2
• Because the real
VM guy is busy!!
• Seth and Kate’s
daughter Adelyn, born
June 19
Copyright © 2015 Instantiations, Inc.
Dino2
Agenda
• Driving forces
• VAST VM history
• Do we need a new VM?
• Challenges
• How we did it
• Results
• Demo
• Still to do
• Q&A
Copyright © 2015 Instantiations, Inc.
Dino2
Driving Forces
• 64-bit support required
• Dramatically expands available memory space
• Interface with 64-bit DLLs/SOs
• Simplify maintenance and enhancement of the
VAST VM
• Enables use of modern tool chains
• Replaces current proprietary modeling language with C
Copyright © 2015 Instantiations, Inc.
Dino2
VAST VM History
• Extremely stable - basically unchanged in 25+
years
• Developed using proprietary Smalltalk VM
Modeling Language
• Maximize efficiency on constrained hardware
• Cross-platform model
• No dependency on C compiler
Smalltalk
Model Code
x86
Power
PC
SPARC
Portable
Assembler
Copyright © 2015 Instantiations, Inc.
Dino2
Do We Need a NEW VM?
• Smalltalk Modeling Language
• Obscure – hard to learn/extend
• Obfuscates the algorithms
• Portable Assembler
• Does not take advantage of new machine architectures
• Generated machine code
• Non-standard calling conventions
• Standard debuggers don’t work
• Hard to map performance tools result back to model
• JIT
• Must be hand-built to match machine architecture
Copyright © 2015 Instantiations, Inc.
Dino2
Sample Smalltalk Model code
VMprCharacterTestBit
self
systemPrimitive: 'VMprCharacterTestBit'
receiverClass: Character
body: [| receiver byteArray bit addr |
receiver := registerModel allocateDataRegister.
byteArray := registerModel allocateAddressRegister.
bit := registerModel allocateDataRegister.
byteArray gets: (self parm: 1 of: 1).
([self isImmediate: byteArray] || [(self isBytes: byteArray) not]) do: [
self failAsmPrimitiveViaCache: PrimErrInvalidClass arg: 1].
receiver gets: (self receiverForParms: 1).
self convertToCharacter: receiver.
bit gets: receiver.
bit &= 7.
receiver shiftRightLogical: 3.
(receiver greaterThanOrEqualUnsigned: (byteArray at: (constant field: 'size' of: K8ObjectHeader))) do: [
self failAsmPrimitiveViaCache: PrimErrInvalidSize arg: 1].
registerModel region: [
addr := registerModel allocateAddressRegister asBytePointer.
addr gets: (constant addressOfLabel: (label global data named: 'K8SetBits')).
bit loadUnsigned: (addr indexedBy: bit)].
receiver loadUnsigned: ((byteArray asBytePointer at: constant objectHeaderSize) index: receiver).
and setFlags source: bit dest: receiver.
condition zero do: [receiver gets: false] else: [receiver gets: true].
self return: receiver parms: 1]
Copyright © 2015 Instantiations, Inc.
Dino2
Sample C code
EsPrimitive(VMprCharacterTestBit)
{
U_16 value;
EsObject byteArray;
U_8 bit;
byteArray = EsPrimitiveArgument(1, 1);
if (!EsIsBytes(byteArray))
EsPrimitiveFailed(EsPrimErrInvalidClass, 1);
value = EsCharacterToU16(EsPrimitiveReceiver(1));
bit = (U_8)(value & 7); /* 0 to 7 bit number within byte */
value = (value >> 3) + 1; /* 1 to (MAX_CHARACTER_VALUE/8)+1 byte number within table */
if (value > (byteArray->size))
EsPrimitiveFailed(EsPrimErrInvalidSize, 1);
EsPrimitiveSucceed((((EsByteAt(byteArray, value)) & (1<<bit)) ? EsTrue : EsFalse), 1);
}
Copyright © 2015 Instantiations, Inc.
Dino2
Challenges
• Minimal existing test cases
• If the basic image tests run, the VM is OK
• ‘VM in C’ performance
• 32-bit x86 VM loses an available register (-)
• C compilers produce far superior code; example:
instruction reordering (+)
• Many benchmarks (both micro and macro) ported and
developed
• Tool chain convergence
• Image conversion
• Impedance mis-match
• “Jump where ever I want to”, stack and register mgmt
Copyright © 2015 Instantiations, Inc.
Dino2
How We Did It
• Moved to cmake and gcc based tool chain
• Use ‘register intrinsics’ for performance
• Nightly build and test
• Minimal assembler
• Low-level arithmetic, exception handling, OLE support
• Incremental changes
• Shim code developed to cross old/new boundary
• VM always works
• 64-bit ‘clean’ changes as we go
• Detour from plan: Interpreter was done all in one piece
Copyright © 2015 Instantiations, Inc.
Dino2
How We Did It
• Example: Garbage Collector
• 3 major components: Scavenger, Mark-Compact,
Allocator
• Components converted one-at-a-time
• Millions of lines of trace output produced to verify
everything worked the same
• Incremental changes means we always had a working
VM to test the changes
Copyright © 2015 Instantiations, Inc.
Dino2
How We Did It
• Just in time image conversion (64-bit VM)
• 32-bit images and image components (ICs) converted
on first use
• Image can be saved in 64-bit format
• 32-bit ICs loadable from 64-bit image
Copyright © 2015 Instantiations, Inc.
Dino2
How We Did It
There’s no magic in software, just hard work with a result that
may appear to be magic!
• The image has to change -- because 64-bitness
shows through
• Foreign Function Interfaces (FFI) aka PlatformFunctions
• Memory mapping objects (OSObjects)
• Goal is to minimize changes in user code
• So most of the changes are in VAST framework code
Copyright © 2015 Instantiations, Inc.
Dino2
How We Did It
• Elastic PlatformFunctions
• Holds template for making FFI call
• Parameter sizes and offsets were fixed
• Changed parameter sizes and offsets from fixed to
relative
Copyright © 2015 Instantiations, Inc.
Dino2
How We Did It
• Elastic OSStructures
• Accessors were based on fixed size and structure offsets
• Changed accessors from absolute to relative offset
• Compute fixed offsets on image startup
Copyright © 2015 Instantiations, Inc.
Dino2
How We Did It
• Elastic OSStructure Example (C)
#ifdef _WIN32
#include <pshpack1.h>
#endif
typedef struct NMHDR
{
HWND hwndFrom;
UINT_PTR idFrom;
UINT code; // NM_ code
};
typedef struct TVKEYDOWN {
NMHDR hdr;
WORD wVKey;
UINT flags;
};
#ifdef _WIN32
#include <poppack.h>
#endif
Copyright © 2015 Instantiations, Inc.
Dino2
How We Did It
• Elastic OSStructure Example (Smalltalk)
"Define NMHDR Struct“
OSNmhdr members: #(#hwndFrom #idFrom #code) types: #(pointer pointer
uint32).
"Define TVKEYDOWN Struct - Pack1 if 32-bit“
OSTvKeydown members: #(hdr wVKey flags) types: #(OSNmhdr uint16 uint32).
System is64BitVM ifFalse: [OSTvKeydown updateAlignmentType: AlignNone]. "Pack
on byte boundary“
-----------------------------------------------------------------------------------------------
OSTvKeydown>>#flags
"Answer the member: UINT flags.
32/64-bit compatible“
^ self uint32At: #flags
Copyright © 2015 Instantiations, Inc.
Dino2
How We Did It
• Additional Benefits of Elastic OSStructures
• Custom Packing for data structures
• OSStructure members: #(a b) types: #(int8 int8) alignment:
Align2 "pack2"
• Custom Padding
• OSStructure members: #(a b) types: #(int8 pad[3] int32)
alignment: AlignNone "pack1/manual pad“
• Embedded OSStructures
• OSStructureA members #(a) types: #(int8)
• OSStructureB members #(a b) types: #(int8 OSStructureA)
• Nested Anonymous Structures/Unions
• OSStructure members: #(a (b c) ) types: #(int32 ((int32 int32)) )
• struct { int a; struct { int b; int c; } }
• OSStructure members: #(a (b c) ) types: #(int32 (int32 double) )
• struct { int a; union { int b; double c; } }
• -
Copyright © 2015 Instantiations, Inc.
Dino2
How We Did It
• Additional Benefits of Elastic OSStructures
• Pointer Types
• OSStructure members #(a b) types: #(pointer int32) "4 bytes on
32-bit, 8 bytes on 64-bit"
• OSStructure members #(a b) types: #('uint8*' int32) "Also a
pointer with additional type info"
• Arrays
• OSStructure members #(a b) types: #('int8[10]' int32) "Array
types are supported
• OSVariableStructure members: #(a b) types: #(int8 pointer[])
"Flexible array types supported
Copyright © 2015 Instantiations, Inc.
Dino2
How We Did It
• Additional Benefits of Elastic OSStructures
• Dependency Analyzer
• Don't need to define OSStructures in order of their dependencies
• Invalid Circular dependencies will be detected
• Extensible Base Types
• You can add your own types, either globally or method override
• We do a method override for TCHAR for future Unicode support
• Currently a char8, but may later be a char32. Existing definitions using
TCHAR are now future proofed for this change
Copyright © 2015 Instantiations, Inc.
Dino2
Results
• 64-bit VM is just a recompile
• No separate 32-to-64 bit image converter
• Interpreter benchmarks are > 80% of current VM
• Before algorithm tuning
• Before C tuning
• User code is largely unaware of change
Copyright © 2015 Instantiations, Inc.
Dino2
Demo
Copyright © 2015 Instantiations, Inc.
Dino2
Still To Do
• 80% done means more work to do
• Performance tuning (algorithms and C)
• JIT
• 64-bit Packager
• Improved garbage collector
• Installation and setup
• UNIX
Copyright © 2015 Instantiations, Inc.
Dino2
When can we have it?
• Windows - 3 delivery dates
• Alpha
• 1Q2016
• Early customer involvement program; entry by invitation
• Beta
• 2Q2016
• Open registration
• Production
• V9.0 on normal product delivery schedule
• UNIX later
Copyright © 2015 Instantiations, Inc.
Contact us
• General information
• info@instantiations.com
• Sales
• sales@instantiations.com
• Support
• support@instantiations.com
• Me
• john_okeefe@instantiations.com
Copyright © 2015 Instantiations, Inc.
Thank you for your attention
Questions?

Más contenido relacionado

Destacado

Top 8 youth program director resume samples
Top 8 youth program director resume samplesTop 8 youth program director resume samples
Top 8 youth program director resume samples
tonychoper1905
 

Destacado (12)

Containerization Is More than the New Virtualization
Containerization Is More than the New VirtualizationContainerization Is More than the New Virtualization
Containerization Is More than the New Virtualization
 
Top 8 youth program director resume samples
Top 8 youth program director resume samplesTop 8 youth program director resume samples
Top 8 youth program director resume samples
 
Class seven sura akhlas
Class seven sura akhlasClass seven sura akhlas
Class seven sura akhlas
 
Manú SPA
Manú SPAManú SPA
Manú SPA
 
Don't or Doesn't
Don't or Doesn'tDon't or Doesn't
Don't or Doesn't
 
Don't doesn't ed
Don't doesn't edDon't doesn't ed
Don't doesn't ed
 
38
3838
38
 
Class seven i like folk songs
Class seven i like folk songsClass seven i like folk songs
Class seven i like folk songs
 
PRESSURE DROP STUDIES IN WAVY CORRUGATED PLATE HEAT EXCHANGERS
PRESSURE DROP STUDIES IN WAVY CORRUGATED PLATE HEAT EXCHANGERSPRESSURE DROP STUDIES IN WAVY CORRUGATED PLATE HEAT EXCHANGERS
PRESSURE DROP STUDIES IN WAVY CORRUGATED PLATE HEAT EXCHANGERS
 
Bakso somay 2
Bakso somay 2Bakso somay 2
Bakso somay 2
 
La dieta mediterránea
 La dieta mediterránea La dieta mediterránea
La dieta mediterránea
 
Medio ambiente
Medio ambienteMedio ambiente
Medio ambiente
 

Similar a Dino2 - the Amazing Evolution of the VA Smalltalk Virtual Machine

Srikanth_PILLI_CV_latest
Srikanth_PILLI_CV_latestSrikanth_PILLI_CV_latest
Srikanth_PILLI_CV_latest
Srikanth Pilli
 
PyKinect: Body Iteration Application Development Using Python
PyKinect: Body Iteration Application Development Using PythonPyKinect: Body Iteration Application Development Using Python
PyKinect: Body Iteration Application Development Using Python
pycontw
 
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
Sang Don Kim
 
Using Smalltalk for controlling robotics systems
Using Smalltalk for controlling robotics systemsUsing Smalltalk for controlling robotics systems
Using Smalltalk for controlling robotics systems
Serge Stinckwich
 

Similar a Dino2 - the Amazing Evolution of the VA Smalltalk Virtual Machine (20)

embedded C.pptx
embedded C.pptxembedded C.pptx
embedded C.pptx
 
Sista: Improving Cog’s JIT performance
Sista: Improving Cog’s JIT performanceSista: Improving Cog’s JIT performance
Sista: Improving Cog’s JIT performance
 
DevOpsCon 2015 - DevOps in Mobile Games
DevOpsCon 2015 - DevOps in Mobile GamesDevOpsCon 2015 - DevOps in Mobile Games
DevOpsCon 2015 - DevOps in Mobile Games
 
Continuous Delivery the hard way with Kubernetes
Continuous Delivery the hard way with KubernetesContinuous Delivery the hard way with Kubernetes
Continuous Delivery the hard way with Kubernetes
 
Continuous Delivery the Hard Way with Kubernetes
Continuous Delivery the Hard Way with Kubernetes Continuous Delivery the Hard Way with Kubernetes
Continuous Delivery the Hard Way with Kubernetes
 
Oh the compilers you'll build
Oh the compilers you'll buildOh the compilers you'll build
Oh the compilers you'll build
 
Jfokus 2016 - A JVMs Journey into Polyglot Runtimes
Jfokus 2016 - A JVMs Journey into Polyglot RuntimesJfokus 2016 - A JVMs Journey into Polyglot Runtimes
Jfokus 2016 - A JVMs Journey into Polyglot Runtimes
 
Continuous Delivery the Hard Way with Kubernetes
Continuous Delivery the Hard Way with Kubernetes Continuous Delivery the Hard Way with Kubernetes
Continuous Delivery the Hard Way with Kubernetes
 
Building Applications with the Microsoft Kinect SDK
Building Applications with the Microsoft Kinect SDKBuilding Applications with the Microsoft Kinect SDK
Building Applications with the Microsoft Kinect SDK
 
03 workshop
 03 workshop 03 workshop
03 workshop
 
The OMR GC talk - Ruby Kaigi 2015
The OMR GC talk - Ruby Kaigi 2015The OMR GC talk - Ruby Kaigi 2015
The OMR GC talk - Ruby Kaigi 2015
 
Why use Gitlab
Why use GitlabWhy use Gitlab
Why use Gitlab
 
Why and How to Run Your Own Gitlab Runners as Your Company Grows
Why and How to Run Your Own Gitlab Runners as Your Company GrowsWhy and How to Run Your Own Gitlab Runners as Your Company Grows
Why and How to Run Your Own Gitlab Runners as Your Company Grows
 
Srikanth_PILLI_CV_latest
Srikanth_PILLI_CV_latestSrikanth_PILLI_CV_latest
Srikanth_PILLI_CV_latest
 
Simple Single Instruction Multiple Data (SIMD) with the Intel® Implicit SPMD ...
Simple Single Instruction Multiple Data (SIMD) with the Intel® Implicit SPMD ...Simple Single Instruction Multiple Data (SIMD) with the Intel® Implicit SPMD ...
Simple Single Instruction Multiple Data (SIMD) with the Intel® Implicit SPMD ...
 
PyKinect: Body Iteration Application Development Using Python
PyKinect: Body Iteration Application Development Using PythonPyKinect: Body Iteration Application Development Using Python
PyKinect: Body Iteration Application Development Using Python
 
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
 
Using Smalltalk for controlling robotics systems
Using Smalltalk for controlling robotics systemsUsing Smalltalk for controlling robotics systems
Using Smalltalk for controlling robotics systems
 
20191018 DevOpsDays Taipei 2019 從零開始的 Configuration Management
20191018 DevOpsDays Taipei 2019 從零開始的 Configuration Management20191018 DevOpsDays Taipei 2019 從零開始的 Configuration Management
20191018 DevOpsDays Taipei 2019 從零開始的 Configuration Management
 
SMP implementation for OpenBSD/sgi
SMP implementation for OpenBSD/sgiSMP implementation for OpenBSD/sgi
SMP implementation for OpenBSD/sgi
 

Más 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 programming
ESUG
 
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
ESUG
 
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 results
ESUG
 
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
ESUG
 
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
ESUG
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic Programming
ESUG
 
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
ESUG
 
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
ESUG
 
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
ESUG
 
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
ESUG
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and Future
ESUG
 
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
ESUG
 

Más 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

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Último (20)

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 

Dino2 - the Amazing Evolution of the VA Smalltalk Virtual Machine

  • 1. Copyright © 2015 Instantiations, Inc. 23rd ESUG Conference Brescia, Italy July 13-19, 2015 Dino2 The Evolution of the VA Smalltalk Virtual Machine John O’Keefe Chief Technical Officer Instantiations, Inc.
  • 2. Copyright © 2015 Instantiations, Inc. Dino2 • Why am I giving the presentation instead of a real VM guy?
  • 3. Copyright © 2014 Instantiations, Inc. Dino2 • Because the real VM guy is busy!! • Seth and Kate’s daughter Adelyn, born June 19
  • 4. Copyright © 2015 Instantiations, Inc. Dino2 Agenda • Driving forces • VAST VM history • Do we need a new VM? • Challenges • How we did it • Results • Demo • Still to do • Q&A
  • 5. Copyright © 2015 Instantiations, Inc. Dino2 Driving Forces • 64-bit support required • Dramatically expands available memory space • Interface with 64-bit DLLs/SOs • Simplify maintenance and enhancement of the VAST VM • Enables use of modern tool chains • Replaces current proprietary modeling language with C
  • 6. Copyright © 2015 Instantiations, Inc. Dino2 VAST VM History • Extremely stable - basically unchanged in 25+ years • Developed using proprietary Smalltalk VM Modeling Language • Maximize efficiency on constrained hardware • Cross-platform model • No dependency on C compiler Smalltalk Model Code x86 Power PC SPARC Portable Assembler
  • 7. Copyright © 2015 Instantiations, Inc. Dino2 Do We Need a NEW VM? • Smalltalk Modeling Language • Obscure – hard to learn/extend • Obfuscates the algorithms • Portable Assembler • Does not take advantage of new machine architectures • Generated machine code • Non-standard calling conventions • Standard debuggers don’t work • Hard to map performance tools result back to model • JIT • Must be hand-built to match machine architecture
  • 8. Copyright © 2015 Instantiations, Inc. Dino2 Sample Smalltalk Model code VMprCharacterTestBit self systemPrimitive: 'VMprCharacterTestBit' receiverClass: Character body: [| receiver byteArray bit addr | receiver := registerModel allocateDataRegister. byteArray := registerModel allocateAddressRegister. bit := registerModel allocateDataRegister. byteArray gets: (self parm: 1 of: 1). ([self isImmediate: byteArray] || [(self isBytes: byteArray) not]) do: [ self failAsmPrimitiveViaCache: PrimErrInvalidClass arg: 1]. receiver gets: (self receiverForParms: 1). self convertToCharacter: receiver. bit gets: receiver. bit &= 7. receiver shiftRightLogical: 3. (receiver greaterThanOrEqualUnsigned: (byteArray at: (constant field: 'size' of: K8ObjectHeader))) do: [ self failAsmPrimitiveViaCache: PrimErrInvalidSize arg: 1]. registerModel region: [ addr := registerModel allocateAddressRegister asBytePointer. addr gets: (constant addressOfLabel: (label global data named: 'K8SetBits')). bit loadUnsigned: (addr indexedBy: bit)]. receiver loadUnsigned: ((byteArray asBytePointer at: constant objectHeaderSize) index: receiver). and setFlags source: bit dest: receiver. condition zero do: [receiver gets: false] else: [receiver gets: true]. self return: receiver parms: 1]
  • 9. Copyright © 2015 Instantiations, Inc. Dino2 Sample C code EsPrimitive(VMprCharacterTestBit) { U_16 value; EsObject byteArray; U_8 bit; byteArray = EsPrimitiveArgument(1, 1); if (!EsIsBytes(byteArray)) EsPrimitiveFailed(EsPrimErrInvalidClass, 1); value = EsCharacterToU16(EsPrimitiveReceiver(1)); bit = (U_8)(value & 7); /* 0 to 7 bit number within byte */ value = (value >> 3) + 1; /* 1 to (MAX_CHARACTER_VALUE/8)+1 byte number within table */ if (value > (byteArray->size)) EsPrimitiveFailed(EsPrimErrInvalidSize, 1); EsPrimitiveSucceed((((EsByteAt(byteArray, value)) & (1<<bit)) ? EsTrue : EsFalse), 1); }
  • 10. Copyright © 2015 Instantiations, Inc. Dino2 Challenges • Minimal existing test cases • If the basic image tests run, the VM is OK • ‘VM in C’ performance • 32-bit x86 VM loses an available register (-) • C compilers produce far superior code; example: instruction reordering (+) • Many benchmarks (both micro and macro) ported and developed • Tool chain convergence • Image conversion • Impedance mis-match • “Jump where ever I want to”, stack and register mgmt
  • 11. Copyright © 2015 Instantiations, Inc. Dino2 How We Did It • Moved to cmake and gcc based tool chain • Use ‘register intrinsics’ for performance • Nightly build and test • Minimal assembler • Low-level arithmetic, exception handling, OLE support • Incremental changes • Shim code developed to cross old/new boundary • VM always works • 64-bit ‘clean’ changes as we go • Detour from plan: Interpreter was done all in one piece
  • 12. Copyright © 2015 Instantiations, Inc. Dino2 How We Did It • Example: Garbage Collector • 3 major components: Scavenger, Mark-Compact, Allocator • Components converted one-at-a-time • Millions of lines of trace output produced to verify everything worked the same • Incremental changes means we always had a working VM to test the changes
  • 13. Copyright © 2015 Instantiations, Inc. Dino2 How We Did It • Just in time image conversion (64-bit VM) • 32-bit images and image components (ICs) converted on first use • Image can be saved in 64-bit format • 32-bit ICs loadable from 64-bit image
  • 14. Copyright © 2015 Instantiations, Inc. Dino2 How We Did It There’s no magic in software, just hard work with a result that may appear to be magic! • The image has to change -- because 64-bitness shows through • Foreign Function Interfaces (FFI) aka PlatformFunctions • Memory mapping objects (OSObjects) • Goal is to minimize changes in user code • So most of the changes are in VAST framework code
  • 15. Copyright © 2015 Instantiations, Inc. Dino2 How We Did It • Elastic PlatformFunctions • Holds template for making FFI call • Parameter sizes and offsets were fixed • Changed parameter sizes and offsets from fixed to relative
  • 16. Copyright © 2015 Instantiations, Inc. Dino2 How We Did It • Elastic OSStructures • Accessors were based on fixed size and structure offsets • Changed accessors from absolute to relative offset • Compute fixed offsets on image startup
  • 17. Copyright © 2015 Instantiations, Inc. Dino2 How We Did It • Elastic OSStructure Example (C) #ifdef _WIN32 #include <pshpack1.h> #endif typedef struct NMHDR { HWND hwndFrom; UINT_PTR idFrom; UINT code; // NM_ code }; typedef struct TVKEYDOWN { NMHDR hdr; WORD wVKey; UINT flags; }; #ifdef _WIN32 #include <poppack.h> #endif
  • 18. Copyright © 2015 Instantiations, Inc. Dino2 How We Did It • Elastic OSStructure Example (Smalltalk) "Define NMHDR Struct“ OSNmhdr members: #(#hwndFrom #idFrom #code) types: #(pointer pointer uint32). "Define TVKEYDOWN Struct - Pack1 if 32-bit“ OSTvKeydown members: #(hdr wVKey flags) types: #(OSNmhdr uint16 uint32). System is64BitVM ifFalse: [OSTvKeydown updateAlignmentType: AlignNone]. "Pack on byte boundary“ ----------------------------------------------------------------------------------------------- OSTvKeydown>>#flags "Answer the member: UINT flags. 32/64-bit compatible“ ^ self uint32At: #flags
  • 19. Copyright © 2015 Instantiations, Inc. Dino2 How We Did It • Additional Benefits of Elastic OSStructures • Custom Packing for data structures • OSStructure members: #(a b) types: #(int8 int8) alignment: Align2 "pack2" • Custom Padding • OSStructure members: #(a b) types: #(int8 pad[3] int32) alignment: AlignNone "pack1/manual pad“ • Embedded OSStructures • OSStructureA members #(a) types: #(int8) • OSStructureB members #(a b) types: #(int8 OSStructureA) • Nested Anonymous Structures/Unions • OSStructure members: #(a (b c) ) types: #(int32 ((int32 int32)) ) • struct { int a; struct { int b; int c; } } • OSStructure members: #(a (b c) ) types: #(int32 (int32 double) ) • struct { int a; union { int b; double c; } } • -
  • 20. Copyright © 2015 Instantiations, Inc. Dino2 How We Did It • Additional Benefits of Elastic OSStructures • Pointer Types • OSStructure members #(a b) types: #(pointer int32) "4 bytes on 32-bit, 8 bytes on 64-bit" • OSStructure members #(a b) types: #('uint8*' int32) "Also a pointer with additional type info" • Arrays • OSStructure members #(a b) types: #('int8[10]' int32) "Array types are supported • OSVariableStructure members: #(a b) types: #(int8 pointer[]) "Flexible array types supported
  • 21. Copyright © 2015 Instantiations, Inc. Dino2 How We Did It • Additional Benefits of Elastic OSStructures • Dependency Analyzer • Don't need to define OSStructures in order of their dependencies • Invalid Circular dependencies will be detected • Extensible Base Types • You can add your own types, either globally or method override • We do a method override for TCHAR for future Unicode support • Currently a char8, but may later be a char32. Existing definitions using TCHAR are now future proofed for this change
  • 22. Copyright © 2015 Instantiations, Inc. Dino2 Results • 64-bit VM is just a recompile • No separate 32-to-64 bit image converter • Interpreter benchmarks are > 80% of current VM • Before algorithm tuning • Before C tuning • User code is largely unaware of change
  • 23. Copyright © 2015 Instantiations, Inc. Dino2 Demo
  • 24. Copyright © 2015 Instantiations, Inc. Dino2 Still To Do • 80% done means more work to do • Performance tuning (algorithms and C) • JIT • 64-bit Packager • Improved garbage collector • Installation and setup • UNIX
  • 25. Copyright © 2015 Instantiations, Inc. Dino2 When can we have it? • Windows - 3 delivery dates • Alpha • 1Q2016 • Early customer involvement program; entry by invitation • Beta • 2Q2016 • Open registration • Production • V9.0 on normal product delivery schedule • UNIX later
  • 26. Copyright © 2015 Instantiations, Inc. Contact us • General information • info@instantiations.com • Sales • sales@instantiations.com • Support • support@instantiations.com • Me • john_okeefe@instantiations.com
  • 27. Copyright © 2015 Instantiations, Inc. Thank you for your attention Questions?