[Vm-dev] Changing numArgs of primitive CompiledMethod in Spur
dionisiydk at gmail.com
Mon Feb 29 10:12:05 UTC 2016
We have test for debugging failed named primitive. And without template
trick this test is not working. Debugging this test step by step shows what
is really not working. We not got error code from prim call while doing
step over it.
It is CodeSimulationTest>>testErrorCodeNotFound
Beside your fix with method header not helps alone. I make all tests
working with another change. But I am not really understand this code:
tryNamedPrimitiveIn: aCompiledMethod for: aReceiver withArgs: arguments
"Invoke the named primitive for aCompiledMethod, answering its result, or,
if the primiitve fails, answering the error code."
<primitive: 218 error: ec>
["If ec is an integer other than -1 there was a problem with primitive 218,
not with the external primitive itself. -1 indicates a generic failure
ec should be nil) but ec = nil means primitive 218 is not implemented. So
interpret -1 to mean the external primitive failed with a nil error code."
ec isInteger ifTrue:
[ec = -1
ifTrue: [ec := nil]
ifFalse: [*^self class primitiveFailTokenFor: ec*]]].
^"execute prim by template method"
So it is fixes Pharo tests problem. But I don't know what other issues it
2016-02-27 11:39 GMT+01:00 Denis Kudriashov <dionisiydk at gmail.com>:
> Hi Eliot
> 2016-02-27 0:25 GMT+01:00 Eliot Miranda <eliot.miranda at gmail.com>:
>> So the code to change the number of arguments is fine. What's wrong is
>> the code to store the error code. That comes /after/ the three byte call
>> primitive bytecode at the start of the method. So it should read
>> xpc := self initialPC + 3.
>> "long store temp"
>> (self at: xpc) = 129 ifTrue:
>> [self at: xpc + 1 put: (16r40 + numArgs).
>> self at: xpc + 3 put: (16r10 + numArgs)]
>> Is there any solution to make it working?
>> The above should work. But there's a much easier way
> This works. Thank's. I will try your attachment later.
> Best regards,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Vm-dev