-
Notifications
You must be signed in to change notification settings - Fork 68
Simulation Environment
The VM simulation environment, described in two decades of smalltalk vm development and Cross-ISA Testing of the Pharo VM: Lessons Learned While Porting to ARMv8 can be obtained in many different ways.
The current simulation environment and VM generator runs on top in Pharo 9 and Pharo 10. If you're not interested on working in JIT simulation, a standard Pharo development environment is enough.
If you're interested on JIT simulation, you will need to install the Unicorn machine code simulation library.
To install this library, go to https://github.com/tesonep/unicorn and follow the build instructions (usually boiled down to a make install
).
If you're starting from a clone of this git repository, one possibility is to create a simulator environment by using our automated cmake process.
$ cmake -B /path/to/build/directory -S /path/to/git/repo
$ cmake --build /path/to/build/directory --target vmmaker
That will create an image with the simulation environment on /path/to/build/directory/build/vmmaker/image
and download in /path/to/build/directory/build/vmmaker/vm
a virtual machine with the corresponding version.
An alternative approach, when starting from a standard Pharo image, is to load the vm git repository inside Pharo through Iceberg.
This can be done either by cloning or by importing an already cloned repository.
Then, the BaselineOfVMMaker
should be installed through Metacello
.
The simulator can be launched through the following scripts.
The simulator can be parameterized with the word size, class to use as memory manager, set of bytecodes, and then the image to be launched.
The class StackInterpreterSimulator
launches the non-JIT simulation while CogVMSimulator
launches the JIT simulation.
InterpreterStackPages initialize.
options := {
#ObjectMemory -> #Spur64BitCoMemoryManager.
#BytesPerWord -> 8.
#MULTIPLEBYTECODESETS -> true.
#bytecodeTableInitializer -> #initializeBytecodeTableForSqueakV3PlusClosuresSistaV1Hybrid.
} asDictionary.
c := StackInterpreterSimulator newWithOptions: options.
c openOn: Smalltalk imagePath extraMemory: 100000.
c run.
InterpreterStackPages initialize.
options := {
#ObjectMemory -> #Spur64BitCoMemoryManager.
#ISA -> #aarch64.
#BytesPerWord -> 8.
#MULTIPLEBYTECODESETS -> true.
#bytecodeTableInitializer -> #initializeBytecodeTableForSqueakV3PlusClosuresSistaV1Hybrid.
} asDictionary.
c := CogVMSimulator newWithOptions: options.
c openOn: Smalltalk imagePath extraMemory: 100000.
c run.