* t/pmc/complex.t:
[parrot.git] / include / parrot / interpreter.h
blob6d0febbdb0efea542b50ffc9d5e2f453664e5ffb
1 /* interpreter.h
2 * Copyright (C) 2001-2007, The Perl Foundation.
3 * SVN Info
4 * $Id$
5 * Overview:
6 * The interpreter API handles running the operations
7 */
9 #ifndef PARROT_INTERPRETER_H_GUARD
10 #define PARROT_INTERPRETER_H_GUARD
12 /* These should be visible to embedders. */
14 /* General flags */
15 /* &gen_from_enum(interpflags.pasm) */
16 typedef enum {
17 PARROT_NO_FLAGS = 0x00,
18 PARROT_BOUNDS_FLAG = 0x04, /* We're tracking byte code bounds */
19 PARROT_PROFILE_FLAG = 0x08, /* gathering profile information */
20 PARROT_GC_DEBUG_FLAG = 0x10, /* debugging memory management */
22 PARROT_EXTERN_CODE_FLAG = 0x100, /* reusing another interp's code */
23 PARROT_DESTROY_FLAG = 0x200, /* the last interpreter shall cleanup */
25 PARROT_IS_THREAD = 0x1000, /* interpreter is a thread */
26 PARROT_THR_COPY_INTERP = 0x2000, /* thread start copies interp state */
27 PARROT_THR_THREAD_POOL = 0x4000, /* type3 threads */
29 PARROT_THR_TYPE_1 = PARROT_IS_THREAD,
30 PARROT_THR_TYPE_2 = PARROT_IS_THREAD | PARROT_THR_COPY_INTERP,
31 PARROT_THR_TYPE_3 = PARROT_IS_THREAD | PARROT_THR_COPY_INTERP |
32 PARROT_THR_THREAD_POOL
34 } Parrot_Interp_flag;
35 /* &end_gen */
37 /* &gen_from_enum(interpdebug.pasm) */
38 typedef enum {
39 PARROT_NO_DEBUG = 0x00,
40 PARROT_MEM_STAT_DEBUG_FLAG = 0x01, /* memory usage summary */
41 PARROT_BACKTRACE_DEBUG_FLAG = 0x02, /* print bt in exception */
42 PARROT_JIT_DEBUG_FLAG = 0x04, /* create jit stabs file */
43 PARROT_START_DEBUG_FLAG = 0x08,
44 PARROT_THREAD_DEBUG_FLAG = 0x10,
45 PARROT_EVAL_DEBUG_FLAG = 0x20, /* create EVAL_n file */
46 PARROT_REG_DEBUG_FLAG = 0x40, /* fill I,N with garbage */
47 PARROT_CTX_DESTROY_DEBUG_FLAG = 0x80, /* ctx of a sub is gone */
48 PARROT_ALL_DEBUG_FLAGS = 0xffff
49 } Parrot_debug_flags;
50 /* &end_gen */
52 /* &gen_from_enum(interptrace.pasm) */
53 typedef enum {
54 PARROT_NO_TRACE = 0x00,
55 PARROT_TRACE_OPS_FLAG = 0x01, /* op execution trace */
56 PARROT_TRACE_FIND_METH_FLAG = 0x02, /* find_method */
57 PARROT_TRACE_SUB_CALL_FLAG = 0x04, /* invoke/retcc */
58 PARROT_ALL_TRACE_FLAGS = 0xffff
59 } Parrot_trace_flags;
60 /* &end_gen */
62 /* &gen_from_enum(interpcores.pasm) */
63 typedef enum {
64 PARROT_SLOW_CORE, /* slow bounds/trace/profile core */
65 PARROT_FUNCTION_CORE = PARROT_SLOW_CORE,
66 PARROT_FAST_CORE = 0x01, /* fast DO_OP core */
67 PARROT_SWITCH_CORE = 0x02, /* P = prederef */
68 PARROT_CGP_CORE = 0x06, /* CP */
69 PARROT_CGOTO_CORE = 0x04, /* C = cgoto */
70 PARROT_JIT_CORE = 0x10, /* J = JIT */
71 PARROT_CGP_JIT_CORE = 0x16, /* JCP */
72 PARROT_SWITCH_JIT_CORE = 0x12, /* J P */
73 PARROT_EXEC_CORE = 0x20, /* TODO Parrot_exec_run variants */
74 PARROT_GC_DEBUG_CORE = 0x40 /* run GC before each op */
75 } Parrot_Run_core_t;
76 /* &end_gen */
78 /* &gen_from_enum(cloneflags.pasm) */
79 typedef enum {
80 PARROT_CLONE_CODE = 0x1, /* active code segments
81 * XXX interaction with lexicals
83 PARROT_CLONE_GLOBALS = 0x2, /* global stash */
84 PARROT_CLONE_RUNOPS = 0x4, /* runops choice */
85 PARROT_CLONE_INTERP_FLAGS = 0x8, /* bounds checking and
86 * debugging flags */
87 PARROT_CLONE_HLL = 0x10, /* clone HLL setting */
88 PARROT_CLONE_CLASSES = 0x20, /* clone usermade classes */
89 PARROT_CLONE_LIBRARIES = 0x40, /* clone loaded library set */
90 /* flags that won't be initially implemented */
91 PARROT_CLONE_CC = 0x80, /* clone current continuation --
92 * fork()-like cloning (requires
93 * cloned code segments); probably
94 * would only work if runloop_level is 1
97 /* combinations of flags */
98 PARROT_CLONE_DEFAULT = 0x7f /* everything but CC */
99 } Parrot_clone_flags;
100 /* &end_gen */
102 struct parrot_interp_t;
103 /* One of the most common shim arguments is the interpreter itself, so it
104 * gets its own macro.
107 #define PARROT_INTERP /*@notnull@*/ /*@in@*/ Parrot_Interp interp
108 #define NULLOK_INTERP /*@null@*/ /*@in@*/ Parrot_Interp interp
109 #define SHIM_INTERP /*@unused@*/ /*@null@*/ Parrot_Interp interp_unused __attribute__unused__
112 #ifdef PARROT_IN_CORE
114 #define Parrot_String STRING *
115 #define Parrot_PMC PMC *
116 #define Parrot_Language Parrot_Int
117 #define Parrot_Vtable struct _vtable*
119 typedef struct parrot_interp_t *Parrot_Interp;
121 typedef Parrot_Interp_flag Interp_flags;
122 typedef Parrot_Run_core_t Run_Cores;
124 #define Interp_flags_SET(interp, flag) ((interp)->flags |= (flag))
125 #define Interp_flags_CLEAR(interp, flag) ((interp)->flags &= ~(flag))
126 #define Interp_flags_TEST(interp, flag) ((interp)->flags & (flag))
128 #define Interp_debug_SET(interp, flag) ((interp)->debug_flags |= (flag))
129 #define Interp_debug_CLEAR(interp, flag) ((interp)->debug_flags &= ~(flag))
130 #define Interp_debug_TEST(interp, flag) ((interp)->debug_flags & (flag))
132 #define Interp_trace_SET(interp, flag) (CONTEXT(interp)->trace_flags |= (flag))
133 #define Interp_trace_CLEAR(interp, flag) (CONTEXT(interp)->trace_flags &= ~(flag))
134 #define Interp_trace_TEST(interp, flag) (CONTEXT(interp)->trace_flags & (flag))
136 #define Interp_core_SET(interp, core) ((interp)->run_core = (core))
137 #define Interp_core_TEST(interp, core) ((interp)->run_core == (core))
139 #include "parrot/register.h"
140 #include "parrot/parrot.h"
141 #include "parrot/warnings.h"
143 #include "parrot/op.h"
144 #include "parrot/oplib.h"
146 #include "parrot/debug.h"
147 #include "parrot/mmd.h"
149 typedef struct warnings_t {
150 Warnings_classes classes;
151 } *Warnings;
154 * ProfData have these extra items in front followed by
155 * one entry per op at (op + extra)
158 typedef enum {
159 PARROT_PROF_DOD_p1, /* pass 1 mark root set */
160 PARROT_PROF_DOD_p2, /* pass 2 mark next_for_GC */
161 PARROT_PROF_DOD_cp, /* collect PMCs */
162 PARROT_PROF_DOD_cb, /* collect buffers */
163 /* DOD must be 0..3 */
164 PARROT_PROF_GC,
165 PARROT_PROF_EXCEPTION,
166 PARROT_PROF_EXTRA
167 } profile_extra_enum;
170 * data[op_count] is time spent for exception handling
172 typedef struct ProfData {
173 int op;
174 UINTVAL numcalls;
175 FLOATVAL time;
176 } ProfData;
178 typedef struct _RunProfile {
179 FLOATVAL starttime;
180 FLOATVAL dod_time;
181 opcode_t cur_op;
182 ProfData *data;
183 } RunProfile;
185 /* Forward declaration for imc_info_t -- the actual struct is
186 * defined in imcc/imc.h
188 struct _imc_info_t;
190 typedef union {
191 PMC **regs_p;
192 STRING **regs_s;
193 } Regs_ps;
195 typedef union {
196 FLOATVAL *regs_n;
197 INTVAL *regs_i;
198 } Regs_ni;
200 /* If CTX_LEAK_DEBUG is enabled, then turning on PARROT_CTX_DESTROY_DEBUG_FLAG
201 will print tons of detail about when Parrot_Context structures are allocated
202 and deallocated to stderr. If CTX_LEAK_DEBUG is disabled, then all of the
203 relevant code is omitted, and PARROT_CTX_DESTROY_DEBUG_FLAG has no effect.
205 #define CTX_LEAK_DEBUG 1
207 typedef struct Parrot_Context {
208 /* common header with Interp_Context */
209 struct Parrot_Context *caller_ctx; /* caller context */
210 Regs_ni bp; /* pointers to FLOATVAL & INTVAL */
211 Regs_ps bp_ps; /* pointers to PMC & STR */
212 /* end common header */
213 INTVAL *n_regs_used; /* INSP in PBC points to Sub */
214 size_t regs_mem_size; /* memory occupied by registers */
215 int ref_count; /* how often refered to */
216 struct Stack_Chunk *reg_stack; /* register stack */
218 struct Stack_Chunk *user_stack; /* Base of the scratch stack */
219 PMC *lex_pad; /* LexPad PMC */
220 struct Parrot_Context *outer_ctx; /* outer context, if a closure */
221 UINTVAL warns; /* Keeps track of what warnings
222 * have been activated */
223 UINTVAL errors; /* fatals that can be turned off */
224 UINTVAL trace_flags;
225 UINTVAL recursion_depth; /* Sub call recursion depth */
227 * new call scheme and introspective variables
229 PMC *current_sub; /* the Sub we are executing */
231 * for now use a return continuation PMC
233 PMC *current_cont; /* the return continuation PMC */
234 PMC *current_object; /* current object if a method call */
235 opcode_t *current_pc; /* program counter of Sub invocation */
236 PMC *current_namespace; /* The namespace we're currently in */
237 INTVAL current_HLL; /* see also src/hll.c */
238 opcode_t *current_results; /* ptr into code with get_results opcode */
239 PMC *results_signature; /* results signature pmc if it is non-const */
240 /* deref the constants - we need it all the time */
241 struct PackFile_Constant ** constants;
242 /* code->prederefed.code - code->base.data in opcodes
243 * to simplify conversio between code ptrs in e.g. invoke
245 size_t pred_offset;
246 } parrot_context_t;
248 typedef parrot_context_t Parrot_Context;
250 struct _Thread_data; /* in thread.h */
251 struct _Caches; /* caches .h */
253 typedef struct _Prederef_branch { /* item for recording branches */
254 size_t offs; /* offset in code */
255 void *op; /* opcode at that position */
256 } Prederef_branch;
258 typedef struct _Prederef {
259 void **code; /* prederefed code */
260 Prederef_branch *branches; /* list of branches in code */
261 size_t n_branches; /* entries in that list */
262 size_t n_allocated; /* allocated size of it */
263 } Prederef;
267 * This is an 'inlined' copy of the first 3 Context items for
268 * faster access of registers mainly
269 * During a context switch a 3 pointers are set
271 typedef struct Interp_Context {
272 /* common header */
273 struct Parrot_Context *state; /* context */
274 Regs_ni bp; /* pointers to FLOATVAL & INTVAL */
275 Regs_ps bp_ps; /* pointers to PMC & STR */
276 /* end common header */
277 } Interp_Context;
279 #define CONTEXT(interp) ((interp)->ctx.state)
281 #define CHUNKED_CTX_MEM 0 /* no longer works, but will be reinstated
282 * some day; see src/register.c for details.
285 typedef struct _context_mem {
286 #if CHUNKED_CTX_MEM
287 char *data; /* ctx + register store */
288 char *free; /* free to allocate */
289 char *threshold; /* continuation threshold */
290 struct _context_mem *prev; /* previous allocated area */
291 #else
292 void **free_list; /* array of free-lists, per size free slots */
293 int n_free_slots; /* amount of allocated */
294 #endif
296 } context_mem;
298 struct _handler_node_t; /* forward def - exit.h */
300 * The actual interpreter structure
302 struct parrot_interp_t {
303 struct Interp_Context ctx;
304 context_mem ctx_mem; /* ctx memory managment */
306 struct Arenas *arena_base; /* Pointer to this interpreter's
307 * arena */
309 PMC *class_hash; /* Hash of classes */
310 VTABLE **vtables; /* array of vtable ptrs */
311 int n_vtable_max; /* highest used type */
312 int n_vtable_alloced; /* alloced vtable space */
314 struct _ParrotIOData *piodata; /* interpreter's IO system */
316 op_lib_t *op_lib; /* Opcode library */
317 size_t op_count; /* The number of ops */
318 op_info_t *op_info_table; /* Opcode info table (name, nargs, arg types) */
320 op_func_t *op_func_table; /* opcode dispatch table (functions, labels,
321 * or nothing (e.g. switched core), which
322 * the interpreter is currently running */
323 op_func_t *evc_func_table; /* opcode dispatch for event checking */
324 op_func_t *save_func_table; /* for restoring op_func_table */
326 int n_libs; /* count of libs below */
327 op_lib_t **all_op_libs; /* all loaded opcode libraries */
329 INTVAL flags; /* Various interpreter flags that
330 * signal that runops should do
331 * something */
333 UINTVAL debug_flags; /* debug settings */
335 INTVAL run_core; /* type of core to run the ops */
337 /* TODO profile per code segment or global */
338 RunProfile *profile; /* The structure and array where we keep the
339 * profile counters */
341 INTVAL resume_flag;
342 size_t resume_offset;
344 struct PackFile_ByteCode *code; /* The code we are executing */
345 struct PackFile *initial_pf; /* first created PF */
347 struct _imc_info_t *imc_info; /* imcc data */
349 const char* output_file; /* The file into which output is written */
351 PDB_t *pdb; /* Debug system */
352 Interp * debugger; /* trace / debug interpreter */
354 struct Stack_Chunk *dynamic_env; /* current dynamic environment */
356 void *lo_var_ptr; /* Pointer to memory on runops system stack */
358 Interp * parent_interpreter;
360 /* per interpreter global vars */
361 INTVAL world_inited; /* world_init_once() is done */
363 PMC *iglobals; /* SArray of PMCs, containing: */
364 /* 0: PMC *Parrot_base_classname_hash; hash containing name->base_type */
365 /* 1: PMC *Parrot_compreg_hash; hash containing assembler/compilers */
366 /* 2: PMC *Argv; list of argv */
367 /* 3: PMC *NCI func hash hash of NCI funcs */
368 /* 4: PMC *ParrotInterpreter that's me */
369 /* 5: PMC *Dyn_libs Array of dynamically loaded ParrotLibrary */
370 /* 6: PMC *Config_Hash Hash of config settings */
371 /* 7: PMC *Lib_Paths LoL of search paths */
372 /* 8: PMC *PBC_Libs Hash of load_bytecode cde */
373 /* 9: PMC *Executable String PMC with name from argv[0]. */
375 PMC* DOD_registry; /* registered PMCs added to the root set */
377 PMC* HLL_info; /* storage for HLL names and types */
378 PMC* HLL_namespace; /* cache of HLL toplevel ns */
380 PMC *root_namespace; /* namespace hash */
382 MMD_table *binop_mmd_funcs; /* Table of MMD functions */
383 UINTVAL n_binop_mmd_funcs; /* function count */
385 struct _Caches * caches; /* s. caches.h */
387 STRING **const_cstring_table; /* CONST_STRING(x) items */
389 PMC *scheduler; /* concurrency scheduler */
390 struct QUEUE* task_queue; /* per interpreter queue */
391 struct _handler_node_t *exit_handler_list; /* exit.c */
392 int sleeping; /* used during sleep in events */
394 struct parrot_exception_t *exceptions; /* internal exception stack */
395 struct parrot_exception_t *exc_free_list; /* and free list */
396 PMC ** exception_list; /* precreated exception objects */
398 int current_runloop_level; /* for reentering run loop */
399 int current_runloop_id;
401 struct _Thread_data *thread_data; /* thread specific items */
403 UINTVAL recursion_limit; /* Sub call resursion limit */
405 UINTVAL gc_generation; /* GC generation number */
407 opcode_t *current_args; /* ptr into code with set_args opcode */
408 opcode_t *current_params; /* ptr into code with get_params opcode */
409 opcode_t *current_returns; /* ptr into code with get_returns opcode */
410 PMC *args_signature; /* args signature pmc if it is non-const */
411 PMC *params_signature; /* params signature pmc if it is non-const */
412 PMC *returns_signature; /* returns signature pmc if it is non-const */
413 /* during a call sequencer the caller fills these objects
414 * inside the invoke these get moved to the context structure
416 PMC *current_cont; /* the return continuation PMC */
417 PMC *current_object; /* current object if a method call */
420 /* typedef struct parrot_interp_t Interp; done in parrot.h so that
421 interpreter.h's prereq headers can
422 use 'Interp' */
424 typedef enum {
425 RESUME_NONE = 0x00,
426 RESUME_RESTART = 0x01,
427 RESUME_ISJ = 0x02,
428 RESUME_INITIAL = 0x04
429 } resume_flag_enum;
431 /* &gen_from_enum(iglobals.pasm) */
432 typedef enum {
433 IGLOBALS_CLASSNAME_HASH,
434 IGLOBALS_COMPREG_HASH,
435 IGLOBALS_ARGV_LIST,
436 IGLOBALS_NCI_FUNCS,
437 IGLOBALS_INTERPRETER, /* this interpreter as ParrotInterpreter PMC */
438 IGLOBALS_DYN_LIBS, /* Hash of ParrotLibrary loaded dynamic ext */
439 IGLOBALS_CONFIG_HASH,
440 IGLOBALS_LIB_PATHS, /* LoL of search paths and dynamic ext */
441 IGLOBALS_PBC_LIBS, /* Hash of load_bytecode cde */
442 IGLOBALS_EXECUTABLE, /* How Parrot was invoked (from argv[0]) */
444 IGLOBALS_SIZE
445 } iglobals_enum;
446 /* &end_gen */
448 #define PCONST(i) PF_CONST(interp->code, (i))
449 #define PNCONST PF_NCONST(interp->code)
451 /* TODO - Make this a config option */
452 #define PARROT_CATCH_NULL 1
454 #if PARROT_CATCH_NULL
455 PARROT_API extern PMC * PMCNULL; /* Holds single Null PMC */
456 # define PMC_IS_NULL(p) ((p) == PMCNULL || (p) == NULL)
457 #else
458 # define PMCNULL ((PMC *)NULL)
459 # define PMC_IS_NULL(p) ((p) == PMCNULL)
460 #endif /* PARROT_CATCH_NULL */
463 #define STRING_IS_NULL(s) ((s) == NULL)
464 #define STRING_IS_EMPTY(s) !(int)(s)->strlen
466 /* &gen_from_def(sysinfo.pasm) prefix(SYSINFO_) */
468 #define PARROT_INTSIZE 1
469 #define PARROT_FLOATSIZE 2
470 #define PARROT_POINTERSIZE 3
471 #define PARROT_OS 4
472 #define PARROT_OS_VERSION 5
473 #define PARROT_OS_VERSION_NUMBER 6
474 #define CPU_ARCH 7
475 #define CPU_TYPE 8
477 /* &end_gen */
479 typedef opcode_t *(*native_func_t)(PARROT_INTERP,
480 opcode_t * cur_opcode,
481 opcode_t * start_code);
483 VAR_SCOPE native_func_t run_native;
485 typedef PMC *(*Parrot_compiler_func_t)(Parrot_Interp interp,
486 const char * program);
488 /* HEADERIZER BEGIN: src/inter_create.c */
490 PARROT_API
491 PARROT_CANNOT_RETURN_NULL
492 Parrot_Interp make_interpreter(ARGIN_NULLOK(Interp *parent), INTVAL flags);
494 PARROT_API
495 void Parrot_destroy(PARROT_INTERP)
496 __attribute__nonnull__(1);
498 void Parrot_really_destroy(PARROT_INTERP,
499 NULLOK(int exit_code),
500 SHIM(void *arg))
501 __attribute__nonnull__(1);
503 /* HEADERIZER END: src/inter_create.c */
505 /* HEADERIZER BEGIN: src/inter_run.c */
507 PARROT_API
508 PARROT_IGNORABLE_RESULT
509 PARROT_CAN_RETURN_NULL
510 void * Parrot_run_meth_fromc(PARROT_INTERP,
511 ARGIN(PMC *sub),
512 ARGIN_NULLOK(PMC *obj),
513 SHIM(STRING *meth))
514 __attribute__nonnull__(1)
515 __attribute__nonnull__(2);
517 PARROT_API
518 PARROT_IGNORABLE_RESULT
519 PARROT_CAN_RETURN_NULL
520 void* Parrot_run_meth_fromc_arglist(PARROT_INTERP,
521 ARGIN(PMC *sub),
522 ARGIN_NULLOK(PMC *obj),
523 ARGIN(STRING *meth),
524 ARGIN(const char *sig),
525 va_list args)
526 __attribute__nonnull__(1)
527 __attribute__nonnull__(2)
528 __attribute__nonnull__(4)
529 __attribute__nonnull__(5);
531 PARROT_API
532 PARROT_IGNORABLE_RESULT
533 FLOATVAL Parrot_run_meth_fromc_arglist_retf(PARROT_INTERP,
534 ARGIN(PMC *sub),
535 ARGIN_NULLOK(PMC *obj),
536 ARGIN(STRING *meth),
537 ARGIN(const char *sig),
538 va_list args)
539 __attribute__nonnull__(1)
540 __attribute__nonnull__(2)
541 __attribute__nonnull__(4)
542 __attribute__nonnull__(5);
544 PARROT_API
545 PARROT_IGNORABLE_RESULT
546 PARROT_CAN_RETURN_NULL
547 INTVAL Parrot_run_meth_fromc_arglist_reti(PARROT_INTERP,
548 ARGIN(PMC *sub),
549 ARGIN_NULLOK(PMC *obj),
550 ARGIN(STRING *meth),
551 ARGIN(const char *sig),
552 va_list args)
553 __attribute__nonnull__(1)
554 __attribute__nonnull__(2)
555 __attribute__nonnull__(4)
556 __attribute__nonnull__(5);
558 PARROT_API
559 PARROT_IGNORABLE_RESULT
560 PARROT_CAN_RETURN_NULL
561 void* Parrot_run_meth_fromc_args(PARROT_INTERP,
562 ARGIN(PMC *sub),
563 ARGIN_NULLOK(PMC *obj),
564 ARGIN(STRING *meth),
565 ARGIN(const char *sig),
566 ...)
567 __attribute__nonnull__(1)
568 __attribute__nonnull__(2)
569 __attribute__nonnull__(4)
570 __attribute__nonnull__(5);
572 PARROT_API
573 PARROT_IGNORABLE_RESULT
574 FLOATVAL Parrot_run_meth_fromc_args_retf(PARROT_INTERP,
575 ARGIN(PMC *sub),
576 ARGIN_NULLOK(PMC *obj),
577 ARGIN(STRING *meth),
578 ARGIN(const char *sig),
579 ...)
580 __attribute__nonnull__(1)
581 __attribute__nonnull__(2)
582 __attribute__nonnull__(4)
583 __attribute__nonnull__(5);
585 PARROT_API
586 PARROT_IGNORABLE_RESULT
587 INTVAL Parrot_run_meth_fromc_args_reti(PARROT_INTERP,
588 ARGIN(PMC *sub),
589 ARGIN_NULLOK(PMC *obj),
590 ARGIN(STRING *meth),
591 ARGIN(const char *sig),
592 ...)
593 __attribute__nonnull__(1)
594 __attribute__nonnull__(2)
595 __attribute__nonnull__(4)
596 __attribute__nonnull__(5);
598 PARROT_API
599 PARROT_IGNORABLE_RESULT
600 PARROT_CANNOT_RETURN_NULL
601 parrot_context_t * Parrot_runops_fromc(PARROT_INTERP, ARGIN(PMC *sub))
602 __attribute__nonnull__(1)
603 __attribute__nonnull__(2);
605 PARROT_API
606 PARROT_IGNORABLE_RESULT
607 PARROT_CAN_RETURN_NULL
608 void * Parrot_runops_fromc_arglist(PARROT_INTERP,
609 ARGIN(PMC *sub),
610 ARGIN(const char *sig),
611 va_list args)
612 __attribute__nonnull__(1)
613 __attribute__nonnull__(2)
614 __attribute__nonnull__(3);
616 PARROT_API
617 PARROT_IGNORABLE_RESULT
618 FLOATVAL Parrot_runops_fromc_arglist_retf(PARROT_INTERP,
619 ARGIN(PMC *sub),
620 ARGIN(const char *sig),
621 va_list args)
622 __attribute__nonnull__(1)
623 __attribute__nonnull__(2)
624 __attribute__nonnull__(3);
626 PARROT_API
627 PARROT_IGNORABLE_RESULT
628 INTVAL Parrot_runops_fromc_arglist_reti(PARROT_INTERP,
629 ARGIN(PMC *sub),
630 ARGIN(const char *sig),
631 va_list args)
632 __attribute__nonnull__(1)
633 __attribute__nonnull__(2)
634 __attribute__nonnull__(3);
636 PARROT_API
637 PARROT_IGNORABLE_RESULT
638 PARROT_CAN_RETURN_NULL
639 PMC * Parrot_runops_fromc_args(PARROT_INTERP,
640 ARGIN(PMC *sub),
641 ARGIN(const char *sig),
642 ...)
643 __attribute__nonnull__(1)
644 __attribute__nonnull__(2)
645 __attribute__nonnull__(3);
647 PARROT_API
648 PARROT_IGNORABLE_RESULT
649 PARROT_CAN_RETURN_NULL
650 void * Parrot_runops_fromc_args_event(PARROT_INTERP,
651 ARGIN(PMC *sub),
652 ARGIN(const char *sig),
653 ...)
654 __attribute__nonnull__(1)
655 __attribute__nonnull__(2)
656 __attribute__nonnull__(3);
658 PARROT_API
659 PARROT_IGNORABLE_RESULT
660 FLOATVAL Parrot_runops_fromc_args_retf(PARROT_INTERP,
661 ARGIN(PMC *sub),
662 ARGIN(const char *sig),
663 ...)
664 __attribute__nonnull__(1)
665 __attribute__nonnull__(2)
666 __attribute__nonnull__(3);
668 PARROT_API
669 PARROT_IGNORABLE_RESULT
670 INTVAL Parrot_runops_fromc_args_reti(PARROT_INTERP,
671 ARGIN(PMC *sub),
672 ARGIN(const char *sig),
673 ...)
674 __attribute__nonnull__(1)
675 __attribute__nonnull__(2)
676 __attribute__nonnull__(3);
678 void runops(PARROT_INTERP, size_t offs)
679 __attribute__nonnull__(1);
681 /* HEADERIZER END: src/inter_run.c */
683 /* HEADERIZER BEGIN: src/inter_cb.c */
685 PARROT_API
686 void Parrot_callback_C(ARGIN(char *external_data), ARGMOD(PMC *user_data))
687 __attribute__nonnull__(1)
688 __attribute__nonnull__(2)
689 FUNC_MODIFIES(*user_data);
691 PARROT_API
692 void Parrot_callback_D(ARGMOD(PMC *user_data), ARGIN(char *external_data))
693 __attribute__nonnull__(1)
694 __attribute__nonnull__(2)
695 FUNC_MODIFIES(*user_data);
697 PARROT_API
698 PARROT_CANNOT_RETURN_NULL
699 PARROT_WARN_UNUSED_RESULT
700 PMC* Parrot_make_cb(PARROT_INTERP,
701 ARGMOD(PMC* sub),
702 ARGIN(PMC* user_data),
703 ARGIN(STRING *cb_signature))
704 __attribute__nonnull__(1)
705 __attribute__nonnull__(2)
706 __attribute__nonnull__(3)
707 __attribute__nonnull__(4)
708 FUNC_MODIFIES(* sub);
710 PARROT_API
711 void Parrot_run_callback(PARROT_INTERP,
712 ARGMOD(PMC* user_data),
713 ARGIN(char* external_data))
714 __attribute__nonnull__(1)
715 __attribute__nonnull__(2)
716 __attribute__nonnull__(3)
717 FUNC_MODIFIES(* user_data);
719 /* HEADERIZER END: src/inter_cb.c */
721 /* HEADERIZER BEGIN: src/inter_misc.c */
723 PARROT_API
724 INTVAL interpinfo(PARROT_INTERP, INTVAL what)
725 __attribute__nonnull__(1);
727 PARROT_API
728 PARROT_WARN_UNUSED_RESULT
729 PARROT_CAN_RETURN_NULL
730 PMC* interpinfo_p(PARROT_INTERP, INTVAL what)
731 __attribute__nonnull__(1);
733 PARROT_API
734 PARROT_WARN_UNUSED_RESULT
735 PARROT_CANNOT_RETURN_NULL
736 STRING* interpinfo_s(PARROT_INTERP, INTVAL what)
737 __attribute__nonnull__(1);
739 PARROT_API
740 PARROT_CANNOT_RETURN_NULL
741 void * Parrot_compile_file(PARROT_INTERP,
742 ARGIN(const char *fullname),
743 ARGOUT(STRING **error))
744 __attribute__nonnull__(1)
745 __attribute__nonnull__(2)
746 __attribute__nonnull__(3)
747 FUNC_MODIFIES(*error);
749 PARROT_API
750 PARROT_WARN_UNUSED_RESULT
751 PARROT_CAN_RETURN_NULL
752 PMC * Parrot_compile_string(PARROT_INTERP,
753 ARGIN(STRING *type),
754 ARGIN(const char *code),
755 ARGOUT(STRING **error))
756 __attribute__nonnull__(1)
757 __attribute__nonnull__(2)
758 __attribute__nonnull__(3)
759 __attribute__nonnull__(4)
760 FUNC_MODIFIES(*error);
762 PARROT_API
763 void Parrot_compreg(PARROT_INTERP,
764 ARGIN(STRING *type),
765 NOTNULL(Parrot_compiler_func_t func))
766 __attribute__nonnull__(1)
767 __attribute__nonnull__(2)
768 __attribute__nonnull__(3);
770 PARROT_API
771 void Parrot_mark_method_writes(PARROT_INTERP,
772 int type,
773 ARGIN(const char *name))
774 __attribute__nonnull__(1)
775 __attribute__nonnull__(3);
777 PARROT_API
778 void register_nci_method(PARROT_INTERP,
779 const int type,
780 ARGIN(void *func),
781 ARGIN(const char *name),
782 ARGIN(const char *proto))
783 __attribute__nonnull__(1)
784 __attribute__nonnull__(3)
785 __attribute__nonnull__(4)
786 __attribute__nonnull__(5);
788 PARROT_API
789 void register_raw_nci_method_in_ns(PARROT_INTERP,
790 const int type,
791 ARGIN(void *func),
792 ARGIN(const char *name))
793 __attribute__nonnull__(1)
794 __attribute__nonnull__(3)
795 __attribute__nonnull__(4);
797 PARROT_WARN_UNUSED_RESULT
798 INTVAL sysinfo_i(SHIM_INTERP, INTVAL info_wanted);
800 PARROT_CANNOT_RETURN_NULL
801 PARROT_WARN_UNUSED_RESULT
802 STRING * sysinfo_s(PARROT_INTERP, INTVAL info_wanted)
803 __attribute__nonnull__(1);
805 /* HEADERIZER END: src/inter_misc.c */
808 /* interpreter.c */
809 void runops_int(Interp *, size_t offset);
810 void exec_init_prederef(PARROT_INTERP,
811 void *prederef_arena);
812 void prepare_for_run(PARROT_INTERP);
813 void *init_jit(PARROT_INTERP, opcode_t *pc);
814 PARROT_API void dynop_register(PARROT_INTERP, PMC* op_lib);
815 void do_prederef(void **pc_prederef, PARROT_INTERP, int type);
817 /* interpreter.pmc */
818 void clone_interpreter(Parrot_Interp dest, Parrot_Interp self, INTVAL flags);
820 void Parrot_setup_event_func_ptrs(Parrot_Interp interp);
822 PARROT_API void disable_event_checking(PARROT_INTERP);
823 PARROT_API void enable_event_checking(PARROT_INTERP);
824 #else
826 struct Parrot_Interp_;
827 typedef struct Parrot_Interp_ *Parrot_Interp;
829 typedef void * *(*native_func_t)(Parrot_Interp interp,
830 void *cur_opcode,
831 void *start_code);
833 #endif /* PARROT_IN_CORE */
834 #endif /* PARROT_INTERPRETER_H_GUARD */
837 * Local variables:
838 * c-file-style: "parrot"
839 * End:
840 * vim: expandtab shiftwidth=4: