annotate dyncall/dyncall_callvm_sparc64.c @ 466:ddfb9577a00e

introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed for upcoming aggregate support (until now only x86 platforms allowed for specifically selecting thiscall mode, given the different conventions on the same platform); also added respective DC_SIGCHAR_CC_THISCALL ('*')
author Tassilo Philipp
date Wed, 02 Feb 2022 18:30:44 +0100
parents ad5f9803f52f
children 71c884e610f0
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
178
183594497726 - renamed sparc_v9 -> sparc64 for consistency (with other platforms using 32/64 suffix instead of instrset name)
cslag
parents: 84
diff changeset
5 File: dyncall/dyncall_callvm_sparc64.c
183594497726 - renamed sparc_v9 -> sparc64 for consistency (with other platforms using 32/64 suffix instead of instrset name)
cslag
parents: 84
diff changeset
6 Description: Call VM for sparc64 (v9) ABI.
0
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
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
9 Copyright (c) 2011-2020 Daniel Adler <dadler@uni-goettingen.de>
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
10
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
11 Permission to use, copy, modify, and distribute this software for any
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
12 purpose with or without fee is hereby granted, provided that the above
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
13 copyright notice and this permission notice appear in all copies.
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
14
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
15 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
16 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
17 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
18 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
19 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
20 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
21 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
22
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
178
183594497726 - renamed sparc_v9 -> sparc64 for consistency (with other platforms using 32/64 suffix instead of instrset name)
cslag
parents: 84
diff changeset
27 #include "dyncall_callvm_sparc64.h"
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
28 #include "dyncall_alloc.h"
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
29
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
30
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
31 void dcCall_v9(DCCallVM* vm, DCpointer target);
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
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
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
34 /* Reset argument buffer. */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
35 static void dc_callvm_reset_v9(DCCallVM* in_self)
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_v9* self = (DCCallVM_v9*)in_self;
84
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
38 dcVecResize(&self->mVecHead, 0);
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
39 }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
40
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
41
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
42 /* Destructor. */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
43 static void dc_callvm_free_v9(DCCallVM* in_self)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
44 {
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
45 dcFreeMem(in_self);
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
46 }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
47
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
48 static void dc_callvm_argLongLong_v9(DCCallVM* in_self, DClonglong x)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
49 {
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
50 DCCallVM_v9* self = (DCCallVM_v9*)in_self;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
51 dcVecAppend(&self->mVecHead, &x, sizeof(DClonglong));
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
52 }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
53
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
54 /* all integers are promoted to 64-bit. */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
55 static void dc_callvm_argLong_v9 (DCCallVM* in_self, DClong x) { dc_callvm_argLongLong_v9(in_self, (DClonglong) x ); }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
56 static void dc_callvm_argInt_v9 (DCCallVM* in_self, DCint x) { dc_callvm_argLongLong_v9(in_self, (DClonglong) x ); }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
57 static void dc_callvm_argBool_v9 (DCCallVM* in_self, DCbool x) { dc_callvm_argLongLong_v9(in_self, (DClonglong) x ); }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
58 static void dc_callvm_argChar_v9 (DCCallVM* in_self, DCchar x) { dc_callvm_argLongLong_v9(in_self, (DClonglong) x ); }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
59 static void dc_callvm_argShort_v9 (DCCallVM* in_self, DCshort x) { dc_callvm_argLongLong_v9(in_self, (DClonglong) x ); }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
60 static void dc_callvm_argPointer_v9(DCCallVM* in_self, DCpointer x) { dc_callvm_argLongLong_v9(in_self, (DClonglong) x ); }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
61
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
62 static void dc_callvm_argDouble_v9(DCCallVM* in_self, DCdouble x)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
63 {
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
64 DCCallVM_v9* self = (DCCallVM_v9*)in_self;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
65 dcVecAppend(&self->mVecHead, &x, sizeof(DCdouble));
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
66 }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
67
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
68 static void dc_callvm_argDouble_v9_ellipsis(DCCallVM* in_self, DCdouble x)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
69 {
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
70 union {
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
71 long long l;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
72 double d;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
73 } u;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
74 u.d = x;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
75 dc_callvm_argLongLong_v9(in_self, u.l);
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
76 }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
77
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
78 static void dc_callvm_argFloat_v9_ellipsis(DCCallVM* in_self, DCfloat x)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
79 {
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
80 dc_callvm_argDouble_v9_ellipsis(in_self, (DCdouble) x);
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
81 }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
82
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
83 static void dc_callvm_argFloat_v9(DCCallVM* in_self, DCfloat x)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
84 {
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
85 union {
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
86 double d;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
87 float f[2];
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
88 } u;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
89 u.f[1] = x;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
90 dc_callvm_argDouble_v9(in_self, u.d);
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 static void dc_callvm_mode_v9(DCCallVM* in_self, DCint mode);
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
94
466
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
95 DCCallVM_vt gVT_v9_ellipsis =
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
96 {
466
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
97 &dc_callvm_free_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
98 &dc_callvm_reset_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
99 &dc_callvm_mode_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
100 &dc_callvm_argBool_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
101 &dc_callvm_argChar_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
102 &dc_callvm_argShort_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
103 &dc_callvm_argInt_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
104 &dc_callvm_argLong_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
105 &dc_callvm_argLongLong_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
106 &dc_callvm_argFloat_v9_ellipsis,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
107 &dc_callvm_argDouble_v9_ellipsis,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
108 &dc_callvm_argPointer_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
109 NULL /* argStruct */,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
110 (DCvoidvmfunc*) &dcCall_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
111 (DCboolvmfunc*) &dcCall_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
112 (DCcharvmfunc*) &dcCall_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
113 (DCshortvmfunc*) &dcCall_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
114 (DCintvmfunc*) &dcCall_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
115 (DClongvmfunc*) &dcCall_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
116 (DClonglongvmfunc*) &dcCall_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
117 (DCfloatvmfunc*) &dcCall_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
118 (DCdoublevmfunc*) &dcCall_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
119 (DCpointervmfunc*) &dcCall_v9,
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
120 NULL /* callStruct */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
121 };
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
122
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
123 /* CallVM virtual table. */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
124 DCCallVM_vt gVT_v9 =
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
125 {
466
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
126 &dc_callvm_free_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
127 &dc_callvm_reset_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
128 &dc_callvm_mode_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
129 &dc_callvm_argBool_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
130 &dc_callvm_argChar_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
131 &dc_callvm_argShort_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
132 &dc_callvm_argInt_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
133 &dc_callvm_argLong_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
134 &dc_callvm_argLongLong_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
135 &dc_callvm_argFloat_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
136 &dc_callvm_argDouble_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
137 &dc_callvm_argPointer_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
138 NULL /* argStruct */,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
139 (DCvoidvmfunc*) &dcCall_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
140 (DCboolvmfunc*) &dcCall_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
141 (DCcharvmfunc*) &dcCall_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
142 (DCshortvmfunc*) &dcCall_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
143 (DCintvmfunc*) &dcCall_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
144 (DClongvmfunc*) &dcCall_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
145 (DClonglongvmfunc*) &dcCall_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
146 (DCfloatvmfunc*) &dcCall_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
147 (DCdoublevmfunc*) &dcCall_v9,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
148 (DCpointervmfunc*) &dcCall_v9,
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
149 NULL /* callStruct */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
150 };
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
151
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
152 /* mode: only a single mode available currently. */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
153 static void dc_callvm_mode_v9(DCCallVM* in_self, DCint mode)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
154 {
84
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
155 DCCallVM_v9* self = (DCCallVM_v9*)in_self;
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
156 DCCallVM_vt* vt;
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
157
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
158 switch(mode) {
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
159 case DC_CALL_C_DEFAULT:
466
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
160 case DC_CALL_C_DEFAULT_THIS:
84
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
161 case DC_CALL_C_SPARC64:
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
162 case DC_CALL_C_ELLIPSIS:
84
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
163 vt = &gVT_v9;
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
164 break;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
165 case DC_CALL_C_ELLIPSIS_VARARGS:
84
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
166 vt = &gVT_v9_ellipsis;
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
167 break;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
168 default:
466
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
169 self->mInterface.mError = DC_ERROR_UNSUPPORTED_MODE;
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
170 return;
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
171 }
84
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
172 dc_callvm_base_init(&self->mInterface, vt);
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
173 }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
174
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
175 /* Public API. */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
176 DCCallVM* dcNewCallVM(DCsize size)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
177 {
84
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
178 DCCallVM_v9* p = (DCCallVM_v9*)dcAllocMem(sizeof(DCCallVM_v9)+size);
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
179
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
180 dc_callvm_mode_v9((DCCallVM*)p, DC_CALL_C_DEFAULT);
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
181
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
182 dcVecInit(&p->mVecHead,size);
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
183 dc_callvm_reset_v9(&p->mInterface);
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
184
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
185 return (DCCallVM*)p;
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
186 }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
187