Ticket #1563: runcore_purge.45837.diff
File runcore_purge.45837.diff, 124.8 KB (added by jkeenan, 12 years ago) |
---|
-
runtime/parrot/library/distutils.pir
1276 1276 .sub 'get_cores' 1277 1277 $P0 = new 'Hash' 1278 1278 $P0['C'] = '' 1279 # $P0['CGP'] = '_cgp'1280 # $P0['CGoto'] = '_cg'1281 $P0['CSwitch'] = '_switch'1282 1279 .return ($P0) 1283 1280 .end 1284 1281 … … 4284 4281 flags .= " " 4285 4282 $S0 = $P0['cc_hasjit'] 4286 4283 flags .= $S0 4287 flags .= " "4288 $S0 = $P0['cg_flag']4289 flags .= $S04290 4284 .return (flags) 4291 4285 .end 4292 4286 -
src/embed.c
336 336 case PARROT_FAST_CORE: 337 337 Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "fast")); 338 338 break; 339 case PARROT_SWITCH_CORE:340 Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "switch"));341 break;342 case PARROT_CGP_CORE:343 Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "cgp"));344 break;345 case PARROT_CGOTO_CORE:346 Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "cgoto"));347 break;348 339 case PARROT_EXEC_CORE: 349 340 Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "exec")); 350 341 break; -
src/dynoplibs/Rules.in
14 14 src/dynoplibs/obscure_ops.c: src/dynoplibs/obscure.ops $(BUILD_TOOLS_DIR)/ops2c.pl 15 15 $(PERL) $(BUILD_TOOLS_DIR)/ops2c.pl C --dynamic src/dynoplibs/obscure.ops 16 16 17 $(DYNEXT_DIR)/obscure_ops_switch$(LOAD_EXT): src/dynoplibs/obscure_ops_switch$(O) $(LIBPARROT)18 $(LD) @ld_out@$@ src/dynoplibs/obscure_ops_switch$(O) $(LINKARGS)19 #IF(win32): if exist $@.manifest mt.exe -nologo -manifest $@.manifest -outputresource:$@;220 #IF(cygwin or hpux): $(CHMOD) 0775 $@21 22 src/dynoplibs/obscure_ops_switch$(O): include/pmc/pmc_parrotlibrary.h include/pmc/pmc_callcontext.h src/dynoplibs/obscure_ops_switch.c $(PARROT_H_HEADERS)23 24 src/dynoplibs/obscure_ops_switch.h: src/dynoplibs/obscure_ops_switch.c25 26 src/dynoplibs/obscure_ops_switch.c: src/dynoplibs/obscure.ops $(BUILD_TOOLS_DIR)/ops2c.pl27 $(PERL) $(BUILD_TOOLS_DIR)/ops2c.pl CSwitch --dynamic src/dynoplibs/obscure.ops28 29 $(DYNEXT_DIR)/obscure_ops_cg$(LOAD_EXT): src/dynoplibs/obscure_ops_cg$(O) $(LIBPARROT)30 $(LD) @ld_out@$@ src/dynoplibs/obscure_ops_cg$(O) $(LINKARGS)31 #IF(win32): if exist $@.manifest mt.exe -nologo -manifest $@.manifest -outputresource:$@;232 #IF(cygwin or hpux): $(CHMOD) 0775 $@33 34 src/dynoplibs/obscure_ops_cg$(O): include/pmc/pmc_parrotlibrary.h include/pmc/pmc_callcontext.h src/dynoplibs/obscure_ops_cg.c $(PARROT_H_HEADERS)35 36 src/dynoplibs/obscure_ops_cg.h: src/dynoplibs/obscure_ops_cg.c37 38 src/dynoplibs/obscure_ops_cg.c: src/dynoplibs/obscure.ops $(BUILD_TOOLS_DIR)/ops2c.pl39 $(PERL) $(BUILD_TOOLS_DIR)/ops2c.pl CGoto --dynamic src/dynoplibs/obscure.ops40 41 $(DYNEXT_DIR)/obscure_ops_cgp$(LOAD_EXT): src/dynoplibs/obscure_ops_cgp$(O) $(LIBPARROT)42 $(LD) @ld_out@$@ src/dynoplibs/obscure_ops_cgp$(O) $(LINKARGS)43 #IF(win32): if exist $@.manifest mt.exe -nologo -manifest $@.manifest -outputresource:$@;244 #IF(cygwin or hpux): $(CHMOD) 0775 $@45 46 src/dynoplibs/obscure_ops_cgp$(O): include/pmc/pmc_parrotlibrary.h include/pmc/pmc_callcontext.h src/dynoplibs/obscure_ops_cgp.c $(PARROT_H_HEADERS)47 48 src/dynoplibs/obscure_ops_cgp.h: src/dynoplibs/obscure_ops_cgp.c49 50 src/dynoplibs/obscure_ops_cgp.c: src/dynoplibs/obscure.ops $(BUILD_TOOLS_DIR)/ops2c.pl51 $(PERL) $(BUILD_TOOLS_DIR)/ops2c.pl CGP --dynamic src/dynoplibs/obscure.ops52 53 17 $(DYNEXT_DIR)/math_ops$(LOAD_EXT): src/dynoplibs/math_ops$(O) $(LIBPARROT) 54 18 $(LD) @ld_out@$@ src/dynoplibs/math_ops$(O) $(LINKARGS) 55 19 #IF(win32): if exist $@.manifest mt.exe -nologo -manifest $@.manifest -outputresource:$@;2 … … 62 26 63 27 src/dynoplibs/math_ops.h: src/dynoplibs/math_ops.c 64 28 65 $(DYNEXT_DIR)/math_ops_switch$(LOAD_EXT): src/dynoplibs/math_ops_switch$(O) $(LIBPARROT)66 $(LD) @ld_out@$@ src/dynoplibs/math_ops_switch$(O) $(LINKARGS)67 #IF(win32): if exist $@.manifest mt.exe -nologo -manifest $@.manifest -outputresource:$@;268 #IF(cygwin or hpux): $(CHMOD) 0775 $@69 70 src/dynoplibs/math_ops_switch$(O): include/pmc/pmc_parrotlibrary.h include/pmc/pmc_callcontext.h src/dynoplibs/math_ops_switch.c $(PARROT_H_HEADERS)71 72 src/dynoplibs/math_ops_switch.h: src/dynoplibs/math_ops_switch.c73 74 src/dynoplibs/math_ops_switch.c: src/dynoplibs/math.ops $(BUILD_TOOLS_DIR)/ops2c.pl75 $(PERL) $(BUILD_TOOLS_DIR)/ops2c.pl CSwitch --dynamic src/dynoplibs/math.ops76 77 $(DYNEXT_DIR)/math_ops_cg$(LOAD_EXT): src/dynoplibs/math_ops_cg$(O) $(LIBPARROT)78 $(LD) @ld_out@$@ src/dynoplibs/math_ops_cg$(O) $(LINKARGS)79 #IF(win32): if exist $@.manifest mt.exe -nologo -manifest $@.manifest -outputresource:$@;280 #IF(cygwin or hpux): $(CHMOD) 0775 $@81 82 src/dynoplibs/math_ops_cg$(O): include/pmc/pmc_parrotlibrary.h include/pmc/pmc_callcontext.h src/dynoplibs/math_ops_cg.c $(PARROT_H_HEADERS)83 84 src/dynoplibs/math_ops_cg.h: src/dynoplibs/math_ops_cg.c85 86 src/dynoplibs/math_ops_cg.c: src/dynoplibs/math.ops $(BUILD_TOOLS_DIR)/ops2c.pl87 $(PERL) $(BUILD_TOOLS_DIR)/ops2c.pl CGoto --dynamic src/dynoplibs/math.ops88 89 $(DYNEXT_DIR)/math_ops_cgp$(LOAD_EXT): src/dynoplibs/math_ops_cgp$(O) $(LIBPARROT)90 $(LD) @ld_out@$@ src/dynoplibs/math_ops_cgp$(O) $(LINKARGS)91 #IF(win32): if exist $@.manifest mt.exe -nologo -manifest $@.manifest -outputresource:$@;292 #IF(cygwin or hpux): $(CHMOD) 0775 $@93 94 src/dynoplibs/math_ops_cgp$(O): include/pmc/pmc_parrotlibrary.h include/pmc/pmc_callcontext.h src/dynoplibs/math_ops_cgp.c $(PARROT_H_HEADERS)95 96 src/dynoplibs/math_ops_cgp.h: src/dynoplibs/math_ops_cgp.c97 98 src/dynoplibs/math_ops_cgp.c: src/dynoplibs/math.ops $(BUILD_TOOLS_DIR)/ops2c.pl99 $(PERL) $(BUILD_TOOLS_DIR)/ops2c.pl CGP --dynamic src/dynoplibs/math.ops -
src/dynoplibs/Defines.in
1 1 DYNOPLIBS_TARGETS = \ 2 #IF(cg_flag): $(DYNEXT_DIR)/obscure_ops_cg$(LOAD_EXT) \3 #IF(cg_flag): $(DYNEXT_DIR)/obscure_ops_cgp$(LOAD_EXT) \4 2 $(DYNEXT_DIR)/obscure_ops$(LOAD_EXT) \ 5 $(DYNEXT_DIR)/obscure_ops_switch$(LOAD_EXT) \6 #IF(cg_flag): $(DYNEXT_DIR)/math_ops_cg$(LOAD_EXT) \7 #IF(cg_flag): $(DYNEXT_DIR)/math_ops_cgp$(LOAD_EXT) \8 3 $(DYNEXT_DIR)/math_ops$(LOAD_EXT) \ 9 $(DYNEXT_DIR)/math_ops_switch$(LOAD_EXT)10 4 11 5 DYNOPLIBS_CLEANUPS = \ 12 6 src/dynoplibs/*.c \ -
src/pmc/callcontext.pmc
434 434 ATTR UINTVAL trace_flags; 435 435 ATTR UINTVAL recursion_depth; /* Sub call recursion depth */ 436 436 437 /* code->prederefed.code - code->base.data in opcodes438 * to simplify conversion between code ptrs in e.g. invoke */439 ATTR size_t pred_offset;440 441 437 /* Storage for arguments */ 442 438 ATTR struct Pcc_cell *positionals; /* array of positionals */ 443 439 ATTR INTVAL num_positionals; /* count of used positionals */ -
src/packfile.c
684 684 Parrot_runcore_t *old_core = interp->run_core; 685 685 PMC *retval = PMCNULL; 686 686 687 /* turn off JIT and prederef - both would act on the whole688 * PackFile which probably isn't worth the effort */689 if (PARROT_RUNCORE_JIT_OPS_TEST(interp->run_core)690 || PARROT_RUNCORE_PREDEREF_OPS_TEST(interp->run_core))691 Parrot_runcore_switch(interp, CONST_STRING(interp, "fast"));692 693 687 Parrot_pcc_set_constants(interp, CURRENT_CONTEXT(interp), 694 688 interp->code->const_table->constants); 695 689 … … 2581 2575 ASSERT_ARGS(byte_code_destroy) 2582 2576 PackFile_ByteCode * const byte_code = (PackFile_ByteCode *)self; 2583 2577 2584 if (byte_code->prederef.code) {2585 Parrot_free_memalign(byte_code->prederef.code);2586 byte_code->prederef.code = NULL;2587 2588 if (byte_code->prederef.branches) {2589 mem_gc_free(interp, byte_code->prederef.branches);2590 byte_code->prederef.branches = NULL;2591 }2592 }2593 2594 2578 byte_code->fixups = NULL; 2595 2579 byte_code->const_table = NULL; 2596 2580 byte_code->debugs = NULL; … … 3099 3083 ? find_constants(interp, new_cs->const_table) 3100 3084 : new_cs->const_table->constants); 3101 3085 3102 /* new_cs->const_table->constants; */3103 Parrot_pcc_set_pred_offset(interp, CURRENT_CONTEXT(interp),3104 new_cs->base.data - (opcode_t*) new_cs->prederef.code);3105 3106 3086 if (really) 3107 3087 prepare_for_run(interp); 3108 3088 -
src/interp/inter_misc.c
237 237 else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "fast"))) 238 238 return PARROT_FAST_CORE; 239 239 else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "switch"))) 240 return PARROT_SWITCH_CORE;241 else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "cgp")))242 return PARROT_CGP_CORE;243 else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "cgoto")))244 return PARROT_CGOTO_CORE;245 else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "exec")))246 240 return PARROT_EXEC_CORE; 247 241 else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "gc_debug"))) 248 242 return PARROT_GC_DEBUG_CORE; -
src/main.c
301 301 " --hash-seed F00F specify hex value to use as hash seed\n" 302 302 " -X --dynext add path to dynamic extension search\n" 303 303 " <Run core options>\n" 304 " -R --runcore slow|bounds|fast |cgoto|cgp\n"305 " -R --runcore switch|trace|profiling|gcdebug\n"304 " -R --runcore slow|bounds|fast\n" 305 " -R --runcore trace|profiling|gcdebug\n" 306 306 " -t --trace [flags]\n" 307 307 " <VM options>\n" 308 308 " -D --parrot-debug[=HEXFLAGS]\n" … … 461 461 *core = PARROT_SLOW_CORE; 462 462 else if (STREQ(opt.opt_arg, "fast") || STREQ(opt.opt_arg, "function")) 463 463 *core = PARROT_FAST_CORE; 464 else if (STREQ(opt.opt_arg, "switch"))465 *core = PARROT_SWITCH_CORE;466 else if (STREQ(opt.opt_arg, "cgp"))467 *core = PARROT_CGP_CORE;468 else if (STREQ(opt.opt_arg, "cgoto"))469 *core = PARROT_CGOTO_CORE;470 464 else if (STREQ(opt.opt_arg, "jit")) 471 465 *core = PARROT_FAST_CORE; 472 else if (STREQ(opt.opt_arg, "cgp-jit"))473 *core = PARROT_CGP_CORE;474 else if (STREQ(opt.opt_arg, "switch-jit"))475 *core = PARROT_SWITCH_CORE;476 466 else if (STREQ(opt.opt_arg, "exec")) 477 467 *core = PARROT_EXEC_CORE; 478 468 else if (STREQ(opt.opt_arg, "trace")) -
src/call/context.c
321 321 ctx->current_object = NULL; 322 322 ctx->handlers = PMCNULL; 323 323 ctx->caller_ctx = NULL; 324 ctx->pred_offset = 0;325 324 ctx->current_sig = PMCNULL; 326 325 ctx->current_sub = PMCNULL; 327 326 … … 331 330 ctx->warns = old->warns; 332 331 ctx->errors = old->errors; 333 332 ctx->trace_flags = old->trace_flags; 334 ctx->pred_offset = old->pred_offset;335 333 ctx->current_HLL = old->current_HLL; 336 334 ctx->current_namespace = old->current_namespace; 337 335 /* end COW */ … … 343 341 ctx->warns = 0; 344 342 ctx->errors = 0; 345 343 ctx->trace_flags = 0; 346 ctx->pred_offset = 0;347 344 ctx->current_HLL = 0; 348 345 ctx->current_namespace = PMCNULL; 349 346 ctx->recursion_depth = 0; -
src/call/pcc.c
356 356 Parrot_runcore_t *old_core = interp->run_core; 357 357 const opcode_t offset = dest - interp->code->base.data; 358 358 359 if (PARROT_RUNCORE_PREDEREF_OPS_TEST(interp->run_core))360 Parrot_runcore_switch(interp, CONST_STRING(interp, "slow"));361 362 359 runops(interp, offset); 363 360 Interp_core_SET(interp, old_core); 364 361 } -
src/call/context_accessors.c
471 471 472 472 /* 473 473 474 =item C<size_t Parrot_pcc_get_pred_offset_func(PARROT_INTERP, PMC *ctx)>475 476 =item C<void Parrot_pcc_set_pred_offset_func(PARROT_INTERP, PMC *ctx, size_t477 pred_offset)>478 479 Get/set pred_offset480 481 =cut482 483 */484 485 PARROT_EXPORT486 size_t487 Parrot_pcc_get_pred_offset_func(PARROT_INTERP, ARGIN(PMC *ctx))488 {489 ASSERT_ARGS(Parrot_pcc_get_pred_offset_func)490 Parrot_Context const *c = get_context_struct_fast(interp, ctx);491 return c->pred_offset;492 }493 494 PARROT_EXPORT495 void496 Parrot_pcc_set_pred_offset_func(PARROT_INTERP, ARGIN(PMC *ctx), size_t pred_offset)497 {498 ASSERT_ARGS(Parrot_pcc_set_pred_offset_func)499 Parrot_Context *c = get_context_struct_fast(interp, ctx);500 c->pred_offset = pred_offset;501 }502 503 504 /*505 506 474 =item C<UINTVAL Parrot_pcc_warnings_on_func(PARROT_INTERP, PMC *ctx, UINTVAL 507 475 flags)> 508 476 -
src/runcore/main.c
22 22 #include "parrot/runcore_api.h" 23 23 #include "parrot/runcore_profiling.h" 24 24 #include "parrot/oplib/core_ops.h" 25 #include "parrot/oplib/core_ops_switch.h"26 25 #include "parrot/oplib/ops.h" 27 26 #include "main.str" 28 27 29 #ifdef HAVE_COMPUTED_GOTO30 # include "parrot/oplib/core_ops_cg.h"31 # include "parrot/oplib/core_ops_cgp.h"32 #endif33 28 #include "parrot/dynext.h" 34 29 #include "pmc/pmc_parrotlibrary.h" 35 30 #include "pmc/pmc_callcontext.h" … … 44 39 static void dynop_register_switch(PARROT_INTERP, size_t n_old, size_t n_new) 45 40 __attribute__nonnull__(1); 46 41 47 static void dynop_register_xx(PARROT_INTERP,48 size_t n_old,49 size_t n_new,50 oplib_init_f init_func)51 __attribute__nonnull__(1);52 53 42 PARROT_WARN_UNUSED_RESULT 54 43 PARROT_CANNOT_RETURN_NULL 55 44 static oplib_init_f get_dynamic_op_lib_init(SHIM_INTERP, … … 62 51 __attribute__nonnull__(1) 63 52 __attribute__nonnull__(2); 64 53 65 static void stop_prederef(PARROT_INTERP)66 __attribute__nonnull__(1);67 68 static void turn_ev_check(PARROT_INTERP, int on)69 __attribute__nonnull__(1);70 71 54 #define ASSERT_ARGS_dynop_register_switch __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 72 55 PARROT_ASSERT_ARG(interp)) 73 #define ASSERT_ARGS_dynop_register_xx __attribute__unused__ int _ASSERT_ARGS_CHECK = (\74 PARROT_ASSERT_ARG(interp))75 56 #define ASSERT_ARGS_get_dynamic_op_lib_init __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 76 57 PARROT_ASSERT_ARG(lib)) 77 58 #define ASSERT_ARGS_notify_func_table __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 78 59 PARROT_ASSERT_ARG(interp) \ 79 60 , PARROT_ASSERT_ARG(table)) 80 #define ASSERT_ARGS_stop_prederef __attribute__unused__ int _ASSERT_ARGS_CHECK = (\81 PARROT_ASSERT_ARG(interp))82 #define ASSERT_ARGS_turn_ev_check __attribute__unused__ int _ASSERT_ARGS_CHECK = (\83 PARROT_ASSERT_ARG(interp))84 61 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */ 85 62 /* HEADERIZER END: static */ 86 63 … … 105 82 106 83 Parrot_runcore_slow_init(interp); 107 84 Parrot_runcore_fast_init(interp); 108 Parrot_runcore_switch_init(interp);109 85 110 86 Parrot_runcore_exec_init(interp); 111 87 Parrot_runcore_gc_debug_init(interp); … … 115 91 116 92 /* set the default runcore */ 117 93 Parrot_runcore_switch(interp, default_core); 118 119 #ifdef HAVE_COMPUTED_GOTO120 Parrot_runcore_cgp_init(interp);121 Parrot_runcore_cgoto_init(interp);122 #endif123 94 } 124 95 125 96 … … 187 158 188 159 /* 189 160 190 =item C<static void turn_ev_check(PARROT_INTERP, int on)>191 192 Turn on or off event checking for prederefed cores.193 194 Fills in the C<event_checker> opcode, or restores original ops in all195 branch locations of the opcode stream.196 197 Note that when C<on> is true, this is being called from the event198 handler thread.199 200 =cut201 202 */203 204 static void205 turn_ev_check(PARROT_INTERP, int on)206 {207 ASSERT_ARGS(turn_ev_check)208 const Prederef * const pi = &interp->code->prederef;209 size_t i;210 211 if (!pi->branches)212 return;213 214 for (i = 0; i < pi->n_branches; ++i) {215 const size_t offs = pi->branches[i].offs;216 if (on)217 interp->code->prederef.code[offs] =218 ((void **)interp->op_lib->op_func_table)219 [CORE_OPS_check_events__];220 else221 interp->code->prederef.code[offs] = pi->branches[i].op;222 }223 }224 225 226 /*227 228 161 =item C<static oplib_init_f get_dynamic_op_lib_init(PARROT_INTERP, const PMC 229 162 *lib)> 230 163 … … 249 182 250 183 /* 251 184 252 =item C<static void stop_prederef(PARROT_INTERP)>253 254 Restore the interpreter's op function tables to their initial state.255 Also recreate the event function pointers. This is only necessary256 for run-core changes, but we don't know the old run core.257 258 =cut259 260 */261 262 static void263 stop_prederef(PARROT_INTERP)264 {265 ASSERT_ARGS(stop_prederef)266 interp->op_func_table = PARROT_CORE_OPLIB_INIT(interp, 1)->op_func_table;267 268 if (interp->evc_func_table) {269 mem_gc_free(interp, interp->evc_func_table);270 interp->evc_func_table = NULL;271 }272 273 Parrot_setup_event_func_ptrs(interp);274 }275 276 277 /*278 279 185 =item C<void prepare_for_run(PARROT_INTERP)> 280 186 281 187 Prepares to run the interpreter's run core. … … 337 243 if ((int)interp->resume_offset < 0) 338 244 Parrot_ex_throw_from_c_args(interp, NULL, 1, 339 245 "branch_cs: illegal resume offset"); 340 stop_prederef(interp);341 246 } 342 247 } 343 248 } … … 397 302 Parrot_runcore_destroy(PARROT_INTERP) 398 303 { 399 304 ASSERT_ARGS(Parrot_runcore_destroy) 400 #ifdef HAVE_COMPUTED_GOTO401 op_lib_t *cg_lib;402 #endif403 305 size_t num_cores = interp->num_cores; 404 306 size_t i; 405 307 … … 423 325 if (interp->n_libs <= 0) 424 326 return; 425 327 426 #ifdef HAVE_COMPUTED_GOTO427 cg_lib = PARROT_CORE_CGP_OPLIB_INIT(interp, 1);428 429 if (cg_lib->op_func_table)430 mem_gc_free(interp, cg_lib->op_func_table);431 cg_lib->op_func_table = NULL;432 433 cg_lib = PARROT_CORE_CG_OPLIB_INIT(interp, 1);434 if (cg_lib->op_func_table)435 mem_gc_free(interp, cg_lib->op_func_table);436 cg_lib->op_func_table = NULL;437 #endif438 439 328 mem_gc_free(interp, interp->op_info_table); 440 329 mem_gc_free(interp, interp->op_func_table); 441 330 interp->op_info_table = NULL; … … 560 449 core->flags = OP_FUNC_IS_ALLOCATED | OP_INFO_IS_ALLOCATED; 561 450 562 451 /* done for plain core */ 563 #ifdef HAVE_COMPUTED_GOTO564 dynop_register_xx(interp, n_old, n_new, PARROT_CORE_CGP_OPLIB_INIT);565 dynop_register_xx(interp, n_old, n_new, PARROT_CORE_CG_OPLIB_INIT);566 #endif567 568 452 dynop_register_switch(interp, n_old, n_new); 569 453 } 570 454 571 455 572 /*573 456 574 =item C<static void dynop_register_xx(PARROT_INTERP, size_t n_old, size_t n_new,575 oplib_init_f init_func)>576 457 577 Register C<op_lib> with other cores.578 579 =cut580 581 */582 583 #ifdef HAVE_COMPUTED_GOTO584 585 static void586 dynop_register_xx(PARROT_INTERP,587 size_t n_old, size_t n_new, oplib_init_f init_func)588 {589 ASSERT_ARGS(dynop_register_xx)590 const size_t n_tot = n_old + n_new;591 op_func_t *ops_addr = NULL;592 op_lib_t *cg_lib = init_func(interp, 1);593 594 # if 0595 /* related to CG and CGP ops issue below */596 op_lib_t *new_lib;597 STRING *op_variant;598 oplib_init_f new_init_func;599 PMC *lib_variant;600 # endif601 602 if (cg_lib->flags & OP_FUNC_IS_ALLOCATED) {603 ops_addr = mem_gc_realloc_n_typed_zeroed(interp,604 cg_lib->op_func_table, n_tot, n_old, op_func_t);605 }606 else {607 size_t i;608 609 ops_addr = mem_gc_allocate_n_zeroed_typed(interp, n_tot, op_func_t);610 cg_lib->flags = OP_FUNC_IS_ALLOCATED;611 612 for (i = 0; i < n_old; ++i)613 ops_addr[i] = cg_lib->op_func_table[i];614 }615 616 /*617 * XXX running CG and CGP ops currently works only via the wrapper618 *619 * the problem is:620 * The actual runcores cg_core and cgp_core are very big functions.621 * The C compiler usually addresses "spilled" registers in the C stack.622 * The loaded opcode lib is another possibly big function, but with623 * a likely different stack layout. Directly jumping around between624 * code locations in these two opcode functions works, but access625 * to stack-ed (or spilled) variables fails badly.626 *627 * We would need to prepare the assembly source of the opcode628 * lib so that all variable access on the stack has the same629 * layout and compile the prepared assembly to ops_cgp?.o630 *631 * The switched core is different anyway, as we can't extend the632 * compiled big switch statement with the new cases. We have633 * always to use the wrapper__ opcode called from the default case.634 */635 # if 0636 /* check if the lib_pmc exists with a _xx flavor */637 new_init_func = get_op_lib_init(0, 0, lib_pmc);638 new_lib = new_init_func(1);639 op_variant = Parrot_sprintf_c(interp, "%s_ops%s",640 new_lib->name, cg_lib->suffix);641 lib_variant = Parrot_load_lib(interp, op_variant, NULL);642 643 /* XXX running CG and CGP ops currently works only via the wrapper */644 if (0 /*lib_variant */) {645 size_t i;646 647 new_init_func = get_dynamic_op_lib_init(interp, lib_variant);648 new_lib = new_init_func(1);649 650 for (i = n_old; i < n_tot; ++i)651 ops_addr[i] = (new_lib->op_func_table)[i - n_old];652 653 new_lib->op_func_table = ops_addr;654 new_lib->op_count = n_tot;655 656 new_init_func((long) ops_addr);657 }658 else659 # endif660 {661 size_t i;662 663 /* if not install wrappers */664 /* fill new entries with the wrapper op */665 for (i = n_old; i < n_tot; ++i)666 ops_addr[i] = ops_addr[CORE_OPS_wrapper__];667 }668 669 /* if we are running this core, update event check ops */670 if (interp->run_core->id == cg_lib->core_type) {671 size_t i;672 673 for (i = n_old; i < n_tot; ++i)674 interp->evc_func_table[i] =675 (op_func_t)ops_addr[CORE_OPS_check_events__];676 interp->save_func_table = ops_addr;677 }678 679 /* tell the cg_core about the new jump table */680 cg_lib->op_func_table = ops_addr;681 cg_lib->op_count = n_tot;682 init_func(interp, (long) ops_addr);683 }684 685 #endif686 687 688 458 /* 689 459 690 460 =item C<static void dynop_register_switch(PARROT_INTERP, size_t n_old, size_t … … 702 472 dynop_register_switch(PARROT_INTERP, size_t n_old, size_t n_new) 703 473 { 704 474 ASSERT_ARGS(dynop_register_switch) 705 op_lib_t * const lib = PARROT_CORE_ SWITCH_OPLIB_INIT(interp, 1);475 op_lib_t * const lib = PARROT_CORE_OPLIB_INIT(interp, 1); 706 476 lib->op_count = n_old + n_new; 707 477 } 708 478 … … 729 499 PARROT_ASSERT(table); 730 500 interp->op_func_table = table; 731 501 } 732 733 if (PARROT_RUNCORE_EVENT_CHECK_TEST(interp->run_core))734 turn_ev_check(interp, on);735 502 } 736 503 737 504 -
src/runcore/cores.c
249 249 250 250 #include "parrot/oplib/ops.h" 251 251 #include "parrot/oplib/core_ops.h" 252 #include "parrot/oplib/core_ops_switch.h"253 252 #include "parrot/dynext.h" 254 253 255 254 #include "pmc/pmc_sub.h" 256 255 #include "pmc/pmc_callcontext.h" 257 256 258 #ifdef HAVE_COMPUTED_GOTO259 # include "parrot/oplib/core_ops_cg.h"260 # include "parrot/oplib/core_ops_cgp.h"261 #endif262 263 257 #ifdef WIN32 264 258 # define getpid _getpid 265 259 #endif … … 271 265 272 266 PARROT_WARN_UNUSED_RESULT 273 267 PARROT_CAN_RETURN_NULL 274 static opcode_t * runops_cgoto_core(PARROT_INTERP,275 SHIM(Parrot_runcore_t *runcore),276 ARGIN(opcode_t *pc))277 __attribute__nonnull__(1)278 __attribute__nonnull__(3);279 280 PARROT_WARN_UNUSED_RESULT281 PARROT_CANNOT_RETURN_NULL282 static opcode_t * runops_cgp_core(PARROT_INTERP,283 ARGIN(Parrot_runcore_t *runcore),284 ARGIN(opcode_t *pc))285 __attribute__nonnull__(1)286 __attribute__nonnull__(2)287 __attribute__nonnull__(3);288 289 PARROT_WARN_UNUSED_RESULT290 PARROT_CAN_RETURN_NULL291 268 static opcode_t * runops_debugger_core(PARROT_INTERP, 292 269 SHIM(Parrot_runcore_t *runcore), 293 270 ARGIN(opcode_t *pc)) … … 328 305 __attribute__nonnull__(3); 329 306 330 307 PARROT_WARN_UNUSED_RESULT 331 PARROT_CANNOT_RETURN_NULL332 static opcode_t * runops_switch_core(PARROT_INTERP,333 ARGIN(Parrot_runcore_t *runcore),334 ARGIN(opcode_t *pc))335 __attribute__nonnull__(1)336 __attribute__nonnull__(2)337 __attribute__nonnull__(3);338 339 PARROT_WARN_UNUSED_RESULT340 308 PARROT_CAN_RETURN_NULL 341 309 static opcode_t * runops_trace_core(PARROT_INTERP, ARGIN(opcode_t *pc)) 342 310 __attribute__nonnull__(1) 343 311 __attribute__nonnull__(2); 344 312 345 #define ASSERT_ARGS_runops_cgoto_core __attribute__unused__ int _ASSERT_ARGS_CHECK = (\346 PARROT_ASSERT_ARG(interp) \347 , PARROT_ASSERT_ARG(pc))348 #define ASSERT_ARGS_runops_cgp_core __attribute__unused__ int _ASSERT_ARGS_CHECK = (\349 PARROT_ASSERT_ARG(interp) \350 , PARROT_ASSERT_ARG(runcore) \351 , PARROT_ASSERT_ARG(pc))352 313 #define ASSERT_ARGS_runops_debugger_core __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 353 314 PARROT_ASSERT_ARG(interp) \ 354 315 , PARROT_ASSERT_ARG(pc)) … … 365 326 #define ASSERT_ARGS_runops_slow_core __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 366 327 PARROT_ASSERT_ARG(interp) \ 367 328 , PARROT_ASSERT_ARG(pc)) 368 #define ASSERT_ARGS_runops_switch_core __attribute__unused__ int _ASSERT_ARGS_CHECK = (\369 PARROT_ASSERT_ARG(interp) \370 , PARROT_ASSERT_ARG(runcore) \371 , PARROT_ASSERT_ARG(pc))372 329 #define ASSERT_ARGS_runops_trace_core __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 373 330 PARROT_ASSERT_ARG(interp) \ 374 331 , PARROT_ASSERT_ARG(pc)) … … 438 395 439 396 /* 440 397 441 =item C<void Parrot_runcore_switch_init(PARROT_INTERP)>442 443 Registers the switch runcore with Parrot.444 445 =cut446 447 */448 449 void450 Parrot_runcore_switch_init(PARROT_INTERP)451 {452 ASSERT_ARGS(Parrot_runcore_switch_init)453 454 Parrot_runcore_t * const coredata = mem_gc_allocate_zeroed_typed(interp, Parrot_runcore_t);455 coredata->name = CONST_STRING(interp, "switch");456 coredata->id = PARROT_SWITCH_CORE;457 coredata->opinit = PARROT_CORE_SWITCH_OPLIB_INIT;458 coredata->runops = runops_switch_core;459 coredata->prepare_run = init_prederef;460 coredata->destroy = NULL;461 coredata->flags = 0;462 463 PARROT_RUNCORE_PREDEREF_OPS_SET(coredata);464 465 Parrot_runcore_register(interp, coredata);466 }467 468 469 /*470 471 398 =item C<void Parrot_runcore_exec_init(PARROT_INTERP)> 472 399 473 400 Registers the exec runcore with Parrot. … … 543 470 coredata->name = CONST_STRING(interp, "debugger"); 544 471 coredata->id = PARROT_DEBUGGER_CORE; 545 472 coredata->opinit = PARROT_CORE_OPLIB_INIT; 546 coredata->prepare_run = init_prederef;473 coredata->prepare_run = NULL; 547 474 coredata->runops = runops_debugger_core; 548 475 coredata->destroy = NULL; 549 476 coredata->flags = 0; … … 556 483 557 484 /* 558 485 559 =item C<void Parrot_runcore_cgp_init(PARROT_INTERP)>560 561 Registers the CGP runcore with Parrot.562 563 =cut564 565 */566 567 #ifdef HAVE_COMPUTED_GOTO568 569 void570 Parrot_runcore_cgp_init(PARROT_INTERP)571 {572 ASSERT_ARGS(Parrot_runcore_cgp_init)573 574 Parrot_runcore_t * const coredata = mem_gc_allocate_zeroed_typed(interp, Parrot_runcore_t);575 coredata->name = CONST_STRING(interp, "cgp");576 coredata->id = PARROT_CGP_CORE;577 coredata->opinit = PARROT_CORE_CGP_OPLIB_INIT;578 coredata->prepare_run = init_prederef;579 coredata->runops = runops_cgp_core;580 coredata->flags = 0;581 582 coredata->destroy = NULL;583 584 PARROT_RUNCORE_CGOTO_OPS_SET(coredata);585 PARROT_RUNCORE_EVENT_CHECK_SET(coredata);586 PARROT_RUNCORE_PREDEREF_OPS_SET(coredata);587 588 Parrot_runcore_register(interp, coredata);589 }590 591 592 /*593 594 =item C<void Parrot_runcore_cgoto_init(PARROT_INTERP)>595 596 Registers the cgoto runcore with Parrot.597 598 =cut599 600 */601 602 void603 Parrot_runcore_cgoto_init(PARROT_INTERP)604 {605 ASSERT_ARGS(Parrot_runcore_cgoto_init)606 607 Parrot_runcore_t * const coredata = mem_gc_allocate_zeroed_typed(interp, Parrot_runcore_t);608 coredata->name = CONST_STRING(interp, "cgoto");609 coredata->id = PARROT_CGOTO_CORE;610 coredata->opinit = PARROT_CORE_CG_OPLIB_INIT;611 coredata->runops = runops_cgoto_core;612 coredata->destroy = NULL;613 coredata->prepare_run = NULL;614 coredata->flags = 0;615 616 PARROT_RUNCORE_FUNC_TABLE_SET(coredata);617 PARROT_RUNCORE_CGOTO_OPS_SET(coredata);618 619 Parrot_runcore_register(interp, coredata);620 }621 622 623 #endif /* #ifdef HAVE_COMPUTED_GOTO */624 625 626 /*627 628 486 =item C<static opcode_t * runops_fast_core(PARROT_INTERP, Parrot_runcore_t 629 487 *runcore, opcode_t *pc)> 630 488 … … 660 518 } 661 519 662 520 663 /*664 665 =item C<static opcode_t * runops_cgoto_core(PARROT_INTERP, Parrot_runcore_t666 *runcore, opcode_t *pc)>667 668 Runs the Parrot operations starting at C<pc> until there are no more669 operations, using the computed C<goto> core, performing no bounds checking,670 profiling, or tracing.671 672 If computed C<goto> is not available then Parrot exits with exit code 1.673 674 =cut675 676 */677 678 PARROT_WARN_UNUSED_RESULT679 PARROT_CAN_RETURN_NULL680 static opcode_t *681 runops_cgoto_core(PARROT_INTERP, SHIM(Parrot_runcore_t *runcore), ARGIN(opcode_t *pc))682 {683 ASSERT_ARGS(runops_cgoto_core)684 685 /* disable pc */686 Parrot_pcc_set_pc(interp, CURRENT_CONTEXT(interp), NULL);687 688 #ifdef HAVE_COMPUTED_GOTO689 pc = cg_core(pc, interp);690 return pc;691 #else692 UNUSED(pc);693 Parrot_io_eprintf(interp,694 "Computed goto unavailable in this configuration.\n");695 Parrot_exit(interp, 1);696 #endif697 }698 699 521 #ifdef code_start 700 522 # undef code_start 701 523 #endif … … 935 757 } 936 758 937 759 938 /*939 760 940 =item C<static opcode_t * runops_switch_core(PARROT_INTERP, Parrot_runcore_t941 *runcore, opcode_t *pc)>942 943 Runs the C<switch> core.944 945 =cut946 947 */948 949 PARROT_WARN_UNUSED_RESULT950 PARROT_CANNOT_RETURN_NULL951 static opcode_t *952 runops_switch_core(PARROT_INTERP, ARGIN(Parrot_runcore_t *runcore), ARGIN(opcode_t *pc))953 {954 ASSERT_ARGS(runops_switch_core)955 opcode_t * const code_start = (opcode_t *)interp->code->base.data;956 opcode_t *pc_prederef;957 958 init_prederef(interp, runcore);959 pc_prederef = (opcode_t*)interp->code->prederef.code + (pc - code_start);960 961 return switch_core(pc_prederef, interp);962 }963 964 965 761 /* 966 762 967 =item C<void * init_prederef(PARROT_INTERP, Parrot_runcore_t *runcore)>968 969 Initialize: load prederef C<func_table>, file prederef.code.970 971 =cut972 973 */974 975 PARROT_CAN_RETURN_NULL976 void *977 init_prederef(PARROT_INTERP, ARGIN(Parrot_runcore_t *runcore))978 {979 ASSERT_ARGS(init_prederef)980 load_prederef(interp, runcore);981 982 if (!interp->code->prederef.code) {983 void *pred_func;984 opcode_t *pc = interp->code->base.data;985 const size_t N = interp->code->base.size;986 size_t i;987 988 void ** const temp =989 (void **)Parrot_memalign_if_possible(256, N * sizeof (void *));990 /* calc and remember pred_offset */991 CONTEXT(interp)->pred_offset = pc - (opcode_t *)temp;992 993 /* fill with the prederef__ opcode function */994 if (PARROT_RUNCORE_PREDEREF_OPS_TEST(runcore)995 && !PARROT_RUNCORE_CGOTO_OPS_TEST(runcore))996 pred_func = (void *)CORE_OPS_prederef__;997 else {998 PARROT_ASSERT(interp->op_lib->op_func_table);999 pred_func = ((void **)1000 interp->op_lib->op_func_table)[CORE_OPS_prederef__];1001 }1002 1003 for (i = 0; i < N;) {1004 const op_info_t * const opinfo = &interp->op_info_table[*pc];1005 size_t n = opinfo->op_count;1006 1007 temp[i] = pred_func;1008 1009 ADD_OP_VAR_PART(interp, interp->code, pc, n);1010 1011 pc += n;1012 i += n;1013 }1014 1015 interp->code->prederef.code = temp;1016 }1017 1018 return NULL;1019 }1020 1021 1022 /*1023 1024 =item C<void load_prederef(PARROT_INTERP, Parrot_runcore_t *runcore)>1025 1026 C<< interp->op_lib >> = prederefed oplib.1027 1028 =cut1029 1030 */1031 1032 void1033 load_prederef(PARROT_INTERP, ARGIN(Parrot_runcore_t *runcore))1034 {1035 ASSERT_ARGS(load_prederef)1036 const oplib_init_f init_func = get_core_op_lib_init(interp, runcore);1037 1038 int (*get_op)(PARROT_INTERP, const char * name, int full);1039 1040 get_op = interp->op_lib->op_code;1041 interp->op_lib = init_func(interp, 1);1042 1043 /* preserve the get_op function */1044 interp->op_lib->op_code = get_op;1045 1046 if (interp->op_lib->op_count != interp->op_count)1047 Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_PREDEREF_LOAD_ERROR,1048 "Illegal op count (%d) in prederef oplib\n",1049 (int)interp->op_lib->op_count);1050 }1051 1052 1053 /*1054 1055 763 =item C<oplib_init_f get_core_op_lib_init(PARROT_INTERP, Parrot_runcore_t 1056 764 *runcore)> 1057 765 … … 1099 807 1100 808 /* 1101 809 1102 =item C<static opcode_t * runops_cgp_core(PARROT_INTERP, Parrot_runcore_t1103 *runcore, opcode_t *pc)>1104 1105 Runs the computed goto and predereferenced core.1106 1107 =cut1108 1109 */1110 1111 PARROT_WARN_UNUSED_RESULT1112 PARROT_CANNOT_RETURN_NULL1113 static opcode_t *1114 runops_cgp_core(PARROT_INTERP, ARGIN(Parrot_runcore_t *runcore), ARGIN(opcode_t *pc))1115 {1116 ASSERT_ARGS(runops_cgp_core)1117 #ifdef HAVE_COMPUTED_GOTO1118 opcode_t * const code_start = (opcode_t *)interp->code->base.data;1119 opcode_t *pc_prederef;1120 1121 init_prederef(interp, runcore);1122 1123 pc_prederef = (opcode_t *)interp->code->prederef.code + (pc - code_start);1124 return cgp_core(pc_prederef, interp);1125 1126 #else1127 UNUSED(pc);1128 Parrot_io_eprintf(interp,1129 "Computed goto unavailable in this configuration.\n");1130 Parrot_exit(interp, 1);1131 #endif1132 1133 }1134 1135 /*1136 1137 810 =back 1138 811 1139 812 */ -
docs/book/draft/appc_command_line_options.pod
260 260 261 261 Run with the I<fast core>. 262 262 263 =item -R cgoto264 265 Run the I<computed goto core> (CGoto).266 267 =item -R cgp268 269 Run with the I<CGoto-Prederefed> core.270 271 =item -R switch272 273 Run with the I<Switched core>.274 275 263 =item -R gcdebug 276 264 277 265 Performs a full GC run before every op dispatch -
docs/porting_intro.pod
13 13 internals. For each feature, a brief description of its purpose, hints on 14 14 helping to port it, and pointers to more information are included. 15 15 16 =head1 CGoto or CGP (CGoto Predereferenced)17 18 =head2 What it is19 20 "Computed goto" is a non-standard C feature that allows taking a pointer to an21 statement label (e.g. "LOOP:" ) using the unary && operator. Certain Parrot22 runcores make use of this feature as an optimization.23 24 =head2 How to help25 26 If cgoto is not supported in Parrot by default on your platform, try to compile27 config/auto/cgoto/test_c.in with your C compiler and determine why it fails. If28 the compiler does not support the computed goto concept at all, this feature29 cannot be made to work (don't worry, there are other runcores). However, if30 the compiler supports it but the test is inadequate, please submit a bug report31 describing how the implementation of this feature differs from what Parrot32 expects.33 34 Note that gcc supports this feature out of the box, though it sometimes35 struggles with it in low-memory situations. Failures during compilation of36 core_ops_cg.c are frequently caused by insufficient resources rather than bugs37 in gcc or Parrot.38 39 =head2 References40 41 =over 442 43 =item * F<config/auto/cgoto/test_c.in>44 45 =item * I<make testC>46 47 =back48 49 16 =head1 Threads 50 17 51 18 =head2 What it is -
docs/configuration.pod
123 123 124 124 =over 4 125 125 126 =item F<config/auto/cgoto.pm>127 128 Does your compiler support computed goto...129 130 126 =item F<gen/config_h.pm> 131 127 132 128 Generate C headers... … … 136 132 Note that on non-interactive steps, the text I<done> will be printed after the 137 133 description when the step finishes executing; for example, the user will see: 138 134 139 D oes your compiler support computed goto..............done.135 Determine flags for building shared libraries.....-fPIC 140 136 141 137 =item C<result> 142 138 -
docs/running.pod
135 135 may be available on your system: 136 136 137 137 slow, bounds bounds checking core (default) 138 cgoto computed goto core139 cgp computed goto-predereferenced core140 fast fast core (no bounds checking, profiling, or tracing)141 138 gcdebug performs a full GC run before every op dispatch (good for 142 139 debugging GC problems) 143 switch switch core144 140 trace bounds checking core w/ trace info (see 'parrot --help-debug') 145 141 profiling see F<docs/dev/profilling.pod> 146 142 … … 249 245 The trace and profile cores are also based on the "slow" core, doing 250 246 full bounds checking, and also printing runtime information to stderr. 251 247 252 The switched core eschews these tiny op functions in favor of cases in a large253 switch statement:254 255 switch_runcore( op ):256 while ( op ):257 switch *op:258 case NOP:259 ...260 case STORE:261 ...262 ...263 264 Depending on the C compiler implementation, this may be faster than function265 calling. On older systems, it may fail to compile altogether.266 267 The computed-goto ("cgoto") runcore avoids the overhead of function268 calls by jumping directly to the address where each opcode's function269 starts. The computed-goto-prederef ("CGP") core takes this one step270 further by replacing opcode numbers in the bytecode with those opfunc271 addresses. See "Predereferencing" in F<docs/glossary.pod> for a272 fuller explanation.273 274 248 =head1 Operation table 275 249 276 250 Command Line Action Output -
tools/build/ops2c.pl
47 47 48 48 % perl tools/build/ops2c.pl trans [--help] [--no-lines] [--dynamic] 49 49 [--core | input.ops [input2.ops ...]] 50 trans := C | CGoto | CGP | CSwitch | CPrederef50 trans := C 51 51 52 52 For example: 53 53 … … 75 75 76 76 Create the function-based (slow or fast core) run loop. 77 77 78 =item C<CGoto>79 80 Create the C<goto> run loop.81 82 =item C<CGP>83 84 Create the C<goto> and predereferenced run loop.85 86 =item C<CSwitch>87 88 Create the C<switch>ed and predereferenced run loop.89 90 =item C<CPrederef>91 92 Create the predereferenced run loop.93 94 78 =back 95 79 96 80 =head2 Options … … 153 137 154 138 =item C<Parrot::OpTrans::C> 155 139 156 =item C<Parrot::OpTrans::CGoto>157 158 =item C<Parrot::OpTrans::CGP>159 160 =item C<Parrot::OpTrans::CSwitch>161 162 =item C<Parrot::OpTrans::CPrederef>163 164 140 =item C<Parrot::Ops2c::Utils> 165 141 166 142 =item C<Parrot::Ops2c::Auxiliary> -
tools/dev/parrot-fuzzer
62 62 63 63 Specify which runcore to use when running Parrot. The default is the C<slow> 64 64 core. This option corresponds directly to Parrot's C<--runcore> option. Other 65 runcores include C<fast> , C<jit>, C<cgoto>, C<cgp>, C<cgp-jit>, and C<switch>.65 runcores include C<fast>. 66 66 See Parrot's help for more details. 67 67 68 68 =item C<--ignore_blacklist> -
lib/Parrot/Configure/Options/Conf.pm
91 91 --opcode=(type) Use the given type for opcodes 92 92 --ops=(files) Use the given ops files 93 93 94 --cgoto=0 Don't build cgoto core - recommended when short of mem95 94 --jitcapable Use JIT 96 95 --execcapable Use JIT to emit a native executable 97 96 --without-threads Build parrot without thread support -
lib/Parrot/Configure/Options/Conf/Shared.pm
15 15 cc 16 16 ccflags 17 17 ccwarn 18 cgoto19 18 configure_trace 20 19 cxx 21 20 darwin_no_fink -
lib/Parrot/Configure/Step/List.pm
41 41 auto::isreg 42 42 auto::jit 43 43 auto::frames 44 auto::cgoto45 44 auto::inline 46 45 auto::gc 47 46 auto::memalign -
lib/Parrot/Ops2c/Auxiliary.pm
12 12 my $usage_msg = <<USAGE; 13 13 % perl tools/build/ops2c.pl trans [--help] [--no-lines] [--dynamic] 14 14 [--core | input.ops [input2.ops ...]] 15 trans := C | CGoto | CGP | CSwitch | CPrederef15 trans := C 16 16 17 17 For example: 18 18 -
lib/Parrot/Ops2c/Utils.pm
89 89 return; 90 90 } 91 91 my $class_name = shift @argv; 92 my %is_allowed = map { $_ => 1 } qw( C CGoto CGP CSwitch CPrederef);92 my %is_allowed = map { $_ => 1 } qw( C ); 93 93 unless ( $is_allowed{$class_name} ) { 94 94 print STDERR 95 "Parrot::Ops2c::Utils::new() requires C , CGoto, CGP, CSwitch and/or CPrederef: $!";95 "Parrot::Ops2c::Utils::new() requires C: $!"; 96 96 return; 97 97 } 98 98 … … 372 372 373 373 $self->_print_run_core_func_decl_source($SOURCE); 374 374 375 $self->_print_cg_jump_table($SOURCE);376 377 $self->_print_goto_opcode($SOURCE);378 379 375 $self->_print_op_function_definitions($SOURCE); 380 376 } 381 377 … … 650 646 $one_op .= "$definition $comment {\n$src}\n\n"; 651 647 push @op_funcs, $one_op; 652 648 push @op_protos, $prototype; 653 $prev_src = $src if ( $self->{suffix} eq '_cgp' || $self->{suffix} eq '_switch' );654 649 $prev_index = $index; 655 650 } 656 651 $index++; … … 662 657 $self->{cg_jump_table} = \@cg_jump_table; 663 658 } 664 659 665 sub _print_cg_jump_table {666 my ( $self, $fh ) = @_;667 668 my @cg_jump_table = @{ $self->{cg_jump_table} };669 670 if ( $self->{suffix} =~ /cg/ ) {671 print $fh @cg_jump_table;672 print $fh <<END_C;673 NULL674 };675 END_C676 print $fh $self->{trans}->run_core_after_addr_table( $self->{bs} );677 }678 return 1;679 }680 681 sub _print_goto_opcode {682 my ( $self, $fh ) = @_;683 684 if ( $self->{suffix} =~ /cgp/ ) {685 print $fh <<END_C;686 #ifdef __GNUC__687 # ifdef I386688 else if (cur_opcode == (opcode_t *)(void **) 1)689 __asm__ ("jmp *4(%ebp)"); /* jump to ret addr, used by JIT */690 # endif691 #endif692 _reg_base = (char*)Parrot_pcc_get_regs_ni(interp, CURRENT_CONTEXT(interp))->regs_i;693 goto **(void **)cur_opcode;694 695 END_C696 }697 elsif ( $self->{suffix} =~ /cg/ ) {698 print $fh <<END_C;699 goto *$self->{bs}ops_addr[*cur_opcode];700 701 END_C702 }703 return 1;704 }705 706 660 sub _print_op_function_definitions { 707 661 my ( $self, $fh ) = @_; 708 662 -
lib/Parrot/OpTrans/CSwitch.pm
1 # Copyright (C) 2001-2009, Parrot Foundation.2 # $Id$3 4 =head1 NAME5 6 Parrot::OpTrans::CSwitch - C Switch Transform7 8 =head1 DESCRIPTION9 10 C<Parrot::OpTrans::CSwitch> inherits from C<Parrot::OpTrans::CPrederef>11 to provide a mixture of predereferenced register addressing and a12 C<switch>ed run loop.13 14 =head2 Instance Methods15 16 =over 417 18 =cut19 20 package Parrot::OpTrans::CSwitch;21 22 use strict;23 use warnings;24 25 use Parrot::OpTrans;26 use base qw( Parrot::OpTrans::CPrederef );27 28 sub new {29 my $class = shift;30 my $self = $class->SUPER::new(@_);31 $self->{split_count} ||= 0;32 return $self;33 }34 35 =item C<core_type()>36 37 The core type is C<PARROT_SWITCH_CORE>.38 39 =cut40 41 sub core_type {42 return 'PARROT_SWITCH_CORE';43 }44 45 =item C<core_prefix()>46 47 The prefix is C<'switch_'>.48 49 =cut50 51 sub core_prefix {52 return "switch_";53 }54 55 =item C<suffix()>56 57 The suffix is C<'_switch'>.58 59 =cut60 61 sub suffix {62 return "_switch";63 }64 65 =item C<defines()>66 67 Returns the C C<#define> macros required by the ops.68 69 =cut70 71 sub defines {72 my ( $self, $pred_def );73 $self = shift;74 $pred_def = $self->SUPER::defines();75 my $type = __PACKAGE__;76 return $pred_def . <<END;77 /* defines - $0 -> $type */78 # define opcode_to_prederef(i, op) (op ? \\79 (opcode_t*) (op - Parrot_pcc_get_pred_offset(interp, i->ctx)) : (opcode_t*)NULL)80 END81 }82 83 =item C<goto_address($address)>84 85 Transforms the C<goto ADDRESS($address)> macro in an ops file into the86 relevant C code.87 88 =cut89 90 sub goto_address {91 my ( $self, $addr ) = @_;92 93 #print STDERR "pbcc: map_ret_abs($addr)\n";94 95 if ( $addr eq '0' ) {96 return "return (0);";97 }98 else {99 return <<EOC;100 {101 cur_opcode = opcode_to_prederef(interp, $addr);102 goto SWITCH_RELOAD;103 }104 EOC105 }106 }107 108 =item C<goto_offset($offset)>109 110 Transforms the C<goto OFFSET($offset)> macro in an ops file into the111 relevant C code.112 113 =cut114 115 sub goto_offset {116 my ( $self, $offset ) = @_;117 return "{ cur_opcode += $offset; goto SWITCH_AGAIN; }";118 }119 120 =item C<init_func_init1($base)>121 122 Returns the C code for the init function.123 124 =cut125 126 sub init_func_init1 {127 my ( $self, $base ) = @_;128 my $cg_func = $self->core_prefix . $base;129 my $bs = $base . $self->suffix . '_';130 131 return <<END_C;132 if (!${bs}op_lib.op_func_table)133 ${bs}op_lib.op_func_table = (op_func_t *)&${bs}op_lib;134 END_C135 }136 137 138 =item C<run_core_func_start()>139 140 Returns the C code prior to the run core function.141 142 =cut143 144 sub run_core_func_start {145 my $type = __PACKAGE__;146 return <<END_C;147 /* run_core_func_start - $0 -> $type */148 #if defined(__GNUC__) && defined(I386) && defined(PARROT_SWITCH_REGS)149 register opcode_t * cur_opcode __asm__ ("esi") = cur_op;150 register char * _reg_base __asm__ ("edi");151 #else152 opcode_t * cur_opcode = cur_op;153 char * _reg_base;154 #endif155 156 SWITCH_RELOAD:157 _reg_base = (char*)Parrot_pcc_get_regs_ni(interp, CURRENT_CONTEXT(interp))->regs_i;158 do {159 SWITCH_AGAIN:160 Parrot_cx_handle_tasks(interp, interp->scheduler);161 if (!cur_opcode)162 break;163 switch (*(opcode_t*)cur_opcode) {164 END_C165 }166 167 =item C<run_core_split($base)>168 169 If defined return code to split e.g. a switch.170 171 =cut172 173 sub run_core_split {174 my ($self) = @_;175 $self->{split_count}++;176 177 return <<END_C;178 default:179 switch (*(opcode_t*)cur_opcode) {180 END_C181 }182 183 =item C<run_core_finish($base)>184 185 Returns the C code following the run core function.186 187 =cut188 189 sub run_core_finish {190 my ( $self, $base ) = @_;191 my $bs = $base . $self->suffix . '_';192 my $c = <<END_C;193 default:194 if (*(opcode_t*)cur_opcode >= 0 &&195 *(opcode_t*)cur_opcode < (opcode_t)${bs}op_lib.op_count) {196 *(opcode_t*)cur_opcode = CORE_OPS_wrapper__;197 continue;198 }199 Parrot_ex_throw_from_c_args(interp, NULL, 1,200 "illegal opcode in switch core\\n");201 break;202 } /* switch */203 END_C204 for ( my $i = 0 ; $i < $self->{split_count} ; $i++ ) {205 $c .= <<END_C;206 } /* switch $i */207 END_C208 }209 $c .= <<END_C;210 } while (1);211 return NULL;212 }213 END_C214 215 $c .= " /* " . $self->core_prefix . "$base */\n\n";216 217 return $c;218 }219 220 =back221 222 =head1 SEE ALSO223 224 =over 4225 226 =item C<Parrot::OpTrans>227 228 =item C<Parrot::OpTrans::C>229 230 =item C<Parrot::OpTrans::CGP>231 232 =item C<Parrot::OpTrans::CGoto>233 234 =item C<Parrot::OpTrans::CPrederef>235 236 =back237 238 =cut239 240 1;241 242 # Local Variables:243 # mode: cperl244 # cperl-indent-level: 4245 # fill-column: 100246 # End:247 # vim: expandtab shiftwidth=4: -
lib/Parrot/OpTrans/CGP.pm
1 # Copyright (C) 2002, Parrot Foundation.2 # $Id$3 4 =head1 NAME5 6 Parrot::OpTrans::CGP - C Goto Predereferenced Transform7 8 =head1 DESCRIPTION9 10 C<Parrot::OpTrans::CGP> inherits from C<Parrot::OpTrans::CPrederef> and11 C<Parrot::OpTrans::CGoto> to provide predereferenced register addressing12 and C C<goto> run loop.13 14 =head2 Instance Methods15 16 =over 417 18 =cut19 20 package Parrot::OpTrans::CGP;21 22 use strict;23 use warnings;24 25 use base qw( Parrot::OpTrans::CPrederef Parrot::OpTrans::CGoto );26 27 =item C<core_type()>28 29 Returns C<PARROT_CGP_CORE>.30 31 =cut32 33 sub core_type {34 return 'PARROT_CGP_CORE';35 }36 37 =item C<suffix()>38 39 The suffix is C<'_cgp'>.40 41 =cut42 43 sub suffix {44 return "_cgp";45 }46 47 =item C<core_prefix()>48 49 The core prefix is C<'cgp_'>.50 51 =cut52 53 sub core_prefix {54 return "cgp_";55 }56 57 =item C<defines()>58 59 Returns the C C<#define> macros required by the ops.60 61 =cut62 63 sub defines {64 my ( $self, $pred_def );65 $self = shift;66 $pred_def = $self->SUPER::defines();67 my $type = __PACKAGE__;68 return $pred_def . <<END;69 /* defines - $0 -> $type */70 # define opcode_to_prederef(i, op) \\71 (opcode_t *) (op - Parrot_pcc_get_pred_offset(interp, i->ctx))72 END73 }74 75 =item C<goto_address($address)>76 77 Transforms the C<goto ADDRESS($address)> macro in an ops file into the78 relevant C code.79 80 =cut81 82 sub goto_address {83 my ( $self, $addr ) = @_;84 85 #print STDERR "pbcc: map_ret_abs($addr)\n";86 87 if ( $addr eq '0' ) {88 return "return (0);";89 }90 else {91 return "if ($addr == 0)92 return 0;93 Parrot_cx_handle_tasks(interp, interp->scheduler);94 _reg_base = (char*)Parrot_pcc_get_regs_ni(interp, CURRENT_CONTEXT(interp))->regs_i;95 goto **(void **)(cur_opcode = opcode_to_prederef(interp, $addr))";96 }97 }98 99 =item C<goto_offset($offset)>100 101 Transforms the C<goto OFFSET($offset)> macro in an ops file into the102 relevant C code.103 104 =cut105 106 sub goto_offset {107 my ( $self, $offset ) = @_;108 109 # this must be a single expression, in case it's in a single-statement if110 return "do {\nParrot_pcc_set_pc(interp, CURRENT_CONTEXT(interp), CUR_OPCODE + $offset);\n"111 . "goto **(void **)(cur_opcode += $offset);\n} while (1)";112 }113 114 sub run_core_func_start {115 my $type = __PACKAGE__;116 return <<END_C;117 /* run_core_func_start - $0 -> $type */118 /* at least gcc 2.95.2 miscompiles set_args - %edi119 * is used for the vtable call and _reg_base is clobbered120 * # if 1191 := PARROT_OP_set_args_pc121 * (gdb) disas l_ops_addr[1191] l_ops_addr[1192]122 */123 #if defined(__GNUC__) && defined(I386) && defined(PARROT_CGP_REGS)124 register opcode_t * cur_opcode __asm__ ("esi") = cur_op;125 register char * _reg_base __asm__ ("edi");126 #else127 opcode_t *cur_opcode = cur_op;128 char * _reg_base;129 #endif130 131 static void *const l_ops_addr[] = {132 END_C133 }134 135 =back136 137 =head1 SEE ALSO138 139 =over 4140 141 =item C<Parrot::OpTrans>142 143 =item C<Parrot::OpTrans::C>144 145 =item C<Parrot::OpTrans::CGoto>146 147 =item C<Parrot::OpTrans::CPrederef>148 149 =item C<Parrot::OpTrans::CSwitch>150 151 =back152 153 =cut154 155 1;156 157 # Local Variables:158 # mode: cperl159 # cperl-indent-level: 4160 # fill-column: 100161 # End:162 # vim: expandtab shiftwidth=4: -
lib/Parrot/OpTrans/CGoto.pm
1 # Copyright (C) 2002-2007, Parrot Foundation.2 # $Id$3 4 =head1 NAME5 6 Parrot::OpTrans::CGoto - CGoto Transform7 8 =head1 DESCRIPTION9 10 Used to generate C code from Parrot operations.11 12 C<Parrot::OpTrans::CGoto> inherits from C<Parrot::OpTrans> to provide a13 C C<goto> run loop.14 15 =head2 Instance Methods16 17 =over 418 19 =cut20 21 package Parrot::OpTrans::CGoto;22 23 use strict;24 use warnings;25 26 use base qw( Parrot::OpTrans );27 28 =item C<suffix()>29 30 The suffix is C<'_cg'>.31 32 =cut33 34 sub suffix {35 return "_cg";36 }37 38 =item C<core_prefix()>39 40 The core prefix is C<'cg_'>.41 42 =cut43 44 sub core_prefix {45 return "cg_";46 }47 48 =item C<core_type()>49 50 The core type is C<PARROT_CGOTO_CORE>.51 52 =cut53 54 sub core_type {55 return 'PARROT_CGOTO_CORE';56 }57 58 =item C<defines()>59 60 Returns the C C<#define> macros required by the ops.61 62 =cut63 64 sub defines {65 my $type = __PACKAGE__;66 return <<END;67 /* defines - $0 -> $type */68 #undef CONST69 #define REL_PC ((size_t)(cur_opcode - (opcode_t*)interp->code->base.data))70 #define CUR_OPCODE cur_opcode71 #define IREG(i) REG_INT(interp, cur_opcode[i])72 #define NREG(i) REG_NUM(interp, cur_opcode[i])73 #define PREG(i) REG_PMC(interp, cur_opcode[i])74 #define SREG(i) REG_STR(interp, cur_opcode[i])75 #define CONST(i) Parrot_pcc_get_constants(interp, interp->ctx)[cur_opcode[i]]76 END77 }78 79 =item C<pc($pc)>80 81 =item C<pc()>82 83 Sets/gets the current position in Parrot code.84 85 =cut86 87 sub pc {88 my $self = shift;89 90 if (@_) {91 $self->{PC} = shift;92 }93 else {94 return $self->{PC};95 }96 }97 98 =item C<args(@args)>99 100 =item C<args()>101 102 Sets/gets the transform's arguments.103 104 =cut105 106 sub args {107 my $self = shift;108 109 if (@_) {110 $self->{ARGS} = [@_];111 }112 else {113 return $self->{ARGS};114 }115 }116 117 =item C<arg($index)>118 119 Returns the argument at C<$index>.120 121 =cut122 123 sub arg {124 my $self = shift;125 126 return $self->{ARGS}[shift];127 }128 129 =item C<goto_address($address)>130 131 Transforms the C<goto ADDRESS($address)> macro in an ops file into the132 relevant C code.133 134 =cut135 136 sub goto_address {137 my ( $self, $addr ) = @_;138 139 #print STDERR "pbcc: map_ret_abs($addr)\n";140 141 if ( $addr eq '0' ) {142 return "return (0);";143 }144 else {145 return "if ((opcode_t *) $addr == 0)146 return 0;147 goto *ops_addr[*(cur_opcode = (opcode_t *)$addr)]";148 }149 }150 151 =item C<expr_offset($offset)>152 153 Transforms the C<OFFSET($offset)> macro in an ops file into the154 relevant C code.155 156 =cut157 158 sub expr_offset {159 my ( $self, $offset ) = @_;160 161 return "cur_opcode + $offset";162 }163 164 =item C<goto_offset($offset)>165 166 Transforms the C<goto OFFSET($offset)> macro in an ops file into the167 relevant C code.168 169 =cut170 171 sub goto_offset {172 my ( $self, $offset ) = @_;173 174 return "goto *ops_addr[*(cur_opcode += $offset)]";175 }176 177 my %arg_maps = (178 'op' => "cur_opcode[%ld]",179 180 'i' => "IREG(%ld)",181 'n' => "NREG(%ld)",182 'p' => "PREG(%ld)",183 's' => "SREG(%ld)",184 'k' => "PREG(%ld)",185 'ki' => "IREG(%ld)",186 187 'ic' => "cur_opcode[%ld]",188 'nc' => "CONST(%ld)->u.number",189 'pc' => "CONST(%ld)->u.key",190 'sc' => "CONST(%ld)->u.string",191 'kc' => "CONST(%ld)->u.key",192 'kic' => "cur_opcode[%ld]"193 );194 195 =item C<access_arg($type, $num, $op)>196 197 Returns the C code for the specified op argument type (see198 C<Parrot::OpTrans>) and value. C<$op> is an instance of C<Parrot::Op>.199 200 =cut201 202 sub access_arg {203 my ( $self, $type, $num, $op ) = @_;204 205 #print STDERR "pbcc: map_arg($type, $num)\n";206 207 die "Unrecognized type '$type' for num '$num'" unless exists $arg_maps{$type};208 209 return sprintf( $arg_maps{$type}, $num );210 }211 212 =item C<restart_address($address)>213 214 Returns the C code for C<restart ADDRESS($address)>.215 216 =cut217 218 sub restart_address {219 my ( $self, $addr ) = @_;220 221 return "interp->resume_offset = $addr; interp->resume_flag = 1";222 }223 224 =item C<restart_offset($offset)>225 226 Returns the C code for C<restart OFFSET($offset)>.227 228 =cut229 230 sub restart_offset {231 my ( $self, $offset ) = @_;232 233 return "interp->resume_offset = REL_PC + $offset; interp->resume_flag = 1";234 }235 236 =item C<run_core_func_decl($core)>237 238 Returns the C code for the run core function declaration.239 240 =cut241 242 sub run_core_func_decl {243 my ( $self, $core ) = @_;244 245 return "opcode_t * " . $self->core_prefix . "$core(opcode_t *cur_op, PARROT_INTERP)";246 }247 248 =item C<ops_addr_decl($base_suffix)>249 250 Returns the C code for the ops address declaration.251 252 =cut253 254 sub ops_addr_decl {255 my ( $self, $bs ) = @_;256 257 return "static void *const* ${bs}ops_addr;\n\n";258 }259 260 =item C<run_core_func_start()>261 262 Returns the C code prior to the run core function.263 264 =cut265 266 sub run_core_func_start {267 return <<END_C;268 #if defined(__GNUC__) && defined(I386) /* && defined(NO_DYNOPS) */269 register opcode_t *cur_opcode __asm__ ("esi") = cur_op;270 #else271 opcode_t *cur_opcode = cur_op;272 #endif273 274 static void *const l_ops_addr[] = {275 END_C276 }277 278 =item C<run_core_after_addr_table($base_suffix)>279 280 Returns the run core C code for section after the address table.281 282 =cut283 284 sub run_core_after_addr_table {285 my ( $self, $bs ) = @_;286 return <<END_C;287 288 if (!${bs}ops_addr)289 ${bs}ops_addr = l_ops_addr;290 if (cur_opcode == 0) {291 DECL_CONST_CAST;292 return (opcode_t *) PARROT_const_cast(void **, ${bs}ops_addr);293 }294 END_C295 }296 297 =item C<run_core_finish($base)>298 299 Returns the C code following the run core function.300 301 =cut302 303 sub run_core_finish {304 my ( $self, $base ) = @_;305 306 return "\n} /* " . $self->core_prefix . "$base */\n\n";307 }308 309 =item C<init_func_init1($base)>310 311 Returns the C code for the init function.312 313 =cut314 315 sub init_func_init1 {316 my ( $self, $base ) = @_;317 my $cg_func = $self->core_prefix . $base;318 my $bs = $base . $self->suffix . '_';319 320 return <<END_C;321 if (!${bs}op_lib.op_func_table)322 ${bs}op_lib.op_func_table = (op_func_t *) $cg_func(0, 0);323 END_C324 }325 326 =item C<init_set_dispatch($base_suffix)>327 328 Returns the C code to initialize the dispatch mechanism within the core's329 initialization function.330 331 =cut332 333 sub init_set_dispatch {334 my ( $self, $bs ) = @_;335 336 return <<END_C;337 ${bs}ops_addr = (void**) init;338 END_C339 }340 341 =back342 343 =head1 SEE ALSO344 345 =over 4346 347 =item C<Parrot::OpTrans>348 349 =item C<Parrot::OpTrans::C>350 351 =item C<Parrot::OpTrans::CGP>352 353 =item C<Parrot::OpTrans::CPrederef>354 355 =item C<Parrot::OpTrans::CSwitch>356 357 =back358 359 =cut360 361 1;362 363 # Local Variables:364 # mode: cperl365 # cperl-indent-level: 4366 # fill-column: 100367 # End:368 # vim: expandtab shiftwidth=4: -
lib/Parrot/OpTrans/CPrederef.pm
1 #! perl2 # Copyright (C) 2001-2007, Parrot Foundation.3 # $Id$4 5 =head1 NAME6 7 Parrot::OpTrans::CPrederef - C Predereferenced Transform8 9 =head1 DESCRIPTION10 11 C<Parrot::OpTrans::CPrederef> inherits from C<Parrot::OpTrans::C>12 to provide basic functionality for predereferenced run loops (switch,13 CGP).14 15 =head2 Instance Methods16 17 =over 418 19 =cut20 21 package Parrot::OpTrans::CPrederef;22 23 use strict;24 use warnings;25 26 use Parrot::OpTrans;27 use base qw( Parrot::OpTrans::C );28 29 =item C<defines()>30 31 Returns the C C<#define> macros required by the ops.32 33 =cut34 35 sub defines {36 my $type = __PACKAGE__;37 return <<END;38 /* defines - $0 -> $type */39 #define REL_PC ((size_t)(cur_opcode - (opcode_t*)interp->code->prederef.code))40 #define CUR_OPCODE \\41 ((opcode_t*)cur_opcode + Parrot_pcc_get_pred_offset(interp, CURRENT_CONTEXT(interp)))42 #define OP_AS_OFFS(o) (_reg_base + ((opcode_t*)cur_opcode)[o])43 44 END45 }46 47 =item expr_address($addr)48 49 =item expr_address($offset)50 51 =item expr_pop()52 53 Create various address parts.54 55 =cut56 57 sub expr_address {58 my ( $self, $addr ) = @_;59 return "opcode_to_prederef(interp, $addr)";60 }61 62 sub expr_offset {63 my ( $self, $offset ) = @_;64 return "CUR_OPCODE + $offset";65 }66 67 sub expr_pop {68 my ($self) = @_;69 return "opcode_to_prederef(interp, pop_dest(interp))";70 }71 72 sub run_core_func_decl {73 my ( $self, $core ) = @_;74 75 my $type = __PACKAGE__;76 my $prefix = $self->core_prefix;77 return <<END;78 /* run_core_func_decl - $0 -> $type */79 opcode_t * $prefix$core(opcode_t *cur_op, PARROT_INTERP)80 END81 }82 83 =item C<access_arg($type, $num, $op)>84 85 Returns the C code for the specified op argument type (see86 C<Parrot::OpTrans>) and value. C<$op> is an instance of C<Parrot::Op>.87 88 =cut89 90 sub access_arg {91 my ( $self, $type, $num, $op ) = @_;92 93 my %arg_maps = (94 'op' => "cur_opcode[%ld]",95 96 'i' => "(*(INTVAL *)OP_AS_OFFS(%ld))",97 'ki' => "(*(INTVAL *)OP_AS_OFFS(%ld))",98 'n' => "(*(FLOATVAL *)OP_AS_OFFS(%ld))",99 'p' => "(*(PMC **)OP_AS_OFFS(%ld))",100 's' => "(*(STRING **)OP_AS_OFFS(%ld))",101 'k' => "(*(PMC **)OP_AS_OFFS(%ld))",102 103 'ic' => "((INTVAL)cur_opcode[%ld])",104 'kic' => "((INTVAL)cur_opcode[%ld])",105 'nc' => "(*(FLOATVAL *)cur_opcode[%ld])",106 'sc' => "((STRING *)cur_opcode[%ld])",107 'pc' => "((PMC *)cur_opcode[%ld])",108 'kc' => "((PMC *)cur_opcode[%ld])",109 );110 111 die "Unrecognized type '$type' for num '$num' in opcode @{[$op->full_name]}"112 unless exists $arg_maps{$type};113 114 return sprintf( $arg_maps{$type}, $num );115 }116 117 =back118 119 =head1 SEE ALSO120 121 =over 4122 123 =item C<Parrot::OpTrans>124 125 =item C<Parrot::OpTrans::C>126 127 =item C<Parrot::OpTrans::CGP>128 129 =item C<Parrot::OpTrans::CGoto>130 131 =item C<Parrot::OpTrans::CSwitch>132 133 =back134 135 =cut136 137 1;138 139 # Local Variables:140 # mode: cperl141 # cperl-indent-level: 4142 # fill-column: 100143 # End:144 # vim: expandtab shiftwidth=4: -
lib/Parrot/OpTrans/C.pm
33 33 return 'PARROT_FUNCTION_CORE'; 34 34 } 35 35 36 =item C<core_prefix()>37 38 Returns an empty string.39 40 =cut41 42 sub core_prefix {43 return "";44 }45 46 36 =item C<defines()> 47 37 48 38 Returns the C C<#define> macros for register access etc. … … 173 163 174 164 =item C<Parrot::OpTrans> 175 165 176 =item C<Parrot::OpTrans::CGP>177 178 =item C<Parrot::OpTrans::CGoto>179 180 =item C<Parrot::OpTrans::CPrederef>181 182 =item C<Parrot::OpTrans::CSwitch>183 184 166 =back 185 167 186 168 =cut -
lib/Parrot/OpTrans.pm
16 16 The subclass hierarchy is as follows: 17 17 18 18 OpTrans 19 |___________ 20 | | 21 C CGoto 22 | | 23 CPrederef | 24 | | | 25 | |_________| 26 | | 27 CSwitch CGP 19 | 20 | 21 C 28 22 29 23 =head2 Class Methods 30 24 … … 91 85 die ref($self) . " doesn't have core_type()"; 92 86 } 93 87 94 =item C<core_prefix()>95 96 Implemented in subclasses to return a short prefix indicating the core97 type used to individuate core function names.98 99 88 =item C<run_core_func_decl($base)> 100 89 101 90 Optionally implemented in subclasses to return the C code for the run … … 222 211 223 212 =item C<Parrot::OpTrans::C> 224 213 225 =item C<Parrot::OpTrans::CGP>226 227 =item C<Parrot::OpTrans::CGoto>228 229 =item C<Parrot::OpTrans::CPrederef>230 231 =item C<Parrot::OpTrans::CSwitch>232 233 214 =back 234 215 235 216 =cut -
lib/Parrot/Harness/Options.pm
88 88 89 89 my %remap = ( 90 90 'j' => '-runcore=fast', 91 'g' => '-runcore=cgoto',92 91 'G' => '-runcore=gcdebug', 93 'C' => '-runcore=cgp',94 'S' => '-runcore=switch',95 92 'b' => '-runcore=bounds', 96 93 'f' => '-runcore=fast', 97 94 'r' => '-run-pbc', … … 113 110 print <<"EOF"; 114 111 perl t/harness [options] [testfiles] 115 112 -w ... warnings on 116 -g ... run CGoto117 -C ... run CGP118 -S ... run Switched119 113 -b ... run bounds checked 120 114 --run-exec ... run exec core 121 115 -f ... run fast core -
MANIFEST
1 1 # ex: set ro: 2 2 # $Id$ 3 3 # 4 # generated by tools/dev/mk_manifest_and_skip.pl Tue Apr 20 20:11:26 2010 UT4 # generated by tools/dev/mk_manifest_and_skip.pl Wed Apr 21 03:55:26 2010 UT 5 5 # 6 6 # See below for documentation on the format of this file. 7 7 # … … 225 225 config/auto/backtrace/test_dlinfo_c.in [] 226 226 config/auto/byteorder.pm [] 227 227 config/auto/byteorder/test_c.in [] 228 config/auto/cgoto.pm []229 config/auto/cgoto/test_c.in []230 228 config/auto/cpu.pm [] 231 229 config/auto/cpu/i386/auto.pm [] 232 230 config/auto/cpu/i386/test_gcc_cmpxchg_c.in [] … … 1117 1115 lib/Parrot/Op.pm [devel]lib 1118 1116 lib/Parrot/OpTrans.pm [devel]lib 1119 1117 lib/Parrot/OpTrans/C.pm [devel]lib 1120 lib/Parrot/OpTrans/CGP.pm [devel]lib1121 lib/Parrot/OpTrans/CGoto.pm [devel]lib1122 lib/Parrot/OpTrans/CPrederef.pm [devel]lib1123 lib/Parrot/OpTrans/CSwitch.pm [devel]lib1124 1118 lib/Parrot/Ops2c/Auxiliary.pm [devel]lib 1125 1119 lib/Parrot/Ops2c/Utils.pm [devel]lib 1126 1120 lib/Parrot/Ops2pm.pm [devel]lib … … 1987 1981 t/steps/auto/attributes-01.t [test] 1988 1982 t/steps/auto/backtrace-01.t [test] 1989 1983 t/steps/auto/byteorder-01.t [test] 1990 t/steps/auto/cgoto-01.t [test]1991 1984 t/steps/auto/cpu-01.t [test] 1992 1985 t/steps/auto/ctags-01.t [test] 1993 1986 t/steps/auto/env-01.t [test] -
ports/cygwin/README
682 682 /usr/include/parrot/1.0.0/parrot/op.h 683 683 /usr/include/parrot/1.0.0/parrot/oplib.h 684 684 /usr/include/parrot/1.0.0/parrot/oplib/core_ops.h 685 /usr/include/parrot/1.0.0/parrot/oplib/core_ops_cg.h686 /usr/include/parrot/1.0.0/parrot/oplib/core_ops_cgp.h687 /usr/include/parrot/1.0.0/parrot/oplib/core_ops_switch.h688 685 /usr/include/parrot/1.0.0/parrot/oplib/ops.h 689 686 /usr/include/parrot/1.0.0/parrot/packfile.h 690 687 /usr/include/parrot/1.0.0/parrot/parrot.h … … 748 745 /usr/lib/parrot/1.0.0/src/install_config.o 749 746 /usr/lib/parrot/1.0.0/src/nci.c 750 747 /usr/lib/parrot/1.0.0/src/null_config.o 751 /usr/lib/parrot/1.0.0/src/ops/core_ops_cgp.c752 /usr/lib/parrot/1.0.0/src/ops/core_ops_switch.c753 748 /usr/lib/parrot/1.0.0/src/parrot_config.o 754 749 /usr/lib/parrot/1.0.0/tools/build/ops2c.pl 755 750 /usr/lib/parrot/1.0.0/tools/build/pmc2c.pl … … 892 887 /usr/share/doc/parrot/1.0.0/html/config/auto/attributes.pm.html 893 888 /usr/share/doc/parrot/1.0.0/html/config/auto/backtrace.pm.html 894 889 /usr/share/doc/parrot/1.0.0/html/config/auto/byteorder.pm.html 895 /usr/share/doc/parrot/1.0.0/html/config/auto/cgoto.pm.html896 890 /usr/share/doc/parrot/1.0.0/html/config/auto/cpu.pm.html 897 891 /usr/share/doc/parrot/1.0.0/html/config/auto/cpu/i386/auto.pm.html 898 892 /usr/share/doc/parrot/1.0.0/html/config/auto/cpu/ppc/auto.pm.html -
MANIFEST.SKIP
1 1 # ex: set ro: 2 2 # $Id$ 3 # generated by tools/dev/mk_manifest_and_skip.pl Thu Apr 15 17:41:442010 UT3 # generated by tools/dev/mk_manifest_and_skip.pl Wed Apr 21 05:05:15 2010 UT 4 4 # 5 5 # This file should contain a transcript of the svn:ignore properties 6 6 # of the directories in the Parrot subversion repository. (Needed for -
include/parrot/oplib.h
51 51 CORE_OPS_check_events__, /* inserted into op dispatch when an event 52 52 got scheduled */ 53 53 CORE_OPS_wrapper__, /* inserted by dynop_register for new ops */ 54 CORE_OPS_prederef__ /* inserted by dynop_register for new ops */55 54 /* 2 more reserved */ 56 55 } special_core_ops_enum; 57 56 -
include/parrot/runcore_api.h
38 38 typedef enum Parrot_runcore_flags { 39 39 RUNCORE_REENTRANT_FLAG = 1 << 0, 40 40 RUNCORE_FUNC_TABLE_FLAG = 1 << 1, 41 RUNCORE_EVENT_CHECK_FLAG = 1 << 2,42 RUNCORE_PREDEREF_OPS_FLAG = 1 << 3,43 RUNCORE_CGOTO_OPS_FLAG = 1 << 4,44 RUNCORE_JIT_OPS_FLAG = 1 << 545 41 } Parrot_runcore_flags; 46 42 47 43 … … 55 51 #define PARROT_RUNCORE_FUNC_TABLE_SET(runcore) \ 56 52 Runcore_flag_SET(runcore, RUNCORE_FUNC_TABLE_FLAG) 57 53 58 #define PARROT_RUNCORE_EVENT_CHECK_TEST(runcore) \59 Runcore_flag_TEST(runcore, RUNCORE_EVENT_CHECK_FLAG)60 #define PARROT_RUNCORE_EVENT_CHECK_SET(runcore) \61 Runcore_flag_SET(runcore, RUNCORE_EVENT_CHECK_FLAG)62 63 #define PARROT_RUNCORE_PREDEREF_OPS_TEST(runcore) \64 Runcore_flag_TEST(runcore, RUNCORE_PREDEREF_OPS_FLAG)65 #define PARROT_RUNCORE_PREDEREF_OPS_SET(runcore) \66 Runcore_flag_SET(runcore, RUNCORE_PREDEREF_OPS_FLAG)67 68 #define PARROT_RUNCORE_CGOTO_OPS_TEST(runcore) \69 Runcore_flag_TEST(runcore, RUNCORE_CGOTO_OPS_FLAG)70 #define PARROT_RUNCORE_CGOTO_OPS_SET(runcore) \71 Runcore_flag_SET(runcore, RUNCORE_CGOTO_OPS_FLAG)72 73 #define PARROT_RUNCORE_JIT_OPS_TEST(runcore) \74 Runcore_flag_TEST(runcore, RUNCORE_JIT_OPS_FLAG)75 #define PARROT_RUNCORE_JIT_OPS_SET(runcore) \76 Runcore_flag_SET(runcore, RUNCORE_JIT_OPS_FLAG)77 78 54 /* HEADERIZER BEGIN: src/runcore/main.c */ 79 55 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */ 80 56 … … 152 128 ARGIN(Parrot_runcore_t *runcore)) 153 129 __attribute__nonnull__(2); 154 130 155 PARROT_CAN_RETURN_NULL156 void * init_prederef(PARROT_INTERP, ARGIN(Parrot_runcore_t *runcore))157 __attribute__nonnull__(1)158 __attribute__nonnull__(2);159 160 void load_prederef(PARROT_INTERP, ARGIN(Parrot_runcore_t *runcore))161 __attribute__nonnull__(1)162 __attribute__nonnull__(2);163 164 void Parrot_runcore_cgoto_init(PARROT_INTERP)165 __attribute__nonnull__(1);166 167 void Parrot_runcore_cgp_init(PARROT_INTERP)168 __attribute__nonnull__(1);169 170 131 void Parrot_runcore_debugger_init(PARROT_INTERP) 171 132 __attribute__nonnull__(1); 172 133 … … 182 143 void Parrot_runcore_slow_init(PARROT_INTERP) 183 144 __attribute__nonnull__(1); 184 145 185 void Parrot_runcore_switch_init(PARROT_INTERP)186 __attribute__nonnull__(1);187 188 146 #define ASSERT_ARGS_get_core_op_lib_init __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 189 147 PARROT_ASSERT_ARG(runcore)) 190 #define ASSERT_ARGS_init_prederef __attribute__unused__ int _ASSERT_ARGS_CHECK = (\191 PARROT_ASSERT_ARG(interp) \192 , PARROT_ASSERT_ARG(runcore))193 #define ASSERT_ARGS_load_prederef __attribute__unused__ int _ASSERT_ARGS_CHECK = (\194 PARROT_ASSERT_ARG(interp) \195 , PARROT_ASSERT_ARG(runcore))196 #define ASSERT_ARGS_Parrot_runcore_cgoto_init __attribute__unused__ int _ASSERT_ARGS_CHECK = (\197 PARROT_ASSERT_ARG(interp))198 #define ASSERT_ARGS_Parrot_runcore_cgp_init __attribute__unused__ int _ASSERT_ARGS_CHECK = (\199 PARROT_ASSERT_ARG(interp))200 148 #define ASSERT_ARGS_Parrot_runcore_debugger_init __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 201 149 PARROT_ASSERT_ARG(interp)) 202 150 #define ASSERT_ARGS_Parrot_runcore_exec_init __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ … … 207 155 PARROT_ASSERT_ARG(interp)) 208 156 #define ASSERT_ARGS_Parrot_runcore_slow_init __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 209 157 PARROT_ASSERT_ARG(interp)) 210 #define ASSERT_ARGS_Parrot_runcore_switch_init __attribute__unused__ int _ASSERT_ARGS_CHECK = (\211 PARROT_ASSERT_ARG(interp))212 158 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */ 213 159 /* HEADERIZER END: src/runcore/cores.c */ 214 160 -
include/parrot/op.h
57 57 /* NOTE: Sure wish we could put the types here... */ 58 58 59 59 typedef opcode_t *(*op_func_t)(opcode_t *, PARROT_INTERP); 60 typedef void **(*op_func_prederef_t)(void **, PARROT_INTERP);61 60 62 61 63 62 /* -
include/parrot/interpreter.h
64 64 PARROT_SLOW_CORE, /* slow bounds/trace/profile core */ 65 65 PARROT_FUNCTION_CORE = PARROT_SLOW_CORE, 66 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 67 PARROT_EXEC_CORE = 0x20, /* TODO Parrot_exec_run variants */ 71 68 PARROT_GC_DEBUG_CORE = 0x40, /* run GC before each op */ 72 69 PARROT_DEBUGGER_CORE = 0x80, /* used by parrot debugger */ … … 152 149 struct _Thread_data; /* in thread.h */ 153 150 struct _Caches; /* caches .h */ 154 151 155 typedef struct _Prederef_branch { /* item for recording branches */156 size_t offs; /* offset in code */157 void *op; /* opcode at that position */158 } Prederef_branch;159 160 typedef struct _Prederef {161 void **code; /* prederefed code */162 Prederef_branch *branches; /* list of branches in code */163 size_t n_branches; /* entries in that list */164 size_t n_allocated; /* allocated size of it */165 } Prederef;166 167 152 /* Get Context from interpreter */ 168 153 #define CONTEXT(interp) Parrot_pcc_get_context_struct((interp), (interp)->ctx) 169 154 -
include/parrot/packfile.h
255 255 256 256 struct PackFile_ByteCode { 257 257 PackFile_Segment base; 258 Prederef prederef; /* The predereferenced code and info */259 258 struct PackFile_Debug *debugs; 260 259 PackFile_ConstTable *const_table; 261 260 PackFile_FixupTable *fixups; -
include/parrot/exceptions.h
51 51 EXCEPTION_JIT_UNAVAILABLE, 52 52 EXCEPTION_EXEC_UNAVAILABLE, 53 53 EXCEPTION_INTERP_ERROR, 54 EXCEPTION_PREDEREF_LOAD_ERROR,55 54 EXCEPTION_PARROT_USAGE_ERROR, 56 55 EXCEPTION_PIO_ERROR, 57 56 EXCEPTION_PARROT_POINTER_ERROR, -
include/parrot/context.h
214 214 __attribute__nonnull__(2); 215 215 216 216 PARROT_EXPORT 217 size_t Parrot_pcc_get_pred_offset_func(PARROT_INTERP, ARGIN(PMC *ctx))218 __attribute__nonnull__(1)219 __attribute__nonnull__(2);220 221 PARROT_EXPORT222 217 UINTVAL Parrot_pcc_get_recursion_depth_func(PARROT_INTERP, ARGIN(PMC *ctx)) 223 218 __attribute__nonnull__(1) 224 219 __attribute__nonnull__(2); … … 316 311 __attribute__nonnull__(2); 317 312 318 313 PARROT_EXPORT 319 void Parrot_pcc_set_pred_offset_func(PARROT_INTERP,320 ARGIN(PMC *ctx),321 size_t pred_offset)322 __attribute__nonnull__(1)323 __attribute__nonnull__(2);324 325 PARROT_EXPORT326 314 void Parrot_pcc_set_signature_func(PARROT_INTERP, 327 315 ARGIN(PMC *ctx), 328 316 ARGIN_NULLOK(PMC *sig_object)) … … 431 419 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 432 420 PARROT_ASSERT_ARG(interp) \ 433 421 , PARROT_ASSERT_ARG(ctx)) 434 #define ASSERT_ARGS_Parrot_pcc_get_pred_offset_func \435 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\436 PARROT_ASSERT_ARG(interp) \437 , PARROT_ASSERT_ARG(ctx))438 422 #define ASSERT_ARGS_Parrot_pcc_get_recursion_depth_func \ 439 423 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 440 424 PARROT_ASSERT_ARG(interp) \ … … 486 470 #define ASSERT_ARGS_Parrot_pcc_set_pc_func __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 487 471 PARROT_ASSERT_ARG(interp) \ 488 472 , PARROT_ASSERT_ARG(ctx)) 489 #define ASSERT_ARGS_Parrot_pcc_set_pred_offset_func \490 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\491 PARROT_ASSERT_ARG(interp) \492 , PARROT_ASSERT_ARG(ctx))493 473 #define ASSERT_ARGS_Parrot_pcc_set_signature_func __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 494 474 PARROT_ASSERT_ARG(interp) \ 495 475 , PARROT_ASSERT_ARG(ctx)) … … 533 513 # define Parrot_pcc_get_namespace(i, c) (__C(c)->current_namespace) 534 514 # define Parrot_pcc_set_namespace(i, c, value) (__C(c)->current_namespace = (value)) 535 515 536 # define Parrot_pcc_get_pred_offset(i, c) (__C(c)->pred_offset)537 # define Parrot_pcc_set_pred_offset(i, c, value) (__C(c)->pred_offset = (value))538 539 516 # define Parrot_pcc_get_pc(i, c) (__C(c)->current_pc) 540 517 # define Parrot_pcc_set_pc(i, c, value) (__C(c)->current_pc = (value)) 541 518 … … 594 571 # define Parrot_pcc_get_namespace(i, c) Parrot_pcc_get_namespace_func((i), (c)) 595 572 # define Parrot_pcc_set_namespace(i, c, value) Parrot_pcc_set_namespace_func((i), (c), (value)) 596 573 597 # define Parrot_pcc_get_pred_offset(i, c) Parrot_pcc_get_pred_offset_func((i), (c))598 # define Parrot_pcc_set_pred_offset(i, c, value) Parrot_pcc_set_pred_offset_func((i), (c), (value))599 600 574 # define Parrot_pcc_get_pc(i, c) Parrot_pcc_get_pc_func((i), (c)) 601 575 # define Parrot_pcc_set_pc(i, c, value) Parrot_pcc_set_pc_func((i), (c), (value)) 602 576 -
Configure.pl
343 343 344 344 Use the given ops files. 345 345 346 =item C<--cgoto=0>347 348 Don't build cgoto core. This is recommended when you are short of memory.349 350 346 =item C<--jitcapable> 351 347 352 348 Use JIT system. … … 623 619 auto::jit 624 620 auto::frames 625 621 auto::cpu 626 auto::cgoto627 622 auto::inline 628 623 auto::gc 629 624 auto::memalign -
README
92 92 93 93 perldoc -F docs/intro.pod 94 94 95 NOTES96 -----97 98 On some older computers with little RAM, the computed-goto dispatch core99 (ops/core_ops_cg.c) may take a while to compile or may fail to compile at all.100 You can pass a flag to Configure.pl (--cgoto=0) to disable the computed-goto101 core, at a slight cost in runtime speed.102 103 95 CHANGES 104 96 ------- 105 97 -
compilers/imcc/main.c
251 251 if (strchr(opt->opt_arg, '2')) { 252 252 IMCC_INFO(interp)->optimizer_level |= (OPT_PRE | OPT_CFG); 253 253 } 254 if (strchr(opt->opt_arg, 't')) {255 #ifdef HAVE_COMPUTED_GOTO256 *core = PARROT_CGP_CORE;257 #else258 *core = PARROT_SWITCH_CORE;259 #endif260 }261 254 break; 262 255 263 256 default: … … 414 407 if (opt_level & OPT_SUB) 415 408 opt_desc[i++] = 'c'; 416 409 417 if (PARROT_RUNCORE_JIT_OPS_TEST(interp->run_core))418 opt_desc[i++] = 'j';419 420 if (PARROT_RUNCORE_PREDEREF_OPS_TEST(interp->run_core))421 opt_desc[i++] = 't';422 423 410 opt_desc[i] = '\0'; 424 411 return; 425 412 } -
t/configure/testlib/adefectivefoobar
40 40 auto::jit 41 41 auto::cpu 42 42 auto::funcptr 43 auto::cgoto44 43 auto::inline 45 44 auto::gc 46 45 auto::memalign -
t/configure/testlib/bdefectivefoobar
50 50 auto::jit 51 51 auto::cpu 52 52 auto::funcptr 53 auto::cgoto54 53 auto::inline 55 54 auto::gc 56 55 auto::memalign -
t/configure/testlib/cdefectivefoobar
51 51 auto::jit 52 52 auto::cpu 53 53 auto::funcptr 54 auto::cgoto55 54 auto::inline 56 55 auto::gc 57 56 auto::memalign -
t/configure/testlib/ddefectivefoobar
42 42 auto::jit 43 43 auto::cpu 44 44 auto::funcptr 45 auto::cgoto46 45 auto::inline 47 46 auto::gc 48 47 auto::memalign -
t/configure/testlib/verbosefoobar
44 44 auto::jit 45 45 auto::cpu 46 46 auto::funcptr 47 auto::cgoto48 47 auto::inline 49 48 auto::gc 50 49 auto::memalign -
t/pharness/02-get_test_prog_args.t
13 13 }; 14 14 plan( skip_all => 't/harness only runs once configuration has completed' ) 15 15 if $@; 16 plan( tests => 1 6);16 plan( tests => 12 ); 17 17 use Carp; 18 18 use Parrot::Harness::Options qw( get_test_prog_args ); 19 19 … … 28 28 ($gc_debug, $run_exec) = (0,0); 29 29 $args = get_test_prog_args($optsref, $gc_debug, $run_exec); 30 30 like($args, qr/-d/, "Got expected option"); 31 like($args, qr/--runcore=cgoto/, "Got expected option");32 31 like($args, qr/-D40/, "Got expected option"); 33 32 34 33 $optsref = { … … 40 39 ($gc_debug, $run_exec) = (0,0); 41 40 $args = get_test_prog_args($optsref, $gc_debug, $run_exec); 42 41 like($args, qr/-d/, "Got expected option"); 43 like($args, qr/--runcore=cgoto/, "Got expected option");44 42 like($args, qr/-D40/, "Got expected option"); 45 43 like($args, qr/-O2/, "Got expected option"); 46 44 … … 52 50 ($gc_debug, $run_exec) = (1,0); 53 51 $args = get_test_prog_args($optsref, $gc_debug, $run_exec); 54 52 like($args, qr/-d/, "Got expected option"); 55 like($args, qr/--runcore=cgoto/, "Got expected option");56 53 like($args, qr/-D40/, "Got expected option"); 57 54 like($args, qr/\s--gc-debug/, "Got expected option"); 58 55 … … 64 61 ($gc_debug, $run_exec) = (0,1); 65 62 $args = get_test_prog_args($optsref, $gc_debug, $run_exec); 66 63 like($args, qr/-d/, "Got expected option"); 67 like($args, qr/--runcore=cgoto/, "Got expected option");68 64 like($args, qr/-D40/, "Got expected option"); 69 65 like($args, qr/\s--run-exec/, "Got expected option"); 70 66 -
t/steps/auto/cgoto-01.t
1 #! perl2 # Copyright (C) 2007, Parrot Foundation.3 # $Id$4 # auto/cgoto-01.t5 6 use strict;7 use warnings;8 use Test::More tests => 25;9 use Carp;10 use lib qw( lib t/configure/testlib );11 use_ok('config::auto::cgoto');12 use Parrot::Configure::Options qw( process_options );13 use Parrot::Configure::Step::Test;14 use Parrot::Configure::Test qw(15 test_step_constructor_and_description16 );17 use IO::CaptureOutput qw( capture );18 19 20 ########### regular ###########21 22 my ($args, $step_list_ref) = process_options( {23 argv => [ ],24 mode => q{configure},25 } );26 27 my $conf = Parrot::Configure::Step::Test->new;28 $conf->include_config_results( $args );29 30 my $serialized = $conf->pcfreeze();31 32 my $pkg = q{auto::cgoto};33 34 $conf->add_steps($pkg);35 $conf->options->set( %{$args} );36 my $step = test_step_constructor_and_description($conf);37 my $ret = $step->runstep($conf);38 ok( $ret, "runstep() returned true value" );39 ok(defined($step->result()), "A result was defined");40 ok(defined($conf->data->get('cg_flag')), "An attribute has been defined");41 42 $conf->replenish($serialized);43 44 ########### _probe_for_cgoto() ###########45 46 ($args, $step_list_ref) = process_options( {47 argv => [ ],48 mode => q{configure},49 } );50 51 $conf->add_steps($pkg);52 $conf->options->set( %{$args} );53 $step = test_step_constructor_and_description($conf);54 $conf->options->set(cgoto => 1);55 is(auto::cgoto::_probe_for_cgoto($conf), 1,56 "Got expected return value");57 $conf->options->set(cgoto => 0);58 is(auto::cgoto::_probe_for_cgoto($conf), 0,59 "Got expected return value");60 $conf->options->set(cgoto => undef);61 ok(defined(auto::cgoto::_probe_for_cgoto($conf)),62 "Probe returned a defined value");63 64 ########### _evaluate_cgoto() ###########65 66 $step->_evaluate_cgoto($conf, 1);67 ok($conf->data->get('cg_flag'), "An attribute was set to true value");68 is($step->result(), q{yes}, "Expected result was set");69 70 $step->_evaluate_cgoto($conf, 0);71 is($conf->data->get('cg_flag'), q{}, "An attribute was set to empty string");72 is($step->result(), q{no}, "Expected result was set");73 74 $conf->replenish($serialized);75 76 ($args, $step_list_ref) = process_options( {77 argv => [ ],78 mode => q{configure},79 } );80 81 $conf->add_steps($pkg);82 $conf->options->set( %{$args} );83 $step = test_step_constructor_and_description($conf);84 {85 my $stdout;86 capture(87 sub { $step->_evaluate_cgoto($conf, 1) },88 \$stdout89 );90 ok($conf->data->get('cg_flag'), "An attribute was set to true value");91 is($step->result(), q{yes}, "Expected result was set");92 }93 94 {95 my $stdout;96 capture(97 sub { $step->_evaluate_cgoto($conf, 0) },98 \$stdout99 );100 is($conf->data->get('cg_flag'), q{},101 "An attribute was set to empty string");102 is($step->result(), q{no}, "Expected result was set");103 }104 105 106 pass("Completed all tests in $0");107 108 ################### DOCUMENTATION ###################109 110 =head1 NAME111 112 auto/cgoto-01.t - test auto::cgoto113 114 =head1 SYNOPSIS115 116 % prove t/steps/auto/cgoto-01.t117 118 =head1 DESCRIPTION119 120 The files in this directory test functionality used by F<Configure.pl>.121 122 The tests in this file test auto::cgoto.123 124 =head1 AUTHOR125 126 James E Keenan127 128 =head1 SEE ALSO129 130 config::auto::cgoto, F<Configure.pl>.131 132 =cut133 134 # Local Variables:135 # mode: cperl136 # cperl-indent-level: 4137 # fill-column: 100138 # End:139 # vim: expandtab shiftwidth=4: -
t/tools/install/testlib/README
104 104 105 105 perldoc -F docs/intro.pod 106 106 107 NOTES108 -----109 110 On some older computers with little RAM, the computed-goto dispatch core111 (ops/core_ops_cg.c) may take a while to compile or may fail to compile at all.112 You can pass a flag to Configure.pl (--cgoto=0) to disable the computed-goto113 core, at a slight cost in runtime speed.114 115 107 CHANGES 116 108 ------- 117 109 -
t/tools/ops2cutils/04-print_c_source_top.t
19 19 } 20 20 unshift @INC, qq{$topdir/lib}; 21 21 } 22 use Test::More tests => 26;22 use Test::More tests => 10; 23 23 use Carp; 24 24 use Cwd; 25 25 use File::Copy; … … 47 47 require Parrot::Ops2c::Utils; 48 48 49 49 test_print_c_source_top( [qw( C )] ); 50 test_print_c_source_top( [qw( CGoto )] );51 test_print_c_source_top( [qw( CGP )] );52 test_print_c_source_top( [qw( CSwitch )] );53 test_print_c_source_top( [qw( C CGoto CGP CSwitch CPrederef )] );54 50 55 51 ok( chdir($cwd), "returned to starting directory" ); 56 52 } -
t/tools/ops2cutils/09-dynamic_nolines.t
19 19 } 20 20 unshift @INC, qq{$topdir/lib}; 21 21 } 22 use Test::More tests => 22;22 use Test::More tests => 10; 23 23 use Carp; 24 24 use Cwd; 25 25 use File::Copy; … … 52 52 } 53 53 chdir "src/dynoplibs" or croak "Unable to change to src/dynoplibs: $!"; 54 54 55 test_dynops_nolines( [qw( CGoto obscure.ops )] );56 test_dynops_nolines( [qw( CGP obscure.ops )] );57 55 test_dynops_nolines( [qw( C obscure.ops )] ); 58 test_dynops_nolines( [qw( CSwitch obscure.ops )] );59 56 60 57 ok( chdir($cwd), "returned to starting directory" ); 61 58 } -
t/tools/ops2cutils/05-print_c_source_bottom.t
19 19 } 20 20 unshift @INC, qq{$topdir/lib}; 21 21 } 22 use Test::More tests => 26;22 use Test::More tests => 10; 23 23 use Carp; 24 24 use Cwd; 25 25 use File::Copy; … … 48 48 require Parrot::Ops2c::Utils; 49 49 50 50 test_print_c_source_bottom( [qw( C )] ); 51 test_print_c_source_bottom( [qw( CGoto )] );52 test_print_c_source_bottom( [qw( CGP )] );53 test_print_c_source_bottom( [qw( CSwitch )] );54 test_print_c_source_bottom( [qw( C CGoto CGP CSwitch CPrederef )] );55 51 56 52 ok( chdir($cwd), "returned to starting directory" ); 57 53 } -
t/tools/ops2cutils/03-print_c_header_file.t
19 19 } 20 20 unshift @INC, qq{$topdir/lib}; 21 21 } 22 use Test::More tests => 24;22 use Test::More tests => 12; 23 23 use Carp; 24 24 use Cwd; 25 25 use File::Copy; … … 47 47 require Parrot::Ops2c::Utils; 48 48 49 49 test_single_trans_and_header(q{C}); 50 test_single_trans_and_header(q{CGoto});51 test_single_trans_and_header(q{CGP});52 test_single_trans_and_header(q{CSwitch});53 test_single_trans_and_header(q{CPrederef});54 50 55 51 { 56 local @ARGV = qw( C CGoto CGP CSwitch CPrederef);52 local @ARGV = qw( C ); 57 53 my $self = Parrot::Ops2c::Utils->new( 58 54 { 59 55 argv => [@ARGV], … … 73 69 74 70 sub test_single_trans_and_header { 75 71 my $trans = shift; 76 my %available = map { $_, 1 } qw( C CGoto CGP CSwitch CPrederef);72 my %available = map { $_, 1 } qw( C ); 77 73 croak "Bad argument $trans to test_single_trans()" 78 74 unless $available{$trans}; 79 75 -
t/tools/ops2cutils/01-new.t
19 19 } 20 20 unshift @INC, qq{$topdir/lib}; 21 21 } 22 use Test::More tests => 1 9;22 use Test::More tests => 15; 23 23 use Carp; 24 24 use Cwd; 25 25 use File::Copy; … … 87 87 "Constructor correctly returned undef due to bad class name command-line argument" ); 88 88 like( 89 89 $stderr, 90 qr/Parrot::Ops2c::Utils::new\(\) requires C , CGoto, CGP, CSwitch and\/or CPrederef/,90 qr/Parrot::Ops2c::Utils::new\(\) requires C/, 91 91 "Got correct error message" 92 92 ); 93 93 } 94 94 95 95 test_single_trans(q{C}); 96 test_single_trans(q{CGoto});97 test_single_trans(q{CGP});98 test_single_trans(q{CSwitch});99 test_single_trans(q{CPrederef});100 96 101 97 { 102 local @ARGV = qw( C CGoto CGP CSwitch CPrederef);98 local @ARGV = qw( C ); 103 99 my $self = Parrot::Ops2c::Utils->new( 104 100 { argv => [@ARGV], flag => { core => 1 } } 105 101 ); … … 107 103 } 108 104 109 105 { 110 local @ARGV = qw( C CGoto CGP CSwitch CPrederef);106 local @ARGV = qw( C ); 111 107 my $self = Parrot::Ops2c::Utils->new( 112 108 { 113 109 argv => [@ARGV], … … 146 142 147 143 sub test_single_trans { 148 144 my $trans = shift; 149 my %available = map { $_, 1 } qw( C CGoto CGP CSwitch CPrederef);145 my %available = map { $_, 1 } qw( C ); 150 146 croak "Bad argument $trans to test_single_trans()" 151 147 unless $available{$trans}; 152 148 -
t/tools/ops2cutils/06-dynamic.t
19 19 } 20 20 unshift @INC, qq{$topdir/lib}; 21 21 } 22 use Test::More tests => 27;22 use Test::More tests => 15; 23 23 use Carp; 24 24 use Cwd; 25 25 use File::Copy; … … 55 55 } 56 56 chdir "src/dynoplibs" or croak "Unable to change to src/dynoplibs: $!"; 57 57 58 test_dynops( [qw( CGoto obscure.ops )] ); 59 test_dynops( [qw( CGP obscure.ops )] ); 60 test_dynops( [qw( C obscure.ops )] ); 61 test_dynops( [qw( CSwitch obscure.ops )] ); 58 test_dynops( [qw( C obscure.ops )] ); 62 59 63 60 { 64 61 my ($self, $stdout, $stderr); 65 62 capture( 66 63 sub { $self = Parrot::Ops2c::Utils->new( { 67 argv => [qw( C Switchobscure.ops obscure.ops )],64 argv => [qw( C obscure.ops obscure.ops )], 68 65 flag => { dynamic => 1 }, 69 66 } ); }, 70 67 \$stdout, -
t/tools/ops2cutils/07-make_incdir.t
81 81 require Parrot::Ops2c::Utils; 82 82 83 83 { 84 local @ARGV = qw( C CGoto CGP CSwitch CPrederef);84 local @ARGV = qw( C ); 85 85 my $self = Parrot::Ops2c::Utils->new( 86 86 { 87 87 argv => [@ARGV], … … 98 98 99 99 sub test_single_trans { 100 100 my $trans = shift; 101 my %available = map { $_, 1 } qw( C CGoto CGP CSwitch CPrederef);101 my %available = map { $_, 1 } qw( C ); 102 102 croak "Bad argument $trans to test_single_trans()" 103 103 unless $available{$trans}; 104 104 -
t/tools/ops2cutils/10-print_c_source_file.t
19 19 } 20 20 unshift @INC, qq{$topdir/lib}; 21 21 } 22 use Test::More tests => 21;22 use Test::More tests => 12; 23 23 use Carp; 24 24 use Cwd; 25 25 use File::Copy; … … 47 47 require Parrot::Ops2c::Utils; 48 48 49 49 test_single_trans_and_source(q{C}); 50 test_single_trans_and_source(q{CGoto});51 test_single_trans_and_source(q{CGP});52 test_single_trans_and_source(q{CSwitch});53 50 54 51 { 55 local @ARGV = qw( C CGoto CGP CSwitch);52 local @ARGV = qw( C ); 56 53 my $self = Parrot::Ops2c::Utils->new( 57 54 { 58 55 argv => [@ARGV], … … 72 69 73 70 sub test_single_trans_and_source { 74 71 my $trans = shift; 75 my %available = map { $_, 1 } qw( C CGoto CGP CSwitch CPrederef);72 my %available = map { $_, 1 } qw( C ); 76 73 croak "Bad argument $trans to test_single_trans()" 77 74 unless $available{$trans}; 78 75 -
t/tools/ops2cutils/08-nolines.t
47 47 require Parrot::Ops2c::Utils; 48 48 49 49 { 50 local @ARGV = qw( C CGoto CGP CSwitch CPrederef);50 local @ARGV = qw( C ); 51 51 my $self = Parrot::Ops2c::Utils->new( 52 52 { 53 53 argv => [@ARGV], -
t/harness
134 134 135 135 Turn warnings on. 136 136 137 =item C<-g>138 139 Run the C<CGoto> core.140 141 137 =item C<-G> 142 138 143 139 Run the C<GCDebug> core. … … 146 142 147 143 Alias for running with the fast core. 148 144 149 =item C<-C>150 151 Run the C<CGP> core.152 153 =item C<-S>154 155 Run Switched.156 157 145 =item C<-b> 158 146 159 147 Run bounds checking enabled. -
t/examples/shootout.t
35 35 To add a new test, you do not have to modify this script: 36 36 37 37 1. add your script (toto.pir) to examples/shootout 38 2. put parrot options in the first line (e.g "#!./parrot -Oc -R cgp-jit")38 2. put parrot options in the first line (e.g "#!./parrot -Oc") 39 39 3. make sure you have default argument values 40 40 4. put the expected output as a file : toto.pir_output 41 41 5. if you need an input file (to be read from stdin), call it toto.pir_input … … 74 74 $args =~ s/-j/-C/; 75 75 $args =~ s/-Cj/-C/; 76 76 } 77 unless ( $PConfig{cg_flag} =~ /HAVE/ ) { 78 $args =~ s/-Cj/-j/; 77 $args =~ s/-Cj/-j/; 79 78 80 81 79 # Remove any plain -C option. 80 $args =~ s/(^|\s)-C(\s|$)/$1$2/; 82 81 83 # Remove any extra Cs still floating around 84 $args =~ s/C//; 85 } 82 # Remove any extra Cs still floating around 83 $args =~ s/C//; 86 84 87 85 # look for input files 88 86 my $input = "$file$INPUT_EXT"; -
t/op/interp.t
154 154 $I0 = interpinfo .INTERPINFO_CURRENT_RUNCORE 155 155 if $I0 == .PARROT_FUNCTION_CORE goto ok1 156 156 if $I0 == .PARROT_FAST_CORE goto ok1 157 if $I0 == .PARROT_SWITCH_CORE goto ok1158 if $I0 == .PARROT_CGOTO_CORE goto ok1159 if $I0 == .PARROT_CGP_CORE goto ok1160 157 if $I0 == .PARROT_EXEC_CORE goto ok1 161 158 if $I0 == .PARROT_GC_DEBUG_CORE goto ok1 162 159 print 'not ' -
t/op/annotate-old.t
24 24 =cut 25 25 26 26 TODO: { 27 local $TODO = q|fails in fast and cgoto runcores- TT #1135|28 if $ENV{TEST_PROG_ARGS} =~ /--runcore= (fast|cgoto)/;27 local $TODO = q|fails in fast runcore - TT #1135| 28 if $ENV{TEST_PROG_ARGS} =~ /--runcore=fast/; 29 29 30 30 pir_error_output_like( <<CODE, <<OUTPUT, 'unhandled exception from loaded function'); 31 31 .sub main :main -
t/op/debuginfo.t
24 24 =cut 25 25 26 26 $ENV{TEST_PROG_ARGS} ||= ''; 27 my $nolineno = $ENV{TEST_PROG_ARGS} =~ /--runcore= (fast|cgoto)/27 my $nolineno = $ENV{TEST_PROG_ARGS} =~ /--runcore=fast/ 28 28 ? "\\(unknown file\\)\n-1" : "debuginfo_\\d+\\.pasm\n\\d"; 29 29 30 30 #SKIP: { 31 #skip "disabled on fast-core",1 if $ENV{TEST_PROG_ARGS} =~ /--runcore= (fast|cgoto)/;31 #skip "disabled on fast-core",1 if $ENV{TEST_PROG_ARGS} =~ /--runcore=fast/; 32 32 33 33 pasm_output_like( <<'CODE', <<"OUTPUT", "getline, getfile" ); 34 34 .pcc_sub main: … … 158 158 called from Sub 'main' pc (\d+|-1) \(.*?:(\d+|-1)\)$/ 159 159 OUTPUT 160 160 161 $nolineno = $ENV{TEST_PROG_ARGS} =~ /--runcore= (fast|cgoto)/161 $nolineno = $ENV{TEST_PROG_ARGS} =~ /--runcore=fast/ 162 162 ? '\(\(unknown file\):-1\)' : '\(xyz.pir:126\)'; 163 163 164 164 pir_error_output_like( <<'CODE', <<"OUTPUT", "setfile and setline" ); … … 173 173 /$nolineno/ 174 174 OUTPUT 175 175 176 $nolineno = $ENV{TEST_PROG_ARGS} =~ /--runcore= (fast|cgoto)/176 $nolineno = $ENV{TEST_PROG_ARGS} =~ /--runcore=fast/ 177 177 ? '\(\(unknown file\):-1\)' : '\(foo.p6:128\)'; 178 178 pir_error_output_like( <<'CODE', <<"OUTPUT", "setfile and setline" ); 179 179 .sub main :main -
MANIFEST.generated
37 37 include/parrot/extend_vtable.h [main]include 38 38 include/parrot/feature.h [main]include 39 39 include/parrot/has_header.h [main]include 40 include/parrot/oplib/core_ops_cg.h [main]include41 include/parrot/oplib/core_ops_cgp.h [main]include42 40 include/parrot/oplib/core_ops.h [main]include 43 include/parrot/oplib/core_ops_switch.h [main]include44 41 include/parrot/oplib/ops.h [main]include 45 42 include/parrot/pbcversion.h [devel]include 46 43 include/parrot/platform.h [main]include … … 229 226 src/jit_emit.h [] 230 227 src/nci.c [] 231 228 src/null_config.c [] 232 src/ops/core_ops_cgp.c []233 src/ops/core_ops_switch.c []234 229 src/parrot_config.c [] 235 230 src/pmc/boolean.dump [devel]src 236 231 src/pmc/continuation.dump [devel]src -
config/init/optimize.pm
74 74 $conf->data->set( cc_debug => '' ); 75 75 $conf->data->add( ' ', ccflags => "-DDISABLE_GC_DEBUG=1 -DNDEBUG" ); 76 76 77 # per file overrides - not every compiler can optimize every file.78 79 # The src/ops/core_ops*.c files are challenging to optimize.80 # gcc can usually handle it, but don't assume any other compilers can,81 # until there is specific evidence otherwise.82 if ( ! defined($gccversion)) {83 $conf->data->set('optimize::src/ops/core_ops_cg.c','');84 $conf->data->set('optimize::src/ops/core_ops_cgp.c','');85 $conf->data->set('optimize::src/ops/core_ops_switch.c','');86 }87 88 77 # TT #405 89 78 if ($conf->data->get('cpuarch') eq 'amd64') { 90 79 $conf->data->set('optimize::src/gc/system.c',''); -
config/auto/cgoto.pm
1 # Copyright (C) 2001-2005, Parrot Foundation.2 # $Id$3 4 =head1 NAME5 6 config/auto/cgoto.pm - Computed C<goto>7 8 =head1 DESCRIPTION9 10 Determines whether the compiler supports computed C<goto>.11 12 =cut13 14 package auto::cgoto;15 16 use strict;17 use warnings;18 19 use base qw(Parrot::Configure::Step);20 21 use Parrot::Configure::Utils ':auto';22 23 sub _init {24 my $self = shift;25 return {26 'description' => 'Does your compiler support computed goto',27 'result' => '',28 };29 }30 31 sub runstep {32 my ( $self, $conf ) = @_;33 34 my $test = _probe_for_cgoto( $conf );35 36 $self->_evaluate_cgoto($conf, $test);37 38 return 1;39 }40 41 sub _probe_for_cgoto {42 my $conf = shift;43 my $cgoto = $conf->options->get('cgoto');44 my $test;45 if ( defined $cgoto ) {46 $test = $cgoto;47 }48 else {49 $conf->cc_gen('config/auto/cgoto/test_c.in');50 $test = eval { $conf->cc_build(); 1; } || 0;51 $conf->cc_clean();52 }53 return $test;54 }55 56 sub _evaluate_cgoto {57 my ($self, $conf, $test) = @_;58 my $verbose = $conf->options->get('verbose');59 if ($test) {60 $conf->data->set(61 cg_flag => '-DHAVE_COMPUTED_GOTO'62 );63 print " (yes) " if $verbose;64 $self->set_result('yes');65 }66 else {67 $conf->data->set(68 cg_flag => ''69 );70 print " (no) " if $verbose;71 $self->set_result('no');72 }73 }74 75 1;76 77 # Local Variables:78 # mode: cperl79 # cperl-indent-level: 480 # fill-column: 10081 # End:82 # vim: expandtab shiftwidth=4: -
config/gen/makefiles/dynpmc.in
14 14 LD = @ld@ 15 15 LDFLAGS = @ldflags@ @ld_debug@ @rpath_blib@ 16 16 LD_LOAD_FLAGS = @ld_load_flags@ 17 CFLAGS = @ccflags@ @cc_shared@ @cc_debug@ @ccwarn@ @cc_hasjit@ @ cg_flag@ @gc_flag@ @optimize@17 CFLAGS = @ccflags@ @cc_shared@ @cc_debug@ @ccwarn@ @cc_hasjit@ @gc_flag@ @optimize@ 18 18 LIBPARROT = @libparrot_ldflags@ 19 19 20 20 BUILD_TOOLS_DIR = $(BUILD_DIR)/tools/build -
config/gen/makefiles/root.in
84 84 CC_SHARED = @cc_shared@ 85 85 CC_O_OUT = @cc_o_out@ 86 86 CC_WARN = @ccwarn@ 87 CFLAGS = $(CC_INC) @ccflags@ @cc_build_call_frames@ @cc_debug@ @ cg_flag@ @gc_flag@ @clock_best@ $(CC_SHARED)87 CFLAGS = $(CC_INC) @ccflags@ @cc_build_call_frames@ @cc_debug@ @gc_flag@ @clock_best@ $(CC_SHARED) 88 88 LINK_DYNAMIC = @link_dynamic@ 89 89 LINK = @link@ 90 90 LINKFLAGS = @linkflags@ @link_debug@ @ld_debug@ … … 170 170 parrot.pc \ 171 171 compilers/imcc/imcc.y.flag \ 172 172 compilers/imcc/imcc.l.flag \ 173 src/ops/core_ops.c \ 174 src/ops/core_ops_switch.c 173 src/ops/core_ops.c 175 174 176 175 GEN_PASM_INCLUDES = \ 177 176 runtime/parrot/include/cclass.pasm \ … … 237 236 $(INC_DIR)/vtable.h \ 238 237 $(INC_DIR)/oplib/core_ops.h \ 239 238 $(INC_DIR)/oplib/ops.h \ 240 $(INC_DIR)/oplib/core_ops_switch.h \241 239 $(INC_DIR)/extend_vtable.h \ 242 240 $(INC_DIR)/pbcversion.h 243 241 … … 245 243 src/core_ops.c \ 246 244 src/nci.c \ 247 245 src/glut_nci_thunks.c \ 248 src/core_ops_switch.c \249 246 src/parrot_config.c \ 250 247 src/null_config.c \ 251 248 src/install_config.c \ … … 409 406 410 407 # generated list of header files 411 408 GENERAL_H_FILES = $(NONGEN_HEADERS) $(GEN_HEADERS) \ 412 #IF(cg_flag): $(INC_DIR)/oplib/core_ops_cg.h $(INC_DIR)/oplib/core_ops_cgp.h413 409 414 410 415 411 CHARSET_O_FILES = @TEMP_charset_o@ … … 433 429 434 430 INTERP_O_FILES = \ 435 431 src/string/api$(O) \ 436 \437 432 src/ops/core_ops$(O) \ 438 src/ops/core_ops_switch$(O) \439 \440 433 #IF(i386_has_gcc_cmpxchg): src/atomic/gcc_x86$(O) \ 441 434 src/byteorder$(O) \ 442 435 src/string/charset$(O) \ … … 500 493 @TEMP_atomic_o@ \ 501 494 @TEMP_gc_o@ \ 502 495 #IF(platform_asm): src/platform_asm$(O) \ 503 #IF(cg_flag): src/ops/core_ops_cg$(O) src/ops/core_ops_cgp$(O) \504 496 505 497 506 498 OPS_FILES = @ops@ $(GEN_OPSFILES) … … 1313 1305 src/runcore/main.str \ 1314 1306 include/pmc/pmc_parrotlibrary.h \ 1315 1307 $(INC_DIR)/dynext.h $(INC_DIR)/oplib/core_ops.h \ 1316 $(INC_DIR)/oplib/ core_ops_switch.h $(INC_DIR)/oplib/ops.h \1308 $(INC_DIR)/oplib/ops.h \ 1317 1309 $(PARROT_H_HEADERS) $(INC_DIR)/runcore_api.h \ 1318 1310 $(INC_DIR)/runcore_profiling.h 1319 1311 … … 1418 1410 src/runcore/cores$(O) : src/runcore/cores.str \ 1419 1411 include/pmc/pmc_sub.h \ 1420 1412 $(INC_DIR)/dynext.h $(INC_DIR)/embed.h $(INC_DIR)/oplib/core_ops.h \ 1421 $(INC_DIR)/oplib/ core_ops_switch.h $(INC_DIR)/oplib/ops.h \1413 $(INC_DIR)/oplib/ops.h \ 1422 1414 $(INC_DIR)/runcore_api.h $(INC_DIR)/runcore_trace.h \ 1423 1415 $(PARROT_H_HEADERS) 1424 1416 … … 1528 1520 include/pmc/pmc_continuation.h 1529 1521 $(PERL) $(BUILD_TOOLS_DIR)/ops2c.pl C --core @no_lines_flag@ 1530 1522 1531 ## SUFFIX OVERRIDE1532 src/ops/core_ops_switch$(O) : $(GENERAL_H_FILES) src/ops/core_ops_switch.c \1533 include/pmc/pmc_parrotlibrary.h1534 $(CC) $(CFLAGS) @optimize::src/ops/core_ops_switch.c@ @ccwarn::src/ops/core_ops_switch.c@ @cc_shared@ -I$(@D) @cc_o_out@$@ -c src/ops/core_ops_switch.c1535 1536 $(INC_DIR)/oplib/core_ops_switch.h : src/ops/core_ops_switch.c1537 1538 src/ops/core_ops_switch.c : $(OPS_FILES) $(BUILD_TOOLS_DIR)/ops2c.pl \1539 lib/Parrot/OpsFile.pm lib/Parrot/Op.pm $(INC_DIR)/config.h \1540 lib/Parrot/OpLib/core.pm lib/Parrot/OpTrans/CSwitch.pm \1541 lib/Parrot/OpTrans/CPrederef.pm1542 $(PERL) $(BUILD_TOOLS_DIR)/ops2c.pl CSwitch --core @no_lines_flag@1543 1544 ## SUFFIX OVERRIDE1545 src/ops/core_ops_cg$(O): $(GENERAL_H_FILES) src/ops/core_ops_cg.c \1546 include/pmc/pmc_parrotlibrary.h1547 $(CC) $(CFLAGS) @optimize::src/ops/core_ops_cg.c@ @ccwarn::src/ops/core_ops_cg.c@ @cc_shared@ -I$(@D) @cc_o_out@$@ -c src/ops/core_ops_cg.c1548 1549 ## SUFFIX OVERRIDE1550 src/ops/core_ops_cgp$(O): $(GENERAL_H_FILES) src/ops/core_ops_cgp.c \1551 include/pmc/pmc_parrotlibrary.h1552 $(CC) $(CFLAGS) @optimize::src/ops/core_ops_cgp.c@ @ccwarn::src/ops/core_ops_cgp.c@ @cc_shared@ -I$(@D) @cc_o_out@$@ -c src/ops/core_ops_cgp.c1553 1554 src/runcore/cores.c: $(INC_DIR)/oplib/core_ops_cgp.h1555 1556 $(INC_DIR)/oplib/core_ops_cg.h: src/ops/core_ops_cg.c1557 1558 src/ops/core_ops_cg.c : $(OPS_FILES) $(BUILD_TOOLS_DIR)/ops2c.pl lib/Parrot/OpsFile.pm lib/Parrot/Op.pm lib/Parrot/OpTrans/CGoto.pm lib/Parrot/OpLib/core.pm1559 $(PERL) $(BUILD_TOOLS_DIR)/ops2c.pl CGoto --core1560 1561 $(INC_DIR)/oplib/core_ops_cgp.h: src/ops/core_ops_cgp.c1562 1563 src/ops/core_ops_cgp.c : $(OPS_FILES) $(BUILD_TOOLS_DIR)/ops2c.pl lib/Parrot/OpsFile.pm lib/Parrot/Op.pm lib/Parrot/OpTrans/CGP.pm lib/Parrot/OpLib/core.pm lib/Parrot/OpTrans/CPrederef.pm1564 $(PERL) $(BUILD_TOOLS_DIR)/ops2c.pl CGP --core1565 1566 1523 @TEMP_gc_c@ 1567 1524 1568 1525 @TEMP_pmc_build@ … … 1746 1703 check : test 1747 1704 1748 1705 # Test various run cores and other stuff 1749 # 'test C', 'testg' and 'testj' are tested only1706 # 'testg' and 'testj' are tested only 1750 1707 # when the needed runcores are available 1751 1708 fulltest : 1752 1709 -@make@ testb \ 1753 #IF(cg_flag): testC \1754 1710 testf \ 1755 #IF(cg_flag): testg \1756 1711 testr \ 1757 testS \1758 1712 src_tests \ 1759 1713 run_tests \ 1760 1714 buildtools_tests \ … … 1771 1725 testb : test_prep 1772 1726 $(PERL) t/harness $(EXTRA_TEST_ARGS) -b $(RUNCORE_TEST_FILES) 1773 1727 1774 # CGP core1775 testC : test_prep1776 $(PERL) t/harness $(EXTRA_TEST_ARGS) -C $(RUNCORE_TEST_FILES)1777 1778 1728 # fast core 1779 1729 testf : test_prep 1780 1730 $(PERL) t/harness $(EXTRA_TEST_ARGS) -f $(RUNCORE_TEST_FILES) … … 1795 1745 testr : test_prep 1796 1746 $(PERL) t/harness $(EXTRA_TEST_ARGS) -r $(RUNCORE_TEST_FILES) 1797 1747 1798 # switched core1799 testS : test_prep1800 $(PERL) t/harness $(EXTRA_TEST_ARGS) -S $(RUNCORE_TEST_FILES)1801 1802 # Computed goto jitted core - target retained, but falls back to standard core1803 testCj : test_prep1804 $(PERL) t/harness $(EXTRA_TEST_ARGS) $(RUNCORE_TEST_FILES)1805 1806 # switched jitted core - target retained, but falls back to standard core1807 testSj : test_prep1808 $(PERL) t/harness $(EXTRA_TEST_ARGS) $(RUNCORE_TEST_FILES)1809 1810 1748 # test the EXEC stuff 1811 1749 testexec: test_prep 1812 1750 $(PERL) t/harness $(EXTRA_TEST_ARGS) --run-exec $(RUNCORE_TEST_FILES) … … 1881 1819 #UNLESS(win32): cover-clean \ 1882 1820 editor-clean 1883 1821 $(RM_F) $(INC_DIR)/oplib/core_ops_cg.h src/ops/core_ops_cg.c \ 1884 $(INC_DIR)/oplib/core_ops_cgp.h src/ops/core_ops_cgp.c1885 1822 $(RM_F) chartypes "*.s" "*~" 1886 1823 $(RM_F) $(FLUID_FILES_1) 1887 1824 $(RM_F) $(FLUID_FILES_2) … … 2331 2268 cover: \ 2332 2269 cover.dummy \ 2333 2270 cover-testb \ 2334 #IF(cg_flag): cover-testC \2335 2271 cover-testf \ 2336 #IF(cg_flag): cover-testg \2337 2272 cover-testr \ 2338 cover-testS \2339 2273 cover-src \ 2340 2274 cover-run \ 2341 2275 cover-perl \ … … 2363 2297 cover-testb: cover.dummy 2364 2298 -@make@ testb 2365 2299 2366 cover-testC: cover.dummy2367 -@make@ testC2368 2369 2300 cover-testf: cover.dummy 2370 2301 -@make@ testf 2371 2302 … … 2378 2309 cover-testr: cover.dummy 2379 2310 -@make@ testr 2380 2311 2381 cover-testS: cover.dummy2382 -@make@ testS2383 2384 2312 cover-src: cover.dummy 2385 2313 -@make@ src_tests 2386 2314 -
config/gen/config_h/config_h.in
152 152 /* Oplib and dynamic ops related. */ 153 153 #define PARROT_CORE_OPLIB_NAME "core" 154 154 #define PARROT_CORE_OPLIB_INIT Parrot_DynOp_core_@MAJOR@_@MINOR@_@PATCH@ 155 #define PARROT_CORE_PREDEREF_OPLIB_INIT Parrot_DynOp_core_prederef_@MAJOR@_@MINOR@_@PATCH@156 #define PARROT_CORE_SWITCH_OPLIB_INIT Parrot_DynOp_core_switch_@MAJOR@_@MINOR@_@PATCH@157 #define PARROT_CORE_CG_OPLIB_INIT Parrot_DynOp_core_cg_@MAJOR@_@MINOR@_@PATCH@158 #define PARROT_CORE_CGP_OPLIB_INIT Parrot_DynOp_core_cgp_@MAJOR@_@MINOR@_@PATCH@159 155 160 156 /* ICU. */ 161 157 #define PARROT_HAS_ICU @has_icu@ -
examples/sdl/mandel.pir
556 556 Optimized build 557 557 558 558 [2] plain runcore 64 bit 3.0s 559 [2] -R cgp runcore 64 bit 1.5s560 559 [2] plain runcore 32 bit 3.6s 561 [2] -R cgp runcore 32 bit 1.6s562 560 [1] -R jit 1.1s 563 561 [2] -R jit 0.8s 564 562 [3] -R jit 0.5s -
examples/c/test_main.c
209 209 static void 210 210 usage(void) 211 211 { 212 #ifdef HAVE_COMPUTED_GOTO213 const char* cgoto_info = "Deactivate computed goto";214 #else215 const char* cgoto_info =216 "Deactivate computed goto (not available on this platform)";217 #endif218 219 212 fprintf(stderr, 220 213 "Usage: parrot [switches] [--] programfile [arguments]\n\ 221 214 -b --bounds-checks Activate bounds checks\n\ … … 223 216 -h --help Display this message\n\ 224 217 -j --jit Activate Just-In-Time compiler\n\ 225 218 -p --profile Activate profiling\n\ 226 -P --predereferenced_core Activate predereferencing\n\227 -S --switched_core Activate switched core\n\228 -g --no-computed-goto %s\n\229 219 -t --trace Activate tracing\n\ 230 220 -v --version Display version information\n\ 231 221 -. --wait Wait for a keypress (gives Windows users\n\ … … 233 223 --gc-debug\n\ 234 224 Enable garbage collection debugging mode. This may also be enabled\n\ 235 225 by setting the environment variable $PARROT_GC_DEBUG to 1.\n\ 236 \n", 237 cgoto_info); 226 \n"); 238 227 239 228 Parrot_exit(interp, 0); 240 229 } -
examples/shootout/binarytrees.pir
1 #!./parrot -R cgp1 #!./parrot 2 2 # Copyright (C) 2005-2009, Parrot Foundation. 3 3 # $Id$ 4 4 # -
examples/shootout/fasta.pir
1 #!./parrot -R cgp1 #!./parrot 2 2 # Copyright (C) 2005-2009, Parrot Foundation. 3 3 # $Id$ 4 4 # -
examples/shootout/partialsums.pir
1 #!./parrot -R cgp1 #!./parrot 2 2 # Copyright (C) 2006-2009, Parrot Foundation. 3 3 # $Id$ 4 4 # -
examples/shootout/takfp.pir
1 #!./parrot -R cgp1 #!./parrot 2 2 # Copyright (C) 2005-2009, Parrot Foundation. 3 3 # $Id$ 4 4 # 5 # ./parrot -R cgptakfp.pir N (N = 10 for shootout)5 # ./parrot takfp.pir N (N = 10 for shootout) 6 6 # by Joshua Isom 7 7 # changed default value to N=7 (shootout default before being deprecated) 8 8 # anyway N=10 froze my laptop. Karl Forner -
examples/shootout/recursive-2.pir
6 6 # Fib and Tak by Joshua Isom 7 7 8 8 # use less registers (leo) 9 # time ./parrot -Oc -R cgp-jitrecursive-2.pir 119 # time ./parrot -Oc recursive-2.pir 11 10 10 # real 2.32 s (AMD X2@2000) 11 11 # modified default value to n=3. Karl Forner 12 12 -
examples/shootout/recursive.pir
5 5 # Ack by Leopold Toetsch 6 6 # Fib and Tak by Joshua Isom 7 7 # modified default value to n=3. Karl Forner 8 # ./parrot -Oc -R cgp-jitrecursive.pir N8 # ./parrot -Oc recursive.pir N 9 9 10 10 .sub main :main 11 11 .param pmc argv -
examples/shootout/pidigits.pir
1 #!./parrot -R cgp1 #!./parrot 2 2 # Copyright (C) 2005-2009, Parrot Foundation. 3 3 # $Id$ 4 4 # -
examples/shootout/ack.pir
3 3 # $Id$ 4 4 # OUTPUT="Ack(3, 9) = 4093\n" 5 5 # 6 # ./parrot -Oc -R cgp-jit6 # ./parrot -Oc 7 7 # RQ (Karl) 8 8 # Seems to be an old benchmark, now deprecated by the shootout 9 9 # -
examples/shootout/random.pir
1 #!./parrot -R cgp1 #!./parrot 2 2 # Copyright (C) 2005-2009, Parrot Foundation. 3 3 # $Id$ 4 4 # -
examples/config/file/configcompiler
50 50 auto::jit 51 51 auto::cpu 52 52 auto::funcptr 53 auto::cgoto54 53 auto::inline 55 54 auto::gc 56 55 auto::memalign -
examples/config/file/configwithfatalstep
42 42 auto::jit 43 43 auto::cpu 44 44 auto::funcptr 45 auto::cgoto46 45 auto::inline 47 46 auto::gc 48 47 auto::memalign -
examples/embed/cotorra.c
108 108 { 109 109 static const struct runcoreinfo cores [] = { 110 110 { PARROT_SLOW_CORE, "slow" }, 111 { PARROT_FAST_CORE, "fast" },112 { PARROT_CGOTO_CORE, "cgoto" },113 111 { PARROT_GC_DEBUG_CORE, "gcdebug" }, 114 { PARROT_SWITCH_CORE, "switch" }115 112 }; 116 113 static const unsigned int n = sizeof (cores)/sizeof (struct runcoreinfo); 117 114 unsigned int i; -
examples/benchmarks/oo1.pir
11 11 # python oo1.py 1.2 (first time) 12 12 # python oo1.py 0.51 13 13 14 # parrot -R cgp oo1.pasm -g -O315 16 14 # original list fixed 4.9 (leaks mem ~ 110 M used) 17 15 # don't clone vtable 4.4 18 16 # Dan's vtable cache 4.3 3.8 … … 31 29 # Dan's new object layout 1.00 32 30 33 31 34 # parrot -R cgp oo1-prop.pasm35 # invokecc 0.7536 # RetCont out of loop 0.5737 32 # parrot -R jit oo1-prop.pasm 0.54 38 33 39 34 .namespace [ "Foo" ] -
examples/benchmarks/oo2.pir
11 11 # python oo2.py 2.9 (first time) 12 12 # python oo2.py 2.4 13 13 14 # parrot -R cgp oo2.pasm -g -O315 # with reuse regsave mem 6.1516 # anchor P1 6.717 # Dan's new object layout 5.118 19 14 # parrot -R jit oo2.pasm -g -O3 20 15 # with reuse regsave mem 6.1 21 16 # anchor P1 6.5 22 17 # Dan's new object layout 4.9 23 18 24 # parrot -R cgp oo2-prop.pasm 2.825 19 # parrot -R jit oo2-prop.pasm 2.6 26 20 27 21 .namespace [ "Foo" ]