[Vm-dev] VM Maker: VMMaker.oscog-eem.2347.mcz

Alistair Grant akgrant0710 at gmail.com
Sat Mar 10 17:35:28 UTC 2018


Hi Clément,


On 10 March 2018 at 13:27, Clément Bera <bera.clement at gmail.com> wrote:
>
>
>
> On Fri, Mar 9, 2018 at 9:22 AM, Alistair Grant <akgrant0710 at gmail.com> wrote:
>>
>>
>> Hi Eliot, Clément & Ben,
>>
>> Thanks very much for all your suggestions on getting started with the
>> simulator.  I'll be looking at them all.
>>
>> Thanks again,
>> Alistair
>>
>
> Another thing you can do is to simulate the simulator itself, so you can look at the code, the execution from the outside and from the inside at the same time. See picture below
>
> | cos |
> cos := StackInterpreterSimulator newWithOptions: #(ObjectMemory Spur32BitMemoryManager).
> cos desiredNumStackPages: 8.
> cos openOn: 'SpurVMMaker.image'.
> cos systemAttributes
> at: 2 put: '-doit';
> at: 3 put: '| cos |
> cos := StackInterpreterSimulator newWithOptions: #(ObjectMemory Spur32BitMemoryManager).
> cos desiredNumStackPages: 8.
> cos openOn: ''SpurVMMaker.image''.
> cos openAsMorph; run'.
>
> cos openAsMorph; run

And down the rabbit hole we go... :-)

But seriously: Thanks for the tip, I doubt I would have thought of this.

Cheers,
Alistair



>> On 8 March 2018 at 17:42, Ben Coman <btc at openinworld.com> wrote:
>> >
>> >
>> >
>> > On 8 March 2018 at 22:59, Alistair Grant <akgrant0710 at gmail.com> wrote:
>> >>
>> >>
>> >> Hi Eliot,
>> >>
>> >> On Wed, Mar 07, 2018 at 10:46:41PM +0000, commits at source.squeak.org wrote:
>> >> >
>> >> > Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
>> >> > http://source.squeak.org/VMMaker/VMMaker.oscog-eem.2347.mcz
>> >> >
>> >> > ==================== Summary ====================
>> >> >
>> >> > Name: VMMaker.oscog-eem.2347
>> >> > Author: eem
>> >> > Time: 7 March 2018, 2:46:20.98144 pm
>> >> > UUID: 062614a7-e3da-4b30-997a-9568911b9ff5
>> >> > Ancestors: VMMaker.oscog-akg.2346
>> >> >
>> >> > Review of Alistair's recent FilePlugin changes:
>> >> >
>> >> > Alistair, in var:type: declarations use symbols for types, as these are shared in lots of cases.
>> >>
>> >> In my defense, the slang code I was looking at used strings.  But this
>> >> makes sense and I'll change.
>> >>
>> >>
>> >> > With several plugins, but especially the FilePlugin and SocketPlugin, avoid using cCode: 'aString(...)' inSmalltalk: [passive default] because this is not simulateable.  For example in FilePlugin>>#primitiveFileWrite you'll see
>> >> >       bytesWritten := self
>> >> >                                               sqFile: file
>> >> >                                               Write: count * elementSize
>> >> >                                               From: (interpreterProxy cCoerce: (interpreterProxy firstIndexableField: array) to: #'char *')
>> >> >                                               At: startIndex - 1 * elementSize.
>> >> > instead of a self cCode: 'sqFileWriteFromAt(...)' form and you'll find an implementation at FilePluginSimulator>>#sqFile:Write:From:At:
>> >>
>> >> It looks like it's at the point where I need to understand
>> >> the simulator (which I haven't looked at yet).
>> >>
>> >> I haven't seen it yet, but I'll definitely watch Clémnt's video.
>> >> Where else should I look to get started with the simulator?
>> >
>> >
>> > Here is a beginner picking the brains of the experts...
>> > http://forum.world.st/Exploring-the-simulator-was-Re-REPL-image-for-simulation-td4896870.html
>> >
>> > which Clement summarised here...
>> > https://clementbera.wordpress.com/2016/05/30/simulating-the-cog-vm/
>> >
>> > cheers -ben
>> >
>> >
>> >>
>> >> > In primitiveConnectToFile[Descriptor] you write
>> >> >
>> >> >       interpreterProxy failed ifFalse:
>> >> >               [^interpreterProxy pop: 3 "rcvr, name, writeFlag"
>> >> >                                                       thenPush: filePointer].
>> >> >       ^interpreterProxy primitiveFail.
>> >> >
>> >> > but there's no point calling primitiveFail a secoind time given that interpreterProxy failed tells you the primitive has already failed.  Simply write
>> >> >
>> >> >       interpreterProxy failed ifFalse:
>> >> >               [interpreterProxy pop: 3 "rcvr, name, writeFlag"
>> >> >                                                       thenPush: filePointer]
>> >>
>> >> OK.
>> >>
>> >> Thanks for the feedback,
>> >> Alistair
>> >>
>> >
>> >
>
>
>
>
> --
> Clément Béra
> Pharo consortium engineer
> https://clementbera.github.io/
> https://clementbera.wordpress.com/
> Bâtiment B 40, avenue Halley 59650 Villeneuve d'Ascq
>


More information about the Vm-dev mailing list