New primitive to include (please?) Re: [Vm-dev] Method executing but not sent to the receiver

Mariano Martinez Peck marianopeck at
Mon Apr 25 14:59:08 UTC 2011

So...if everybody is happy with this new primitive, can we include it in the
main distribution of VMMaker and VMMaker-oscog ?
I mean...I can do it, I have commit access. But I would live to have the
accept. Andreas and Levente have already agreed. Eliot ? can I commit it to
VMMaker-oscog ?
David ? can I commit it to VMMaker ?
is this number 190 okay?



I copy past the code here:

CompiledMethod >> executeWithReceiver: aReceiver arguments: anArray
 "Execute the compiledMethod against the aReceiver and args in argArray."

<primitive: 190>
   self primitiveFailed

And this is the primitive.

StackInterpreterPrimitives >> primitiveExecuteWithReceiverAr
    "method, recevier, and the array of arguments are on top of stack.
Execute method against receiver and args.
     Set primitiveFunctionPointer because no cache lookup has been done for
the method, and
     hence primitiveFunctionPointer is stale."
    | receiverMethod argCnt argumentArray primitiveIndex receiverObject |
    receiverMethod := self stackValue: 2.
    receiverObject := self stackValue: 1.
    argumentArray := self stackTop.
    ((objectMemory isOopCompiledMethod: receiverMethod)
     and: [objectMemory isArray: argumentArray]) ifFalse:
        [^self primitiveFailFor: PrimErrBadArgument].
    argCnt := self argumentCountOf: receiverMethod.
    argCnt = (objectMemory fetchWordLengthOf: argumentArray) ifFalse:
        [^self primitiveFailFor: PrimErrBadNumArgs].
    self pop: 3.
    self push: receiverObject.
    0 to: argCnt - 1 do:
        self push: (objectMemory fetchPointer: i ofObject: argumentArray)].
    newMethod := receiverMethod.
    primitiveIndex := self primitiveIndexOf: newMethod.
    primitiveFunctionPointer := self functionPointerFor: primitiveIndex
inClass: nil.
    argumentCount := argCnt.
    "We set the messageSelector for executeMethod below since things
     like the at cache read messageSelector and so it cannot be left stale."
    messageSelector := objectMemory nilObject.
    self executeNewMethod.
    "Recursive xeq affects primErrorCode"
    self initPrimCall

On Wed, Apr 20, 2011 at 2:42 PM, Andreas Raab <andreas.raab at> wrote:

> On 4/20/2011 14:29, Mariano Martinez Peck wrote:
>> CompiledMethod >> valueWithReceiver: aReceiver arguments: anArray
>>    "Execute compiledMethod against the receiver and args in argArray. The
>> receiver is the CompiledMethod"
>> <primitive: 666>
>>    self primitiveFailed
>> Where the primitive is send directly, and not a message to the receiver.
>> Is something like this available or I would need to create a new
>> primitive?
> Which by the way, is the primitive that should exist, and
> Object>>withArgs:executeMethod: should be nuked ASAP. There is no reason to
> pollute the Object namespace any more than absolutely necessary.
> Cheers,
>  - Andreas

-------------- next part --------------
An HTML attachment was scrubbed...

More information about the Vm-dev mailing list