[Vm-dev] a problem with alien,
primitive fail (primFFICallResult:withArguments:)
Esteban Lorenzano
estebanlm at gmail.com
Tue Dec 28 13:45:24 UTC 2010
Hi,
so in dabusiness.h I changed
} else {
long v = interpreterProxy->signed32BitValueOf(arg);
if (interpreterProxy->failed())
return PrimErrBadArgument;
*(long *)argvec = v;
argvec += sizeof(long);
}
for
} else {
long v;
sqInt argClass = interpreterProxy->fetchClassOf(arg);
if (argClass == (interpreterProxy->classLargePositiveInteger())) {
v = interpreterProxy->positive32BitValueOf(arg);
} else {
v = interpreterProxy->signed32BitValueOf(arg);
}
if (interpreterProxy->failed())
return PrimErrBadArgument;
*(long *)argvec = v;
argvec += sizeof(long);
}
now it seems to be working... maybe I need extend this for other integer possible values? well, one problem at a time... for now is working, but the Alien Bridge still don't, so I'll continue hacking that :)
Cheers and thanks
Esteban
El 28/12/2010, a las 5:37a.m., Igor Stasenko escribió:
>
> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20101228/0fdd5645/attachment.htm
More information about the Vm-dev
mailing list