[tode_st] ByteArray>>unsignedLongLongAt: (and presumably ByteArray>>unsignedLongLongAt:put:) wrong for UFFI

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[tode_st] ByteArray>>unsignedLongLongAt: (and presumably ByteArray>>unsignedLongLongAt:put:) wrong for UFFI

Dale Henrichs-3
Mariano,

I had to change ByteArray>>unsignedLongLongAt: to:

"protocol: *FFI-Kernel"
unsignedLongLongAt: byteOffset
     "Answer a 64-bit integer in Smalltalk order (little-endian)."
     | n1 n2 |
     n1 := self unsignedLongAt: byteOffset .
     n2 := self unsignedLongAt: byteOffset+4 .
     ^n2 = 0 ifTrue: [n1] ifFalse: [(n2 bitShift: 32) + n1]

from:

"protocol: *FFI-Kernel"
unsignedLongLongAt: byteOffset
     "Answer a 64-bit integer in Smalltalk order (little-endian)."
     | n1 n2 |
     n1 := self unsignedLongAt: byteOffset bigEndian: false.
     n2 := self unsignedLongAt: byteOffset+4 bigEndian: false.
     ^n2 = 0 ifTrue: [n1] ifFalse: [(n2 bitShift: 32) + n1]

to be able to access the GsGciErrSType>context oopType ... this is
required to handle client forwarders which are needed for the minimal
tODE api .. The ...bigEndian: variants don't use the primitive call that
is special cased for ExternalAddress (why they aren't separate prim
calls beats me) so it's just not correct at all as is ...

These methods are actually in FFI-Kernel, which is probably broken with
respect the these as well (IIRC, I had to implement those guys for the
Pharo3.0/4.0 and just might be wrong for Pharo5.0? ... I won't check
back with Pharo3.0/4.0 until I get the minimal tODE spi funcional for
Pharo5.0...

I'm patching ByteArray>>unsignedLongLongAt: for now ... and it looks
like I'm in good shape with client forwarders --- a couple more test
cases to go ...

Dale

--
You received this message because you are subscribed to the Google Groups "tODE" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.