Simulate "3+4" with InterpreterSimulator

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

Simulate "3+4" with InterpreterSimulator

Ang BeePeng
Hi,

I have a InterpreterSimulator start up, in a workspace I type "3+4". From here, I want to step through bytecode per bytecode, when I hit "print". What should I do to achieve this?

Can I debug on the interpreter in the middle of the simulation? Or perhaps I need to put a "self halt" somewhere in the VM source?

Thanks.

Ang Beepeng
Reply | Threaded
Open this post in threaded view
|

Re: Simulate "3+4" with InterpreterSimulator

Michael van der Gulik-2
 
On Tue, Mar 23, 2010 at 7:14 AM, Ang BeePeng <[hidden email]> wrote:

>
>
> Hi,
>
> I have a InterpreterSimulator start up, in a workspace I type "3+4". From
> here, I want to step through bytecode per bytecode, when I hit "print". What
> should I do to achieve this?
>
> Can I debug on the interpreter in the middle of the simulation? Or perhaps I
> need to put a "self halt" somewhere in the VM source?

I don't really know much about the InterpreterSimulator (and congrats
for getting it going! I never got it running...), but...

I would look for a primitive method somewhere which would cause the
simulated environment to stop and pop a debugger up in the host. You
would then evaluate that in the same method as "3+4".

If this primitive method doesn't exist, you could probably quickly
make one that just does "self halt.".

Gulik.

--
http://gulik.pbwiki.com/
Reply | Threaded
Open this post in threaded view
|

Re: Simulate "3+4" with InterpreterSimulator

David T. Lewis
 
On Tue, Mar 23, 2010 at 11:32:43AM +1300, Michael van der Gulik wrote:

>  
> On Tue, Mar 23, 2010 at 7:14 AM, Ang BeePeng <[hidden email]> wrote:
> >
> > I have a InterpreterSimulator start up, in a workspace I type "3+4". From
> > here, I want to step through bytecode per bytecode, when I hit "print". What
> > should I do to achieve this?
> >
> > Can I debug on the interpreter in the middle of the simulation? Or perhaps I
> > need to put a "self halt" somewhere in the VM source?
>
> I don't really know much about the InterpreterSimulator (and congrats
> for getting it going! I never got it running...), but...
>
> I would look for a primitive method somewhere which would cause the
> simulated environment to stop and pop a debugger up in the host. You
> would then evaluate that in the same method as "3+4".

Try putting a self halt in Interpreter>>primitiveAdd, which should be
called when you evaluate "3+4".

The main interpreter loop is Interpreter>>interpret, which fetches
bytecodes and evaluates them. You can probably put a break in
InterpreterSimulator>>dispatchOn:in: which is called by #interpret
and simulates the big case statement that the interpreter loop
uses to dispatch bytecodes for execution.

Dave

Reply | Threaded
Open this post in threaded view
|

Re: Simulate "3+4" with InterpreterSimulator

Ang BeePeng
In reply to this post by Michael van der Gulik-2
Hi,

Here's a page, step by step guide to get InterpreterSimulator work, hope it helps.

http://askoh.com/mwiki/index.php?title=Squeak_Virtual_Machine#Interpreter_Simulator

Thanks.

Ang Beepeng
Reply | Threaded
Open this post in threaded view
|

Re: Simulate "3+4" with InterpreterSimulator

Michael van der Gulik-2
 
On Tue, Mar 23, 2010 at 4:24 PM, Ang BeePeng <[hidden email]> wrote:
>
>
> Hi,
>
> Here's a page, step by step guide to get InterpreterSimulator work, hope it
> helps.
>
> http://askoh.com/mwiki/index.php?title=Squeak_Virtual_Machine#Interpreter_Simulator

That is awesome!

Can I ask very nicely if somebody could put the resulting image up on
http://squeakvm.org in an appropriately findable place, preferably
with a workspace set up with cool bits of code?

Does it specifically need VM version 3.9.2?

Cheers,
Gulik.


--
http://gulik.pbwiki.com/
Reply | Threaded
Open this post in threaded view
|

Re: Simulate "3+4" with InterpreterSimulator

Ang BeePeng
In reply to this post by David T. Lewis
David T. Lewis wrote
 
Try putting a self halt in Interpreter>>primitiveAdd, which should be
called when you evaluate "3+4".
Or is it bytecodePrimAdd?

David T. Lewis wrote
The main interpreter loop is Interpreter>>interpret, which fetches
bytecodes and evaluates them. You can probably put a break in
InterpreterSimulator>>dispatchOn:in: which is called by #interpret
and simulates the big case statement that the interpreter loop
uses to dispatch bytecodes for execution.
I can easily debug the InterpreterSimulator from the beginning. But, to move from the very beginning to the point where I can debug "3+4" would be very far, long, right? Or are there any way that I can do, to just skip to the part that I'm interested with.

Thank you so much for you help.

Thanks.

Ang Beepeng
Reply | Threaded
Open this post in threaded view
|

Re: Simulate "3+4" with InterpreterSimulator

Ang BeePeng
This post was updated on .
In reply to this post by Michael van der Gulik-2
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Simulate "3+4" with InterpreterSimulator

Ang BeePeng
Michael van der Gulik-2 wrote
That is awesome!

Can I ask very nicely if somebody could put the resulting image up on
http://squeakvm.org in an appropriately findable place, preferably
with a workspace set up with cool bits of code?

Does it specifically need VM version 3.9.2?
Hi, I have a InterpreterSimulator set up. Unzip, and you can play around with it already. Please let me know if you have any problem with it.

I think it does need 3.9 VM specifically, you can search previous nabble post about this.

Thanks.

Ang Beepeng
Reply | Threaded
Open this post in threaded view
|

Re: Simulate "3+4" with InterpreterSimulator

Michael van der Gulik-2
In reply to this post by Ang BeePeng

On Mon, Mar 29, 2010 at 4:25 AM, Ang BeePeng <[hidden email]> wrote:

>
>
>
> Michael van der Gulik-2 wrote:
>>
>>
>> That is awesome!
>>
>> Can I ask very nicely if somebody could put the resulting image up on
>> http://squeakvm.org in an appropriately findable place, preferably
>> with a workspace set up with cool bits of code?
>>
>> Does it specifically need VM version 3.9.2?
>>
>>
>
> Hi, I have a  http://askoh.com/mwiki/images/b/be/InterpreterSimulator.zip
> InterpreterSimulator  set up. Unzip, and you can play around with it
> already. Please let me know if you have any problem with it.
>
> I think it does need 3.9 VM specifically, you can search previous nabble
> post about this.

This is awesome! :-). I'm amazed that computers are fast enough to run
this on a FULL image these days!!!

It runs kind of okay on my 3.11 Linux VM. There seems to be a font
problem; the workspace isn't drawing any text, although you can select
it where text is meant to be. Also event handling is a bit odd; the VM
doesn't seem to react even though CPU usage on the machine is near 0%.

Are you willing to tidy this up enough for putting on e.g.
ftp.squeak.org? I think this image is a great asset! It needs:

* You don't need the "package-cache", "sm" and "cs" directories. All
that stuff is in the image already.
* You can delete SqueakDebug.log.
* I don't know what the file .DS_store is, but its optional too.
* There's a halt in InterpreterSimulator>>lookupMethodInClass:

If you aren't willing to do this, I'll see if I can find free time this week.

Gulik.

--
http://gulik.pbwiki.com/
Reply | Threaded
Open this post in threaded view
|

Re: Simulate "3+4" with InterpreterSimulator

Ang BeePeng
Michael van der Gulik-2 wrote
This is awesome! :-). I'm amazed that computers are fast enough to run
this on a FULL image these days!!!

It runs kind of okay on my 3.11 Linux VM. There seems to be a font
problem; the workspace isn't drawing any text, although you can select
it where text is meant to be. Also event handling is a bit odd; the VM
doesn't seem to react even though CPU usage on the machine is near 0%.

Are you willing to tidy this up enough for putting on e.g.
ftp.squeak.org? I think this image is a great asset! It needs:

* You don't need the "package-cache", "sm" and "cs" directories. All
that stuff is in the image already.
* You can delete SqueakDebug.log.
* I don't know what the file .DS_store is, but its optional too.
* There's a halt in InterpreterSimulator>>lookupMethodInClass:

If you aren't willing to do this, I'll see if I can find free time this week.
Hi,

I will do that.

Halt in lookupMethodInClass: is done on purpose I believe. I'm not sure if it is ok to remove it.

Thanks.

Ang Beepeng
Reply | Threaded
Open this post in threaded view
|

Re: Simulate "3+4" with InterpreterSimulator

Bert Freudenberg
In reply to this post by Michael van der Gulik-2

On 29.03.2010, at 00:50, Michael van der Gulik wrote:

>
>
> On Mon, Mar 29, 2010 at 4:25 AM, Ang BeePeng <[hidden email]> wrote:
>>
>>
>>
>> Michael van der Gulik-2 wrote:
>>>
>>>
>>> That is awesome!
>>>
>>> Can I ask very nicely if somebody could put the resulting image up on
>>> http://squeakvm.org in an appropriately findable place, preferably
>>> with a workspace set up with cool bits of code?
>>>
>>> Does it specifically need VM version 3.9.2?
>>>
>>>
>>
>> Hi, I have a  http://askoh.com/mwiki/images/b/be/InterpreterSimulator.zip
>> InterpreterSimulator  set up. Unzip, and you can play around with it
>> already. Please let me know if you have any problem with it.
>>
>> I think it does need 3.9 VM specifically, you can search previous nabble
>> post about this.
>
> This is awesome! :-). I'm amazed that computers are fast enough to run
> this on a FULL image these days!!!
>
> It runs kind of okay on my 3.11 Linux VM. There seems to be a font
> problem; the workspace isn't drawing any text, although you can select
> it where text is meant to be. Also event handling is a bit odd; the VM
> doesn't seem to react even though CPU usage on the machine is near 0%.
>
> Are you willing to tidy this up enough for putting on e.g.
> ftp.squeak.org? I think this image is a great asset! It needs:
>
> * You don't need the "package-cache", "sm" and "cs" directories. All
> that stuff is in the image already.
> * You can delete SqueakDebug.log.
> * I don't know what the file .DS_store is, but its optional too.
> * There's a halt in InterpreterSimulator>>lookupMethodInClass:
>
> If you aren't willing to do this, I'll see if I can find free time this week.
>
> Gulik.
>
> --
> http://gulik.pbwiki.com/

Same here - runs fine on the latest Mac VM, but StrikeFonts do not show correctly.

You should remove the Windows VM from the zip, it's not needed. Anyone interested in this work will have a VM already ;-)

- Bert -


Reply | Threaded
Open this post in threaded view
|

Re: Simulate "3+4" with InterpreterSimulator

Ang BeePeng
In reply to this post by Michael van der Gulik-2
Michael van der Gulik-2 wrote
the workspace isn't drawing any text, although you can select
Hi,

Sorry, I miss this sentence previously. The text will show up after awhile. Sometimes, I'll need to rerun InterpreterSimulator for the text in workspace to show up. I tried to type, highlight and printIt, it's fine.

So, that means I remove those files, win VM, leave the image untouched. Is that ok?

Thanks.

Ang Beepng
Reply | Threaded
Open this post in threaded view
|

Re: Simulate "3+4" with InterpreterSimulator

Michael van der Gulik-2
 
On Tue, Mar 30, 2010 at 4:51 AM, Ang BeePeng <[hidden email]> wrote:

>
>
>
> Michael van der Gulik-2 wrote:
>>
>>
>> the workspace isn't drawing any text, although you can select
>>
>>
>
> Hi,
>
> Sorry, I miss this sentence previously. The text will show up after awhile.
> Sometimes, I'll need to rerun InterpreterSimulator for the text in workspace
> to show up. I tried to type, highlight and printIt, it's fine.
>
> So, that means I remove those files, win VM, leave the image untouched. Is
> that ok?

Yes, for now. Then I'll ask the web team if we can upload it to ftp.squeak.org.

I'll see if I can work out why the StrikeFonts aren't working.

Gulik.


--
http://gulik.pbwiki.com/
Reply | Threaded
Open this post in threaded view
|

Re: Simulate "3+4" with InterpreterSimulator

Ang BeePeng
Hi,

Here you go. http://askoh.com/mwiki/images/5/50/InterpreterSimulator-image.zip

Thanks for your help.

Ang Beepeng
Reply | Threaded
Open this post in threaded view
|

Re: Simulate "3+4" with InterpreterSimulator

Bert Freudenberg

On 30.03.2010, at 05:15, Ang BeePeng wrote:
>
>
>
> Hi,
>
> Here you go.
> http://askoh.com/mwiki/index.php?title=Special:Upload&wpDestFile=InterpreterSimulator-image.zip

Actually:

http://askoh.com/mwiki/images/5/50/InterpreterSimulator-image.zip

You only forgot to remove squeak.ini which is only used by the Windows VM.

On the Mac it works with a 4.2.3 VM, but not the experimental 5.0 VM.

- Bert -

Reply | Threaded
Open this post in threaded view
|

Re: Simulate "3+4" with InterpreterSimulator

johnmci
 

On 2010-03-30, at 3:43 AM, Bert Freudenberg wrote:

> You only forgot to remove squeak.ini which is only used by the Windows VM.
>
> On the Mac it works with a 4.2.3 VM, but not the experimental 5.0 VM.

Really? So what happens?



>
> - Bert -
>

--
===========================================================================
John M. McIntosh <[hidden email]>   Twitter:  squeaker68882
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
===========================================================================





smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Simulate "3+4" with InterpreterSimulator

Bert Freudenberg
 
On 30.03.2010, at 20:26, John M McIntosh wrote:
>
>
> On 2010-03-30, at 3:43 AM, Bert Freudenberg wrote:
>
>> You only forgot to remove squeak.ini which is only used by the Windows VM.
>>
>> On the Mac it works with a 4.2.3 VM, but not the experimental 5.0 VM.
>
> Really? So what happens?

Some error when it's trying to simulate directory fetching.

- Bert -


Reply | Threaded
Open this post in threaded view
|

Re: Simulate "3+4" with InterpreterSimulator

johnmci
 
Er, well a bit more information? Or point to a image/changes I can try?

On 2010-03-31, at 8:46 AM, Bert Freudenberg wrote:

>
> On 30.03.2010, at 20:26, John M McIntosh wrote:
>>
>>
>> On 2010-03-30, at 3:43 AM, Bert Freudenberg wrote:
>>
>>> You only forgot to remove squeak.ini which is only used by the Windows VM.
>>>
>>> On the Mac it works with a 4.2.3 VM, but not the experimental 5.0 VM.
>>
>> Really? So what happens?
>
> Some error when it's trying to simulate directory fetching.
>
> - Bert -
>
>
--
===========================================================================
John M. McIntosh <[hidden email]>   Twitter:  squeaker68882
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
===========================================================================





smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Simulate "3+4" with InterpreterSimulator

Bert Freudenberg

On 31.03.2010, at 18:10, John M McIntosh wrote:
>
> Er, well a bit more information? Or point to a image/changes I can try?

You snipped that from my last mail. Need coffee? ;)

http://askoh.com/mwiki/images/5/50/InterpreterSimulator-image.zip

- Bert -

> On 2010-03-31, at 8:46 AM, Bert Freudenberg wrote:
>
>>
>> On 30.03.2010, at 20:26, John M McIntosh wrote:
>>>
>>>
>>> On 2010-03-30, at 3:43 AM, Bert Freudenberg wrote:
>>>
>>>> You only forgot to remove squeak.ini which is only used by the Windows VM.
>>>>
>>>> On the Mac it works with a 4.2.3 VM, but not the experimental 5.0 VM.
>>>
>>> Really? So what happens?
>>
>> Some error when it's trying to simulate directory fetching.
>>
>> - Bert -
>>
>>
>
> --
> ===========================================================================
> John M. McIntosh <[hidden email]>   Twitter:  squeaker68882
> Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
> ===========================================================================
>
>
>
>



Reply | Threaded
Open this post in threaded view
|

Re: Simulate "3+4" with InterpreterSimulator

johnmci
 
ABSOLUTELY need more coffee, still recovering from an allnighter to get WikiServer on the iPad.

On 2010-03-31, at 9:18 AM, Bert Freudenberg wrote:

>
> On 31.03.2010, at 18:10, John M McIntosh wrote:
>>
>> Er, well a bit more information? Or point to a image/changes I can try?
>
> You snipped that from my last mail. Need coffee? ;)
>
> http://askoh.com/mwiki/images/5/50/InterpreterSimulator-image.zip
>
> - Bert -
--
===========================================================================
John M. McIntosh <[hidden email]>   Twitter:  squeaker68882
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
===========================================================================





smime.p7s (3K) Download Attachment
12