annotate dyncall/dyncall_callvm_arm64.c @ 663:127b569978cc default tip

- another tweak handling clang trying to be too smart (see last commit)
author Tassilo Philipp
date Sun, 24 Mar 2024 13:52:44 +0100
parents cab0031c6691
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
1 /*
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
2
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
3 Package: dyncall
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
4 Library: dyncall
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
5 File: dyncall/dyncall_callvm_arm64.c
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
6 Description: ARM 64-bit ABI implementation
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
7 License:
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
8
466
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 376
diff changeset
9 Copyright (c) 2015-2020 Daniel Adler <dadler@uni-goettingen.de>,
281
f5577f6bf97a - file header cleanups for release
Tassilo Philipp
parents: 84
diff changeset
10 Tassilo Philipp <tphilipp@potion-studios.com>
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
11
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
12 Permission to use, copy, modify, and distribute this software for any
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
13 purpose with or without fee is hereby granted, provided that the above
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
14 copyright notice and this permission notice appear in all copies.
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
15
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
16 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
17 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
18 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
19 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
20 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
21 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
22 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
23
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
24 */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
25
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
26
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
27 #include "dyncall_callvm_arm64.h"
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
28 #include "dyncall_alloc.h"
371
451299d50c1a - windows arm64 support (dyncall, dyncallback, cmake support for armasm64), thanks Bernhard Urban-Forster!
Tassilo Philipp
parents: 366
diff changeset
29 #include "dyncall_macros.h"
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
30
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
31
366
ad5f9803f52f - removal of some unnecessary headers that only contained internally used forward declarations, so no need to have them
Tassilo Philipp
parents: 281
diff changeset
32 void dcCall_arm64(DCpointer target, DCpointer data, DCsize size, DCpointer regdata);
ad5f9803f52f - removal of some unnecessary headers that only contained internally used forward declarations, so no need to have them
Tassilo Philipp
parents: 281
diff changeset
33
ad5f9803f52f - removal of some unnecessary headers that only contained internally used forward declarations, so no need to have them
Tassilo Philipp
parents: 281
diff changeset
34
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
35 static void reset(DCCallVM* in_p)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
36 {
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
37 DCCallVM_arm64* p = (DCCallVM_arm64*)in_p;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
38 p->i = 0;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
39 p->f = 0;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
40 dcVecReset(&p->mVecHead);
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
41 }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
42
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
43
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
44 static void deinit(DCCallVM* in_self)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
45 {
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
46 dcFreeMem(in_self);
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
47 }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
48
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
49
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
50
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
51 static void a_i64(DCCallVM* in_self, DClonglong x)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
52 {
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
53 DCCallVM_arm64* p = (DCCallVM_arm64*)in_self;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
54 if (p->i < 8) {
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
55 p->I[p->i] = x;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
56 p->i++;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
57 } else {
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
58 dcVecAppend(&p->mVecHead, &x, sizeof(DClonglong));
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
59 }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
60 }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
61
651
cab0031c6691 - arm64 files:
Tassilo Philipp
parents: 533
diff changeset
62 static void a_bool (DCCallVM* self, DCbool x) { a_i64(self, (DClonglong)x); }
cab0031c6691 - arm64 files:
Tassilo Philipp
parents: 533
diff changeset
63 static void a_char (DCCallVM* self, DCchar x) { a_i64(self, x); }
cab0031c6691 - arm64 files:
Tassilo Philipp
parents: 533
diff changeset
64 static void a_short (DCCallVM* self, DCshort x) { a_i64(self, x); }
cab0031c6691 - arm64 files:
Tassilo Philipp
parents: 533
diff changeset
65 static void a_int (DCCallVM* self, DCint x) { a_i64(self, x); }
cab0031c6691 - arm64 files:
Tassilo Philipp
parents: 533
diff changeset
66 static void a_long (DCCallVM* self, DClong x) { a_i64(self, x); }
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
67 static void a_pointer (DCCallVM* self, DCpointer x) { a_i64(self, (DClonglong) x ); }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
68
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
69 static void a_float(DCCallVM* in_p, DCfloat x)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
70 {
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
71 DCCallVM_arm64* p = (DCCallVM_arm64*)in_p;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
72
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
73 if (p->f < 8) {
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
74 p->u.S[ p->f << 1 ] = x;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
75 p->f++;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
76 } else {
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
77 dcVecAppend(&p->mVecHead, &x, sizeof(DCfloat));
371
451299d50c1a - windows arm64 support (dyncall, dyncallback, cmake support for armasm64), thanks Bernhard Urban-Forster!
Tassilo Philipp
parents: 366
diff changeset
78 dcVecSkip(&p->mVecHead, 4); /* align to 8-bytes */
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
79 }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
80 }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
81
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
82 static void a_double(DCCallVM* in_p, DCdouble x)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
83 {
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
84 DCCallVM_arm64* p = (DCCallVM_arm64*)in_p;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
85 if (p->f < 8) {
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
86 p->u.D[ p->f ] = x;
466
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 376
diff changeset
87 p->f++;
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
88 } else {
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
89 dcVecAppend(&p->mVecHead, &x, sizeof(DCdouble));
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
90 }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
91 }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
92
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
93 void call(DCCallVM* in_p, DCpointer target)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
94 {
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
95 DCCallVM_arm64* p = (DCCallVM_arm64*)in_p;
466
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 376
diff changeset
96
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
97 /*
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
98 ** copy 'size' argument is given in number of 16-byte 'pair' blocks.
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
99 */
466
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 376
diff changeset
100
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
101 dcCall_arm64(target, dcVecData(&p->mVecHead), ( dcVecSize(&p->mVecHead) + 15 ) & -16, &p->u.S[0]);
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
102 }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
103
84
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
104 static void mode(DCCallVM* in_self, DCint mode);
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
105
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
106 DCCallVM_vt vt_arm64 =
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
107 {
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
108 &deinit
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
109 , &reset
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
110 , &mode
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
111 , &a_bool
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
112 , &a_char
466
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 376
diff changeset
113 , &a_short
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
114 , &a_int
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
115 , &a_long
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
116 , &a_i64
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
117 , &a_float
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
118 , &a_double
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
119 , &a_pointer
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 466
diff changeset
120 , NULL /* argAggr */
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
121 , (DCvoidvmfunc*) &call
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
122 , (DCboolvmfunc*) &call
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
123 , (DCcharvmfunc*) &call
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
124 , (DCshortvmfunc*) &call
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
125 , (DCintvmfunc*) &call
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
126 , (DClongvmfunc*) &call
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
127 , (DClonglongvmfunc*) &call
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
128 , (DCfloatvmfunc*) &call
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
129 , (DCdoublevmfunc*) &call
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
130 , (DCpointervmfunc*) &call
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 466
diff changeset
131 , NULL /* callAggr */
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 466
diff changeset
132 , NULL /* beginAggr */
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
133 };
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
134
371
451299d50c1a - windows arm64 support (dyncall, dyncallback, cmake support for armasm64), thanks Bernhard Urban-Forster!
Tassilo Philipp
parents: 366
diff changeset
135 #ifdef DC__OS_Win64
376
041cb6ad4d50 - simplified callvm setup for win/arm64 a bit, no behaviour changes
Tassilo Philipp
parents: 371
diff changeset
136 /* for variadic, everything is pushed like ints as no FP regs are used, so
041cb6ad4d50 - simplified callvm setup for win/arm64 a bit, no behaviour changes
Tassilo Philipp
parents: 371
diff changeset
137 allocate arguments to an imaginary stack, where the first 64 bytes of
371
451299d50c1a - windows arm64 support (dyncall, dyncallback, cmake support for armasm64), thanks Bernhard Urban-Forster!
Tassilo Philipp
parents: 366
diff changeset
138 the stack are loaded into x0-x7, and any remaining arguments on the stack */
451299d50c1a - windows arm64 support (dyncall, dyncallback, cmake support for armasm64), thanks Bernhard Urban-Forster!
Tassilo Philipp
parents: 366
diff changeset
139
376
041cb6ad4d50 - simplified callvm setup for win/arm64 a bit, no behaviour changes
Tassilo Philipp
parents: 371
diff changeset
140 static void var_float (DCCallVM* in_p, DCfloat x) { DClonglong tmp = 0; *(DCfloat*)&tmp = x; a_i64(in_p, tmp); }
041cb6ad4d50 - simplified callvm setup for win/arm64 a bit, no behaviour changes
Tassilo Philipp
parents: 371
diff changeset
141 static void var_double(DCCallVM* in_p, DCdouble x) { a_i64(in_p, *(DClonglong *)&x); }
371
451299d50c1a - windows arm64 support (dyncall, dyncallback, cmake support for armasm64), thanks Bernhard Urban-Forster!
Tassilo Philipp
parents: 366
diff changeset
142
451299d50c1a - windows arm64 support (dyncall, dyncallback, cmake support for armasm64), thanks Bernhard Urban-Forster!
Tassilo Philipp
parents: 366
diff changeset
143 DCCallVM_vt vt_arm64_win_varargs =
451299d50c1a - windows arm64 support (dyncall, dyncallback, cmake support for armasm64), thanks Bernhard Urban-Forster!
Tassilo Philipp
parents: 366
diff changeset
144 {
451299d50c1a - windows arm64 support (dyncall, dyncallback, cmake support for armasm64), thanks Bernhard Urban-Forster!
Tassilo Philipp
parents: 366
diff changeset
145 &deinit
451299d50c1a - windows arm64 support (dyncall, dyncallback, cmake support for armasm64), thanks Bernhard Urban-Forster!
Tassilo Philipp
parents: 366
diff changeset
146 , &reset
451299d50c1a - windows arm64 support (dyncall, dyncallback, cmake support for armasm64), thanks Bernhard Urban-Forster!
Tassilo Philipp
parents: 366
diff changeset
147 , &mode
376
041cb6ad4d50 - simplified callvm setup for win/arm64 a bit, no behaviour changes
Tassilo Philipp
parents: 371
diff changeset
148 , &a_bool
041cb6ad4d50 - simplified callvm setup for win/arm64 a bit, no behaviour changes
Tassilo Philipp
parents: 371
diff changeset
149 , &a_char
041cb6ad4d50 - simplified callvm setup for win/arm64 a bit, no behaviour changes
Tassilo Philipp
parents: 371
diff changeset
150 , &a_short
041cb6ad4d50 - simplified callvm setup for win/arm64 a bit, no behaviour changes
Tassilo Philipp
parents: 371
diff changeset
151 , &a_int
041cb6ad4d50 - simplified callvm setup for win/arm64 a bit, no behaviour changes
Tassilo Philipp
parents: 371
diff changeset
152 , &a_long
371
451299d50c1a - windows arm64 support (dyncall, dyncallback, cmake support for armasm64), thanks Bernhard Urban-Forster!
Tassilo Philipp
parents: 366
diff changeset
153 , &a_i64
451299d50c1a - windows arm64 support (dyncall, dyncallback, cmake support for armasm64), thanks Bernhard Urban-Forster!
Tassilo Philipp
parents: 366
diff changeset
154 , &var_float
451299d50c1a - windows arm64 support (dyncall, dyncallback, cmake support for armasm64), thanks Bernhard Urban-Forster!
Tassilo Philipp
parents: 366
diff changeset
155 , &var_double
376
041cb6ad4d50 - simplified callvm setup for win/arm64 a bit, no behaviour changes
Tassilo Philipp
parents: 371
diff changeset
156 , &a_pointer
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 466
diff changeset
157 , NULL /* argAggr */
371
451299d50c1a - windows arm64 support (dyncall, dyncallback, cmake support for armasm64), thanks Bernhard Urban-Forster!
Tassilo Philipp
parents: 366
diff changeset
158 , (DCvoidvmfunc*) &call
451299d50c1a - windows arm64 support (dyncall, dyncallback, cmake support for armasm64), thanks Bernhard Urban-Forster!
Tassilo Philipp
parents: 366
diff changeset
159 , (DCboolvmfunc*) &call
451299d50c1a - windows arm64 support (dyncall, dyncallback, cmake support for armasm64), thanks Bernhard Urban-Forster!
Tassilo Philipp
parents: 366
diff changeset
160 , (DCcharvmfunc*) &call
451299d50c1a - windows arm64 support (dyncall, dyncallback, cmake support for armasm64), thanks Bernhard Urban-Forster!
Tassilo Philipp
parents: 366
diff changeset
161 , (DCshortvmfunc*) &call
451299d50c1a - windows arm64 support (dyncall, dyncallback, cmake support for armasm64), thanks Bernhard Urban-Forster!
Tassilo Philipp
parents: 366
diff changeset
162 , (DCintvmfunc*) &call
451299d50c1a - windows arm64 support (dyncall, dyncallback, cmake support for armasm64), thanks Bernhard Urban-Forster!
Tassilo Philipp
parents: 366
diff changeset
163 , (DClongvmfunc*) &call
451299d50c1a - windows arm64 support (dyncall, dyncallback, cmake support for armasm64), thanks Bernhard Urban-Forster!
Tassilo Philipp
parents: 366
diff changeset
164 , (DClonglongvmfunc*) &call
451299d50c1a - windows arm64 support (dyncall, dyncallback, cmake support for armasm64), thanks Bernhard Urban-Forster!
Tassilo Philipp
parents: 366
diff changeset
165 , (DCfloatvmfunc*) &call
451299d50c1a - windows arm64 support (dyncall, dyncallback, cmake support for armasm64), thanks Bernhard Urban-Forster!
Tassilo Philipp
parents: 366
diff changeset
166 , (DCdoublevmfunc*) &call
451299d50c1a - windows arm64 support (dyncall, dyncallback, cmake support for armasm64), thanks Bernhard Urban-Forster!
Tassilo Philipp
parents: 366
diff changeset
167 , (DCpointervmfunc*) &call
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 466
diff changeset
168 , NULL /* callAggr */
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 466
diff changeset
169 , NULL /* beginAggr */
371
451299d50c1a - windows arm64 support (dyncall, dyncallback, cmake support for armasm64), thanks Bernhard Urban-Forster!
Tassilo Philipp
parents: 366
diff changeset
170 };
451299d50c1a - windows arm64 support (dyncall, dyncallback, cmake support for armasm64), thanks Bernhard Urban-Forster!
Tassilo Philipp
parents: 366
diff changeset
171 #endif
451299d50c1a - windows arm64 support (dyncall, dyncallback, cmake support for armasm64), thanks Bernhard Urban-Forster!
Tassilo Philipp
parents: 366
diff changeset
172
84
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
173 static void mode(DCCallVM* in_self, DCint mode)
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
174 {
84
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
175 DCCallVM_arm64* self = (DCCallVM_arm64*)in_self;
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
176 DCCallVM_vt* vt;
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
177
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
178 switch(mode) {
371
451299d50c1a - windows arm64 support (dyncall, dyncallback, cmake support for armasm64), thanks Bernhard Urban-Forster!
Tassilo Philipp
parents: 366
diff changeset
179 case DC_CALL_C_ELLIPSIS:
451299d50c1a - windows arm64 support (dyncall, dyncallback, cmake support for armasm64), thanks Bernhard Urban-Forster!
Tassilo Philipp
parents: 366
diff changeset
180 case DC_CALL_C_ELLIPSIS_VARARGS:
451299d50c1a - windows arm64 support (dyncall, dyncallback, cmake support for armasm64), thanks Bernhard Urban-Forster!
Tassilo Philipp
parents: 366
diff changeset
181 #ifdef DC__OS_Win64
451299d50c1a - windows arm64 support (dyncall, dyncallback, cmake support for armasm64), thanks Bernhard Urban-Forster!
Tassilo Philipp
parents: 366
diff changeset
182 vt = &vt_arm64_win_varargs;
451299d50c1a - windows arm64 support (dyncall, dyncallback, cmake support for armasm64), thanks Bernhard Urban-Forster!
Tassilo Philipp
parents: 366
diff changeset
183 break;
451299d50c1a - windows arm64 support (dyncall, dyncallback, cmake support for armasm64), thanks Bernhard Urban-Forster!
Tassilo Philipp
parents: 366
diff changeset
184 #endif /* if not win64, use below */
466
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 376
diff changeset
185 case DC_CALL_C_DEFAULT:
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 376
diff changeset
186 case DC_CALL_C_DEFAULT_THIS:
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 376
diff changeset
187 case DC_CALL_C_ARM64:
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
188 vt = &vt_arm64;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
189 break;
466
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 376
diff changeset
190 default:
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 376
diff changeset
191 self->mInterface.mError = DC_ERROR_UNSUPPORTED_MODE;
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
192 return;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
193 }
84
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
194 dc_callvm_base_init(&self->mInterface, vt);
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
195 }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
196
84
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
197 /* Public API. */
466
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 376
diff changeset
198 DCCallVM* dcNewCallVM(DCsize size)
84
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
199 {
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
200 DCCallVM_arm64* p = (DCCallVM_arm64*)dcAllocMem(sizeof(DCCallVM_arm64)+size);
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
201
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
202 mode((DCCallVM*)p, DC_CALL_C_DEFAULT);
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
203
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
204 dcVecInit(&p->mVecHead, size);
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
205 reset((DCCallVM*)p);
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
206
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
207 return (DCCallVM*)p;
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
208 }
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
209