[Vm-dev] a problem with alien, primitive fail (primFFICallResult:withArguments:)

Igor Stasenko siguctua at gmail.com
Tue Dec 28 08:37:04 UTC 2010


On 28 December 2010 01:54, Esteban Lorenzano <estebanlm at gmail.com> wrote:
>
> Hi,
> I'm trying to get the Alien ObjectiveC bridge to work, and I'm having a problem (right now no cog, just cocoa vm 5.7 with "regular" alien, NewspeakI32ABIPlugin), and I'm having a problem on sending a message with this form:
> someAlien
> primFFICallResult: resultAlien
> withArguments: {anAlien. aLargePositiveInteger}
> so... it is answering primitiveFail (code 3), because the third argument is bad taken when converting... the primitive does this path:
> callIA32IntegralReturn,
> ...
> long v = interpreterProxy->signed32BitValueOf(arg);
> ...
> value = (((byteAt((oop + (BASE_HEADER_SIZE)) + 0)) + ((byteAt((oop + (BASE_HEADER_SIZE)) + 1)) << 8)) + ((byteAt((oop + (BASE_HEADER_SIZE)) + 2)) << 16)) + ((byteAt((oop + (BASE_HEADER_SIZE)) + 3)) << 24);
> value here is negative, and of course, it throws an error.
> So... anybody has a clue of whats wrong? I know the number is actually a LargePositiveInteger, so it should be ok, and pass... so any idea?

sure, if your largePositiveInteger, which is 32bit unsigned integer,
then

 long v = interpreterProxy->signed32BitValueOf(arg);

should be

unsigned long v = interpreterProxy->positive32BitValueOf(arg);

> Cheers,
> Esteban
>
>
>
>



-- 
Best regards,
Igor Stasenko AKA sig.


More information about the Vm-dev mailing list