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

Thiede, Christoph Christoph.Thiede at student.hpi.uni-potsdam.de
Sat Sep 5 11:17:38 UTC 2020


>     x := Compiler evaluate: 'super identityHash' for: ProtoObject new.

>     thisContext objectClass: x.


Also interesting:

'super bar' returns a DNU where the receiver is a SmallInteger (sic!). In a second image, the call is skipped, again ...

________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Thiede, Christoph
Gesendet: Samstag, 5. September 2020 13:10:29
An: Squeak Dev
Betreff: [squeak-dev] Two new questions about VM machinery :-)


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.

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.
<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?

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

Best,
Christoph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200905/4fa9181c/attachment.html>


More information about the Squeak-dev mailing list