[Vm-dev] VM Maker: VMMaker.oscog-tfel.1274.mcz

Eliot Miranda eliot.miranda at gmail.com
Thu Apr 30 16:36:57 UTC 2015


Hi Tim,

   is there a reason why you cannot put this in a subclass, e.g.
RSqueakInterpreterProxy, rather than in the default?  Seems to me that
would provide better documentation than the current method.  Also you could
at least comment the method to explain that this is for RSqueak, and try
and explain what happens in the RSqueakVM.  It looks opaque to me.  I like
to know what primitives do.  For example, the comment in
BlockClosure>>ensure: is explicit:

ensure: aBlock
"Evaluate a termination block after evaluating the receiver, regardless of
 whether the receiver's evaluation completes.  N.B.  This method is *not*
 implemented as a primitive.  Primitive 198 always fails.  The VM uses prim
 198 in a context's method as the mark for an ensure:/ifCurtailed:
activation."

| complete returnValue |
<primitive: 198>
returnValue := self valueNoContextSwitch.
complete ifNil:[
complete := true.
aBlock value.
].
^ returnValue

What you have is mysterious (at least to me):

primitiveFailFor: reasonCode
"Set specific primitive failure.
N.B. primitiveFailFor: PrimNoErr is expected to clear the primFailCode.
Primitive 255 is called to indicate that we are currently simulating a
primitive that should fail and the VM should handle that case appropriately
(if supported by the VM)."
<primitive: 255>
^ primFailCode := reasonCode

Surely, "Primitive 255 is called to inform the VM that we are failing a
primitive we are simulating.  Specific VMs, e.g. the RSqueakVM, choose not
to implement certain primitives and prefer to simulate the code.  In this
case the VM needs the primitive execution to catch, and handle, failure of
the simulated code."



On Wed, Apr 29, 2015 at 10:59 PM, <commits at source.squeak.org> wrote:

>
> Tim Felgentreff uploaded a new version of VMMaker to project VM Maker:
> http://source.squeak.org/VMMaker/VMMaker.oscog-tfel.1274.mcz
>
> ==================== Summary ====================
>
> Name: VMMaker.oscog-tfel.1274
> Author: tfel
> Time: 30 April 2015, 7:59:26.741 am
> UUID: 11ab491c-b25b-4a4b-bbee-864f39e9d3e7
> Ancestors: VMMaker.oscog-rmacnak.1273
>
> Merge from VMMaker-tfel.363. Add primitive 255 as marker to
> InterpreterProxy>>primitiveFailFor: for RSqueakVM to notice that the
> simulation is about to fail
>
> =============== Diff against VMMaker.oscog-rmacnak.1273 ===============
>
> Item was changed:
>   ----- Method: InterpreterProxy>>primitiveFailFor: (in category 'other')
> -----
>   primitiveFailFor: reasonCode
>         "Set specific primitive failure.
> +       N.B. primitiveFailFor: PrimNoErr is expected to clear the
> primFailCode.
> +       Primitive 255 is called to indicate that we are currently
> simulating a primitive that should fail and the VM should handle that case
> appropriately (if supported by the VM)."
> +       <primitive: 255>
> +       ^ primFailCode := reasonCode!
> -        N.B. primitiveFailFor: PrimNoErr is expected to clear the
> primFailCode."
> -       (self confirm:'A primitive is failing -- Stop simulation?')
> ifTrue:[self halt].
> -       ^primFailCode := reasonCode!
>
>


-- 
best,
Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20150430/21ed69fd/attachment.htm


More information about the Vm-dev mailing list