Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 355 lines (245 sloc) 8.734 kb
c64e58f pmc docs update 3
Michael Scott authored
1 /*
e69d2a4 Andy Lester Made pcc_params be static. Removed unused arg from build_func. Headerizi...
petdance authored
2 Copyright (C) 2001-2010, Parrot Foundation.
c64e58f pmc docs update 3
Michael Scott authored
3
4 =head1 NAME
5
f474cd7 Bernhard Schmalhofer [perl #38235] Rename (dyn)?classes to (dyn)?pmc
bschmalhofer authored
6 src/pmc/nci.pmc - Native Call Interface
c64e58f pmc docs update 3
Michael Scott authored
7
8 =head1 DESCRIPTION
9
10 The vtable functions for the native C call functions.
11
12 =head2 Methods
13
14 =over 4
15
16 =cut
17
18 */
2a2c19b Added in code to properly do native calls to library routines loaded via
Dan Sugalski authored
19
6bdd5f9 Andy Lester headerizer now runs on PMC files
petdance authored
20 /* HEADERIZER HFILE: none */
21 /* HEADERIZER BEGIN: static */
e69d2a4 Andy Lester Made pcc_params be static. Removed unused arg from build_func. Headerizi...
petdance authored
22 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
23
1e5a8ee Peter Lobsinger eliminate use of libffi-specific nci.pmc
plobsing authored
24 PARROT_IGNORABLE_RESULT
25 static nci_thunk_t /*@alt void@*/
26 build_func(PARROT_INTERP,
a90f6d7 Peter Lobsinger switch ffi nci.pmc over to standard signature parser
plobsing authored
27 ARGMOD(Parrot_NCI_attributes *nci))
f631eb3 Peter Lobsinger remove private2 (raw) flag from nci-ffi.pmc
plobsing authored
28 __attribute__nonnull__(1)
29 __attribute__nonnull__(2)
a90f6d7 Peter Lobsinger switch ffi nci.pmc over to standard signature parser
plobsing authored
30 FUNC_MODIFIES(*nci);
31
1e5a8ee Peter Lobsinger eliminate use of libffi-specific nci.pmc
plobsing authored
32 #define ASSERT_ARGS_build_func __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
f631eb3 Peter Lobsinger remove private2 (raw) flag from nci-ffi.pmc
plobsing authored
33 PARROT_ASSERT_ARG(interp) \
a90f6d7 Peter Lobsinger switch ffi nci.pmc over to standard signature parser
plobsing authored
34 , PARROT_ASSERT_ARG(nci))
e69d2a4 Andy Lester Made pcc_params be static. Removed unused arg from build_func. Headerizi...
petdance authored
35 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
6bdd5f9 Andy Lester headerizer now runs on PMC files
petdance authored
36 /* HEADERIZER END: static */
37
75d67e7 Peter Lobsinger avoid rebuilding the pcc cif every call
plobsing authored
38 /*
39
1e5a8ee Peter Lobsinger eliminate use of libffi-specific nci.pmc
plobsing authored
40 =item C<static nci_thunk_t build_func(PARROT_INTERP, Parrot_NCI_attributes
41 *nci)>
75d67e7 Peter Lobsinger avoid rebuilding the pcc cif every call
plobsing authored
42
1e5a8ee Peter Lobsinger eliminate use of libffi-specific nci.pmc
plobsing authored
43 Actually build the NCI thunk.
75d67e7 Peter Lobsinger avoid rebuilding the pcc cif every call
plobsing authored
44
45 =cut
46
47 */
48
1e5a8ee Peter Lobsinger eliminate use of libffi-specific nci.pmc
plobsing authored
49 PARROT_IGNORABLE_RESULT
50 static nci_thunk_t
51 build_func(PARROT_INTERP, ARGMOD(Parrot_NCI_attributes *nci))
f631eb3 Peter Lobsinger remove private2 (raw) flag from nci-ffi.pmc
plobsing authored
52 {
1e5a8ee Peter Lobsinger eliminate use of libffi-specific nci.pmc
plobsing authored
53 ASSERT_ARGS(build_func)
f631eb3 Peter Lobsinger remove private2 (raw) flag from nci-ffi.pmc
plobsing authored
54
a90f6d7 Peter Lobsinger switch ffi nci.pmc over to standard signature parser
plobsing authored
55 nci->signature = Parrot_nci_parse_signature(interp, nci->sig_str);
56
57 Parrot_nci_sig_to_pcc(interp, nci->signature,
58 &nci->pcc_params_signature,
59 &nci->pcc_return_signature);
f631eb3 Peter Lobsinger remove private2 (raw) flag from nci-ffi.pmc
plobsing authored
60
a90f6d7 Peter Lobsinger switch ffi nci.pmc over to standard signature parser
plobsing authored
61 /* Arity is length of the signature minus one (the return type). */
62 nci->arity = VTABLE_elements(interp, nci->signature) - 1;
f631eb3 Peter Lobsinger remove private2 (raw) flag from nci-ffi.pmc
plobsing authored
63
1e5a8ee Peter Lobsinger eliminate use of libffi-specific nci.pmc
plobsing authored
64 /* Build call function. */
65 nci->fb_info = build_call_func(interp, nci->sig_str);
66 nci->func = F2DPTR(VTABLE_get_pointer(interp, nci->fb_info));
67
68 return (nci_thunk_t)nci->func;
f631eb3 Peter Lobsinger remove private2 (raw) flag from nci-ffi.pmc
plobsing authored
69 }
70
1e5a8ee Peter Lobsinger eliminate use of libffi-specific nci.pmc
plobsing authored
71
336b07c Vasily Chekalkin Add 'does invokable' to all PMCs with VTABLE_invoke (except Object). Par...
bacek authored
72 pmclass NCI auto_attrs provides invokable {
9d723e0 Peter Lobsinger update NCI signature parsing to emit new (half year old) PCC param and r...
plobsing authored
73 /* NCI thunk handling attributes */
1e5a8ee Peter Lobsinger eliminate use of libffi-specific nci.pmc
plobsing authored
74 ATTR PMC *signature; /* parsed signature */
75 ATTR STRING *sig_str; /* signature string */
76 ATTR void *func; /* function pointer to call */
77 ATTR PMC *fb_info; /* frame-builder info */
78 ATTR void *orig_func; /* pointer to wrapped function */
0c5f9c3 GSoC: The majority of my NCI changes in 1 commit.
John Harrison authored
79
9d723e0 Peter Lobsinger update NCI signature parsing to emit new (half year old) PCC param and r...
plobsing authored
80 /* Parrot Sub-ish attributes */
81 ATTR STRING *pcc_params_signature;
82 ATTR STRING *pcc_return_signature;
2d5eeb8 Peter Lobsinger eliminate some unnecessary attributes
plobsing authored
83 ATTR INTVAL arity;
9d723e0 Peter Lobsinger update NCI signature parsing to emit new (half year old) PCC param and r...
plobsing authored
84
85 /* MMD fields */
1e5a8ee Peter Lobsinger eliminate use of libffi-specific nci.pmc
plobsing authored
86 ATTR STRING *long_signature;
87 ATTR PMC *multi_sig;
2a2c19b Added in code to properly do native calls to library routines loaded via
Dan Sugalski authored
88
c64e58f pmc docs update 3
Michael Scott authored
89 /*
90
59661f1 allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
91 =item C<METHOD get_multisig()>
1415cda add introspection method get_multisig
Leopold Toetsch authored
92
1e5a8ee Peter Lobsinger eliminate use of libffi-specific nci.pmc
plobsing authored
93 Return the MMD signature PMC, if any or C<PMCNULL>.
1415cda add introspection method get_multisig
Leopold Toetsch authored
94
95 =cut
96
97 */
98
59661f1 allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
99 METHOD get_multisig() {
26f7d7b cotto [PMC] replace PMC_pmc_val with an ATTR in the NCI PMC
cotto authored
100 PMC *sig;
101 GET_ATTR_multi_sig(INTERP, SELF, sig);
83dd9f2 NotFound [core] partial fix for TT #667, examples/namespace/namespace_dump.pir d...
NotFound authored
102 if (PMC_IS_NULL(sig))
26f7d7b cotto [PMC] replace PMC_pmc_val with an ATTR in the NCI PMC
cotto authored
103 sig = PMCNULL;
59661f1 allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
104 RETURN(PMC *sig);
1415cda add introspection method get_multisig
Leopold Toetsch authored
105 }
106
107 /*
108
c64e58f pmc docs update 3
Michael Scott authored
109 =item C<void init()>
110
111 Initializes the NCI with a C<NULL> function pointer.
112
113 =cut
114
115 */
116
59661f1 allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
117 VTABLE void init() {
2646951 tewk [gsoc_nci] gsoc_nci_001 merge
tewk authored
118 PObj_custom_mark_SET(SELF);
f7fc86b nci
Leopold Toetsch authored
119 }
120
1e5a8ee Peter Lobsinger eliminate use of libffi-specific nci.pmc
plobsing authored
121 VTABLE void *get_pointer() {
122 return PARROT_NCI(SELF)->orig_func;
123 }
124
c64e58f pmc docs update 3
Michael Scott authored
125 /*
126
380c0ba fix NCI related DOD problem
Leopold Toetsch authored
127 =item C<void set_pointer_keyed_str(STRING *key, void *func)>
c64e58f pmc docs update 3
Michael Scott authored
128
380c0ba fix NCI related DOD problem
Leopold Toetsch authored
129 Sets the specified function pointer and signature (C<*key>).
c64e58f pmc docs update 3
Michael Scott authored
130
131 =cut
132
133 */
134
59661f1 allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
135 VTABLE void set_pointer_keyed_str(STRING *key, void *func) {
1764f4c chromatic [PMC] Optimized NCI registration signature handling slightly by avoiding
chromatic authored
136 Parrot_NCI_attributes * const nci_info = PARROT_NCI(SELF);
637246f Jonathan Worthington Refactor the NCI PMC to have an underlying structure, in preparation for...
jnthn authored
137
62e3049 Andy Lester consting, and fixed embedded tabs
petdance authored
138 /* Store the original function and signature. */
1e5a8ee Peter Lobsinger eliminate use of libffi-specific nci.pmc
plobsing authored
139 SET_ATTR_orig_func(INTERP, SELF, func);
c4cd281 chromatic [PMC] Avoided an unnecessary STRING copying and creation in NCI's
chromatic authored
140
141 /* ensure that the STRING signature is constant */
142 if (!PObj_constant_TEST(key)) {
e9680f1 Nick Wellnhofer Fix usage of Parrot_str_to_cstring
nwellnhof authored
143 key = Parrot_str_new_init(interp, key->strstart, key->bufused,
144 key->encoding, PObj_constant_FLAG);
c4cd281 chromatic [PMC] Avoided an unnecessary STRING copying and creation in NCI's
chromatic authored
145 }
146
a90f6d7 Peter Lobsinger switch ffi nci.pmc over to standard signature parser
plobsing authored
147 nci_info->sig_str = key;
2646951 tewk [gsoc_nci] gsoc_nci_001 merge
tewk authored
148 }
03918bc chromatic [PMC] Fixed a read of unitialized memory in NCI PMC reported by Valgrind...
chromatic authored
149
2646951 tewk [gsoc_nci] gsoc_nci_001 merge
tewk authored
150 /*
151
152 =item C<void mark()>
153
154 Mark any referenced strings and PMCs.
155
156 =cut
157
158 */
159 VTABLE void mark() {
1e5a8ee Peter Lobsinger eliminate use of libffi-specific nci.pmc
plobsing authored
160 if (PARROT_NCI(SELF)) {
161 Parrot_NCI_attributes * const nci_info = PARROT_NCI(SELF);
f631eb3 Peter Lobsinger remove private2 (raw) flag from nci-ffi.pmc
plobsing authored
162
1e5a8ee Peter Lobsinger eliminate use of libffi-specific nci.pmc
plobsing authored
163 Parrot_gc_mark_PMC_alive(interp, nci_info->signature);
164 Parrot_gc_mark_PMC_alive(interp, nci_info->fb_info);
165 Parrot_gc_mark_PMC_alive(interp, nci_info->multi_sig);
f631eb3 Peter Lobsinger remove private2 (raw) flag from nci-ffi.pmc
plobsing authored
166
1e5a8ee Peter Lobsinger eliminate use of libffi-specific nci.pmc
plobsing authored
167 Parrot_gc_mark_STRING_alive(interp, nci_info->sig_str);
168 Parrot_gc_mark_STRING_alive(interp, nci_info->long_signature);
169 Parrot_gc_mark_STRING_alive(interp, nci_info->pcc_params_signature);
170 Parrot_gc_mark_STRING_alive(interp, nci_info->pcc_return_signature);
f631eb3 Peter Lobsinger remove private2 (raw) flag from nci-ffi.pmc
plobsing authored
171 }
172 }
173
174 /*
175
c64e58f pmc docs update 3
Michael Scott authored
176 =item C<PMC *clone()>
177
178 Creates and returns a clone of the NCI.
179
180 =cut
181
182 */
183
59661f1 allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
184 VTABLE PMC *clone() {
971e997 NotFound rename pmc attributes struct from Parrot_<type> to Parrot_<type>_attribu...
NotFound authored
185 Parrot_NCI_attributes * const nci_info_self = PARROT_NCI(SELF);
186 Parrot_NCI_attributes *nci_info_ret;
1e5a8ee Peter Lobsinger eliminate use of libffi-specific nci.pmc
plobsing authored
187 void *orig_func;
62e3049 Andy Lester consting, and fixed embedded tabs
petdance authored
188
083213a Andrew Whitworth start rename of pmc_new to Parrot_pmc_new
Whiteknight authored
189 PMC * const ret = Parrot_pmc_new(INTERP, SELF->vtable->base_type);
59661f1 allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
190 nci_info_ret = PARROT_NCI(ret);
82c7cf6 chromatic [PMC] Minor cleanups and tidyings.
chromatic authored
191
c64e58f pmc docs update 3
Michael Scott authored
192 /* FIXME if data is malloced (JIT/i386!) then we need
193 * the length of data here, to memcpy it
194 * ManagedStruct or Buffer?
195 */
2646951 tewk [gsoc_nci] gsoc_nci_001 merge
tewk authored
196 nci_info_ret->func = nci_info_self->func;
3b094c7 Peter Lobsinger add NCI.fb_info for frame buffer info
plobsing authored
197 nci_info_ret->fb_info = nci_info_self->fb_info;
811a7df cotto [PMC] make NCI PMCs use ATTRs, with one temporary workaround for i386 ji...
cotto authored
198 nci_info_ret->orig_func = nci_info_self->orig_func;
1e5a8ee Peter Lobsinger eliminate use of libffi-specific nci.pmc
plobsing authored
199 nci_info_ret->signature = nci_info_self->signature;
a90f6d7 Peter Lobsinger switch ffi nci.pmc over to standard signature parser
plobsing authored
200 nci_info_ret->sig_str = nci_info_self->sig_str;
2646951 tewk [gsoc_nci] gsoc_nci_001 merge
tewk authored
201 nci_info_ret->pcc_params_signature = nci_info_self->pcc_params_signature;
9d723e0 Peter Lobsinger update NCI signature parsing to emit new (half year old) PCC param and r...
plobsing authored
202 nci_info_ret->pcc_return_signature = nci_info_self->pcc_params_signature;
2646951 tewk [gsoc_nci] gsoc_nci_001 merge
tewk authored
203 nci_info_ret->arity = nci_info_self->arity;
1e5a8ee Peter Lobsinger eliminate use of libffi-specific nci.pmc
plobsing authored
204 PObj_get_FLAGS(ret) = PObj_get_FLAGS(SELF);
82c7cf6 chromatic [PMC] Minor cleanups and tidyings.
chromatic authored
205
c64e58f pmc docs update 3
Michael Scott authored
206 return ret;
2a2c19b Added in code to properly do native calls to library routines loaded via
Dan Sugalski authored
207 }
208
c64e58f pmc docs update 3
Michael Scott authored
209 /*
210
211 =item C<INTVAL defined()>
212
213 Returns whether the NCI is defined.
214
215 =cut
216
217 */
218
59661f1 allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
219 VTABLE INTVAL defined() {
971e997 NotFound rename pmc attributes struct from Parrot_<type> to Parrot_<type>_attribu...
NotFound authored
220 Parrot_NCI_attributes * const nci_info = PARROT_NCI(SELF);
8832378 chromatic [PMC] Delayed NCI thunk initialization until absolutely necessary. This
chromatic authored
221 return nci_info->orig_func != NULL;
2a2c19b Added in code to properly do native calls to library routines loaded via
Dan Sugalski authored
222 }
223
c64e58f pmc docs update 3
Michael Scott authored
224 /*
225
0ae5d55 Paul Cochrane Patch courtesy of Steve Peters <steve at fisharerojo dot org>, his comme...
paultcochrane authored
226 =item C<opcode_t *invoke(void *next)>
c64e58f pmc docs update 3
Michael Scott authored
227
8832378 chromatic [PMC] Delayed NCI thunk initialization until absolutely necessary. This
chromatic authored
228 Calls the associated C function, returning C<*next>. If the invocant is a
229 class, the PMC arguments are shifted down.
c64e58f pmc docs update 3
Michael Scott authored
230
231 =cut
232
233 */
234
59661f1 allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
235 VTABLE opcode_t *invoke(void *next) {
1e5a8ee Peter Lobsinger eliminate use of libffi-specific nci.pmc
plobsing authored
236 Parrot_NCI_attributes * const nci_info = PARROT_NCI(SELF);
237 nci_thunk_t func;
238 PMC *fb_info;
bbd8ef4 cotto [strings] first of many patches from darbelo++ getting rid of ->strstart...
cotto authored
239 char *sig_str;
1e5a8ee Peter Lobsinger eliminate use of libffi-specific nci.pmc
plobsing authored
240 void *orig_func;
811a7df cotto [PMC] make NCI PMCs use ATTRs, with one temporary workaround for i386 ji...
cotto authored
241 PMC *cont;
1e5a8ee Peter Lobsinger eliminate use of libffi-specific nci.pmc
plobsing authored
242
243 GET_ATTR_orig_func(INTERP, SELF, orig_func);
244 func = (nci_thunk_t)D2FPTR(nci_info->func);
245
246 if (!func) {
c64fa8d Peter Lobsinger split NCI signature parser out from nci.pmc
plobsing authored
247 /* build the thunk only when necessary */
1e5a8ee Peter Lobsinger eliminate use of libffi-specific nci.pmc
plobsing authored
248 func = build_func(interp, nci_info);
82c7cf6 chromatic [PMC] Minor cleanups and tidyings.
chromatic authored
249
1e5a8ee Peter Lobsinger eliminate use of libffi-specific nci.pmc
plobsing authored
250 if (!func)
c64fa8d Peter Lobsinger split NCI signature parser out from nci.pmc
plobsing authored
251 Parrot_ex_throw_from_c_args(INTERP, NULL,
252 EXCEPTION_INVALID_OPERATION,
253 "attempt to call NULL function");
8832378 chromatic [PMC] Delayed NCI thunk initialization until absolutely necessary. This
chromatic authored
254 }
2646951 tewk [gsoc_nci] gsoc_nci_001 merge
tewk authored
255
1e5a8ee Peter Lobsinger eliminate use of libffi-specific nci.pmc
plobsing authored
256 GET_ATTR_fb_info(INTERP, SELF, fb_info);
f631eb3 Peter Lobsinger remove private2 (raw) flag from nci-ffi.pmc
plobsing authored
257
92c390d Fix tailcalls to NCI, #38724
Leopold Toetsch authored
258 cont = INTERP->current_cont;
8b188db Andrew Whitworth Fix for TT #1029. The return continuation was being mangled in the PIR c...
Whiteknight authored
259 func(INTERP, SELF, fb_info);
260
8838c7f builtins 1 - first shot
Leopold Toetsch authored
261 /*
92c390d Fix tailcalls to NCI, #38724
Leopold Toetsch authored
262 * If the NCI function was tailcalled, the return result
263 * is already passed back to the caller of this frame
264 * - see Parrot_init_ret_nci(). We therefore invoke the
265 * return continuation here, which gets rid of this frame
266 * and returns the real return address
8838c7f builtins 1 - first shot
Leopold Toetsch authored
267 */
8832378 chromatic [PMC] Delayed NCI thunk initialization until absolutely necessary. This
chromatic authored
268 if (cont && cont != NEED_CONTINUATION
269 && (PObj_get_FLAGS(cont) & SUB_FLAG_TAILCALL)) {
540d4c3 Vasily Chekalkin Merge context_pmc3 branch into trunk.
bacek authored
270 cont = Parrot_pcc_get_continuation(interp, CURRENT_CONTEXT(interp));
92c390d Fix tailcalls to NCI, #38724
Leopold Toetsch authored
271 next = VTABLE_invoke(INTERP, cont, next);
272 }
82c7cf6 chromatic [PMC] Minor cleanups and tidyings.
chromatic authored
273
e063e49 chromatic Continuing Parrot/C++ cleanups (Steve Peters, RT #42746).
chromatic authored
274 return (opcode_t *)next;
2a2c19b Added in code to properly do native calls to library routines loaded via
Dan Sugalski authored
275 }
380c0ba fix NCI related DOD problem
Leopold Toetsch authored
276
c64e58f pmc docs update 3
Michael Scott authored
277 /*
278
279 =item C<INTVAL get_integer()>
280
281 Returns the function pointer as an integer.
282
283 =cut
284
285 */
286
59661f1 allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
287 VTABLE INTVAL get_integer() {
1e5a8ee Peter Lobsinger eliminate use of libffi-specific nci.pmc
plobsing authored
288 Parrot_NCI_attributes * const nci_info = PARROT_NCI(SELF);
289 if (!nci_info->func)
290 build_func(INTERP, nci_info);
291 return (INTVAL)nci_info->func;
3168931 Forth can now generate code for words on the fly and execute them.
Dan Sugalski authored
292 }
293
f35b03c Sam Ruby Initial support for sort
rubys authored
294 /*
295
296 =item C<INTVAL get_bool()>
297
298 Returns the boolean value of the pointer.
299
300 =cut
301
302 */
303
59661f1 allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
304 VTABLE INTVAL get_bool() {
971e997 NotFound rename pmc attributes struct from Parrot_<type> to Parrot_<type>_attribu...
NotFound authored
305 Parrot_NCI_attributes * const nci_info = PARROT_NCI(SELF);
1e5a8ee Peter Lobsinger eliminate use of libffi-specific nci.pmc
plobsing authored
306 return (0 != (INTVAL)nci_info->orig_func);
f35b03c Sam Ruby Initial support for sort
rubys authored
307 }
308
6586a2c Jonathan Worthington Implement arity method on NCI PMCs, plus a test for it.
jnthn authored
309 /*
310
59661f1 allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
311 =item C<METHOD arity()>
6586a2c Jonathan Worthington Implement arity method on NCI PMCs, plus a test for it.
jnthn authored
312
01e804c Bruce Gray [pmc] Typo corrections
Util authored
313 Return the arity of the NCI (the number of arguments).
6586a2c Jonathan Worthington Implement arity method on NCI PMCs, plus a test for it.
jnthn authored
314
315 =cut
316
317 */
59661f1 allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
318 METHOD arity() {
971e997 NotFound rename pmc attributes struct from Parrot_<type> to Parrot_<type>_attribu...
NotFound authored
319 Parrot_NCI_attributes * const nci_info = PARROT_NCI(SELF);
48d2796 NotFound Another unreachable warning, codingstd in jit_emit ppc
NotFound authored
320 INTVAL arity = 0;
59661f1 allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
321
8832378 chromatic [PMC] Delayed NCI thunk initialization until absolutely necessary. This
chromatic authored
322 if (nci_info) {
1e5a8ee Peter Lobsinger eliminate use of libffi-specific nci.pmc
plobsing authored
323 if (!nci_info->func)
324 build_func(INTERP, nci_info);
325 if (nci_info->func) {
c64fa8d Peter Lobsinger split NCI signature parser out from nci.pmc
plobsing authored
326 arity = nci_info->arity;
327 RETURN(INTVAL arity);
8832378 chromatic [PMC] Delayed NCI thunk initialization until absolutely necessary. This
chromatic authored
328 }
329 }
6586a2c Jonathan Worthington Implement arity method on NCI PMCs, plus a test for it.
jnthn authored
330
8832378 chromatic [PMC] Delayed NCI thunk initialization until absolutely necessary. This
chromatic authored
331 Parrot_ex_throw_from_c_args(INTERP, NULL,
332 EXCEPTION_INVALID_OPERATION,
333 "You cannot get the arity of an undefined NCI.");
59661f1 allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
334 }
2a2c19b Added in code to properly do native calls to library routines loaded via
Dan Sugalski authored
335 }
c64e58f pmc docs update 3
Michael Scott authored
336
337 /*
338
339 =back
340
341 =head1 SEE ALSO
342
1e5a8ee Peter Lobsinger eliminate use of libffi-specific nci.pmc
plobsing authored
343 F<docs/pdds/pdd03_calling_conventions.pod>.
f631eb3 Peter Lobsinger remove private2 (raw) flag from nci-ffi.pmc
plobsing authored
344
c64e58f pmc docs update 3
Michael Scott authored
345 =cut
346
347 */
348
0eb3eb3 added formatting footer and detabbed
Michael Scott authored
349 /*
350 * Local variables:
72575ae Bernhard Schmalhofer #40481: [PATCH] C-code coda in pmc files
bschmalhofer authored
351 * c-file-style: "parrot"
0eb3eb3 added formatting footer and detabbed
Michael Scott authored
352 * End:
1d7dded Peter Lobsinger update C file vim modelines
plobsing authored
353 * vim: expandtab shiftwidth=4 cinoptions='\:2=2' :
72575ae Bernhard Schmalhofer #40481: [PATCH] C-code coda in pmc files
bschmalhofer authored
354 */
Something went wrong with that request. Please try again.