Discussion:
[Vm-dev] Simulate "3+4" with InterpreterSimulator
Ang BeePeng
2010-03-22 18:14:26 UTC
Permalink
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
--
View this message in context: http://n4.nabble.com/Simulate-3-4-with-InterpreterSimulator-tp1678060p1678060.html
Sent from the Squeak - VM mailing list archive at Nabble.com.
Michael van der Gulik
2010-03-22 22:32:43 UTC
Permalink
Post by 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?
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/
David T. Lewis
2010-03-23 01:29:41 UTC
Permalink
Post by Michael van der Gulik
Post by Ang BeePeng
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
Ang BeePeng
2010-03-23 03:49:53 UTC
Permalink
Post by David T. Lewis
Try putting a self halt in Interpreter>>primitiveAdd, which should be
called when you evaluate "3+4".
Or is it bytecodePrimAdd?
Post by David T. Lewis
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
--
View this message in context: http://n4.nabble.com/Simulate-3-4-with-InterpreterSimulator-tp1678060p1678647.html
Sent from the Squeak - VM mailing list archive at Nabble.com.
Ang BeePeng
2010-03-23 03:24:17 UTC
Permalink
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
--
View this message in context: http://n4.nabble.com/Simulate-3-4-with-InterpreterSimulator-tp1678060p1678623.html
Sent from the Squeak - VM mailing list archive at Nabble.com.
Michael van der Gulik
2010-03-23 03:48:48 UTC
Permalink
Post by Ang BeePeng
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/
Ang BeePeng
2010-03-28 15:25:40 UTC
Permalink
Post by Michael van der Gulik
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.

Thanks.

Ang Beepeng
--
View this message in context: http://n4.nabble.com/Simulate-3-4-with-InterpreterSimulator-tp1678060p1694169.html
Sent from the Squeak - VM mailing list archive at Nabble.com.
Ang BeePeng
2010-03-28 16:57:41 UTC
Permalink
Post by Michael van der Gulik
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.

Thanks.

Ang Beepeng
--
View this message in context: http://n4.nabble.com/Simulate-3-4-with-InterpreterSimulator-tp1678060p1694237.html
Sent from the Squeak - VM mailing list archive at Nabble.com.
Michael van der Gulik
2010-03-28 22:50:54 UTC
Permalink
Post by Michael van der Gulik
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/
Ang BeePeng
2010-03-29 02:43:11 UTC
Permalink
Post by Michael van der Gulik
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.
* 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.
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
--
View this message in context: http://n4.nabble.com/Simulate-3-4-with-InterpreterSimulator-tp1678060p1694646.html
Sent from the Squeak - VM mailing list archive at Nabble.com.
Bert Freudenberg
2010-03-29 13:49:14 UTC
Permalink
Post by Michael van der Gulik
Post by Ang BeePeng
Post by Michael van der Gulik
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.
* 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.
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 -
Ang BeePeng
2010-03-29 15:51:01 UTC
Permalink
Post by Michael van der Gulik
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
--
View this message in context: http://n4.nabble.com/Simulate-3-4-with-InterpreterSimulator-tp1678060p1695271.html
Sent from the Squeak - VM mailing list archive at Nabble.com.
Michael van der Gulik
2010-03-29 21:11:37 UTC
Permalink
Post by Ang BeePeng
Post by Michael van der Gulik
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/
Ang BeePeng
2010-03-30 03:15:46 UTC
Permalink
Hi,

Here you go.
http://askoh.com/mwiki/index.php?title=Special:Upload&wpDestFile=InterpreterSimulator-image.zip

Thanks for your help.

Ang Beepeng
--
View this message in context: http://n4.nabble.com/Simulate-3-4-with-InterpreterSimulator-tp1678060p1738776.html
Sent from the Squeak - VM mailing list archive at Nabble.com.
Bert Freudenberg
2010-03-30 10:43:45 UTC
Permalink
Post by Ang BeePeng
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 -
John M McIntosh
2010-03-30 18:26:39 UTC
Permalink
Post by Bert Freudenberg
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?
Post by Bert Freudenberg
- Bert -
--
===========================================================================
John M. McIntosh <***@smalltalkconsulting.com> Twitter: squeaker68882
Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com
===========================================================================
Bert Freudenberg
2010-03-31 15:46:02 UTC
Permalink
Post by John M McIntosh
Post by Bert Freudenberg
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
2010-03-31 16:10:34 UTC
Permalink
Er, well a bit more information? Or point to a image/changes I can try?
Post by Bert Freudenberg
Post by John M McIntosh
Post by Bert Freudenberg
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 <***@smalltalkconsulting.com> Twitter: squeaker68882
Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com
===========================================================================
Bert Freudenberg
2010-03-31 16:18:22 UTC
Permalink
Post by John M McIntosh
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 -
Post by John M McIntosh
Post by Bert Freudenberg
Post by John M McIntosh
Post by Bert Freudenberg
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 -
--
===========================================================================
Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com
===========================================================================
John M McIntosh
2010-03-31 19:20:49 UTC
Permalink
ABSOLUTELY need more coffee, still recovering from an allnighter to get WikiServer on the iPad.
Post by Bert Freudenberg
Post by John M McIntosh
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 <***@smalltalkconsulting.com> Twitter: squeaker68882
Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com
===========================================================================
John M McIntosh
2010-09-08 22:29:37 UTC
Permalink
Ok, I was looking at this problem Bert said:

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

First when you click to get a world menu it comes up white no data for the menu rows. I tested on a 4.2.5 and back to a 3.8.21 with the same behavior
so it that what happens on windows & linux?

That makes it hard to pick the file dialog, so Bert do you have some smalltalk code that fails I could try in the simulator workspace?
Post by Bert Freudenberg
Post by Ang BeePeng
Hi,
Here you go.
http://askoh.com/mwiki/index.php?title=Special:Upload&wpDestFile=InterpreterSimulator-image.zip
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 -
--
===========================================================================
John M. McIntosh <***@smalltalkconsulting.com> Twitter: squeaker68882
Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com
===========================================================================
Loading...