1 /* interpreter.h 2 * Copyright (C) 2001-2014, Parrot Foundation. 3 * Overview: 4 * The interpreter API handles running the operations 5 */ 6 7 #ifndef PARROT_INTERPRETER_H_GUARD 8 #define PARROT_INTERPRETER_H_GUARD 9 10 /* These should be visible to embedders. */ 11 12 /* General flags */ 13 /* &gen_from_enum(interpflags.pasm) */ 14 typedef enum { 15 PARROT_NO_FLAGS = 0x00, 16 PARROT_BOUNDS_FLAG = 0x04, /* We're tracking byte code bounds */ 17 PARROT_PROFILE_FLAG = 0x08, /* gathering profile information */ 18 PARROT_GC_DEBUG_FLAG = 0x10, /* debugging memory management */ 19 20 PARROT_EXTERN_CODE_FLAG = 0x100, /* reusing another interp's code */ 21 PARROT_DESTROY_FLAG = 0x200, /* the last interpreter shall cleanup */ 22 23 PARROT_IS_THREAD = 0x1000, /* interpreter is a thread */ 24 PARROT_THR_FLAG_NEW_PMC = 0x2000, /* flag new PMCs */ 25 PARROT_THR_THREAD_POOL = 0x4000 /* type3 threads */ 26 27 } Parrot_Interp_flag; 28 /* &end_gen */ 29 30 /* &gen_from_enum(interpdebug.pasm) */ 31 typedef enum { 32 PARROT_NO_DEBUG = 0x00, 33 PARROT_MEM_STAT_DEBUG_FLAG = 0x01, /* memory/gc usage summary */ 34 PARROT_BACKTRACE_DEBUG_FLAG = 0x02, /* print bt in exception */ 35 PARROT_JIT_DEBUG_FLAG = 0x04, /* create jit stabs file (unused) */ 36 PARROT_START_DEBUG_FLAG = 0x08, 37 PARROT_THREAD_DEBUG_FLAG = 0x10, 38 PARROT_EVAL_DEBUG_FLAG = 0x20, /* create EVAL_n file */ 39 PARROT_REG_DEBUG_FLAG = 0x40, /* fill I,N with garbage */ 40 PARROT_CTX_DESTROY_DEBUG_FLAG = 0x80, /* ctx of a sub is gone */ 41 PARROT_GC_DETAIL_DEBUG_FLAG = 0x100, /* formerly DETAIL_MEMORY_DEBUG */ 42 PARROT_MEM_DETAIL_DEBUG_FLAG = 0x200, /* every single malloc/free */ 43 PARROT_ALL_DEBUG_FLAGS = 0xffff 44 } Parrot_debug_flags; 45 /* &end_gen */ 46 47 /* &gen_from_enum(interptrace.pasm) */ 48 typedef enum { 49 PARROT_NO_TRACE = 0x00, 50 PARROT_TRACE_OPS_FLAG = 0x01, /* op execution trace */ 51 PARROT_TRACE_FIND_METH_FLAG = 0x02, /* find_method */ 52 PARROT_TRACE_SUB_CALL_FLAG = 0x04, /* invoke/retcc, not with --optimizing */ 53 PARROT_TRACE_CORO_STATE_FLAG = 0x08, /* not with --optimizing */ 54 PARROT_TRACE_OPS_PMC_FLAG = 0x10, /* verbose op: pmc flags */ 55 PARROT_TRACE_ARRAY_STATE_FLAG = 0x20, /* array state, not with --optimizing */ 56 PARROT_ALL_TRACE_FLAGS = 0xffff 57 } Parrot_trace_flags; 58 /* &end_gen */ 59 60 typedef enum { /* sync with compilers/imcc/debug.h */ 61 PARROT_IMCC_DEBUG_NONE = 0x0000, 62 PARROT_IMCC_VERBOSE = 0x0001, 63 PARROT_IMCC_DEBUG_MK_CONST = 0x0002, 64 PARROT_IMCC_DEBUG_PARSER = 0x0004, /* sets yydebug */ 65 PARROT_IMCC_DEBUG_IMC = 0x0008, /* dump symreg, insns */ 66 PARROT_IMCC_DEBUG_CFG = 0x0010, 67 PARROT_IMCC_DEBUG_OPT1 = 0x0020, 68 PARROT_IMCC_DEBUG_OPT2 = 0x0040, 69 PARROT_IMCC_DEBUG_SPILL = 0x0080, 70 PARROT_IMCC_DEBUG_AST = 0x0100, 71 PARROT_IMCC_DEBUG_PBC = 0x1000, 72 PARROT_IMCC_DEBUG_PBC_CONST = 0x2000, 73 PARROT_IMCC_DEBUG_PBC_FIXUP = 0x4000, 74 PARROT_IMCC_DEBUG_ALL = 0xffff 75 } Parrot_imcc_dflags; 76 77 typedef enum { /* sync with compilers/imcc/imc.h */ 78 PARROT_IMCC_OPT_NONE = 0x000, 79 PARROT_IMCC_OPT_PRE = 0x001, /* -O1 */ 80 PARROT_IMCC_OPT_CFG = 0x002, /* -O2 */ 81 PARROT_IMCC_OPT_SUB = 0x004, /* -Oc */ 82 PARROT_IMCC_OPT_PASM = 0x100, /* -Op */ 83 } Parrot_imcc_opt_flags; 84 85 /* &gen_from_enum(interpcores.pasm) */ 86 typedef enum { 87 PARROT_SLOW_CORE, /* slow bounds/trace core */ 88 PARROT_FUNCTION_CORE = PARROT_SLOW_CORE, 89 PARROT_FAST_CORE = 0x01, /* fast DO_OP core */ 90 PARROT_EXEC_CORE = 0x20, /* TODO Parrot_exec_run variants */ 91 PARROT_GC_DEBUG_CORE = 0x40, /* run GC before each op */ 92 PARROT_DEBUGGER_CORE = 0x80, /* used by parrot debugger */ 93 PARROT_PROFILING_CORE = 0x160, /* used by parrot debugger */ 94 PARROT_SUBPROF_SUB_CORE = 0x200, /* sub profiler core, sub mode */ 95 PARROT_SUBPROF_HLL_CORE = 0x201, /* sub profiler core, hll mode */ 96 PARROT_SUBPROF_OPS_CORE = 0x202 /* sub profiler core, ops mode */ 97 } Parrot_Run_core_t; 98 /* &end_gen */ 99 100 /* &gen_from_enum(cloneflags.pasm) */ 101 typedef enum { 102 PARROT_CLONE_CODE = 0x1, /* active code segments 103 * XXX interaction with lexicals 104 */ 105 PARROT_CLONE_GLOBALS = 0x2, /* global stash */ 106 PARROT_CLONE_RUNOPS = 0x4, /* runops choice */ 107 PARROT_CLONE_INTERP_FLAGS = 0x8, /* bounds checking and 108 * debugging flags */ 109 PARROT_CLONE_HLL = 0x10, /* clone HLL setting */ 110 PARROT_CLONE_CLASSES = 0x20, /* clone usermade classes */ 111 PARROT_CLONE_LIBRARIES = 0x40, /* clone loaded library set */ 112 /* flags that won't be initially implemented */ 113 PARROT_CLONE_CC = 0x80, /* clone current continuation -- 114 * fork()-like cloning (requires 115 * cloned code segments); probably 116 * would only work if runloop_level is 1 */ 117 118 /* combinations of flags */ 119 PARROT_CLONE_DEFAULT = 0x7f /* everything but CC */ 120 } Parrot_clone_flags; 121 /* &end_gen */ 122 123 /* Codes used by long jumps to runloop */ 124 #define PARROT_JMP_EXCEPTION_HANDLED 1 125 #define PARROT_JMP_EXCEPTION_FROM_C 2 126 #define PARROT_JMP_EXCEPTION_FINALIZED 3 127 128 struct parrot_interp_t; 129 130 /* One of the most common shim arguments is the interpreter itself, so it 131 * gets its own macro. */ 132 #define PARROT_INTERP /*@notnull@*/ /*@in@*/ ARGMOD(Parrot_Interp interp) 133 #define NULLOK_INTERP /*@null@*/ /*@in@*/ ARGMOD(Parrot_Interp interp) 134 #define SHIM_INTERP /*@unused@*/ /*@notnull@*/ ARGIN(Parrot_Interp interp_unused) \ 135 __attribute__unused__ 136 137 138 #ifdef PARROT_IN_CORE 139 140 #define Parrot_Vtable struct _vtable* 141 142 typedef Parrot_Interp_flag Interp_flags; 143 typedef Parrot_Run_core_t Run_Cores; 144 145 #define Interp_flags_SET(interp, flag) ((interp)->flags |= (flag)) 146 #define Interp_flags_CLEAR(interp, flag) ((interp)->flags &= ~(flag)) 147 #define Interp_flags_TEST(interp, flag) (((interp)->flags & (flag)) == (flag)) 148 149 #define Interp_debug_SET(interp, flag) ((interp)->debug_flags |= (flag)) 150 #define Interp_debug_CLEAR(interp, flag) ((interp)->debug_flags &= ~(flag)) 151 #define Interp_debug_TEST(interp, flag) (((interp)->debug_flags & (flag)) == (flag)) 152 153 #define Interp_trace_SET(interp, flag) Parrot_pcc_trace_flags_on(interp, interp->ctx, (flag)) 154 #define Interp_trace_CLEAR(interp, flag) Parrot_pcc_trace_flags_off(interp, interp->ctx, (flag)) 155 #define Interp_trace_TEST(interp, flag) Parrot_pcc_trace_flags_test(interp, interp->ctx, (flag)) 156 157 #define Interp_core_SET(interp, core) ((interp)->run_core = (core)) 158 #define Interp_core_TEST(interp, core) ((interp)->run_core == (core)) 159 160 #include "parrot/context.h" 161 #include "parrot/parrot.h" 162 #include "parrot/warnings.h" 163 164 #include "parrot/op.h" 165 #include "parrot/oplib.h" 166 167 #include "parrot/debugger.h" 168 #include "parrot/multidispatch.h" 169 #include "parrot/call.h" 170 #include "parrot/gc_api.h" 171 #include "parrot/thread.h" 172 173 typedef struct warnings_t { 174 Warnings_classes classes; 175 } *Warnings; 176 177 struct _Caches; /* caches .h */ 178 179 /* Get Context from interpreter */ 180 #define CONTEXT(interp) Parrot_pcc_get_context_struct((interp), (interp)->ctx) 181 182 /* 183 * Helper macros to fetch fields from context. 184 * 185 * Not considered as part of public API. Should be replaced with proper accessor 186 * functions to manipulate Context. 187 */ 188 #define CURRENT_CONTEXT(interp) ((interp)->ctx) 189 190 struct _handler_node_t; /* forward def - exit.h */ 191 192 /* The actual interpreter structure */ 193 struct parrot_interp_t { 194 PMC *ctx; /* current Context */ 195 196 struct GC_Subsystem *gc_sys; /* functions and data specific 197 to current GC subsystem*/ 198 199 PMC *gc_registry; /* root set of registered PMCs */ 200 201 PMC *class_hash; /* Hash of classes */ 202 VTABLE **vtables; /* array of vtable ptrs */ 203 int n_vtable_max; /* highest used type */ 204 int n_vtable_alloced; /* alloced vtable space */ 205 206 struct _ParrotIOData *piodata; /* interpreter's IO system */ 207 208 op_func_t *evc_func_table; /* event check opcode dispatch */ 209 size_t evc_func_table_size; 210 211 int n_libs; /* count of libs below */ 212 op_lib_t **all_op_libs; /* all loaded opcode libraries */ 213 214 INTVAL flags; /* Various interpreter flags that 215 * signal that runops should do 216 * something */ 217 218 UINTVAL debug_flags; /* debug settings */ 219 220 struct runcore_t *run_core; /* type of core to run the ops */ 221 struct runcore_t **cores; /* array of known runcores */ 222 UINTVAL num_cores; /* number of known runcores */ 223 224 INTVAL resume_flag; 225 size_t resume_offset; 226 227 PackFile_ByteCode *code; /* The code we are executing */ 228 229 Hash *op_hash; /* mapping from op names to op_info_t */ 230 231 PDB_t *pdb; /* debug /trace system */ 232 233 void *lo_var_ptr; /* Pointer to memory on runops 234 * system stack */ 235 236 Interp *parent_interpreter; 237 238 /* per interpreter global vars */ 239 INTVAL world_inited; /* world_init_once() is done */ 240 241 UINTVAL hash_seed; /* STRING hash seed */ 242 243 PMC *iglobals; /* FixedPMCArray of PMCs, containing: */ 244 /* 0: PMC *Parrot_base_classname_hash; hash containing name->base_type */ 245 /* 1: PMC *Parrot_compreg_hash; hash containing assembler/compilers */ 246 /* 2: PMC *Argv; list of argv */ 247 /* 3: PMC *NCI func hash hash of NCI funcs */ 248 /* 4: PMC *ParrotInterpreter that's me */ 249 /* 5: PMC *Dyn_libs dynamically loaded ParrotLibrary */ 250 /* 6: PMC *Config_Hash Hash of config settings */ 251 /* 7: PMC *Lib_Paths LoL of search paths */ 252 /* 8: PMC *PBC_Libs Hash of load_bytecode cde */ 253 /* 9: PMC *Executable String PMC with name from argv[0]. */ 254 255 256 PMC *HLL_info; /* OrderedHash of HLL names and types */ 257 PMC *HLL_namespace; /* ResizablePMCArray cache of HLL toplevel ns */ 258 PMC *HLL_entries; /* ResizablePMCArray */ 259 260 PMC *root_namespace; /* namespace hash */ 261 PMC *scheduler; /* concurrency scheduler */ 262 PMC *cur_task; 263 264 MMD_Cache *op_mmd_cache; /* MMD cache for builtins. */ 265 266 struct _Caches * caches; /* see caches.h */ 267 268 STRING **const_cstring_table; /* CONST_STRING(x) items */ 269 Hash *const_cstring_hash; /* cache of const_string items */ 270 271 struct _handler_node_t *exit_handler_list;/* exit.c */ 272 int sleeping; /* used during sleep in events */ 273 274 struct parrot_runloop_t *current_runloop; /* internal runloop jump point stack */ 275 struct parrot_runloop_t *runloop_jmp_free_list; /* and free list */ 276 277 int current_runloop_level; /* for reentering run loop */ 278 int current_runloop_id; 279 int runloop_id_counter; /* for synthesizing runloop ids. */ 280 281 UINTVAL last_alarm; /* has an alarm triggered? */ 282 FLOATVAL quantum_done; /* expiration of current quantum */ 283 284 struct _Thread_data *thread_data; /* thread specific items */ 285 int wake_up; 286 Parrot_cond sleep_cond; 287 Parrot_mutex sleep_mutex; 288 289 UINTVAL recursion_limit; /* Sub call recursion limit */ 290 291 /* during a call sequencer the caller fills these objects 292 * inside the invoke these get moved to the context structure */ 293 PMC *current_cont; /* the return continuation PMC */ 294 Parrot_jump_buff *api_jmp_buf; /* jmp point out of Parrot */ 295 PMC * final_exception; /* Final exception PMC */ 296 INTVAL exit_code; 297 }; 298 299 /* typedef struct parrot_interp_t Interp; done in parrot.h so that 300 interpreter.h's prereq headers can 301 use 'Interp' */ 302 303 typedef enum { 304 RESUME_NONE = 0x00, 305 RESUME_RESTART = 0x01, 306 RESUME_INITIAL = 0x04 307 } resume_flag_enum; 308 309 /* &gen_from_enum(iglobals.pasm) */ 310 typedef enum { 311 IGLOBALS_CLASSNAME_HASH, 312 IGLOBALS_COMPREG_HASH, 313 IGLOBALS_ARGV_LIST, 314 IGLOBALS_NCI_FUNCS, 315 IGLOBALS_NCI_FB_CB, 316 IGLOBALS_NCI_FB_UD, 317 IGLOBALS_INTERPRETER, /* this interpreter as ParrotInterpreter PMC */ 318 IGLOBALS_DYN_LIBS, /* Hash of ParrotLibrary loaded dynamic ext */ 319 IGLOBALS_CONFIG_HASH, 320 IGLOBALS_LIB_PATHS, /* LoL of search paths and dynamic ext */ 321 IGLOBALS_PBC_LIBS, /* Hash of load_bytecode cde */ 322 IGLOBALS_EXECUTABLE, /* How Parrot was invoked (from argv[0]) */ 323 IGLOBALS_LOADED_PBCS, /* Hash of .pbc file -> PackfileView */ 324 325 IGLOBALS_SIZE 326 } iglobals_enum; 327 /* &end_gen */ 328 329 PARROT_DATA STRING *STRINGNULL; /* a single null STRING */ 330 #define STRING_IS_NULL(s) ((s) == STRINGNULL || (s) == NULL) 331 332 PARROT_DATA PMC *PMCNULL; /* Holds single null PMC */ 333 #define PMC_IS_NULL(pmc) ((pmc) == PMCNULL || (pmc) == NULL) 334 335 #define STRING_IS_EMPTY(s) ((s)->strlen == 0) 336 337 /** 338 * WARN: 339 * Remove all of these attributes when we wipe out sysinfo. 340 * I have kept these here for consistency in parameters between 341 * sysinfo and interpinfo. 342 */ 343 /* &gen_from_def(sysinfo.pasm) prefix(SYSINFO_) */ 344 #define PARROT_INTSIZE 16 345 #define PARROT_FLOATSIZE 17 346 #define PARROT_POINTERSIZE 18 347 #define PARROT_OS 30 348 #define PARROT_OS_VERSION 31 349 #define PARROT_OS_VERSION_NUMBER 32 350 #define CPU_ARCH 33 351 #define CPU_TYPE 34 352 #define PARROT_INTMAX 19 353 #define PARROT_INTMIN 20 354 /* &end_gen */ 355 356 typedef opcode_t *(*native_func_t)(PARROT_INTERP, 357 opcode_t * cur_opcode, 358 opcode_t * start_code); 359 360 typedef PMC *(*Parrot_compiler_func_t)(PARROT_INTERP, 361 const char * program); 362 363 /* HEADERIZER BEGIN: src/interp/api.c */ 364 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */ 365 366 PARROT_EXPORT 367 PARROT_DEPRECATED 368 PARROT_CANNOT_RETURN_NULL 369 PMC * clone_interp(PARROT_INTERP, INTVAL flags) 370 __attribute__nonnull__(1); 371 372 PARROT_EXPORT 373 PARROT_CANNOT_RETURN_NULL 374 PARROT_MALLOC 375 Parrot_Interp Parrot_interp_allocate_interpreter( 376 ARGIN_NULLOK(Interp *parent), 377 INTVAL flags); 378 379 PARROT_EXPORT 380 void Parrot_interp_clear_debug(PARROT_INTERP, UINTVAL flag) 381 __attribute__nonnull__(1); 382 383 PARROT_EXPORT 384 void Parrot_interp_clear_flag(PARROT_INTERP, INTVAL flag) 385 __attribute__nonnull__(1); 386 387 PARROT_EXPORT 388 void Parrot_interp_clear_trace(PARROT_INTERP, UINTVAL flag) 389 __attribute__nonnull__(1); 390 391 PARROT_EXPORT 392 PARROT_CANNOT_RETURN_NULL 393 PMC * Parrot_interp_clone(PARROT_INTERP, INTVAL flags) 394 __attribute__nonnull__(1); 395 396 PARROT_EXPORT 397 PARROT_CANNOT_RETURN_NULL 398 PMC * Parrot_interp_compile_file(PARROT_INTERP, 399 ARGIN(PMC *compiler), 400 ARGIN(STRING *fullname)) 401 __attribute__nonnull__(1) 402 __attribute__nonnull__(2) 403 __attribute__nonnull__(3); 404 405 PARROT_EXPORT 406 PARROT_CAN_RETURN_NULL 407 PARROT_WARN_UNUSED_RESULT 408 Parrot_PMC Parrot_interp_compile_string(PARROT_INTERP, 409 ARGIN(PMC *compiler), 410 ARGIN(STRING *code)) 411 __attribute__nonnull__(1) 412 __attribute__nonnull__(2) 413 __attribute__nonnull__(3); 414 415 PARROT_EXPORT 416 void Parrot_interp_destroy(PARROT_INTERP) 417 __attribute__nonnull__(1); 418 419 PARROT_EXPORT 420 PARROT_WARN_UNUSED_RESULT 421 PARROT_CANNOT_RETURN_NULL 422 PMC * Parrot_interp_get_compiler(PARROT_INTERP, ARGIN(STRING *type)) 423 __attribute__nonnull__(1) 424 __attribute__nonnull__(2); 425 426 PARROT_EXPORT 427 PARROT_CANNOT_RETURN_NULL 428 Interp * Parrot_interp_get_from_pmc(ARGIN(PMC * interp_pmc)) 429 __attribute__nonnull__(1); 430 431 PARROT_EXPORT 432 PARROT_WARN_UNUSED_RESULT 433 INTVAL Parrot_interp_info(PARROT_INTERP, INTVAL what) 434 __attribute__nonnull__(1); 435 436 PARROT_EXPORT 437 PARROT_WARN_UNUSED_RESULT 438 PARROT_CANNOT_RETURN_NULL 439 PMC* Parrot_interp_info_p(PARROT_INTERP, INTVAL what) 440 __attribute__nonnull__(1); 441 442 PARROT_EXPORT 443 PARROT_WARN_UNUSED_RESULT 444 PARROT_CANNOT_RETURN_NULL 445 STRING* Parrot_interp_info_s(PARROT_INTERP, INTVAL what) 446 __attribute__nonnull__(1); 447 448 PARROT_EXPORT 449 void Parrot_interp_init_stacktop(PARROT_INTERP, ARGIN(void *stack_top)) 450 __attribute__nonnull__(1) 451 __attribute__nonnull__(2); 452 453 PARROT_EXPORT 454 PARROT_CANNOT_RETURN_NULL 455 Parrot_Interp Parrot_interp_initialize_interpreter(PARROT_INTERP, 456 ARGIN(Parrot_GC_Init_Args *args)) 457 __attribute__nonnull__(1) 458 __attribute__nonnull__(2); 459 460 PARROT_EXPORT 461 PARROT_CANNOT_RETURN_NULL 462 PARROT_MALLOC 463 Parrot_Interp Parrot_interp_make_interpreter( 464 ARGIN_NULLOK(Interp *parent), 465 INTVAL flags); 466 467 PARROT_EXPORT 468 void Parrot_interp_mark_method_writes(PARROT_INTERP, 469 int type, 470 ARGIN(const char *name)) 471 __attribute__nonnull__(1) 472 __attribute__nonnull__(3); 473 474 PARROT_EXPORT 475 PARROT_CANNOT_RETURN_NULL 476 PARROT_MALLOC 477 Parrot_Interp Parrot_interp_new(ARGIN_NULLOK(Parrot_Interp parent)); 478 479 PARROT_EXPORT 480 void Parrot_interp_register_native_pcc_method_in_ns(PARROT_INTERP, 481 const int type, 482 ARGIN(void *func), 483 ARGIN(STRING *name), 484 ARGIN(STRING *signature)) 485 __attribute__nonnull__(1) 486 __attribute__nonnull__(3) 487 __attribute__nonnull__(4) 488 __attribute__nonnull__(5); 489 490 PARROT_EXPORT 491 void Parrot_interp_register_nci_method(PARROT_INTERP, 492 const int type, 493 ARGIN(void *func), 494 ARGIN(const char *name), 495 ARGIN(const char *proto)) 496 __attribute__nonnull__(1) 497 __attribute__nonnull__(3) 498 __attribute__nonnull__(4) 499 __attribute__nonnull__(5); 500 501 PARROT_EXPORT 502 void Parrot_interp_set_compiler(PARROT_INTERP, 503 ARGIN(STRING *type), 504 ARGIN(PMC *compiler)) 505 __attribute__nonnull__(1) 506 __attribute__nonnull__(2) 507 __attribute__nonnull__(3); 508 509 PARROT_EXPORT 510 void Parrot_interp_set_debug(PARROT_INTERP, UINTVAL flag) 511 __attribute__nonnull__(1); 512 513 PARROT_EXPORT 514 void Parrot_interp_set_executable_name(PARROT_INTERP, 515 ARGIN(STRING * const name)) 516 __attribute__nonnull__(1) 517 __attribute__nonnull__(2); 518 519 PARROT_EXPORT 520 void Parrot_interp_set_flag(PARROT_INTERP, INTVAL flag) 521 __attribute__nonnull__(1); 522 523 PARROT_EXPORT 524 void Parrot_interp_set_run_core(PARROT_INTERP, Parrot_Run_core_t core) 525 __attribute__nonnull__(1); 526 527 PARROT_EXPORT 528 void Parrot_interp_set_trace(PARROT_INTERP, UINTVAL flag) 529 __attribute__nonnull__(1); 530 531 PARROT_EXPORT 532 void Parrot_interp_set_warnings(PARROT_INTERP, Parrot_warnclass wc) 533 __attribute__nonnull__(1); 534 535 PARROT_EXPORT 536 PARROT_PURE_FUNCTION 537 Parrot_UInt Parrot_interp_test_debug(PARROT_INTERP, UINTVAL flag) 538 __attribute__nonnull__(1); 539 540 PARROT_EXPORT 541 PARROT_PURE_FUNCTION 542 Parrot_Int Parrot_interp_test_flag(PARROT_INTERP, INTVAL flag) 543 __attribute__nonnull__(1); 544 545 PARROT_EXPORT 546 PARROT_PURE_FUNCTION 547 Parrot_UInt Parrot_interp_test_trace(PARROT_INTERP, UINTVAL flag) 548 __attribute__nonnull__(1); 549 550 void Parrot_interp_clear_emergency_interpreter(void); 551 PARROT_CAN_RETURN_NULL 552 Interp* Parrot_interp_get_emergency_interpreter(void); 553 554 void Parrot_interp_really_destroy(PARROT_INTERP, int exit_code, void *arg) 555 __attribute__nonnull__(1); 556 557 #define ASSERT_ARGS_clone_interp __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 558 PARROT_ASSERT_ARG(interp)) 559 #define ASSERT_ARGS_Parrot_interp_allocate_interpreter \ 560 __attribute__unused__ int _ASSERT_ARGS_CHECK = (0) 561 #define ASSERT_ARGS_Parrot_interp_clear_debug __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 562 PARROT_ASSERT_ARG(interp)) 563 #define ASSERT_ARGS_Parrot_interp_clear_flag __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 564 PARROT_ASSERT_ARG(interp)) 565 #define ASSERT_ARGS_Parrot_interp_clear_trace __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 566 PARROT_ASSERT_ARG(interp)) 567 #define ASSERT_ARGS_Parrot_interp_clone __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 568 PARROT_ASSERT_ARG(interp)) 569 #define ASSERT_ARGS_Parrot_interp_compile_file __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 570 PARROT_ASSERT_ARG(interp) \ 571 , PARROT_ASSERT_ARG(compiler) \ 572 , PARROT_ASSERT_ARG(fullname)) 573 #define ASSERT_ARGS_Parrot_interp_compile_string __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 574 PARROT_ASSERT_ARG(interp) \ 575 , PARROT_ASSERT_ARG(compiler) \ 576 , PARROT_ASSERT_ARG(code)) 577 #define ASSERT_ARGS_Parrot_interp_destroy __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 578 PARROT_ASSERT_ARG(interp)) 579 #define ASSERT_ARGS_Parrot_interp_get_compiler __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 580 PARROT_ASSERT_ARG(interp) \ 581 , PARROT_ASSERT_ARG(type)) 582 #define ASSERT_ARGS_Parrot_interp_get_from_pmc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 583 PARROT_ASSERT_ARG(interp_pmc)) 584 #define ASSERT_ARGS_Parrot_interp_info __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 585 PARROT_ASSERT_ARG(interp)) 586 #define ASSERT_ARGS_Parrot_interp_info_p __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 587 PARROT_ASSERT_ARG(interp)) 588 #define ASSERT_ARGS_Parrot_interp_info_s __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 589 PARROT_ASSERT_ARG(interp)) 590 #define ASSERT_ARGS_Parrot_interp_init_stacktop __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 591 PARROT_ASSERT_ARG(interp) \ 592 , PARROT_ASSERT_ARG(stack_top)) 593 #define ASSERT_ARGS_Parrot_interp_initialize_interpreter \ 594 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 595 PARROT_ASSERT_ARG(interp) \ 596 , PARROT_ASSERT_ARG(args)) 597 #define ASSERT_ARGS_Parrot_interp_make_interpreter \ 598 __attribute__unused__ int _ASSERT_ARGS_CHECK = (0) 599 #define ASSERT_ARGS_Parrot_interp_mark_method_writes \ 600 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 601 PARROT_ASSERT_ARG(interp) \ 602 , PARROT_ASSERT_ARG(name)) 603 #define ASSERT_ARGS_Parrot_interp_new __attribute__unused__ int _ASSERT_ARGS_CHECK = (0) 604 #define ASSERT_ARGS_Parrot_interp_register_native_pcc_method_in_ns \ 605 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 606 PARROT_ASSERT_ARG(interp) \ 607 , PARROT_ASSERT_ARG(func) \ 608 , PARROT_ASSERT_ARG(name) \ 609 , PARROT_ASSERT_ARG(signature)) 610 #define ASSERT_ARGS_Parrot_interp_register_nci_method \ 611 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 612 PARROT_ASSERT_ARG(interp) \ 613 , PARROT_ASSERT_ARG(func) \ 614 , PARROT_ASSERT_ARG(name) \ 615 , PARROT_ASSERT_ARG(proto)) 616 #define ASSERT_ARGS_Parrot_interp_set_compiler __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 617 PARROT_ASSERT_ARG(interp) \ 618 , PARROT_ASSERT_ARG(type) \ 619 , PARROT_ASSERT_ARG(compiler)) 620 #define ASSERT_ARGS_Parrot_interp_set_debug __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 621 PARROT_ASSERT_ARG(interp)) 622 #define ASSERT_ARGS_Parrot_interp_set_executable_name \ 623 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 624 PARROT_ASSERT_ARG(interp) \ 625 , PARROT_ASSERT_ARG(name)) 626 #define ASSERT_ARGS_Parrot_interp_set_flag __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 627 PARROT_ASSERT_ARG(interp)) 628 #define ASSERT_ARGS_Parrot_interp_set_run_core __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 629 PARROT_ASSERT_ARG(interp)) 630 #define ASSERT_ARGS_Parrot_interp_set_trace __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 631 PARROT_ASSERT_ARG(interp)) 632 #define ASSERT_ARGS_Parrot_interp_set_warnings __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 633 PARROT_ASSERT_ARG(interp)) 634 #define ASSERT_ARGS_Parrot_interp_test_debug __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 635 PARROT_ASSERT_ARG(interp)) 636 #define ASSERT_ARGS_Parrot_interp_test_flag __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 637 PARROT_ASSERT_ARG(interp)) 638 #define ASSERT_ARGS_Parrot_interp_test_trace __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 639 PARROT_ASSERT_ARG(interp)) 640 #define ASSERT_ARGS_Parrot_interp_clear_emergency_interpreter \ 641 __attribute__unused__ int _ASSERT_ARGS_CHECK = (0) 642 #define ASSERT_ARGS_Parrot_interp_get_emergency_interpreter \ 643 __attribute__unused__ int _ASSERT_ARGS_CHECK = (0) 644 #define ASSERT_ARGS_Parrot_interp_really_destroy __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 645 PARROT_ASSERT_ARG(interp)) 646 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */ 647 /* HEADERIZER END: src/interp/api.c */ 648 649 /* HEADERIZER BEGIN: src/interp/inter_cb.c */ 650 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */ 651 652 PARROT_EXPORT 653 void Parrot_callback_C( 654 ARGIN(char *external_data), 655 ARGMOD_NULLOK(PMC *user_data)) 656 __attribute__nonnull__(1) 657 FUNC_MODIFIES(*user_data); 658 659 PARROT_EXPORT 660 void Parrot_callback_D( 661 ARGMOD(PMC *user_data), 662 ARGMOD_NULLOK(char *external_data)) 663 __attribute__nonnull__(1) 664 FUNC_MODIFIES(*user_data) 665 FUNC_MODIFIES(*external_data); 666 667 PARROT_EXPORT 668 PARROT_CANNOT_RETURN_NULL 669 PARROT_WARN_UNUSED_RESULT 670 PMC* Parrot_make_cb(PARROT_INTERP, 671 ARGMOD(PMC* sub), 672 ARGIN(PMC* user_data), 673 ARGIN(STRING *cb_signature)) 674 __attribute__nonnull__(1) 675 __attribute__nonnull__(2) 676 __attribute__nonnull__(3) 677 __attribute__nonnull__(4) 678 FUNC_MODIFIES(* sub); 679 680 PARROT_EXPORT 681 void Parrot_run_callback(PARROT_INTERP, 682 ARGMOD(PMC* user_data), 683 ARGIN(void* external_data)) 684 __attribute__nonnull__(1) 685 __attribute__nonnull__(2) 686 __attribute__nonnull__(3) 687 FUNC_MODIFIES(* user_data); 688 689 #define ASSERT_ARGS_Parrot_callback_C __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 690 PARROT_ASSERT_ARG(external_data)) 691 #define ASSERT_ARGS_Parrot_callback_D __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 692 PARROT_ASSERT_ARG(user_data)) 693 #define ASSERT_ARGS_Parrot_make_cb __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 694 PARROT_ASSERT_ARG(interp) \ 695 , PARROT_ASSERT_ARG(sub) \ 696 , PARROT_ASSERT_ARG(user_data) \ 697 , PARROT_ASSERT_ARG(cb_signature)) 698 #define ASSERT_ARGS_Parrot_run_callback __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 699 PARROT_ASSERT_ARG(interp) \ 700 , PARROT_ASSERT_ARG(user_data) \ 701 , PARROT_ASSERT_ARG(external_data)) 702 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */ 703 /* HEADERIZER END: src/interp/inter_cb.c */ 704 705 #else /* !PARROT_IN_CORE */ 706 707 typedef void * *(*native_func_t)(PARROT_INTERP, 708 void *cur_opcode, 709 void *start_code); 710 711 #endif /* PARROT_IN_CORE */ 712 713 #ifndef PMC_IS_NULL 714 # define PMC_IS_NULL(pmc) Parrot_pmc_is_null(NULL, (pmc)) 715 #endif 716 #ifndef STRING_IS_NULL 717 # define STRING_IS_NULL(s) ((s) == NULL || Parrot_str_is_null(NULL, (s)) 718 #endif 719 720 #endif /* PARROT_INTERPRETER_H_GUARD */ 721 722 /* 723 * Local variables: 724 * c-file-style: "parrot" 725 * End: 726 * vim: expandtab shiftwidth=4 cinoptions='\:2=2' : 727 */ 728