[Vm-dev] Direct pointer vs pointerForOop()

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Sat Apr 7 12:25:18 UTC 2018


Hi all,
I was about fixing
https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/240
some implementations use int to pass a pointer, that clearly does not work
in 64bits...

What we need is to pass a buffer which is a Smalltalk ByteArray (or
WordArray or something), in other word an oop, (stored into a sqInt/usqInt).

In Cog/Spur, an oop is a direct machine pointer, so we can avoid a
translation and that's why some implementation directly declare a void*
parameter.

In legacy interpreter VM, an oop is always an sqInt, but not always a
pointer. For example a 32bits image can run on a VM compiled for 64bits,
and in this case, sqInt is 32-bit wide, while the pointer is 64bits. So we
used to pass thru pointerForOop. Some implementations do that.

So what we have now is a big mix of partly compatible/uncompatible code. We
have to fix the int buf, but what should we better use, pointerForOop(sqInt
buf) or direct void *buf?

Nicolas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20180407/27946784/attachment.html>


More information about the Vm-dev mailing list