[Vm-dev] Changing numArgs of primitive CompiledMethod in Spur

Eliot Miranda eliot.miranda at gmail.com
Mon Feb 29 15:33:25 UTC 2016

Hi Denis, what's the test?  Send me the code and I'll try it in Squeak

_,,,^..^,,,_ (phone)

> On Feb 29, 2016, at 2:39 AM, Denis Kudriashov <dionisiydk at gmail.com> wrote:
> But this change not makes debugging test working. During debugging prim call return nil. 
> 2016-02-29 11:12 GMT+01:00 Denis Kudriashov <dionisiydk at gmail.com>:
>> Hi Eliot. 
>> 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>
>> 	ec ifNotNil:
>> 		["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 (where
>> 		  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 can produce.
>> 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,
>>> Denis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20160229/fd3849b4/attachment-0001.htm

More information about the Vm-dev mailing list