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

Juan Vuletich JuanVuletich at zoho.com
Mon Jun 5 16:26:58 UTC 2017


Hi Eliot, Folks,

I think this commit introduces a bug:

On 5/26/2017 10:25 PM, commits at source.squeak.org wrote:
> primitiveMakePoint should fail if its /argument/ is not a SmallInteger or Float.  Since the primitive is on Number we know the receiver is valid, and there is no point chekcing it.  Checking the argument allows us to e.g. make 3D point using a cascade of @'s.
>

The reason why this is wrong is that #@ is a special selector and is 
just not usually sent, being replaced by bytecode 187 /* 
bytecodePrimMakePoint */. This means that the primitive will be called 
with receivers of any kind, not just Number. This breaks the 3D point 
use case:

Previously, doing (1 @ 2) @ 3 would create the Point(1,2) and send #@ 3. 
The primitive would fail because of check of receiver, and a normal send 
would be done, creating an appropriate 3D point.

With this change, the receiver is not validated, but the argument is. 
The primitive doesn't fail (arg is number) and the result is a Point 
with another point as x: Point(Point(1,2),3). In the explorer it shows:
1 at 2@3
     x: 1 at 2
         x: 1
         y: 2
     y: 3

I think that validating the argument is good, but we also need to 
validate receiver.

Thanks,

-- 
Juan Vuletich
www.cuis-smalltalk.org
https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev
@JuanVuletich




More information about the Vm-dev mailing list