Awesome
SimulationStudio
A growing suite of applications and tools using code simulation in Squeak/Smalltalk.
Code simulation is a technique in Squeak that reproduces the original VM interpreter for Smalltalk in the userland (i.e., implements it in itself), making the exploration and manipulation of its implementation much more immediate and enjoyable. The foundation of this project is to extend the default code simulator with the ability to control and modify the execution. For instance, we can disallow certain instructions, implement virtualization features by redirecting memory accesses, or trace the entire execution of a program (similar to bytecode instrumentation). As one example, SimulationStudio implements a sandbox that can safely execute any code isolated from the remaining VM image. On top of the sandbox, this repository also provides several tools that use speculative code execution to offer new ways for exploring objects and classes based on their behavior.
For usage instructions, see the installation section below.
Included packages
SimulationStudio-Base
Provides abstract functionality for simulating stack frames by subclassing SimulationContext
or Simulator
.
SimulationStudio-Sandbox
Execute Smalltalk code in an isolated environment without applying any side effects to the image.
array := {1. 2. 3}.
Sandbox evaluate:
[array at: 1 put: 10.
array first]. "10"
array first. "1"
SimulationStudio-Support
:
Contains several simulation goodies and examples:
- the
BenchmarkSimulator
for hardware-independent benchmark creation - the
CoverageSimulator
for bytecode-precise code coverage analysis - the
LimitSimulator
for hardware-independent calculation timeouts
SimulationStudio-Tools
Contains some programming tools that are implementation using simulation:
-
the
SimulationMethodFinder
which searches for all methods that convert a given set of inputs into a given output by speculatively executing all methods (screenshots) -
the
SimulationProtocolExplorer
which inspects an object and its protocol together with a speculatively evaluated preview of each message (screenshots) -
the
CoverageSimulator
also offers a GUI for browsing the branch coverage of methods:
SimulationStudio-Tracing
(experimental)
Record and browse fine-granular stack traces. Integrates the MessageSendRecorder.
Check out the relevant classes for more details and usage instructions!
For more technical details, also read these announcement threads on the squeak-dev mailing list:
- [ANN] SimulationStudio and sandboxed execution for Squeak
- News from SimulationStudio
- [ANN] News from SimulationStudio: Method Finder 2
There is also a slide deck about the Sandbox and the Simulation Method Finder (German, translation will be provided upon request): Finden statt Suchen: Der Method-Finder wird abgesichert (Don't Search, Find: Securing the MethodFinder). On Squeak Meeting 2022, November 19, 2022. Squeak e.V., Potsdam, Germany.
Installation
... as a precompiled bundle (recommended for most visitors)
Download the archived bundle from the latest release and follow the instructions to open it. In the image, you will find further usage examples. Using the bundle is also the recommended way to browse the sources of the project.
... using Metacello
For the latest Squeak Trunk:
Metacello new
baseline: 'SimulationStudio';
githubUser: 'LinqLover' project: 'SimulationStudio' path: 'packages';
get;
load.
LTS (long-time support) version for an older Squeak release:
Metacello new
baseline: 'SimulationStudio';
githubUser: 'LinqLover' project: 'SimulationStudio' commitish: 'squeak60' path: 'packages';
get;
load.
- Currently supported LTS versions are:
squeak60
To load a specific package, change the last line, e.g., load: 'SimulationStudio-Base'
. See the Metacello docs for more options.
... as a dependency in your Metacello baseline
For the latest Squeak Trunk:
spec baseline: 'SimulationStudio' with: [
spec
repository: 'github://LinqLover/SimulationStudio/packages';
loads: 'SimulationStudio-Sandbox'].
LTS (long-time support) version for an older Squeak release:
spec baseline: 'SimulationStudio' with: [
spec
repository: 'github://LinqLover/SimulationStudio:squeak60/packages';
loads: 'SimulationStudio-Sandbox'].
- Currently supported LTS versions are:
squeak60
Depending on your needs, specify any other package(s) via loads:
. See the Metacello docs for more options.
... using Squot
Open a git browser, clone the repository, and check out the latest commit from the default branch or any LTS branch. Learn more about using the git browser.
Users of SimulationStudio
As of today, the following projects make use of SimulationStudio:
Contribution and bug reports
... are very welcome! Please feel free to submit bug reports, discuss design changes, or propose new extensions!