[Vm-dev] Initializing the simulator without an image

Guillermo Polito guillermopolito at gmail.com
Mon Nov 17 14:24:28 UTC 2014


Hi Eliot, guys,

Does anybody know what is the right way to initialize the simulator when I
have no image (yet) ? That means: I have no contexts, no processes, no
special objects array, no nil. Nothing :).

I want to create an empty simulator that I will fill with objects later,
with bootstrapping purposes. And I know Eliot is doing something like that
to initialize the Spur bootstrap.

I tried to get that working by myself, but when I updated to the latest VM
code everything went bananas. My code was something like:

simulator := StackInterpreterSimulator new.
simulator objectMemory setEndOfMemory: 0.
simulator objectMemory edenBytes: simulator objectMemory defaultEdenBytes.
simulator objectMemory specialObjectsOop: 0. "We don't have one yet"
simulator objectMemory allocateMemoryOfSize: 25000000. "Extra bytes"
simulator objectMemory initialize.
simulator initializeOzInterpreter: 0. "its initializeInterpreter: but a bit
tweeked"

But it stops in an assert because firstFree = end of memory... Which is
wrong as we have an empty memory :D. And i'm a bit lost in this one...

I was looking at how the Spur bootstrap was doing it

on: imageName
StackInterpreter initializeWithOptions: Dictionary new.
(oldInterpreter := StackInterpreterSimulator new)
openOn: imageName extraMemory: 0;
assertValidExecutionPointersAtEachStep: false.
oldHeap := oldInterpreter objectMemory.
newHeap := Spur32BitMMLESimulator new.
newHeap
allocateMemoryOfSize: (oldHeap youngStart * 3 / 2 roundUpTo: 1024 * 1024)
newSpaceSize: 2 * 1024 * 1024
stackSize: 1024 * 1024
codeSize: 0.
newHeap setCheckForLeaks: 15 - 6. "don't check become; or newSpace; soooo
many rehashes in bootstrap"
newHeap bootstrapping: true.
self initMaps

But well, the NewObjectMemory does not have the same API as
SpurMemoryManager.

I'd appreciate any hints on it!
Thanks and cheers,
Guille
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20141117/54c09be6/attachment.htm


More information about the Vm-dev mailing list