Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 358 lines (248 sloc) 8.953 kb
c64e58f pmc docs update 3
Michael Scott authored
1 /*
e69d2a4 @petdance 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 @bschmalhofer [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 @petdance headerizer now runs on PMC files
petdance authored
20 /* HEADERIZER HFILE: none */
21 /* HEADERIZER BEGIN: static */
e69d2a4 @petdance 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 @plobsing 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 @plobsing switch ffi nci.pmc over to standard signature parser
plobsing authored
27 ARGMOD(Parrot_NCI_attributes *nci))
f631eb3 @plobsing remove private2 (raw) flag from nci-ffi.pmc
plobsing authored
28 __attribute__nonnull__(1)
29 __attribute__nonnull__(2)
a90f6d7 @plobsing switch ffi nci.pmc over to standard signature parser
plobsing authored
30 FUNC_MODIFIES(*nci);
31
1e5a8ee @plobsing eliminate use of libffi-specific nci.pmc
plobsing authored
32 #define ASSERT_ARGS_build_func __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
f631eb3 @plobsing remove private2 (raw) flag from nci-ffi.pmc
plobsing authored
33 PARROT_ASSERT_ARG(interp) \
a90f6d7 @plobsing switch ffi nci.pmc over to standard signature parser
plobsing authored
34 , PARROT_ASSERT_ARG(nci))
e69d2a4 @petdance 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 @petdance headerizer now runs on PMC files
petdance authored
36 /* HEADERIZER END: static */
37
75d67e7 @plobsing avoid rebuilding the pcc cif every call
plobsing authored
38 /*
39
1e5a8ee @plobsing 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 @plobsing avoid rebuilding the pcc cif every call
plobsing authored
42
1e5a8ee @plobsing eliminate use of libffi-specific nci.pmc
plobsing authored
43 Actually build the NCI thunk.
75d67e7 @plobsing avoid rebuilding the pcc cif every call
plobsing authored
44
45 =cut
46
47 */
48
1e5a8ee @plobsing 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 @plobsing remove private2 (raw) flag from nci-ffi.pmc
plobsing authored
52 {
1e5a8ee @plobsing eliminate use of libffi-specific nci.pmc
plobsing authored
53 ASSERT_ARGS(build_func)
f631eb3 @plobsing remove private2 (raw) flag from nci-ffi.pmc
plobsing authored
54
a90f6d7 @plobsing 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 @plobsing remove private2 (raw) flag from nci-ffi.pmc
plobsing authored
60
a90f6d7 @plobsing 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 @plobsing remove private2 (raw) flag from nci-ffi.pmc
plobsing authored
63
1e5a8ee @plobsing 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 @plobsing remove private2 (raw) flag from nci-ffi.pmc
plobsing authored
69 }
70
1e5a8ee @plobsing eliminate use of libffi-specific nci.pmc
plobsing authored
71
336b07c @bacek Add 'does invokable' to all PMCs with VTABLE_invoke (except Object). Par...
bacek authored
72 pmclass NCI auto_attrs provides invokable {
9d723e0 @plobsing update NCI signature parsing to emit new (half year old) PCC param and r...
plobsing authored
73 /* NCI thunk handling attributes */
1e5a8ee @plobsing 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 @plobsing 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 @plobsing eliminate some unnecessary attributes
plobsing authored
83 ATTR INTVAL arity;
9d723e0 @plobsing update NCI signature parsing to emit new (half year old) PCC param and r...
plobsing authored
84
85 /* MMD fields */
1e5a8ee @plobsing 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 @plobsing 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 @plobsing 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 @jnthn Refactor the NCI PMC to have an underlying structure, in preparation for...
jnthn authored
137
62e3049 @petdance consting, and fixed embedded tabs
petdance authored
138 /* Store the original function and signature. */
1e5a8ee @plobsing 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)) {
8832378 @chromatic [PMC] Delayed NCI thunk initialization until absolutely necessary. This
chromatic authored
143 char * const key_c = Parrot_str_to_cstring(INTERP, key);
e69d2a4 @petdance Made pcc_params be static. Removed unused arg from build_func. Headerizi...
petdance authored
144 const size_t key_length = Parrot_str_byte_length(interp, key);
1e5a8ee @plobsing eliminate use of libffi-specific nci.pmc
plobsing authored
145 key = Parrot_str_new_init(interp, key_c, key_length,
146 Parrot_default_encoding_ptr, PObj_constant_FLAG);
c4cd281 @chromatic [PMC] Avoided an unnecessary STRING copying and creation in NCI's
chromatic authored
147 Parrot_str_free_cstring(key_c);
148 }
149
a90f6d7 @plobsing switch ffi nci.pmc over to standard signature parser
plobsing authored
150 nci_info->sig_str = key;
2646951 @tewk [gsoc_nci] gsoc_nci_001 merge
tewk authored
151 }
03918bc @chromatic [PMC] Fixed a read of unitialized memory in NCI PMC reported by Valgrind...
chromatic authored
152
2646951 @tewk [gsoc_nci] gsoc_nci_001 merge
tewk authored
153 /*
154
155 =item C<void mark()>
156
157 Mark any referenced strings and PMCs.
158
159 =cut
160
161 */
162 VTABLE void mark() {
1e5a8ee @plobsing eliminate use of libffi-specific nci.pmc
plobsing authored
163 if (PARROT_NCI(SELF)) {
164 Parrot_NCI_attributes * const nci_info = PARROT_NCI(SELF);
f631eb3 @plobsing remove private2 (raw) flag from nci-ffi.pmc
plobsing authored
165
1e5a8ee @plobsing eliminate use of libffi-specific nci.pmc
plobsing authored
166 Parrot_gc_mark_PMC_alive(interp, nci_info->signature);
167 Parrot_gc_mark_PMC_alive(interp, nci_info->fb_info);
168 Parrot_gc_mark_PMC_alive(interp, nci_info->multi_sig);
f631eb3 @plobsing remove private2 (raw) flag from nci-ffi.pmc
plobsing authored
169
1e5a8ee @plobsing eliminate use of libffi-specific nci.pmc
plobsing authored
170 Parrot_gc_mark_STRING_alive(interp, nci_info->sig_str);
171 Parrot_gc_mark_STRING_alive(interp, nci_info->long_signature);
172 Parrot_gc_mark_STRING_alive(interp, nci_info->pcc_params_signature);
173 Parrot_gc_mark_STRING_alive(interp, nci_info->pcc_return_signature);
f631eb3 @plobsing remove private2 (raw) flag from nci-ffi.pmc
plobsing authored
174 }
175 }
176
177 /*
178
c64e58f pmc docs update 3
Michael Scott authored
179 =item C<PMC *clone()>
180
181 Creates and returns a clone of the NCI.
182
183 =cut
184
185 */
186
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
187 VTABLE PMC *clone() {
971e997 @NotFound rename pmc attributes struct from Parrot_<type> to Parrot_<type>_attribu...
NotFound authored
188 Parrot_NCI_attributes * const nci_info_self = PARROT_NCI(SELF);
189 Parrot_NCI_attributes *nci_info_ret;
1e5a8ee @plobsing eliminate use of libffi-specific nci.pmc
plobsing authored
190 void *orig_func;
62e3049 @petdance consting, and fixed embedded tabs
petdance authored
191
083213a @Whiteknight start rename of pmc_new to Parrot_pmc_new
Whiteknight authored
192 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
193 nci_info_ret = PARROT_NCI(ret);
82c7cf6 @chromatic [PMC] Minor cleanups and tidyings.
chromatic authored
194
c64e58f pmc docs update 3
Michael Scott authored
195 /* FIXME if data is malloced (JIT/i386!) then we need
196 * the length of data here, to memcpy it
197 * ManagedStruct or Buffer?
198 */
2646951 @tewk [gsoc_nci] gsoc_nci_001 merge
tewk authored
199 nci_info_ret->func = nci_info_self->func;
3b094c7 @plobsing add NCI.fb_info for frame buffer info
plobsing authored
200 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
201 nci_info_ret->orig_func = nci_info_self->orig_func;
1e5a8ee @plobsing eliminate use of libffi-specific nci.pmc
plobsing authored
202 nci_info_ret->signature = nci_info_self->signature;
a90f6d7 @plobsing switch ffi nci.pmc over to standard signature parser
plobsing authored
203 nci_info_ret->sig_str = nci_info_self->sig_str;
2646951 @tewk [gsoc_nci] gsoc_nci_001 merge
tewk authored
204 nci_info_ret->pcc_params_signature = nci_info_self->pcc_params_signature;
9d723e0 @plobsing update NCI signature parsing to emit new (half year old) PCC param and r...
plobsing authored
205 nci_info_ret->pcc_return_signature = nci_info_self->pcc_params_signature;
2646951 @tewk [gsoc_nci] gsoc_nci_001 merge
tewk authored
206 nci_info_ret->arity = nci_info_self->arity;
1e5a8ee @plobsing eliminate use of libffi-specific nci.pmc
plobsing authored
207 PObj_get_FLAGS(ret) = PObj_get_FLAGS(SELF);
82c7cf6 @chromatic [PMC] Minor cleanups and tidyings.
chromatic authored
208
c64e58f pmc docs update 3
Michael Scott authored
209 return ret;
2a2c19b Added in code to properly do native calls to library routines loaded via
Dan Sugalski authored
210 }
211
c64e58f pmc docs update 3
Michael Scott authored
212 /*
213
214 =item C<INTVAL defined()>
215
216 Returns whether the NCI is defined.
217
218 =cut
219
220 */
221
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
222 VTABLE INTVAL defined() {
971e997 @NotFound rename pmc attributes struct from Parrot_<type> to Parrot_<type>_attribu...
NotFound authored
223 Parrot_NCI_attributes * const nci_info = PARROT_NCI(SELF);
8832378 @chromatic [PMC] Delayed NCI thunk initialization until absolutely necessary. This
chromatic authored
224 return nci_info->orig_func != NULL;
2a2c19b Added in code to properly do native calls to library routines loaded via
Dan Sugalski authored
225 }
226
c64e58f pmc docs update 3
Michael Scott authored
227 /*
228
0ae5d55 @paultcochrane Patch courtesy of Steve Peters <steve at fisharerojo dot org>, his comme...
paultcochrane authored
229 =item C<opcode_t *invoke(void *next)>
c64e58f pmc docs update 3
Michael Scott authored
230
8832378 @chromatic [PMC] Delayed NCI thunk initialization until absolutely necessary. This
chromatic authored
231 Calls the associated C function, returning C<*next>. If the invocant is a
232 class, the PMC arguments are shifted down.
c64e58f pmc docs update 3
Michael Scott authored
233
234 =cut
235
236 */
237
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
238 VTABLE opcode_t *invoke(void *next) {
1e5a8ee @plobsing eliminate use of libffi-specific nci.pmc
plobsing authored
239 Parrot_NCI_attributes * const nci_info = PARROT_NCI(SELF);
240 nci_thunk_t func;
241 PMC *fb_info;
bbd8ef4 @cotto [strings] first of many patches from darbelo++ getting rid of ->strstart...
cotto authored
242 char *sig_str;
1e5a8ee @plobsing eliminate use of libffi-specific nci.pmc
plobsing authored
243 void *orig_func;
811a7df @cotto [PMC] make NCI PMCs use ATTRs, with one temporary workaround for i386 ji...
cotto authored
244 PMC *cont;
1e5a8ee @plobsing eliminate use of libffi-specific nci.pmc
plobsing authored
245
246 GET_ATTR_orig_func(INTERP, SELF, orig_func);
247 func = (nci_thunk_t)D2FPTR(nci_info->func);
248
249 if (!func) {
c64fa8d @plobsing split NCI signature parser out from nci.pmc
plobsing authored
250 /* build the thunk only when necessary */
1e5a8ee @plobsing eliminate use of libffi-specific nci.pmc
plobsing authored
251 func = build_func(interp, nci_info);
82c7cf6 @chromatic [PMC] Minor cleanups and tidyings.
chromatic authored
252
1e5a8ee @plobsing eliminate use of libffi-specific nci.pmc
plobsing authored
253 if (!func)
c64fa8d @plobsing split NCI signature parser out from nci.pmc
plobsing authored
254 Parrot_ex_throw_from_c_args(INTERP, NULL,
255 EXCEPTION_INVALID_OPERATION,
256 "attempt to call NULL function");
8832378 @chromatic [PMC] Delayed NCI thunk initialization until absolutely necessary. This
chromatic authored
257 }
2646951 @tewk [gsoc_nci] gsoc_nci_001 merge
tewk authored
258
1e5a8ee @plobsing eliminate use of libffi-specific nci.pmc
plobsing authored
259 GET_ATTR_fb_info(INTERP, SELF, fb_info);
f631eb3 @plobsing remove private2 (raw) flag from nci-ffi.pmc
plobsing authored
260
1e5a8ee @plobsing eliminate use of libffi-specific nci.pmc
plobsing authored
261 func(INTERP, SELF, fb_info);
92c390d Fix tailcalls to NCI, #38724
Leopold Toetsch authored
262 cont = INTERP->current_cont;
82c7cf6 @chromatic [PMC] Minor cleanups and tidyings.
chromatic authored
263
8838c7f builtins 1 - first shot
Leopold Toetsch authored
264 /*
92c390d Fix tailcalls to NCI, #38724
Leopold Toetsch authored
265 * If the NCI function was tailcalled, the return result
266 * is already passed back to the caller of this frame
267 * - see Parrot_init_ret_nci(). We therefore invoke the
268 * return continuation here, which gets rid of this frame
269 * and returns the real return address
8838c7f builtins 1 - first shot
Leopold Toetsch authored
270 */
8832378 @chromatic [PMC] Delayed NCI thunk initialization until absolutely necessary. This
chromatic authored
271 if (cont && cont != NEED_CONTINUATION
272 && (PObj_get_FLAGS(cont) & SUB_FLAG_TAILCALL)) {
540d4c3 @bacek Merge context_pmc3 branch into trunk.
bacek authored
273 cont = Parrot_pcc_get_continuation(interp, CURRENT_CONTEXT(interp));
92c390d Fix tailcalls to NCI, #38724
Leopold Toetsch authored
274 next = VTABLE_invoke(INTERP, cont, next);
275 }
82c7cf6 @chromatic [PMC] Minor cleanups and tidyings.
chromatic authored
276
e063e49 @chromatic Continuing Parrot/C++ cleanups (Steve Peters, RT #42746).
chromatic authored
277 return (opcode_t *)next;
2a2c19b Added in code to properly do native calls to library routines loaded via
Dan Sugalski authored
278 }
380c0ba fix NCI related DOD problem
Leopold Toetsch authored
279
c64e58f pmc docs update 3
Michael Scott authored
280 /*
281
282 =item C<INTVAL get_integer()>
283
284 Returns the function pointer as an integer.
285
286 =cut
287
288 */
289
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
290 VTABLE INTVAL get_integer() {
1e5a8ee @plobsing eliminate use of libffi-specific nci.pmc
plobsing authored
291 Parrot_NCI_attributes * const nci_info = PARROT_NCI(SELF);
292 if (!nci_info->func)
293 build_func(INTERP, nci_info);
294 return (INTVAL)nci_info->func;
3168931 Forth can now generate code for words on the fly and execute them.
Dan Sugalski authored
295 }
296
f35b03c @rubys Initial support for sort
rubys authored
297 /*
298
299 =item C<INTVAL get_bool()>
300
301 Returns the boolean value of the pointer.
302
303 =cut
304
305 */
306
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
307 VTABLE INTVAL get_bool() {
971e997 @NotFound rename pmc attributes struct from Parrot_<type> to Parrot_<type>_attribu...
NotFound authored
308 Parrot_NCI_attributes * const nci_info = PARROT_NCI(SELF);
1e5a8ee @plobsing eliminate use of libffi-specific nci.pmc
plobsing authored
309 return (0 != (INTVAL)nci_info->orig_func);
f35b03c @rubys Initial support for sort
rubys authored
310 }
311
6586a2c @jnthn Implement arity method on NCI PMCs, plus a test for it.
jnthn authored
312 /*
313
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
314 =item C<METHOD arity()>
6586a2c @jnthn Implement arity method on NCI PMCs, plus a test for it.
jnthn authored
315
01e804c @Util [pmc] Typo corrections
Util authored
316 Return the arity of the NCI (the number of arguments).
6586a2c @jnthn Implement arity method on NCI PMCs, plus a test for it.
jnthn authored
317
318 =cut
319
320 */
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
321 METHOD arity() {
971e997 @NotFound rename pmc attributes struct from Parrot_<type> to Parrot_<type>_attribu...
NotFound authored
322 Parrot_NCI_attributes * const nci_info = PARROT_NCI(SELF);
48d2796 @NotFound Another unreachable warning, codingstd in jit_emit ppc
NotFound authored
323 INTVAL arity = 0;
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
324
8832378 @chromatic [PMC] Delayed NCI thunk initialization until absolutely necessary. This
chromatic authored
325 if (nci_info) {
1e5a8ee @plobsing eliminate use of libffi-specific nci.pmc
plobsing authored
326 if (!nci_info->func)
327 build_func(INTERP, nci_info);
328 if (nci_info->func) {
c64fa8d @plobsing split NCI signature parser out from nci.pmc
plobsing authored
329 arity = nci_info->arity;
330 RETURN(INTVAL arity);
8832378 @chromatic [PMC] Delayed NCI thunk initialization until absolutely necessary. This
chromatic authored
331 }
332 }
6586a2c @jnthn Implement arity method on NCI PMCs, plus a test for it.
jnthn authored
333
8832378 @chromatic [PMC] Delayed NCI thunk initialization until absolutely necessary. This
chromatic authored
334 Parrot_ex_throw_from_c_args(INTERP, NULL,
335 EXCEPTION_INVALID_OPERATION,
336 "You cannot get the arity of an undefined NCI.");
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored
337 }
2a2c19b Added in code to properly do native calls to library routines loaded via
Dan Sugalski authored
338 }
c64e58f pmc docs update 3
Michael Scott authored
339
340 /*
341
342 =back
343
344 =head1 SEE ALSO
345
1e5a8ee @plobsing eliminate use of libffi-specific nci.pmc
plobsing authored
346 F<docs/pdds/pdd03_calling_conventions.pod>.
f631eb3 @plobsing remove private2 (raw) flag from nci-ffi.pmc
plobsing authored
347
c64e58f pmc docs update 3
Michael Scott authored
348 =cut
349
350 */
351
0eb3eb3 added formatting footer and detabbed
Michael Scott authored
352 /*
353 * Local variables:
72575ae @bschmalhofer #40481: [PATCH] C-code coda in pmc files
bschmalhofer authored
354 * c-file-style: "parrot"
0eb3eb3 added formatting footer and detabbed
Michael Scott authored
355 * End:
1d7dded @plobsing update C file vim modelines
plobsing authored
356 * vim: expandtab shiftwidth=4 cinoptions='\:2=2' :
72575ae @bschmalhofer #40481: [PATCH] C-code coda in pmc files
bschmalhofer authored
357 */
Something went wrong with that request. Please try again.