pharo-vm
pharo-vm copied to clipboard
Embedability of PharoVM
We are big fans of the Godot Engine and of Smalltalk and we think both could work wonderfully together. So we want to try to embed the PharoVM inside Godot. First and foremost, just being able to use a premade image within a Godot project would be enough.
For more context : the goal would be to have Godot handles the mainloop, and sometimes send messages to Smalltalk objects. So we need to be able to query the image in order to know what available classes are (so basically, classes inhereting the class Node
or one of its subclass), to know what methods are redefined in them, and to instanciate/free Smalltalk objects.
We started looking into /include/pharovm/
and /extracted/vm/include/common/
but after looking at every file we have issues understanding how to some things.
From what we seen, it seems like we want to get a pointer on a VirtualMachine (declared in /extracted/vm/include/common/sqVirtualMachine.h
), but we have no idea how to get it. Once we have a pointer to the VM, it seems we might be able to get a few informations about the VM? There is very little documentation about each of the functions contained in that structure, we guess we have to use the VM Simulator and check it out to understand what they do. But it doesn't seem like it is enough to be able to query the content of an image.
We seen https://github.com/tesonep/pharo-vm-embedded-example which explains how to embed an image within a program but only shows how to start the VM and not how to obtain a pointer to it and even less explaining how to query the objects/classes inside it.
We are also aware of https://gitlab.com/chandler.justin.s/godot-talk-VM but the VM is in C# and we want a deeper and more direct integration into the Godot Engine, with the aim of including features from the standard Pharo image (like the system browser, monticello, debugger, ...) directly within Godot.
Do you have any information or advice concerning such kind of embedding with the PharoVM?
Maybe this is of help: https://github.com/PierceNg/pharo-vm-embedded-pascal
GitHub
Running Pharo embedded in host programs written in Pascal - PierceNg/pharo-vm-embedded-pascal
This repo is just https://github.com/tesonep/pharo-vm-embedded-example ported to Pascal. It just shows how to do the same embed as the C version.
What we would need to start is, we think :
- A way to query the internals of an image, like querying the defined classes, and their methods.
- A way to communicate with the VM, so sending messages to objects, and creating and freeing new objects.
What those two repo shows is just how to start a VM with an image embedded in an executable, but that's all.
GitHub
This repository have an example of how to create a PharoVM with an embedded image. - tesonep/pharo-vm-embedded-example