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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Mariano Martinez Peck
 


On Fri, Sep 23, 2011 at 6:40 AM, Nick. <[hidden email]> wrote:
Hi guys!

In the past few days i tried to get InterpreterSimulator running without
success.
First of all, a little context about my goal: I'm digging into the VM
because i would like to be able to delegate to some class (that I'll
develop) the responsibility for, say, the method lookup algorithm.

With that in mind, here's what i've been doing:
Using the Pharo 1.2 image Mariano Peck's prepared in his exellent article
(http://marianopeck.wordpress.com/2011/04/23/how-to-debug-the-vm/),  loaded
the VMMaker package with the following script:

   Deprecation raiseWarning: false.
       Gofer new
       squeaksource: 'MetacelloRepository';
       package: 'ConfigurationOfCog';
       load.
   (Smalltalk at: #ConfigurationOfCog) project latestVersion load.

Once it finishes (without errors) I "Save As" the current image as
"demo.image", close it and open the original Pharo 1.2 image that Mariano
provided.
When, for example, I run:

   (CogVMSimulator new openOn: 'demo.image') test
or
   (InterpreterSimulatorLSB new openOn: 'demo.image') test

I get the following error: "Error: basicNew: failed" (see attached images at
the end).

Weird.  Something I remember about the simulator is that you need to run it with a VM that has the BochsIA32Plugin. Try Eliot's VM that will have it for sure. But anywya, I doesn't look related to your particula problem. 

 
When I tried to load VMMaker in the Pharo 1.3 OneClick release, I got
another error (see attached images at the end).


Yes, because you need some changes in order to make it work. I have attached those changes in the post. But those changes should be already integrated in latests Pharo 1.3.
You don't have that error in the image I put of 1.2 because that image comes already with such changes.
 
Am I doing something wrong?
Are those the right simulators to use? I can tell the difference between all
that are available in VMMaker package.


Well...it depends on what you want. FOr example, if you build a stack VM then you should use instead StackInterpreterSimulator. So..for the Cog VM I guess it is CogVMSimulator.

If you go to here: http://www.squeakvm.org/svn/squeak/branches/Cog/image/
you can see http://www.squeakvm.org/svn/squeak/branches/Cog/image/VM%20Simulation%20Workspace.text
It might be outdated, but it can be a start point.

cheers
 
Thanks in advance!

Nick


http://forum.world.st/file/n3835723/error_while_trying_to_run_InterpreterSimulator.png
http://forum.world.st/file/n3835723/Error_while_loading_VMMaker_in_Pharo-1.3-OneClick.png



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



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

Reply | Threaded
Open this post in threaded view
|

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

Nick.
I've updated the thread with steps to reproduce the issue along with the PharoDebug.log files generated.

http://forum.world.st/Got-Error-basicNew-failed-when-running-InterpreterSimulator-tp3835723p3866329.html

Cheers,

Nick
Reply | Threaded
Open this post in threaded view
|

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

Mariano Martinez Peck
In reply to this post by Mariano Martinez Peck
 
Hi Nick. Unfortunatly, few people use the interpreter. Even less (if none) do it in Pharo. The only ones I know that use the simulator right now is Eliot in Squeak and Graig in Spoon.
So...as you can see, the simulator is implemented in image side. Since Eliot uses Squeak for his development, is more likely the simulator will work easier in Squeak than Pharo. Of course that for the Pharo community it would be AWESOME to be able to run the simulator. So if you can help with that, excellent.
As an example, in Pharo you have the error. But in Squeak you have:

String asDisplayText
    "Answer a DisplayText whose text string is the receiver."

    ^DisplayText text: self asText 

:)

So... my suggestion? start with squeak. Once you make it work, please, update it in order to make it work in Pharo :)

In your case, I would try with 3 squeak images: 4.2, 4.3 and the one eliot uses in: http://www.squeakvm.org/svn/squeak/branches/Cog/image/  (VMMaker-Squeak4.1.image)

cheers


On Mon, Oct 3, 2011 at 4:32 AM, Nick. <[hidden email]> wrote:
Hi Guys,

Im attaching the PharoDebug.log (
http://forum.world.st/file/n3866329/PharoDebug.log.tar.gz
PharoDebug.log.tar.gz ) that was generated when the error came up.

Those are the steps I used to reproduce the problem. The environment used is
Ubuntu 11.04:
 - From Jetkins, I downloaded the sources and vm for the "StackVM-Unix"
job: https://ci.lille.inria.fr/pharo/view/Cog/job/StackVM-Unix/6/
 - Unzipped the files and loaded [sources dir]/build/generator.image with
StackVM.
 - Finally, evaluated (StackInterpreterSimulator new openOn: Smalltalk
imageName) test

Also, I tried evaluating the same but running the image from a compiled
stack vm (from StackUnixDebugConfig). In this case, the error that came up
was different: a MNU on ByteStrinng >> asDisplayText.
The log, named CompiledVM-PharoDebug.log is also attached:
http://forum.world.st/file/n3866329/CompiledVM-PharoDebug-.log.tar.gz
CompiledVM-PharoDebug-.log.tar.gz


I'd appreciate any directions on how resolve this one :)

Cheers!


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



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

Reply | Threaded
Open this post in threaded view
|

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

Mariano Martinez Peck
 


On Thu, Oct 13, 2011 at 5:26 AM, Nick. <[hidden email]> 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
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/vm-beginners



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