changeset 376:041cb6ad4d50

- simplified callvm setup for win/arm64 a bit, no behaviour changes
author Tassilo Philipp
date Mon, 28 Dec 2020 14:04:32 +0100
parents c1153f21f2bb
children 51af8ec8d8e6
files dyncall/dyncall_callvm_arm64.c
diffstat 1 files changed, 10 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/dyncall/dyncall_callvm_arm64.c	Sat Dec 26 22:39:46 2020 +0100
+++ b/dyncall/dyncall_callvm_arm64.c	Mon Dec 28 14:04:32 2020 +0100
@@ -132,38 +132,27 @@
 };
 
 #ifdef DC__OS_Win64
-/* for variadic, allocate arguments to an imaginary stack, where the first 64 bytes of
+/* for variadic, everything is pushed like ints as no FP regs are used, so
+   allocate arguments to an imaginary stack, where the first 64 bytes of
    the stack are loaded into x0-x7, and any remaining arguments on the stack */
 
-static void var_bool    (DCCallVM* in_p, DCbool    x) { a_i64( in_p, ((DClonglong) x) ); }
-static void var_char    (DCCallVM* in_p, DCchar    x) { a_i64( in_p, ((DClonglong) x) ); }
-static void var_short   (DCCallVM* in_p, DCshort   x) { a_i64( in_p, ((DClonglong) x) ); }
-static void var_int     (DCCallVM* in_p, DCint     x) { a_i64( in_p, ((DClonglong) x) ); }
-static void var_long    (DCCallVM* in_p, DClong    x) { a_i64( in_p, ((DClonglong) x) ); }
-static void var_pointer (DCCallVM* in_p, DCpointer x) { a_i64( in_p, ((DClonglong) x) ); }
-static void var_float   (DCCallVM* in_p, DCfloat   x) {
-  DClonglong tmp = 0;
-  memcpy(&tmp, &x, sizeof(DCfloat));
-  a_i64(in_p, tmp);
-}
-static void var_double  (DCCallVM* in_p, DCdouble  x) {
-  a_i64(in_p, *(DClonglong *)&x);
-}
+static void var_float (DCCallVM* in_p, DCfloat  x) { DClonglong tmp = 0; *(DCfloat*)&tmp = x; a_i64(in_p, tmp); }
+static void var_double(DCCallVM* in_p, DCdouble x) { a_i64(in_p, *(DClonglong *)&x); }
 
 DCCallVM_vt vt_arm64_win_varargs =
 {
   &deinit
 , &reset
 , &mode
-, &var_bool
-, &var_char
-, &var_short
-, &var_int
-, &var_long
+, &a_bool
+, &a_char
+, &a_short
+, &a_int
+, &a_long
 , &a_i64
 , &var_float
 , &var_double
-, &var_pointer
+, &a_pointer
 , NULL /* argStruct */
 , (DCvoidvmfunc*)       &call
 , (DCboolvmfunc*)       &call
@@ -191,7 +180,6 @@
       vt = &vt_arm64_win_varargs;
       break;
 #endif /* if not win64, use below */
-    case DC_CALL_SYS_DEFAULT:
     case DC_CALL_C_DEFAULT:        
     case DC_CALL_C_ARM64:        
       vt = &vt_arm64;