On Thu, Oct 13, 2011 at 5:26 AM, Nick. <nick.lsts@gmail.com> wrote:
Hi Mariano,

Thanks for the advice.
I want to update this post with the results of some tests I've been doing,
so it's useful to anyone trying to run the simulator.

I got stuck with an error I describe in the "About running
StackInterpreterSimulator in Pharo" section.
Hope someone could give me a clue on fixing that one :)


Wow Nick. Your experience is really really helpful.
 
*Simulator in Squeak 2.6/2.7 is working*
First of all, if all you need is a simulator for learning/experimenting
purposes grab a Squeak 2.6 or 2.7 release (yes, /that/ old). The simulator
works right out of the box in those ones. See
http://wiki.squeak.org/squeak/2465 for  instructions on how to archieve
that.

*About running StackInterpreterSimulator in Pharo*
Taking Mariano's image as base (grab it here:
https://gforge.inria.fr/frs/download.php/28513/Pharo-1.2.1.cog.zip) I found
the following issues and fixed them:

To begin, I saved a copy of the image to a new file named "simulated.image".
Closed the image and reopened the first one.

1) First problem: "Error: basicNew: failed"
Then, I evaluated the following from the original:
(StackInterpreterSimulator new openOn: 'source.image') test.
The error I've got is the one I described in my first post: "Error:
basicNew: failled" for "ArrayClass>>new".
Inspecting the stack trace I found that RootTableSize was an instance of
UndefinedObject in ObjectMemory>>initialize.
Taking a deeper look, it seemed that RootTableSize was setted in
ObjectMemory>>initializeWithOptions, wich wasn't called from
StackInterpreterSimulator>>initialize. Instead, ObjectMemory>>initialize was
called, but that message didn't initialize RootTableSize.
So, I replaced the call form objectMemoryClass initialize to
objectMemoryClass initializeWithOptions: Dictionary new. to get
RootTableSize initialized properly.

2) Second problem: same situation with MethodCacheSize
Proceeding with StackInterpreterSimulator's execution, I came across a
similar situation with MethodCacheSize in ArrayClass>>basicNew:.
Following the same procedure as before, I found MethodCacheSize
uninitialized, and setted it property replacing, in
StackInterpreterSimulator>>initialize, the call from StackInterpreter
initialize. to StackInterpreter initializeWithOptions: Dictionary new.

3) Third problem: missing method from UtilityClass
Proceeding again, I came across an MNU saying that UtilityClass does not
understands "informUser:during:" message. After a message selector search, I
replaced the call (that was being done in
StackInterpreterSimulator>>openOn:extraMemory:) with UIManager default
informUser: (...) during: (...)

4) Fourth problem: "the receiver of / is nil"
Originated from InterpreterStackPage>>headFP:. The cause was that
LargeContextBytes was an instance of UndefinedObject.
Once again, using the Method Finder (great tool!) I fixed the problem
evaluating: InterpreterStackPage initialize. as said in that method's
comment.



Can you put the exact code to initialize all this points of 1) 2) and 4) ?
I mean, can you provide the final script you had to use before being able to do the
(StackInterpreterSimulator new openOn: 'source.image') test.
 
5) Fifth problem: Two MNUs in StackInterpreter
Those came up: isContextNonInt:, generated from
commonVariable:at:chacheIndex: and commonVaraible:at:put:cacheIndex:.
I fixed those issues by replacing calls from self isContextNonInt: to self
objectMemory isContextNonInt:.

6) Sixth problem: MNU in StackInterpreter
The selector was isContextHeader: and it was used in
StackInterpreter>>stObject:at:.
I replaced calls from self isContextHeader: to self objectMemory
isContextHeader:.

for 5) and 6) .. which version of VMMaker are you using?  because maybe this was already fixed in new versions?
 

7) Seventh problem: primitive clone failed in CArrayAccesor.
I fixes that by adding the clone message in CArrayAccessor as follows:
   clone
           <primitive: 148>
       ^ self primitiveFailed

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.

 
*FileOut of the changes described*
http://forum.world.st/file/n3900467/ChangesSoFarToMakeSimulatorWorkInPharo-1.2.1.zip
ChangesSoFarToMakeSimulatorWorkInPharo-1.2.1.zip


Excellent!   At the end you can also provide an image (that mine) with those changes + a workspace with all the needed initialize code and the snippet to start the simulator.

Cheers
  
Cheers and thanks in advance!

Nick





--
View this message in context: http://forum.world.st/Got-Error-basicNew-failed-when-running-InterpreterSimulator-tp3835723p3900467.html
Sent from the Smalltalk VM - Beginners mailing list archive at Nabble.com.
_______________________________________________
VM-beginners mailing list
VM-beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/vm-beginners



--
Mariano
http://marianopeck.wordpress.com