[squeak-dev] Two new questions about VM machinery :-)

Eliot Miranda eliot.miranda at gmail.com
Sun Sep 6 02:49:54 UTC 2020


Hi Christophe, Hi Tobias,

On Sat, Sep 5, 2020 at 4:10 AM Thiede, Christoph <
Christoph.Thiede at student.hpi.uni-potsdam.de> wrote:

> Hi all, hi Eliot,
>
>
> just for curiosity, I have two new questions about the VM machinery (which
> are far away from praxis but close to my interests):
>
>
> *1.** super on ProtoObject*
>
> What would you expect the following to return?
>
> x := Compiler evaluate: 'super identityHash' for: ProtoObject new.
>
> thisContext objectClass: x.
>
> I would have guessed that either the VM crashes or ProtoObject >> #cannotInterpret:
> is called.
>

My guess before looking at the code was that the send provoked a
doesNotUnderstand: and hence the expression returned the result of raising
a MessageNotUnderstood exception.  But looking at the code I see that at
least in the JIT there is undefined behavior in looking up a message in a
nil class (the superclass of ProtoObject is nil).  So thank you for this.
I'll have to firm up the behaviour to ensure a doesNotUnderstand: is the
result.

But actually, it answers you the ProtoObject instance, which I find very
> interesting because it means that if a message cannot be looked up, it is
> simply and silently skipped.
>

Which is a bug.  The only reasonable thing to do here (IMO) is for the VM
to send doesNotUnderstnnd:.


> <http://www.hpi.de/>
> If you debug the call instead (Context class >> #runSimulated:), Context
> >> #send:to:with:lookupIn: raises a nil DNU error, which makes more sense
> but unfortunately is not consistent with the original VM behavior.
> Maybe the Compiler should forbid any call to super from ProtoObject
> instances at all (more formally: if the receiver's class's superclass is
> nil)? Or should we adjust the simulation code?
> (By the way: If you do the same in Squeak.js, you'll get an infinite
> recursion :D)
>
> *2. Mirror primitives*
> What is the reason for primitives such as 75 (#identityHash) or 78/139
> (#nextInstance/#nextObject) not being mirrored in Context?
> Was this simply forgotten, or don't we have the claim to mirror any
> "essential" primitive without it actually being needed by the simulation
> machinery?
>

They're not needed by the execution simulation machinery.


> As always, looking forward to your interesting explanations! :-)
>

>
> Best,
> Christoph
>

Cheers

_,,,^..^,,,_
best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200905/09c69666/attachment.html>


More information about the Squeak-dev mailing list