annotate dyncall/dyncall_callvm_sparc.c @ 533:71c884e610f0

- integration of patches from Raphael Luba, Thekla, Inc.: * integration of aggregate-by-value (struct, union) support patch for x64 (win and sysv) * windows/x64 asm additions to specify how stack unwinds (help for debuggers, exception handling, etc.) * see Changelog for details - new calling convention modes for thiscalls (platform agnostic, was specific before) * new signature character for platform agnostic thiscalls ('*' / DC_SIGCHAR_CC_THISCALL) - dcCallF(), dcVCallF(), dcArgF() and dcVArgF(): * added support for aggregates-by-value (wasn't part of patch) * change that those functions don't implicitly call dcReset() anymore, which was unflexible (breaking change) - added macros to feature test implementation for aggregate-by-value and syscall support - changed libdyncall_s.lib and libdyncallback_s.lib order in callback test makefiles, as some toolchains are picky about order - doc: * man page updates to describe aggregate interface * manual overview changes to highlight platforms with aggregate-by-value support - test/plain: replaced tests w/ old/stale sctruct interface with new aggregate one
author Tassilo Philipp
date Thu, 21 Apr 2022 13:35:47 +0200
parents ddfb9577a00e
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_sparc.c
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
6 Description: Call VM for sparc processor architecture.
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
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
27 #include "dyncall_callvm_sparc.h"
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
28 #include "dyncall_utils.h"
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
29 #include "dyncall_alloc.h"
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
30 #define DEFAULT_STACK_ALIGN 16
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
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 void dcCall_sparc(DCpointer target, DCsize size, DCpointer data);
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
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
35
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
36 /* Destructor. */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
37 static void dc_callvm_free_sparc(DCCallVM* in_self)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
38 {
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
39 dcFreeMem(in_self);
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 /* Reset argument buffer. */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
43 static void dc_callvm_reset_sparc(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 DCCallVM_sparc* self = (DCCallVM_sparc*)in_self;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
46 dcVecReset(&self->mVecHead);
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 /* Load integer 32-bit. */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
50 static void dc_callvm_argInt_sparc(DCCallVM* in_self, DCint x)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
51 {
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
52 DCCallVM_sparc* self = (DCCallVM_sparc*)in_self;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
53 dcVecAppend(&self->mVecHead, &x, sizeof(DCint));
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
54 }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
55
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
56 /* we propagate Bool,Char,Short to Int. */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
57
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
58 static void dc_callvm_argBool_sparc(DCCallVM* in_self, DCbool x) { dc_callvm_argInt_sparc(in_self, (DCint)x); }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
59 static void dc_callvm_argChar_sparc(DCCallVM* in_self, DCchar x) { dc_callvm_argInt_sparc(in_self, (DCint)x); }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
60 static void dc_callvm_argShort_sparc(DCCallVM* in_self, DCshort x) { dc_callvm_argInt_sparc(in_self, (DCint)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 /* handle others Pointer, Long, LongLong, Float and Double as-is. */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
63
466
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
64 static void dc_callvm_argPointer_sparc(DCCallVM* in_self, DCpointer x)
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
65 {
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
66 DCCallVM_sparc* self = (DCCallVM_sparc*)in_self;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
67 dcVecAppend(&self->mVecHead, &x, sizeof(DCpointer));
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
68 }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
69
466
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
70 static void dc_callvm_argLong_sparc(DCCallVM* in_self, DClong x)
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
71 {
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
72 DCCallVM_sparc* self = (DCCallVM_sparc*)in_self;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
73 dcVecAppend(&self->mVecHead, &x, sizeof(DClong));
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
74 }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
75 static void dc_callvm_argLongLong_sparc(DCCallVM* in_self, DClonglong x)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
76 {
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
77 DCCallVM_sparc* self = (DCCallVM_sparc*)in_self;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
78 dcVecAppend(&self->mVecHead, &x, sizeof(DClonglong));
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
79 }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
80 static void dc_callvm_argFloat_sparc(DCCallVM* in_self, DCfloat 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 DCCallVM_sparc* self = (DCCallVM_sparc*)in_self;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
83 dcVecAppend(&self->mVecHead, &x, sizeof(DCfloat));
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
84 }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
85 static void dc_callvm_argDouble_sparc(DCCallVM* in_self, DCdouble x)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
86 {
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
87 DCCallVM_sparc* self = (DCCallVM_sparc*)in_self;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
88 dcVecAppend(&self->mVecHead, &x, sizeof(DCdouble));
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
89 }
466
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
90
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
91 /* we call directly with 'RTYPE dcCall(DCCallVM* in_self, DCpointer target)' */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
92 #if 0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
93 /* call: delegate to default call kernel */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
94 static void dc_callvm_call_sparc(DCCallVM* in_self, DCpointer target)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
95 {
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
96 DCCallVM_sparc* self = (DCCallVM_sparc*)in_self;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
97 dcCall_sparc(target, dcVecSize(&self->mVecHead), dcVecData(&self->mVecHead));
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
98 }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
99 #endif
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
100
84
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
101 static void dc_callvm_mode_sparc(DCCallVM* in_self, DCint mode);
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
102
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
103 /* CallVM virtual table. */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
104 DCCallVM_vt gVT_sparc =
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
105 {
466
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
106 &dc_callvm_free_sparc,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
107 &dc_callvm_reset_sparc,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
108 &dc_callvm_mode_sparc,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
109 &dc_callvm_argBool_sparc,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
110 &dc_callvm_argChar_sparc,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
111 &dc_callvm_argShort_sparc,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
112 &dc_callvm_argInt_sparc,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
113 &dc_callvm_argLong_sparc,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
114 &dc_callvm_argLongLong_sparc,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
115 &dc_callvm_argFloat_sparc,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
116 &dc_callvm_argDouble_sparc,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
117 &dc_callvm_argPointer_sparc,
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 466
diff changeset
118 NULL /* argAggr */,
466
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
119 (DCvoidvmfunc*) &dcCall_sparc,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
120 (DCboolvmfunc*) &dcCall_sparc,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
121 (DCcharvmfunc*) &dcCall_sparc,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
122 (DCshortvmfunc*) &dcCall_sparc,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
123 (DCintvmfunc*) &dcCall_sparc,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
124 (DClongvmfunc*) &dcCall_sparc,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
125 (DClonglongvmfunc*) &dcCall_sparc,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
126 (DCfloatvmfunc*) &dcCall_sparc,
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
127 (DCdoublevmfunc*) &dcCall_sparc,
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
128 (DCpointervmfunc*) &dcCall_sparc,
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 466
diff changeset
129 NULL /* callAggr */,
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 466
diff changeset
130 NULL /* beginAggr */
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
131 };
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
132
84
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
133 /* mode: only a single mode available currently. */
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
134 static void dc_callvm_mode_sparc(DCCallVM* in_self, DCint mode)
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
135 {
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
136 DCCallVM_sparc* self = (DCCallVM_sparc*)in_self;
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
137 DCCallVM_vt* vt;
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
138
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
139 switch(mode) {
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
140 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
141 case DC_CALL_C_DEFAULT_THIS:
84
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
142 case DC_CALL_C_SPARC32:
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
143 case DC_CALL_C_ELLIPSIS:
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
144 case DC_CALL_C_ELLIPSIS_VARARGS:
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
145 vt = &gVT_sparc;
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
146 break;
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
147 default:
466
ddfb9577a00e introduced platform-native thiscall mode (DC_CALL_C_DEFAULT_THIS), as needed
Tassilo Philipp
parents: 366
diff changeset
148 self->mInterface.mError = DC_ERROR_UNSUPPORTED_MODE;
84
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
149 return;
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
150 }
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
151 dc_callvm_base_init(&self->mInterface, vt);
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
152 }
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
153
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
154 /* Public API. */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
155 DCCallVM* dcNewCallVM(DCsize size)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
156 {
163
ddcf2e49654c - tiny compatibility fix with < c99 compilers
cslag
parents: 84
diff changeset
157 DCCallVM_sparc* p;
ddcf2e49654c - tiny compatibility fix with < c99 compilers
cslag
parents: 84
diff changeset
158
84
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
159 /* the six output registers %o0-%o5 are always loaded, thus we need to ensure the argument buffer has space for at least 24 bytes. */
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
160 size = DC_MAX(size, sizeof(void*)*(6+1));
163
ddcf2e49654c - tiny compatibility fix with < c99 compilers
cslag
parents: 84
diff changeset
161 p = (DCCallVM_sparc*)dcAllocMem(sizeof(DCCallVM_sparc)+size);
84
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
162
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
163 dc_callvm_mode_sparc((DCCallVM*)p, DC_CALL_C_DEFAULT);
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
164
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
165 dcVecInit(&p->mVecHead, size);
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
166
67961454902b - bigger cleanup in callvm code
cslag
parents: 0
diff changeset
167 return (DCCallVM*)p;
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
168 }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
169