-
Notifications
You must be signed in to change notification settings - Fork 71
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. It can be parameterized with the word size, class to use as memory manager, set of bytecodes, and then the image to be launched.
The following script launches the non-JIT simulation currently implemented by StackInterpreterSimulator
.
| options stackInterpreterSimulator |
VMStackPages initialize.
options := {
#ObjectMemory -> #Spur64BitCoMemoryManager.
#BytesPerWord -> 8
} asDictionary.
stackInterpreterSimulator := StackInterpreterSimulator newWithOptions: options.
stackInterpreterSimulator openOn: Smalltalk imagePath extraMemory: 100000.
stackInterpreterSimulator run.
The followin script launches the JIT simulation implemented in CogVMSimulator
.
| options cogVMSimulator |
VMStackPages initialize.
options := {
#ObjectMemory -> #Spur64BitCoMemoryManager.
#ISA -> #aarch64.
#BytesPerWord -> 8
} asDictionary.
cogVMSimulator := CogVMSimulator newWithOptions: options.
cogVMSimulator openOn: Smalltalk imagePath extraMemory: 100000.
cogVMSimulator run.