[Vm-beginners] Re: Got "Error: basicNew: failed" when running InterpreterSimulator

Nick. nick.lsts at gmail.com
Wed Dec 21 03:01:37 UTC 2011


Hi Guys,

Just wanted to give you an update. I managed to fix this one:


Mariano Martinez Peck wrote
> 
>> 8) Lastly, restarting the simulation again I found that the desktop from
>> the
>> simulation image was beign rendered (Pharo logo, some Workpaces that were
>> saved, etc.) and then this error came up: "primitive failed:
>> setGCBiasToGrowGCLimit:".
>> The thing is that the VM that hosts the simulated one didn't open the
>> debugger on that halt, it was like the simulated image was frozen (I
>> suppose, because that error was in the call stack of
>> snapshot:andQuit:embedded:).
>>
>> And here is when I wanted to ask you for some help guys, as I couldn't
>> debug
>> the host machine to invesitgate the cause and fix the problem.
>>
>> Do you have any clue/idea to detect the cause/fix this issue?
>>
>>
> No, I have no idea :(
> but maybe someone does.
> 

Here´s how I fixed it:

The first thing I tried to do was to put a halt on the VM implementetion of
#setGCBiasToGrowGCLimit: to see what's going on. That didn't work because
the primitive wasn't called at all, it was failing for another reason.

So, the next thing I did was to halt the interpreter when the selector
matched #primitiveFailed. That allowed me to inspect the call stack, and
finally determine that this bug was caused by StackInterpreterSimulator >>
#loadNewPlugin:.

How did I found that? First of all, I noticed that the primitive pragma in
#setGCBiasToGrowGCLimit: didn't include the "module" parameter: *<primitive:
'primitiveSetGCBiasToGrowGCLimit'> *.
For primitives implemented inside plugins class, the module is assumed to be
the plugin's class name if it's missing (more on that at:
http://marianopeck.wordpress.com/2011/07/06/named-primitives/).

The thing is that this primitive is implemented in the interpreter itself,
so this case wasn't taken into account in #loadNewPlugin: 

So, to fix this bug (after doing some research) I borrowed the
implementation from CogVMSimulator >> #loadNewPlugin: and replaced the one
in StackInterpreterSimulator with it: turned out to be the same, except for
this little fragment of code (that did just what I needed!):
          *pluginString isEmpty
                   ifTrue: [plugin := self]*

After that, the simulator started the image correctly (even the Pharo logo
was rendered!) , but now presenting me a new issue to be solve: mouse clicks
doesn't do anything on the simulated machine. The funny thing is that, when
I exit from it by pressing CMD+"." all those clicks are executed on the host
VM. Somehow they're not passed to the simulated VM, and are "remembered" in
the host VM.

That's all (for the moment).

Cheers,

Nick

--
View this message in context: http://forum.world.st/Got-Error-basicNew-failed-when-running-InterpreterSimulator-tp3835723p4220313.html
Sent from the Smalltalk VM - Beginners mailing list archive at Nabble.com.


More information about the VM-beginners mailing list