Skip to content
Sébastien Doeraene edited this page Mar 15, 2012 · 3 revisions

High-level view

The Mozart VM will be a library embedded in a host that will be responsible for all environmental communication (file, net, etc.)

The normal bootstrap of the VM is as follow:

  • The VM is created
  • C procedures/functions are passed (with a naming string) to the VM to serve as builtins
  • Other named values are passed to the VM (properties) such as command line and pickled initial functor
  • The execution method of the VM is called repeatedly, passing it a callback to determine when to schedule a new Oz thread and when to return from the execution method.

When the VM is created, a single Oz thread is also created, with hard-coded code similar to the following to execute:

{{BootPickle.unpack {BootProperty.get 'initFunctor'}}.'apply'  'export'(get:BootProperty.get)}

Mozart communicates with the host by the builtins. The host can also communicate with Mozart by manipulating the VM as a datastructure. This needs to be synchronized with the VM execution. In practice it can be done between calls to the execution method, from a builtin or from the scheduling callback.

The VM should only contain what cannot be written in Oz with bultins provided by the environment.