[Vm-dev] Simulator in Pharo 3

Stefan Marr smalltalk at stefan-marr.de
Fri Feb 14 12:35:02 UTC 2014


Hi Eliot:

On 13 Feb 2014, at 21:04, Eliot Miranda <eliot.miranda at gmail.com> wrote:

> thanks, lovely.  i already addressed the getSystemParameter: issue.

In the StackInterpreterSimulator, the various #run… methods do unconditionally the initialization of stack pages and initial context.
This looks wrong to me, especially since the comment of #runForNBytes: says that I should be able to use it repeatedly.
I would move the initialization to #initializeInterpreter: in StackInterpreterSimulator and remove it from all the run methods. See [1].

So, with all latest changes the code below gives you a StackInterpreterSimulator that executes the latest Pharo images.
Until it runs into inconsistent values in the BalloonEngineSimulation. But for many cases this should already be more than sufficient.

  InterpreterStackPage initialize.
  StackInterpreterSimulator initializeWithOptions: Dictionary new.
  sim := StackInterpreterSimulator new.
  sim openOn: 'Pharo.image'.
  sim openAsMorph.
  sim initStackPages.
  sim loadInitialContext.
  1 to: 500 do: [:i |
	sim runForNBytes: 100000.
	World doOneCycleNow ].

At the moment, there seem to be strange interactions going on between the simulator and the rest of the system.
At least using `[sim run] fork` doesn’t work properly, and I suppose until the event handling is fixed #run will not work completely either.

Please note, all changes I did is merely fixing bit rot, nothing really broken.
I assume that the BalloonEngine issue would take a little more to debug, but I am not sure what it is in the first place. So interested parties could try it comment.


Best regards
Stefan

[1] https://github.com/smarr/pharo-vm/commit/114f5b3db0ff2185ca5eac0d033eb95b99f524cb


-- 
Stefan Marr
INRIA Lille - Nord Europe
http://stefan-marr.de/research/





More information about the Vm-dev mailing list