[Vm-beginners] Steps toward aarch64 Cog

ken.dickey at whidbey.com ken.dickey at whidbey.com
Sun Dec 23 05:46:22 UTC 2018


Greetings,

Made the mistake of running the FFI unit tests in Cuis, which directly led
me down the rabbit hole.

Think I have made some progress in understanding, but don't yet see how to
teach VMMaker to get code from register.

Here is crux of one of my investigations:
==============================

===== C source ======sqFFITestFuncs.c

/* test passing and returning doubles */
EXPORT(double) ffiTestDoubles(double d1, double d2) {
printf("The two floats are %f and %f\n", (float)d1, (float)d2);
return d1+d2;
}

===== ASM === from objectdump -d
0000000000000ac0 <ffiTestDoubles>:
ac0: a9be7bfd stp x29, x30, [sp, #-32]!
ac4: 90000000 adrp x0, 0 <ffiTestChars>
ac8: 91000000 add x0, x0, #0x0
acc: 910003fd mov x29, sp
ad0: 6d0127e8 stp d8, d9, [sp, #16]
ad4: 1e604009 fmov d9, d0
ad8: 1e604028 fmov d8, d1
adc: 1e624000 fcvt s0, d0
ae0: 1e624021 fcvt s1, d1
ae4: 1e22c000 fcvt d0, s0
ae8: 1e22c021 fcvt d1, s1
aec: 94000000 bl 0 <printf>
af0: 1e682920 fadd d0, d9, d8
af4: 6d4127e8 ldp d8, d9, [sp, #16]
af8: a8c27bfd ldp x29, x30, [sp], #32
afc: d65f03c0 ret
// result returned in d0 (NB: _not_ x0)
=================Cuis Workspace (after FFI unit test)===========
FFITestLibrary ffiTestDoubles: 30.0 with: 65.0. 
"--> 00.00558872584952 -- should be 95.0"
=================Terminal Output===================================
The two floats are 30.000000 and 65.000000
===================================================================
FFIPlugin>>ffiCreateReturnOop: retVal
...

^interpreterProxy floatObjectOf: (self ffiReturnFloatValue).
====================================================================
My theory: return value taken from x0, not
d0.==============================================Is this a sensible
interpretation?Any hints from Heloise?
Thanks much,-KenDPS: Merry Christmas! (I would use Xmas, but who knows what
is lurking under the X? 8^)


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-beginners/attachments/20181222/bb03c8c2/attachment.html>


More information about the VM-beginners mailing list