Mercurial > pub > dyncall > dyncall
comparison dyncall/dyncall_callvm_arm64.c @ 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 | 451299d50c1a |
children | ddfb9577a00e |
comparison
equal
deleted
inserted
replaced
375:c1153f21f2bb | 376:041cb6ad4d50 |
---|---|
130 , (DCpointervmfunc*) &call | 130 , (DCpointervmfunc*) &call |
131 , NULL /* callStruct */ | 131 , NULL /* callStruct */ |
132 }; | 132 }; |
133 | 133 |
134 #ifdef DC__OS_Win64 | 134 #ifdef DC__OS_Win64 |
135 /* for variadic, allocate arguments to an imaginary stack, where the first 64 bytes of | 135 /* for variadic, everything is pushed like ints as no FP regs are used, so |
136 allocate arguments to an imaginary stack, where the first 64 bytes of | |
136 the stack are loaded into x0-x7, and any remaining arguments on the stack */ | 137 the stack are loaded into x0-x7, and any remaining arguments on the stack */ |
137 | 138 |
138 static void var_bool (DCCallVM* in_p, DCbool x) { a_i64( in_p, ((DClonglong) x) ); } | 139 static void var_float (DCCallVM* in_p, DCfloat x) { DClonglong tmp = 0; *(DCfloat*)&tmp = x; a_i64(in_p, tmp); } |
139 static void var_char (DCCallVM* in_p, DCchar x) { a_i64( in_p, ((DClonglong) x) ); } | 140 static void var_double(DCCallVM* in_p, DCdouble x) { a_i64(in_p, *(DClonglong *)&x); } |
140 static void var_short (DCCallVM* in_p, DCshort x) { a_i64( in_p, ((DClonglong) x) ); } | |
141 static void var_int (DCCallVM* in_p, DCint x) { a_i64( in_p, ((DClonglong) x) ); } | |
142 static void var_long (DCCallVM* in_p, DClong x) { a_i64( in_p, ((DClonglong) x) ); } | |
143 static void var_pointer (DCCallVM* in_p, DCpointer x) { a_i64( in_p, ((DClonglong) x) ); } | |
144 static void var_float (DCCallVM* in_p, DCfloat x) { | |
145 DClonglong tmp = 0; | |
146 memcpy(&tmp, &x, sizeof(DCfloat)); | |
147 a_i64(in_p, tmp); | |
148 } | |
149 static void var_double (DCCallVM* in_p, DCdouble x) { | |
150 a_i64(in_p, *(DClonglong *)&x); | |
151 } | |
152 | 141 |
153 DCCallVM_vt vt_arm64_win_varargs = | 142 DCCallVM_vt vt_arm64_win_varargs = |
154 { | 143 { |
155 &deinit | 144 &deinit |
156 , &reset | 145 , &reset |
157 , &mode | 146 , &mode |
158 , &var_bool | 147 , &a_bool |
159 , &var_char | 148 , &a_char |
160 , &var_short | 149 , &a_short |
161 , &var_int | 150 , &a_int |
162 , &var_long | 151 , &a_long |
163 , &a_i64 | 152 , &a_i64 |
164 , &var_float | 153 , &var_float |
165 , &var_double | 154 , &var_double |
166 , &var_pointer | 155 , &a_pointer |
167 , NULL /* argStruct */ | 156 , NULL /* argStruct */ |
168 , (DCvoidvmfunc*) &call | 157 , (DCvoidvmfunc*) &call |
169 , (DCboolvmfunc*) &call | 158 , (DCboolvmfunc*) &call |
170 , (DCcharvmfunc*) &call | 159 , (DCcharvmfunc*) &call |
171 , (DCshortvmfunc*) &call | 160 , (DCshortvmfunc*) &call |
189 case DC_CALL_C_ELLIPSIS_VARARGS: | 178 case DC_CALL_C_ELLIPSIS_VARARGS: |
190 #ifdef DC__OS_Win64 | 179 #ifdef DC__OS_Win64 |
191 vt = &vt_arm64_win_varargs; | 180 vt = &vt_arm64_win_varargs; |
192 break; | 181 break; |
193 #endif /* if not win64, use below */ | 182 #endif /* if not win64, use below */ |
194 case DC_CALL_SYS_DEFAULT: | |
195 case DC_CALL_C_DEFAULT: | 183 case DC_CALL_C_DEFAULT: |
196 case DC_CALL_C_ARM64: | 184 case DC_CALL_C_ARM64: |
197 vt = &vt_arm64; | 185 vt = &vt_arm64; |
198 break; | 186 break; |
199 default: | 187 default: |