[Vm-dev] Exploring the simulator (was Re: REPL image for simulation)

Ben Coman btc at openinworld.com
Sun May 29 02:14:58 UTC 2016


Hi Clement, Thanks for your detailed reply.  I particularly liked your
warm up exercises.  Goal directed learning is better than general
browsing.

On Tue, May 24, 2016 at 1:29 AM, Clément Bera <bera.clement at gmail.com> wrote:
>
> Hi Ben,
>
> The REPL image expects chunk format. Hence you need to write "3 + 4 !"
>
> To get warmed-up:
> 1) Inspect the object memory, then look for the first class table page instance variable. It's an oop referencing an array, try in the simulator to "printOop:" the address of the first class table page that you found. It should print it in the Transcript, the first entries are immediate, in Spur32 SmallInteger/Character/SmallInteger.

The inspector showed a Spur32MMLECoSimulator and classTableFirstPage
held 16r5311F8. Plugging that into [print oop...] showed


> 2) print the active stack, look for the method's address. Try to print it as an oop, and if it tells you "address in the machine code zone", print the cog method and its machine code instead.
>
> Have fun.
>
> I'll try to answer further questions as I like to see people hacking the VM, but I am quite busy :-)
>
>
>
> On Mon, May 23, 2016 at 6:06 PM, Ben Coman <btc at openinworld.com> wrote:
>>
>>
>> On Mon, May 23, 2016 at 3:14 AM, Eliot Miranda <eliot.miranda at gmail.com> wrote:
>> >
>> >> On May 22, 2016, at 9:43 AM, Ben Coman <btc at openinworld.com> wrote:
>> >>
>> >>> On Sat, May 21, 2016 at 4:44 AM, Clément Bera <bera.clement at gmail.com> wrote:
>> >>>
>> >>>> On Fri, May 20, 2016 at 7:29 PM, Ben Coman <btc at openinworld.com> wrote:
>> >>>>
>> >>>> On Fri, May 20, 2016 at 8:44 PM, Clément Bera <bera.clement at gmail.com> wrote:
>> >>>
>> >>> Normally if you build a cog development image:
>> >>> $ svn co http://www.squeakvm.org/svn/squeak/branches/Cog/image
>> >>> $ cd ./image
>> >>> $ ./buildsqueaktrunkvmmakerimage.sh
>> >>>
>> >>> You have multiple scripts available with comments to run the simulator that work out of the box. It should take a couple minutes to get it working. Then the easiest is to simulate a REPL image to easily debug what you want.
>> >>
>> >> Hi Clement,
>> >>
>> >> Could you point me to such a REPL image?
>> >>
>> >> cheers -ben
>>
>> >
>> > Hi Ben,
>> >
>> >     see buildspurreaderimage.sh, or it may be buildspurtrunkreaderimage.sh, in the image directory.
>>
>> Thanks Eliot.  I now have an "Input please" window.  I presume I
>> should type Smalltalk expressions in there.  For a while it was
>> confusing that I could see no effect entering...
>>    3+4
>> or...
>>   Transcript show:'hello'
>>
>> Nothing moving in the Simulator's trace pane, nor the Transcript
>> within the simulation, nor the host's Transcript, but after selecting
>> menu item "print instructions each instruction" I see 3+4 produce a
>> stream of instructions in the host transcript.
>>
>> With such a long list of menu items, I expect now I'll bug everyone to
>> discover what they all are.  I'll use this thread to log random things
>> I discover for posterity for myself and other VM newcomers.  There
>> doesn't seem a lot of info out there on the simulator and maybe some
>> will spark some short comments, but I don't expect feedback on
>> everything.
>>
>> But first, what are a few important menu or workflow items a VM
>> newcomer working with the REPL image would find useful?
>>
>> cheers -ben
>>
>> P.S. After running ./buildspurtrunkreaderimage.sh
>> this is the code I ran in the host image...
>> | cos |
>> cos := CogVMSimulator newWithOptions: #(Cogit
>> StackToRegisterMappingCogit "SimpleStackBasedCogit"
>> ObjectMemory Spur32BitCoMemoryManager
>> "ISA ARMv5" "ISA IA32").
>> "cos initializeThreadSupport."
>> cos desiredNumStackPages: 8.
>> cos openOn: 'spurreader.image'.
>> cos openAsMorph; run
>
>
>


More information about the Vm-dev mailing list