Ticket #1563: runcore_purge.45837.diff

File runcore_purge.45837.diff, 124.8 KB (added by jkeenan, 5 years ago)

diff between runcore_purge branch and trunk (at branch point)

  • runtime/parrot/library/distutils.pir

     
    12761276.sub 'get_cores' 
    12771277    $P0 = new 'Hash' 
    12781278    $P0['C'] = '' 
    1279 #    $P0['CGP'] = '_cgp' 
    1280 #    $P0['CGoto'] = '_cg' 
    1281     $P0['CSwitch'] = '_switch' 
    12821279    .return ($P0) 
    12831280.end 
    12841281 
     
    42844281    flags .= " " 
    42854282    $S0 = $P0['cc_hasjit'] 
    42864283    flags .= $S0 
    4287     flags .= " " 
    4288     $S0 = $P0['cg_flag'] 
    4289     flags .= $S0 
    42904284    .return (flags) 
    42914285.end 
    42924286 
  • src/embed.c

     
    336336      case PARROT_FAST_CORE: 
    337337        Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "fast")); 
    338338        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; 
    348339      case PARROT_EXEC_CORE: 
    349340        Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "exec")); 
    350341        break; 
  • src/dynoplibs/Rules.in

     
    1414src/dynoplibs/obscure_ops.c: src/dynoplibs/obscure.ops $(BUILD_TOOLS_DIR)/ops2c.pl 
    1515        $(PERL) $(BUILD_TOOLS_DIR)/ops2c.pl C --dynamic src/dynoplibs/obscure.ops 
    1616 
    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:$@;2 
    20 #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.c 
    25  
    26 src/dynoplibs/obscure_ops_switch.c: src/dynoplibs/obscure.ops $(BUILD_TOOLS_DIR)/ops2c.pl 
    27         $(PERL) $(BUILD_TOOLS_DIR)/ops2c.pl CSwitch --dynamic src/dynoplibs/obscure.ops 
    28  
    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:$@;2 
    32 #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.c 
    37  
    38 src/dynoplibs/obscure_ops_cg.c: src/dynoplibs/obscure.ops $(BUILD_TOOLS_DIR)/ops2c.pl 
    39         $(PERL) $(BUILD_TOOLS_DIR)/ops2c.pl CGoto --dynamic src/dynoplibs/obscure.ops 
    40  
    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:$@;2 
    44 #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.c 
    49  
    50 src/dynoplibs/obscure_ops_cgp.c: src/dynoplibs/obscure.ops $(BUILD_TOOLS_DIR)/ops2c.pl 
    51         $(PERL) $(BUILD_TOOLS_DIR)/ops2c.pl CGP --dynamic src/dynoplibs/obscure.ops 
    52  
    5317$(DYNEXT_DIR)/math_ops$(LOAD_EXT): src/dynoplibs/math_ops$(O) $(LIBPARROT) 
    5418        $(LD) @ld_out@$@ src/dynoplibs/math_ops$(O) $(LINKARGS) 
    5519#IF(win32):     if exist $@.manifest mt.exe -nologo -manifest $@.manifest -outputresource:$@;2 
     
    6226 
    6327src/dynoplibs/math_ops.h: src/dynoplibs/math_ops.c 
    6428 
    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:$@;2 
    68 #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.c 
    73  
    74 src/dynoplibs/math_ops_switch.c: src/dynoplibs/math.ops $(BUILD_TOOLS_DIR)/ops2c.pl 
    75         $(PERL) $(BUILD_TOOLS_DIR)/ops2c.pl CSwitch --dynamic src/dynoplibs/math.ops 
    76  
    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:$@;2 
    80 #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.c 
    85  
    86 src/dynoplibs/math_ops_cg.c: src/dynoplibs/math.ops $(BUILD_TOOLS_DIR)/ops2c.pl 
    87         $(PERL) $(BUILD_TOOLS_DIR)/ops2c.pl CGoto --dynamic src/dynoplibs/math.ops 
    88  
    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:$@;2 
    92 #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.c 
    97  
    98 src/dynoplibs/math_ops_cgp.c: src/dynoplibs/math.ops $(BUILD_TOOLS_DIR)/ops2c.pl 
    99         $(PERL) $(BUILD_TOOLS_DIR)/ops2c.pl CGP --dynamic src/dynoplibs/math.ops 
  • src/dynoplibs/Defines.in

     
    11DYNOPLIBS_TARGETS = \ 
    2 #IF(cg_flag):    $(DYNEXT_DIR)/obscure_ops_cg$(LOAD_EXT) \ 
    3 #IF(cg_flag):    $(DYNEXT_DIR)/obscure_ops_cgp$(LOAD_EXT) \ 
    42    $(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) \ 
    83    $(DYNEXT_DIR)/math_ops$(LOAD_EXT) \ 
    9     $(DYNEXT_DIR)/math_ops_switch$(LOAD_EXT) 
    104 
    115DYNOPLIBS_CLEANUPS = \ 
    126    src/dynoplibs/*.c \ 
  • src/pmc/callcontext.pmc

     
    434434    ATTR UINTVAL                trace_flags; 
    435435    ATTR UINTVAL                recursion_depth; /* Sub call recursion depth */ 
    436436 
    437     /* code->prederefed.code - code->base.data in opcodes 
    438      * to simplify conversion between code ptrs in e.g. invoke */ 
    439     ATTR size_t pred_offset; 
    440  
    441437    /* Storage for arguments */ 
    442438    ATTR struct Pcc_cell *positionals; /* array of positionals */ 
    443439    ATTR INTVAL  num_positionals;      /* count of used positionals */ 
  • src/packfile.c

     
    684684    Parrot_runcore_t *old_core = interp->run_core; 
    685685    PMC              *retval   = PMCNULL; 
    686686 
    687     /* turn off JIT and prederef - both would act on the whole 
    688      * 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  
    693687    Parrot_pcc_set_constants(interp, CURRENT_CONTEXT(interp), 
    694688            interp->code->const_table->constants); 
    695689 
     
    25812575    ASSERT_ARGS(byte_code_destroy) 
    25822576    PackFile_ByteCode * const byte_code = (PackFile_ByteCode *)self; 
    25832577 
    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  
    25942578    byte_code->fixups      = NULL; 
    25952579    byte_code->const_table = NULL; 
    25962580    byte_code->debugs      = NULL; 
     
    30993083                               ? find_constants(interp, new_cs->const_table) 
    31003084                               : new_cs->const_table->constants); 
    31013085 
    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  
    31063086    if (really) 
    31073087        prepare_for_run(interp); 
    31083088 
  • src/interp/inter_misc.c

     
    237237            else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "fast"))) 
    238238                return PARROT_FAST_CORE; 
    239239            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"))) 
    246240                return PARROT_EXEC_CORE; 
    247241            else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "gc_debug"))) 
    248242                return PARROT_GC_DEBUG_CORE; 
  • src/main.c

     
    301301    "       --hash-seed F00F  specify hex value to use as hash seed\n" 
    302302    "    -X --dynext add path to dynamic extension search\n" 
    303303    "   <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" 
    306306    "    -t --trace [flags]\n" 
    307307    "   <VM options>\n" 
    308308    "    -D --parrot-debug[=HEXFLAGS]\n" 
     
    461461                *core = PARROT_SLOW_CORE; 
    462462            else if (STREQ(opt.opt_arg, "fast") || STREQ(opt.opt_arg, "function")) 
    463463                *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; 
    470464            else if (STREQ(opt.opt_arg, "jit")) 
    471465                *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; 
    476466            else if (STREQ(opt.opt_arg, "exec")) 
    477467                *core = PARROT_EXEC_CORE; 
    478468            else if (STREQ(opt.opt_arg, "trace")) 
  • src/call/context.c

     
    321321    ctx->current_object    = NULL; 
    322322    ctx->handlers          = PMCNULL; 
    323323    ctx->caller_ctx        = NULL; 
    324     ctx->pred_offset       = 0; 
    325324    ctx->current_sig       = PMCNULL; 
    326325    ctx->current_sub       = PMCNULL; 
    327326 
     
    331330        ctx->warns             = old->warns; 
    332331        ctx->errors            = old->errors; 
    333332        ctx->trace_flags       = old->trace_flags; 
    334         ctx->pred_offset       = old->pred_offset; 
    335333        ctx->current_HLL       = old->current_HLL; 
    336334        ctx->current_namespace = old->current_namespace; 
    337335        /* end COW */ 
     
    343341        ctx->warns             = 0; 
    344342        ctx->errors            = 0; 
    345343        ctx->trace_flags       = 0; 
    346         ctx->pred_offset       = 0; 
    347344        ctx->current_HLL       = 0; 
    348345        ctx->current_namespace = PMCNULL; 
    349346        ctx->recursion_depth   = 0; 
  • src/call/pcc.c

     
    356356        Parrot_runcore_t *old_core = interp->run_core; 
    357357        const opcode_t offset = dest - interp->code->base.data; 
    358358 
    359         if (PARROT_RUNCORE_PREDEREF_OPS_TEST(interp->run_core)) 
    360             Parrot_runcore_switch(interp, CONST_STRING(interp, "slow")); 
    361  
    362359        runops(interp, offset); 
    363360        Interp_core_SET(interp, old_core); 
    364361    } 
  • src/call/context_accessors.c

     
    471471 
    472472/* 
    473473 
    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_t 
    477 pred_offset)> 
    478  
    479 Get/set pred_offset 
    480  
    481 =cut 
    482  
    483 */ 
    484  
    485 PARROT_EXPORT 
    486 size_t 
    487 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_EXPORT 
    495 void 
    496 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  
    506474=item C<UINTVAL Parrot_pcc_warnings_on_func(PARROT_INTERP, PMC *ctx, UINTVAL 
    507475flags)> 
    508476 
  • src/runcore/main.c

     
    2222#include "parrot/runcore_api.h" 
    2323#include "parrot/runcore_profiling.h" 
    2424#include "parrot/oplib/core_ops.h" 
    25 #include "parrot/oplib/core_ops_switch.h" 
    2625#include "parrot/oplib/ops.h" 
    2726#include "main.str" 
    2827 
    29 #ifdef HAVE_COMPUTED_GOTO 
    30 #  include "parrot/oplib/core_ops_cg.h" 
    31 #  include "parrot/oplib/core_ops_cgp.h" 
    32 #endif 
    3328#include "parrot/dynext.h" 
    3429#include "pmc/pmc_parrotlibrary.h" 
    3530#include "pmc/pmc_callcontext.h" 
     
    4439static void dynop_register_switch(PARROT_INTERP, size_t n_old, size_t n_new) 
    4540        __attribute__nonnull__(1); 
    4641 
    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  
    5342PARROT_WARN_UNUSED_RESULT 
    5443PARROT_CANNOT_RETURN_NULL 
    5544static oplib_init_f get_dynamic_op_lib_init(SHIM_INTERP, 
     
    6251        __attribute__nonnull__(1) 
    6352        __attribute__nonnull__(2); 
    6453 
    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  
    7154#define ASSERT_ARGS_dynop_register_switch __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 
    7255       PARROT_ASSERT_ARG(interp)) 
    73 #define ASSERT_ARGS_dynop_register_xx __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 
    74        PARROT_ASSERT_ARG(interp)) 
    7556#define ASSERT_ARGS_get_dynamic_op_lib_init __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 
    7657       PARROT_ASSERT_ARG(lib)) 
    7758#define ASSERT_ARGS_notify_func_table __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 
    7859       PARROT_ASSERT_ARG(interp) \ 
    7960    , 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)) 
    8461/* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */ 
    8562/* HEADERIZER END: static */ 
    8663 
     
    10582 
    10683    Parrot_runcore_slow_init(interp); 
    10784    Parrot_runcore_fast_init(interp); 
    108     Parrot_runcore_switch_init(interp); 
    10985 
    11086    Parrot_runcore_exec_init(interp); 
    11187    Parrot_runcore_gc_debug_init(interp); 
     
    11591 
    11692    /* set the default runcore */ 
    11793    Parrot_runcore_switch(interp, default_core); 
    118  
    119 #ifdef HAVE_COMPUTED_GOTO 
    120     Parrot_runcore_cgp_init(interp); 
    121     Parrot_runcore_cgoto_init(interp); 
    122 #endif 
    12394} 
    12495 
    12596 
     
    187158 
    188159/* 
    189160 
    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 all 
    195 branch locations of the opcode stream. 
    196  
    197 Note that when C<on> is true, this is being called from the event 
    198 handler thread. 
    199  
    200 =cut 
    201  
    202 */ 
    203  
    204 static void 
    205 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         else 
    221             interp->code->prederef.code[offs] = pi->branches[i].op; 
    222     } 
    223 } 
    224  
    225  
    226 /* 
    227  
    228161=item C<static oplib_init_f get_dynamic_op_lib_init(PARROT_INTERP, const PMC 
    229162*lib)> 
    230163 
     
    249182 
    250183/* 
    251184 
    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 necessary 
    256 for run-core changes, but we don't know the old run core. 
    257  
    258 =cut 
    259  
    260 */ 
    261  
    262 static void 
    263 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  
    279185=item C<void prepare_for_run(PARROT_INTERP)> 
    280186 
    281187Prepares to run the interpreter's run core. 
     
    337243            if ((int)interp->resume_offset < 0) 
    338244                Parrot_ex_throw_from_c_args(interp, NULL, 1, 
    339245                    "branch_cs: illegal resume offset"); 
    340             stop_prederef(interp); 
    341246        } 
    342247    } 
    343248} 
     
    397302Parrot_runcore_destroy(PARROT_INTERP) 
    398303{ 
    399304    ASSERT_ARGS(Parrot_runcore_destroy) 
    400 #ifdef HAVE_COMPUTED_GOTO 
    401     op_lib_t         *cg_lib; 
    402 #endif 
    403305    size_t            num_cores = interp->num_cores; 
    404306    size_t            i; 
    405307 
     
    423325    if (interp->n_libs <= 0) 
    424326        return; 
    425327 
    426 #ifdef HAVE_COMPUTED_GOTO 
    427     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 #endif 
    438  
    439328    mem_gc_free(interp, interp->op_info_table); 
    440329    mem_gc_free(interp, interp->op_func_table); 
    441330    interp->op_info_table = NULL; 
     
    560449    core->flags         = OP_FUNC_IS_ALLOCATED | OP_INFO_IS_ALLOCATED; 
    561450 
    562451    /* done for plain core */ 
    563 #ifdef HAVE_COMPUTED_GOTO 
    564     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 #endif 
    567  
    568452    dynop_register_switch(interp, n_old, n_new); 
    569453} 
    570454 
    571455 
    572 /* 
    573456 
    574 =item C<static void dynop_register_xx(PARROT_INTERP, size_t n_old, size_t n_new, 
    575 oplib_init_f init_func)> 
    576457 
    577 Register C<op_lib> with other cores. 
    578  
    579 =cut 
    580  
    581 */ 
    582  
    583 #ifdef HAVE_COMPUTED_GOTO 
    584  
    585 static void 
    586 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 0 
    595     /* 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 #  endif 
    601  
    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 wrapper 
    618      * 
    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 with 
    623      *  a likely different stack layout. Directly jumping around between 
    624      *  code locations in these two opcode functions works, but access 
    625      *  to stack-ed (or spilled) variables fails badly. 
    626      * 
    627      *  We would need to prepare the assembly source of the opcode 
    628      *  lib so that all variable access on the stack has the same 
    629      *  layout and compile the prepared assembly to ops_cgp?.o 
    630      * 
    631      *  The switched core is different anyway, as we can't extend the 
    632      *  compiled big switch statement with the new cases. We have 
    633      *  always to use the wrapper__ opcode called from the default case. 
    634      */ 
    635 #  if 0 
    636     /* 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     else 
    659 #  endif 
    660     { 
    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 #endif 
    686  
    687  
    688458/* 
    689459 
    690460=item C<static void dynop_register_switch(PARROT_INTERP, size_t n_old, size_t 
     
    702472dynop_register_switch(PARROT_INTERP, size_t n_old, size_t n_new) 
    703473{ 
    704474    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); 
    706476    lib->op_count        = n_old + n_new; 
    707477} 
    708478 
     
    729499        PARROT_ASSERT(table); 
    730500        interp->op_func_table = table; 
    731501    } 
    732  
    733     if (PARROT_RUNCORE_EVENT_CHECK_TEST(interp->run_core)) 
    734         turn_ev_check(interp, on); 
    735502} 
    736503 
    737504 
  • src/runcore/cores.c

     
    249249 
    250250#include "parrot/oplib/ops.h" 
    251251#include "parrot/oplib/core_ops.h" 
    252 #include "parrot/oplib/core_ops_switch.h" 
    253252#include "parrot/dynext.h" 
    254253 
    255254#include "pmc/pmc_sub.h" 
    256255#include "pmc/pmc_callcontext.h" 
    257256 
    258 #ifdef HAVE_COMPUTED_GOTO 
    259 #  include "parrot/oplib/core_ops_cg.h" 
    260 #  include "parrot/oplib/core_ops_cgp.h" 
    261 #endif 
    262  
    263257#ifdef WIN32 
    264258#  define getpid _getpid 
    265259#endif 
     
    271265 
    272266PARROT_WARN_UNUSED_RESULT 
    273267PARROT_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_RESULT 
    281 PARROT_CANNOT_RETURN_NULL 
    282 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_RESULT 
    290 PARROT_CAN_RETURN_NULL 
    291268static opcode_t * runops_debugger_core(PARROT_INTERP, 
    292269    SHIM(Parrot_runcore_t *runcore), 
    293270    ARGIN(opcode_t *pc)) 
     
    328305        __attribute__nonnull__(3); 
    329306 
    330307PARROT_WARN_UNUSED_RESULT 
    331 PARROT_CANNOT_RETURN_NULL 
    332 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_RESULT 
    340308PARROT_CAN_RETURN_NULL 
    341309static opcode_t * runops_trace_core(PARROT_INTERP, ARGIN(opcode_t *pc)) 
    342310        __attribute__nonnull__(1) 
    343311        __attribute__nonnull__(2); 
    344312 
    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)) 
    352313#define ASSERT_ARGS_runops_debugger_core __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 
    353314       PARROT_ASSERT_ARG(interp) \ 
    354315    , PARROT_ASSERT_ARG(pc)) 
     
    365326#define ASSERT_ARGS_runops_slow_core __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 
    366327       PARROT_ASSERT_ARG(interp) \ 
    367328    , 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)) 
    372329#define ASSERT_ARGS_runops_trace_core __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 
    373330       PARROT_ASSERT_ARG(interp) \ 
    374331    , PARROT_ASSERT_ARG(pc)) 
     
    438395 
    439396/* 
    440397 
    441 =item C<void Parrot_runcore_switch_init(PARROT_INTERP)> 
    442  
    443 Registers the switch runcore with Parrot. 
    444  
    445 =cut 
    446  
    447 */ 
    448  
    449 void 
    450 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  
    471398=item C<void Parrot_runcore_exec_init(PARROT_INTERP)> 
    472399 
    473400Registers the exec runcore with Parrot. 
     
    543470    coredata->name             = CONST_STRING(interp, "debugger"); 
    544471    coredata->id               = PARROT_DEBUGGER_CORE; 
    545472    coredata->opinit           = PARROT_CORE_OPLIB_INIT; 
    546     coredata->prepare_run      = init_prederef; 
     473    coredata->prepare_run      = NULL; 
    547474    coredata->runops           = runops_debugger_core; 
    548475    coredata->destroy          = NULL; 
    549476    coredata->flags            = 0; 
     
    556483 
    557484/* 
    558485 
    559 =item C<void Parrot_runcore_cgp_init(PARROT_INTERP)> 
    560  
    561 Registers the CGP runcore with Parrot. 
    562  
    563 =cut 
    564  
    565 */ 
    566  
    567 #ifdef HAVE_COMPUTED_GOTO 
    568  
    569 void 
    570 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 =cut 
    599  
    600 */ 
    601  
    602 void 
    603 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  
    628486=item C<static opcode_t * runops_fast_core(PARROT_INTERP, Parrot_runcore_t 
    629487*runcore, opcode_t *pc)> 
    630488 
     
    660518} 
    661519 
    662520 
    663 /* 
    664  
    665 =item C<static opcode_t * runops_cgoto_core(PARROT_INTERP, Parrot_runcore_t 
    666 *runcore, opcode_t *pc)> 
    667  
    668 Runs the Parrot operations starting at C<pc> until there are no more 
    669 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 =cut 
    675  
    676 */ 
    677  
    678 PARROT_WARN_UNUSED_RESULT 
    679 PARROT_CAN_RETURN_NULL 
    680 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_GOTO 
    689     pc = cg_core(pc, interp); 
    690     return pc; 
    691 #else 
    692     UNUSED(pc); 
    693     Parrot_io_eprintf(interp, 
    694             "Computed goto unavailable in this configuration.\n"); 
    695     Parrot_exit(interp, 1); 
    696 #endif 
    697 } 
    698  
    699521#ifdef code_start 
    700522#  undef code_start 
    701523#endif 
     
    935757} 
    936758 
    937759 
    938 /* 
    939760 
    940 =item C<static opcode_t * runops_switch_core(PARROT_INTERP, Parrot_runcore_t 
    941 *runcore, opcode_t *pc)> 
    942  
    943 Runs the C<switch> core. 
    944  
    945 =cut 
    946  
    947 */ 
    948  
    949 PARROT_WARN_UNUSED_RESULT 
    950 PARROT_CANNOT_RETURN_NULL 
    951 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  
    965761/* 
    966762 
    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 =cut 
    972  
    973 */ 
    974  
    975 PARROT_CAN_RETURN_NULL 
    976 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 =cut 
    1029  
    1030 */ 
    1031  
    1032 void 
    1033 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  
    1055763=item C<oplib_init_f get_core_op_lib_init(PARROT_INTERP, Parrot_runcore_t 
    1056764*runcore)> 
    1057765 
     
    1099807 
    1100808/* 
    1101809 
    1102 =item C<static opcode_t * runops_cgp_core(PARROT_INTERP, Parrot_runcore_t 
    1103 *runcore, opcode_t *pc)> 
    1104  
    1105 Runs the computed goto and predereferenced core. 
    1106  
    1107 =cut 
    1108  
    1109 */ 
    1110  
    1111 PARROT_WARN_UNUSED_RESULT 
    1112 PARROT_CANNOT_RETURN_NULL 
    1113 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_GOTO 
    1118     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 #else 
    1127     UNUSED(pc); 
    1128     Parrot_io_eprintf(interp, 
    1129             "Computed goto unavailable in this configuration.\n"); 
    1130     Parrot_exit(interp, 1); 
    1131 #endif 
    1132  
    1133 } 
    1134  
    1135 /* 
    1136  
    1137810=back 
    1138811 
    1139812*/ 
  • docs/book/draft/appc_command_line_options.pod

     
    260260 
    261261Run with the I<fast core>. 
    262262 
    263 =item -R cgoto 
    264  
    265 Run the I<computed goto core> (CGoto). 
    266  
    267 =item -R cgp 
    268  
    269 Run with the I<CGoto-Prederefed> core. 
    270  
    271 =item -R switch 
    272  
    273 Run with the I<Switched core>. 
    274  
    275263=item -R gcdebug 
    276264 
    277265Performs a full GC run before every op dispatch 
  • docs/porting_intro.pod

     
    1313internals.  For each feature, a brief description of its purpose, hints on 
    1414helping to port it, and pointers to more information are included. 
    1515 
    16 =head1 CGoto or CGP (CGoto Predereferenced) 
    17  
    18 =head2 What it is 
    19  
    20 "Computed goto" is a non-standard C feature that allows taking a pointer to an 
    21 statement label (e.g. "LOOP:" ) using the unary && operator.  Certain Parrot 
    22 runcores make use of this feature as an optimization. 
    23  
    24 =head2 How to help 
    25  
    26 If cgoto is not supported in Parrot by default on your platform, try to compile 
    27 config/auto/cgoto/test_c.in with your C compiler and determine why it fails. If 
    28 the compiler does not support the computed goto concept at all, this feature 
    29 cannot be made to work (don't worry, there are other runcores).  However, if 
    30 the compiler supports it but the test is inadequate, please submit a bug report 
    31 describing how the implementation of this feature differs from what Parrot 
    32 expects. 
    33  
    34 Note that gcc supports this feature out of the box, though it sometimes 
    35 struggles with it in low-memory situations.  Failures during compilation of 
    36 core_ops_cg.c are frequently caused by insufficient resources rather than bugs 
    37 in gcc or Parrot. 
    38  
    39 =head2 References 
    40  
    41 =over 4 
    42  
    43 =item * F<config/auto/cgoto/test_c.in> 
    44  
    45 =item * I<make testC> 
    46  
    47 =back 
    48  
    4916=head1 Threads 
    5017 
    5118=head2 What it is 
  • docs/configuration.pod

     
    123123 
    124124=over 4 
    125125 
    126 =item F<config/auto/cgoto.pm> 
    127  
    128     Does your compiler support computed goto... 
    129  
    130126=item F<gen/config_h.pm> 
    131127 
    132128    Generate C headers... 
     
    136132Note that on non-interactive steps, the text I<done> will be printed after the 
    137133description when the step finishes executing; for example, the user will see: 
    138134 
    139     Does your compiler support computed goto..............done. 
     135    Determine flags for building shared libraries.....-fPIC 
    140136 
    141137=item C<result> 
    142138 
  • docs/running.pod

     
    135135may be available on your system: 
    136136 
    137137  slow, bounds  bounds checking core (default) 
    138   cgoto         computed goto core 
    139   cgp           computed goto-predereferenced core 
    140   fast          fast core (no bounds checking, profiling, or tracing) 
    141138  gcdebug       performs a full GC run before every op dispatch (good for 
    142139                debugging GC problems) 
    143   switch        switch core 
    144140  trace         bounds checking core w/ trace info (see 'parrot --help-debug') 
    145141  profiling     see F<docs/dev/profilling.pod> 
    146142 
     
    249245The trace and profile cores are also based on the "slow" core, doing 
    250246full bounds checking, and also printing runtime information to stderr. 
    251247 
    252 The switched core eschews these tiny op functions in favor of cases in a large 
    253 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 function 
    265 calling.  On older systems, it may fail to compile altogether. 
    266  
    267 The computed-goto ("cgoto") runcore avoids the overhead of function 
    268 calls by jumping directly to the address where each opcode's function 
    269 starts.  The computed-goto-prederef ("CGP") core takes this one step 
    270 further by replacing opcode numbers in the bytecode with those opfunc 
    271 addresses.  See "Predereferencing" in F<docs/glossary.pod> for a 
    272 fuller explanation. 
    273  
    274248=head1 Operation table 
    275249 
    276250 Command Line          Action         Output 
  • tools/build/ops2c.pl

     
    4747 
    4848    % perl tools/build/ops2c.pl trans [--help] [--no-lines] [--dynamic] 
    4949                                      [--core | input.ops [input2.ops ...]] 
    50        trans := C | CGoto | CGP | CSwitch | CPrederef 
     50       trans := C 
    5151 
    5252For example: 
    5353 
     
    7575 
    7676Create the function-based (slow or fast core) run loop. 
    7777 
    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  
    9478=back 
    9579 
    9680=head2 Options 
     
    153137 
    154138=item C<Parrot::OpTrans::C> 
    155139 
    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  
    164140=item C<Parrot::Ops2c::Utils> 
    165141 
    166142=item C<Parrot::Ops2c::Auxiliary> 
  • tools/dev/parrot-fuzzer

     
    6262 
    6363Specify which runcore to use when running Parrot.  The default is the C<slow> 
    6464core.  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>. 
     65runcores include C<fast>. 
    6666See Parrot's help for more details. 
    6767 
    6868=item C<--ignore_blacklist> 
  • lib/Parrot/Configure/Options/Conf.pm

     
    9191   --opcode=(type)      Use the given type for opcodes 
    9292   --ops=(files)        Use the given ops files 
    9393 
    94    --cgoto=0            Don't build cgoto core - recommended when short of mem 
    9594   --jitcapable         Use JIT 
    9695   --execcapable        Use JIT to emit a native executable 
    9796   --without-threads    Build parrot without thread support 
  • lib/Parrot/Configure/Options/Conf/Shared.pm

     
    1515    cc 
    1616    ccflags 
    1717    ccwarn 
    18     cgoto 
    1918    configure_trace 
    2019    cxx 
    2120    darwin_no_fink 
  • lib/Parrot/Configure/Step/List.pm

     
    4141    auto::isreg 
    4242    auto::jit 
    4343    auto::frames 
    44     auto::cgoto 
    4544    auto::inline 
    4645    auto::gc 
    4746    auto::memalign 
  • lib/Parrot/Ops2c/Auxiliary.pm

     
    1212    my $usage_msg = <<USAGE; 
    1313    % perl tools/build/ops2c.pl trans [--help] [--no-lines] [--dynamic] 
    1414                                      [--core | input.ops [input2.ops ...]] 
    15        trans := C | CGoto | CGP | CSwitch | CPrederef 
     15       trans := C 
    1616 
    1717For example: 
    1818 
  • lib/Parrot/Ops2c/Utils.pm

     
    8989        return; 
    9090    } 
    9191    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 ); 
    9393    unless ( $is_allowed{$class_name} ) { 
    9494        print STDERR 
    95             "Parrot::Ops2c::Utils::new() requires C, CGoto, CGP, CSwitch and/or  CPrederef: $!"; 
     95            "Parrot::Ops2c::Utils::new() requires C: $!"; 
    9696        return; 
    9797    } 
    9898 
     
    372372 
    373373    $self->_print_run_core_func_decl_source($SOURCE); 
    374374 
    375     $self->_print_cg_jump_table($SOURCE); 
    376  
    377     $self->_print_goto_opcode($SOURCE); 
    378  
    379375    $self->_print_op_function_definitions($SOURCE); 
    380376} 
    381377 
     
    650646            $one_op .= "$definition $comment {\n$src}\n\n"; 
    651647            push @op_funcs,  $one_op; 
    652648            push @op_protos, $prototype; 
    653             $prev_src = $src if ( $self->{suffix} eq '_cgp' || $self->{suffix} eq '_switch' ); 
    654649            $prev_index = $index; 
    655650        } 
    656651        $index++; 
     
    662657    $self->{cg_jump_table} = \@cg_jump_table; 
    663658} 
    664659 
    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         NULL 
    674     }; 
    675 END_C 
    676         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 I386 
    688     else if (cur_opcode == (opcode_t *)(void **) 1) 
    689     __asm__ ("jmp *4(%ebp)");  /* jump to ret addr, used by JIT */ 
    690 # endif 
    691 #endif 
    692     _reg_base = (char*)Parrot_pcc_get_regs_ni(interp, CURRENT_CONTEXT(interp))->regs_i; 
    693     goto **(void **)cur_opcode; 
    694  
    695 END_C 
    696     } 
    697     elsif ( $self->{suffix} =~ /cg/ ) { 
    698         print $fh <<END_C; 
    699 goto *$self->{bs}ops_addr[*cur_opcode]; 
    700  
    701 END_C 
    702     } 
    703     return 1; 
    704 } 
    705  
    706660sub _print_op_function_definitions { 
    707661    my ( $self, $fh ) = @_; 
    708662 
  • lib/Parrot/OpTrans/CSwitch.pm

     
    1 # Copyright (C) 2001-2009, Parrot Foundation. 
    2 # $Id$ 
    3  
    4 =head1 NAME 
    5  
    6 Parrot::OpTrans::CSwitch - C Switch Transform 
    7  
    8 =head1 DESCRIPTION 
    9  
    10 C<Parrot::OpTrans::CSwitch> inherits from C<Parrot::OpTrans::CPrederef> 
    11 to provide a mixture of predereferenced register addressing and a 
    12 C<switch>ed run loop. 
    13  
    14 =head2 Instance Methods 
    15  
    16 =over 4 
    17  
    18 =cut 
    19  
    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 =cut 
    40  
    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 =cut 
    50  
    51 sub core_prefix { 
    52     return "switch_"; 
    53 } 
    54  
    55 =item C<suffix()> 
    56  
    57 The suffix is C<'_switch'>. 
    58  
    59 =cut 
    60  
    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 =cut 
    70  
    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 END 
    81 } 
    82  
    83 =item C<goto_address($address)> 
    84  
    85 Transforms the C<goto ADDRESS($address)> macro in an ops file into the 
    86 relevant C code. 
    87  
    88 =cut 
    89  
    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 EOC 
    105     } 
    106 } 
    107  
    108 =item C<goto_offset($offset)> 
    109  
    110 Transforms the C<goto OFFSET($offset)> macro in an ops file into the 
    111 relevant C code. 
    112  
    113 =cut 
    114  
    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 =cut 
    125  
    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_C 
    135 } 
    136  
    137  
    138 =item C<run_core_func_start()> 
    139  
    140 Returns the C code prior to the run core function. 
    141  
    142 =cut 
    143  
    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 #else 
    152     opcode_t * cur_opcode = cur_op; 
    153     char * _reg_base; 
    154 #endif 
    155  
    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_C 
    165 } 
    166  
    167 =item C<run_core_split($base)> 
    168  
    169 If defined return code to split e.g. a switch. 
    170  
    171 =cut 
    172  
    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_C 
    181 } 
    182  
    183 =item C<run_core_finish($base)> 
    184  
    185 Returns the C code following the run core function. 
    186  
    187 =cut 
    188  
    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_C 
    204     for ( my $i = 0 ; $i < $self->{split_count} ; $i++ ) { 
    205         $c .= <<END_C; 
    206     } /* switch $i */ 
    207 END_C 
    208     } 
    209     $c .= <<END_C; 
    210     } while (1); 
    211     return NULL; 
    212 } 
    213 END_C 
    214  
    215     $c .= " /* " . $self->core_prefix . "$base */\n\n"; 
    216  
    217     return $c; 
    218 } 
    219  
    220 =back 
    221  
    222 =head1 SEE ALSO 
    223  
    224 =over 4 
    225  
    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 =back 
    237  
    238 =cut 
    239  
    240 1; 
    241  
    242 # Local Variables: 
    243 #   mode: cperl 
    244 #   cperl-indent-level: 4 
    245 #   fill-column: 100 
    246 # End: 
    247 # vim: expandtab shiftwidth=4: 
  • lib/Parrot/OpTrans/CGP.pm

     
    1 # Copyright (C) 2002, Parrot Foundation. 
    2 # $Id$ 
    3  
    4 =head1 NAME 
    5  
    6 Parrot::OpTrans::CGP - C Goto Predereferenced Transform 
    7  
    8 =head1 DESCRIPTION 
    9  
    10 C<Parrot::OpTrans::CGP> inherits from C<Parrot::OpTrans::CPrederef> and 
    11 C<Parrot::OpTrans::CGoto> to provide predereferenced register addressing 
    12 and C C<goto> run loop. 
    13  
    14 =head2 Instance Methods 
    15  
    16 =over 4 
    17  
    18 =cut 
    19  
    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 =cut 
    32  
    33 sub core_type { 
    34     return 'PARROT_CGP_CORE'; 
    35 } 
    36  
    37 =item C<suffix()> 
    38  
    39 The suffix is C<'_cgp'>. 
    40  
    41 =cut 
    42  
    43 sub suffix { 
    44     return "_cgp"; 
    45 } 
    46  
    47 =item C<core_prefix()> 
    48  
    49 The core prefix is C<'cgp_'>. 
    50  
    51 =cut 
    52  
    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 =cut 
    62  
    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 END 
    73 } 
    74  
    75 =item C<goto_address($address)> 
    76  
    77 Transforms the C<goto ADDRESS($address)> macro in an ops file into the 
    78 relevant C code. 
    79  
    80 =cut 
    81  
    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 the 
    102 relevant C code. 
    103  
    104 =cut 
    105  
    106 sub goto_offset { 
    107     my ( $self, $offset ) = @_; 
    108  
    109     # this must be a single expression, in case it's in a single-statement if 
    110     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 - %edi 
    119      * is used for the vtable call and _reg_base is clobbered 
    120      * # if 1191 := PARROT_OP_set_args_pc 
    121      * (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 #else 
    127     opcode_t *cur_opcode = cur_op; 
    128     char * _reg_base; 
    129 #endif 
    130  
    131     static void *const l_ops_addr[] = { 
    132 END_C 
    133 } 
    134  
    135 =back 
    136  
    137 =head1 SEE ALSO 
    138  
    139 =over 4 
    140  
    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 =back 
    152  
    153 =cut 
    154  
    155 1; 
    156  
    157 # Local Variables: 
    158 #   mode: cperl 
    159 #   cperl-indent-level: 4 
    160 #   fill-column: 100 
    161 # End: 
    162 # vim: expandtab shiftwidth=4: 
  • lib/Parrot/OpTrans/CGoto.pm

     
    1 # Copyright (C) 2002-2007, Parrot Foundation. 
    2 # $Id$ 
    3  
    4 =head1 NAME 
    5  
    6 Parrot::OpTrans::CGoto - CGoto Transform 
    7  
    8 =head1 DESCRIPTION 
    9  
    10 Used to generate C code from Parrot operations. 
    11  
    12 C<Parrot::OpTrans::CGoto> inherits from C<Parrot::OpTrans> to provide a 
    13 C C<goto> run loop. 
    14  
    15 =head2 Instance Methods 
    16  
    17 =over 4 
    18  
    19 =cut 
    20  
    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 =cut 
    33  
    34 sub suffix { 
    35     return "_cg"; 
    36 } 
    37  
    38 =item C<core_prefix()> 
    39  
    40 The core prefix is C<'cg_'>. 
    41  
    42 =cut 
    43  
    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 =cut 
    53  
    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 =cut 
    63  
    64 sub defines { 
    65     my $type = __PACKAGE__; 
    66     return <<END; 
    67 /* defines - $0 -> $type */ 
    68 #undef CONST 
    69 #define REL_PC     ((size_t)(cur_opcode - (opcode_t*)interp->code->base.data)) 
    70 #define CUR_OPCODE cur_opcode 
    71 #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 END 
    77 } 
    78  
    79 =item C<pc($pc)> 
    80  
    81 =item C<pc()> 
    82  
    83 Sets/gets the current position in Parrot code. 
    84  
    85 =cut 
    86  
    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 =cut 
    105  
    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 =cut 
    122  
    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 the 
    132 relevant C code. 
    133  
    134 =cut 
    135  
    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 the 
    154 relevant C code. 
    155  
    156 =cut 
    157  
    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 the 
    167 relevant C code. 
    168  
    169 =cut 
    170  
    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 (see 
    198 C<Parrot::OpTrans>) and value. C<$op> is an instance of C<Parrot::Op>. 
    199  
    200 =cut 
    201  
    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 =cut 
    217  
    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 =cut 
    229  
    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 =cut 
    241  
    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 =cut 
    253  
    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 =cut 
    265  
    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 #else 
    271     opcode_t *cur_opcode = cur_op; 
    272 #endif 
    273  
    274     static void *const l_ops_addr[] = { 
    275 END_C 
    276 } 
    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 =cut 
    283  
    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_C 
    295 } 
    296  
    297 =item C<run_core_finish($base)> 
    298  
    299 Returns the C code following the run core function. 
    300  
    301 =cut 
    302  
    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 =cut 
    314  
    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_C 
    324 } 
    325  
    326 =item C<init_set_dispatch($base_suffix)> 
    327  
    328 Returns the C code to initialize the dispatch mechanism within the core's 
    329 initialization function. 
    330  
    331 =cut 
    332  
    333 sub init_set_dispatch { 
    334     my ( $self, $bs ) = @_; 
    335  
    336     return <<END_C; 
    337         ${bs}ops_addr = (void**) init; 
    338 END_C 
    339 } 
    340  
    341 =back 
    342  
    343 =head1 SEE ALSO 
    344  
    345 =over 4 
    346  
    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 =back 
    358  
    359 =cut 
    360  
    361 1; 
    362  
    363 # Local Variables: 
    364 #   mode: cperl 
    365 #   cperl-indent-level: 4 
    366 #   fill-column: 100 
    367 # End: 
    368 # vim: expandtab shiftwidth=4: 
  • lib/Parrot/OpTrans/CPrederef.pm

     
    1 #! perl 
    2 # Copyright (C) 2001-2007, Parrot Foundation. 
    3 # $Id$ 
    4  
    5 =head1 NAME 
    6  
    7 Parrot::OpTrans::CPrederef - C Predereferenced Transform 
    8  
    9 =head1 DESCRIPTION 
    10  
    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 Methods 
    16  
    17 =over 4 
    18  
    19 =cut 
    20  
    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 =cut 
    34  
    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 END 
    45 } 
    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 =cut 
    56  
    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 END 
    81 } 
    82  
    83 =item C<access_arg($type, $num, $op)> 
    84  
    85 Returns the C code for the specified op argument type (see 
    86 C<Parrot::OpTrans>) and value. C<$op> is an instance of C<Parrot::Op>. 
    87  
    88 =cut 
    89  
    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 =back 
    118  
    119 =head1 SEE ALSO 
    120  
    121 =over 4 
    122  
    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 =back 
    134  
    135 =cut 
    136  
    137 1; 
    138  
    139 # Local Variables: 
    140 #   mode: cperl 
    141 #   cperl-indent-level: 4 
    142 #   fill-column: 100 
    143 # End: 
    144 # vim: expandtab shiftwidth=4: 
  • lib/Parrot/OpTrans/C.pm

     
    3333    return 'PARROT_FUNCTION_CORE'; 
    3434} 
    3535 
    36 =item C<core_prefix()> 
    37  
    38 Returns an empty string. 
    39  
    40 =cut 
    41  
    42 sub core_prefix { 
    43     return ""; 
    44 } 
    45  
    4636=item C<defines()> 
    4737 
    4838Returns the C C<#define> macros for register access etc. 
     
    173163 
    174164=item C<Parrot::OpTrans> 
    175165 
    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  
    184166=back 
    185167 
    186168=cut 
  • lib/Parrot/OpTrans.pm

     
    1616The subclass hierarchy is as follows: 
    1717 
    1818    OpTrans 
    19        |___________ 
    20        |           | 
    21        C         CGoto 
    22        |           | 
    23     CPrederef      | 
    24        | |         | 
    25        | |_________| 
    26        |           | 
    27     CSwitch       CGP 
     19       | 
     20       | 
     21       C 
    2822 
    2923=head2 Class Methods 
    3024 
     
    9185    die ref($self) . " doesn't have core_type()"; 
    9286} 
    9387 
    94 =item C<core_prefix()> 
    95  
    96 Implemented in subclasses to return a short prefix indicating the core 
    97 type used to individuate core function names. 
    98  
    9988=item C<run_core_func_decl($base)> 
    10089 
    10190Optionally implemented in subclasses to return the C code for the run 
     
    222211 
    223212=item C<Parrot::OpTrans::C> 
    224213 
    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  
    233214=back 
    234215 
    235216=cut 
  • lib/Parrot/Harness/Options.pm

     
    8888 
    8989    my %remap      = ( 
    9090        'j' => '-runcore=fast', 
    91         'g' => '-runcore=cgoto', 
    9291        'G' => '-runcore=gcdebug', 
    93         'C' => '-runcore=cgp', 
    94         'S' => '-runcore=switch', 
    9592        'b' => '-runcore=bounds', 
    9693        'f' => '-runcore=fast', 
    9794        'r' => '-run-pbc', 
     
    113110    print <<"EOF"; 
    114111perl t/harness [options] [testfiles] 
    115112    -w         ... warnings on 
    116     -g         ... run CGoto 
    117     -C         ... run CGP 
    118     -S         ... run Switched 
    119113    -b         ... run bounds checked 
    120114    --run-exec ... run exec core 
    121115    -f         ... run fast core 
  • MANIFEST

     
    11# ex: set ro: 
    22# $Id$ 
    33# 
    4 # generated by tools/dev/mk_manifest_and_skip.pl Tue Apr 20 20:11:26 2010 UT 
     4# generated by tools/dev/mk_manifest_and_skip.pl Wed Apr 21 03:55:26 2010 UT 
    55# 
    66# See below for documentation on the format of this file. 
    77# 
     
    225225config/auto/backtrace/test_dlinfo_c.in                      [] 
    226226config/auto/byteorder.pm                                    [] 
    227227config/auto/byteorder/test_c.in                             [] 
    228 config/auto/cgoto.pm                                        [] 
    229 config/auto/cgoto/test_c.in                                 [] 
    230228config/auto/cpu.pm                                          [] 
    231229config/auto/cpu/i386/auto.pm                                [] 
    232230config/auto/cpu/i386/test_gcc_cmpxchg_c.in                  [] 
     
    11171115lib/Parrot/Op.pm                                            [devel]lib 
    11181116lib/Parrot/OpTrans.pm                                       [devel]lib 
    11191117lib/Parrot/OpTrans/C.pm                                     [devel]lib 
    1120 lib/Parrot/OpTrans/CGP.pm                                   [devel]lib 
    1121 lib/Parrot/OpTrans/CGoto.pm                                 [devel]lib 
    1122 lib/Parrot/OpTrans/CPrederef.pm                             [devel]lib 
    1123 lib/Parrot/OpTrans/CSwitch.pm                               [devel]lib 
    11241118lib/Parrot/Ops2c/Auxiliary.pm                               [devel]lib 
    11251119lib/Parrot/Ops2c/Utils.pm                                   [devel]lib 
    11261120lib/Parrot/Ops2pm.pm                                        [devel]lib 
     
    19871981t/steps/auto/attributes-01.t                                [test] 
    19881982t/steps/auto/backtrace-01.t                                 [test] 
    19891983t/steps/auto/byteorder-01.t                                 [test] 
    1990 t/steps/auto/cgoto-01.t                                     [test] 
    19911984t/steps/auto/cpu-01.t                                       [test] 
    19921985t/steps/auto/ctags-01.t                                     [test] 
    19931986t/steps/auto/env-01.t                                       [test] 
  • ports/cygwin/README

     
    682682 /usr/include/parrot/1.0.0/parrot/op.h 
    683683 /usr/include/parrot/1.0.0/parrot/oplib.h 
    684684 /usr/include/parrot/1.0.0/parrot/oplib/core_ops.h 
    685  /usr/include/parrot/1.0.0/parrot/oplib/core_ops_cg.h 
    686  /usr/include/parrot/1.0.0/parrot/oplib/core_ops_cgp.h 
    687  /usr/include/parrot/1.0.0/parrot/oplib/core_ops_switch.h 
    688685 /usr/include/parrot/1.0.0/parrot/oplib/ops.h 
    689686 /usr/include/parrot/1.0.0/parrot/packfile.h 
    690687 /usr/include/parrot/1.0.0/parrot/parrot.h 
     
    748745 /usr/lib/parrot/1.0.0/src/install_config.o 
    749746 /usr/lib/parrot/1.0.0/src/nci.c 
    750747 /usr/lib/parrot/1.0.0/src/null_config.o 
    751  /usr/lib/parrot/1.0.0/src/ops/core_ops_cgp.c 
    752  /usr/lib/parrot/1.0.0/src/ops/core_ops_switch.c 
    753748 /usr/lib/parrot/1.0.0/src/parrot_config.o 
    754749 /usr/lib/parrot/1.0.0/tools/build/ops2c.pl 
    755750 /usr/lib/parrot/1.0.0/tools/build/pmc2c.pl 
     
    892887 /usr/share/doc/parrot/1.0.0/html/config/auto/attributes.pm.html 
    893888 /usr/share/doc/parrot/1.0.0/html/config/auto/backtrace.pm.html 
    894889 /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.html 
    896890 /usr/share/doc/parrot/1.0.0/html/config/auto/cpu.pm.html 
    897891 /usr/share/doc/parrot/1.0.0/html/config/auto/cpu/i386/auto.pm.html 
    898892 /usr/share/doc/parrot/1.0.0/html/config/auto/cpu/ppc/auto.pm.html 
  • MANIFEST.SKIP

     
    11# ex: set ro: 
    22# $Id$ 
    3 # generated by tools/dev/mk_manifest_and_skip.pl Thu Apr 15 17:41:44 2010 UT 
     3# generated by tools/dev/mk_manifest_and_skip.pl Wed Apr 21 05:05:15 2010 UT 
    44# 
    55# This file should contain a transcript of the svn:ignore properties 
    66# of the directories in the Parrot subversion repository. (Needed for 
  • include/parrot/oplib.h

     
    5151    CORE_OPS_check_events__,    /* inserted into op dispatch when an event 
    5252                                   got scheduled */ 
    5353    CORE_OPS_wrapper__,         /* inserted by dynop_register for new ops */ 
    54     CORE_OPS_prederef__         /* inserted by dynop_register for new ops */ 
    5554        /* 2 more reserved */ 
    5655} special_core_ops_enum; 
    5756 
  • include/parrot/runcore_api.h

     
    3838typedef enum Parrot_runcore_flags { 
    3939    RUNCORE_REENTRANT_FLAG    = 1 << 0, 
    4040    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 << 5 
    4541} Parrot_runcore_flags; 
    4642 
    4743 
     
    5551#define PARROT_RUNCORE_FUNC_TABLE_SET(runcore) \ 
    5652    Runcore_flag_SET(runcore, RUNCORE_FUNC_TABLE_FLAG) 
    5753 
    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  
    7854/* HEADERIZER BEGIN: src/runcore/main.c */ 
    7955/* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */ 
    8056 
     
    152128    ARGIN(Parrot_runcore_t *runcore)) 
    153129        __attribute__nonnull__(2); 
    154130 
    155 PARROT_CAN_RETURN_NULL 
    156 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  
    170131void Parrot_runcore_debugger_init(PARROT_INTERP) 
    171132        __attribute__nonnull__(1); 
    172133 
     
    182143void Parrot_runcore_slow_init(PARROT_INTERP) 
    183144        __attribute__nonnull__(1); 
    184145 
    185 void Parrot_runcore_switch_init(PARROT_INTERP) 
    186         __attribute__nonnull__(1); 
    187  
    188146#define ASSERT_ARGS_get_core_op_lib_init __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 
    189147       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)) 
    200148#define ASSERT_ARGS_Parrot_runcore_debugger_init __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 
    201149       PARROT_ASSERT_ARG(interp)) 
    202150#define ASSERT_ARGS_Parrot_runcore_exec_init __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 
     
    207155       PARROT_ASSERT_ARG(interp)) 
    208156#define ASSERT_ARGS_Parrot_runcore_slow_init __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 
    209157       PARROT_ASSERT_ARG(interp)) 
    210 #define ASSERT_ARGS_Parrot_runcore_switch_init __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 
    211        PARROT_ASSERT_ARG(interp)) 
    212158/* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */ 
    213159/* HEADERIZER END: src/runcore/cores.c */ 
    214160 
  • include/parrot/op.h

     
    5757/* NOTE: Sure wish we could put the types here... */ 
    5858 
    5959typedef opcode_t *(*op_func_t)(opcode_t *, PARROT_INTERP); 
    60 typedef void **(*op_func_prederef_t)(void **, PARROT_INTERP); 
    6160 
    6261 
    6362/* 
  • include/parrot/interpreter.h

     
    6464    PARROT_SLOW_CORE,                       /* slow bounds/trace/profile core */ 
    6565    PARROT_FUNCTION_CORE    = PARROT_SLOW_CORE, 
    6666    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      */ 
    7067    PARROT_EXEC_CORE        = 0x20,         /* TODO Parrot_exec_run variants */ 
    7168    PARROT_GC_DEBUG_CORE    = 0x40,         /* run GC before each op */ 
    7269    PARROT_DEBUGGER_CORE    = 0x80,         /* used by parrot debugger */ 
     
    152149struct _Thread_data;    /* in thread.h */ 
    153150struct _Caches;         /* caches .h */ 
    154151 
    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  
    167152/* Get Context from interpreter */ 
    168153#define CONTEXT(interp)         Parrot_pcc_get_context_struct((interp), (interp)->ctx) 
    169154 
  • include/parrot/packfile.h

     
    255255 
    256256struct PackFile_ByteCode { 
    257257    PackFile_Segment       base; 
    258     Prederef               prederef;    /* The predereferenced code and info */ 
    259258    struct PackFile_Debug *debugs; 
    260259    PackFile_ConstTable   *const_table; 
    261260    PackFile_FixupTable   *fixups; 
  • include/parrot/exceptions.h

     
    5151    EXCEPTION_JIT_UNAVAILABLE, 
    5252    EXCEPTION_EXEC_UNAVAILABLE, 
    5353    EXCEPTION_INTERP_ERROR, 
    54     EXCEPTION_PREDEREF_LOAD_ERROR, 
    5554    EXCEPTION_PARROT_USAGE_ERROR, 
    5655    EXCEPTION_PIO_ERROR, 
    5756    EXCEPTION_PARROT_POINTER_ERROR, 
  • include/parrot/context.h

     
    214214        __attribute__nonnull__(2); 
    215215 
    216216PARROT_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_EXPORT 
    222217UINTVAL Parrot_pcc_get_recursion_depth_func(PARROT_INTERP, ARGIN(PMC *ctx)) 
    223218        __attribute__nonnull__(1) 
    224219        __attribute__nonnull__(2); 
     
    316311        __attribute__nonnull__(2); 
    317312 
    318313PARROT_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_EXPORT 
    326314void Parrot_pcc_set_signature_func(PARROT_INTERP, 
    327315    ARGIN(PMC *ctx), 
    328316    ARGIN_NULLOK(PMC *sig_object)) 
     
    431419     __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 
    432420       PARROT_ASSERT_ARG(interp) \ 
    433421    , 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)) 
    438422#define ASSERT_ARGS_Parrot_pcc_get_recursion_depth_func \ 
    439423     __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 
    440424       PARROT_ASSERT_ARG(interp) \ 
     
    486470#define ASSERT_ARGS_Parrot_pcc_set_pc_func __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 
    487471       PARROT_ASSERT_ARG(interp) \ 
    488472    , 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)) 
    493473#define ASSERT_ARGS_Parrot_pcc_set_signature_func __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 
    494474       PARROT_ASSERT_ARG(interp) \ 
    495475    , PARROT_ASSERT_ARG(ctx)) 
     
    533513#  define Parrot_pcc_get_namespace(i, c) (__C(c)->current_namespace) 
    534514#  define Parrot_pcc_set_namespace(i, c, value) (__C(c)->current_namespace = (value)) 
    535515 
    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  
    539516#  define Parrot_pcc_get_pc(i, c) (__C(c)->current_pc) 
    540517#  define Parrot_pcc_set_pc(i, c, value) (__C(c)->current_pc = (value)) 
    541518 
     
    594571#  define Parrot_pcc_get_namespace(i, c) Parrot_pcc_get_namespace_func((i), (c)) 
    595572#  define Parrot_pcc_set_namespace(i, c, value) Parrot_pcc_set_namespace_func((i), (c), (value)) 
    596573 
    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  
    600574#  define Parrot_pcc_get_pc(i, c) Parrot_pcc_get_pc_func((i), (c)) 
    601575#  define Parrot_pcc_set_pc(i, c, value) Parrot_pcc_set_pc_func((i), (c), (value)) 
    602576 
  • Configure.pl

     
    343343 
    344344Use the given ops files. 
    345345 
    346 =item C<--cgoto=0> 
    347  
    348 Don't build cgoto core. This is recommended when you are short of memory. 
    349  
    350346=item C<--jitcapable> 
    351347 
    352348Use JIT system. 
     
    623619    auto::jit 
    624620    auto::frames 
    625621    auto::cpu 
    626     auto::cgoto 
    627622    auto::inline 
    628623    auto::gc 
    629624    auto::memalign 
  • README

     
    9292 
    9393    perldoc -F docs/intro.pod 
    9494 
    95 NOTES 
    96 ----- 
    97  
    98 On some older computers with little RAM, the computed-goto dispatch core 
    99 (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-goto 
    101 core, at a slight cost in runtime speed. 
    102  
    10395CHANGES 
    10496------- 
    10597 
  • compilers/imcc/main.c

     
    251251        if (strchr(opt->opt_arg, '2')) { 
    252252            IMCC_INFO(interp)->optimizer_level |= (OPT_PRE | OPT_CFG); 
    253253        } 
    254         if (strchr(opt->opt_arg, 't')) { 
    255 #ifdef HAVE_COMPUTED_GOTO 
    256             *core = PARROT_CGP_CORE; 
    257 #else 
    258             *core = PARROT_SWITCH_CORE; 
    259 #endif 
    260         } 
    261254        break; 
    262255 
    263256      default: 
     
    414407    if (opt_level & OPT_SUB) 
    415408        opt_desc[i++] = 'c'; 
    416409 
    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  
    423410    opt_desc[i] = '\0'; 
    424411    return; 
    425412} 
  • t/configure/testlib/adefectivefoobar

     
    4040auto::jit 
    4141auto::cpu 
    4242auto::funcptr 
    43 auto::cgoto 
    4443auto::inline 
    4544auto::gc 
    4645auto::memalign 
  • t/configure/testlib/bdefectivefoobar

     
    5050auto::jit 
    5151auto::cpu 
    5252auto::funcptr 
    53 auto::cgoto 
    5453auto::inline 
    5554auto::gc 
    5655auto::memalign 
  • t/configure/testlib/cdefectivefoobar

     
    5151auto::jit 
    5252auto::cpu 
    5353auto::funcptr 
    54 auto::cgoto 
    5554auto::inline 
    5655auto::gc 
    5756auto::memalign 
  • t/configure/testlib/ddefectivefoobar

     
    4242auto::jit 
    4343auto::cpu 
    4444auto::funcptr 
    45 auto::cgoto 
    4645auto::inline 
    4746auto::gc 
    4847auto::memalign 
  • t/configure/testlib/verbosefoobar

     
    4444auto::jit 
    4545auto::cpu 
    4646auto::funcptr 
    47 auto::cgoto 
    4847auto::inline 
    4948auto::gc 
    5049auto::memalign 
  • t/pharness/02-get_test_prog_args.t

     
    1313}; 
    1414plan( skip_all => 't/harness only runs once configuration has completed' ) 
    1515    if $@; 
    16 plan( tests => 16 ); 
     16plan( tests => 12 ); 
    1717use Carp; 
    1818use Parrot::Harness::Options qw( get_test_prog_args ); 
    1919 
     
    2828($gc_debug, $run_exec) = (0,0); 
    2929$args = get_test_prog_args($optsref, $gc_debug, $run_exec); 
    3030like($args, qr/-d/, "Got expected option"); 
    31 like($args, qr/--runcore=cgoto/, "Got expected option"); 
    3231like($args, qr/-D40/, "Got expected option"); 
    3332 
    3433$optsref = { 
     
    4039($gc_debug, $run_exec) = (0,0); 
    4140$args = get_test_prog_args($optsref, $gc_debug, $run_exec); 
    4241like($args, qr/-d/, "Got expected option"); 
    43 like($args, qr/--runcore=cgoto/, "Got expected option"); 
    4442like($args, qr/-D40/, "Got expected option"); 
    4543like($args, qr/-O2/, "Got expected option"); 
    4644 
     
    5250($gc_debug, $run_exec) = (1,0); 
    5351$args = get_test_prog_args($optsref, $gc_debug, $run_exec); 
    5452like($args, qr/-d/, "Got expected option"); 
    55 like($args, qr/--runcore=cgoto/, "Got expected option"); 
    5653like($args, qr/-D40/, "Got expected option"); 
    5754like($args, qr/\s--gc-debug/, "Got expected option"); 
    5855 
     
    6461($gc_debug, $run_exec) = (0,1); 
    6562$args = get_test_prog_args($optsref, $gc_debug, $run_exec); 
    6663like($args, qr/-d/, "Got expected option"); 
    67 like($args, qr/--runcore=cgoto/, "Got expected option"); 
    6864like($args, qr/-D40/, "Got expected option"); 
    6965like($args, qr/\s--run-exec/, "Got expected option"); 
    7066 
  • t/steps/auto/cgoto-01.t

     
    1 #! perl 
    2 # Copyright (C) 2007, Parrot Foundation. 
    3 # $Id$ 
    4 # auto/cgoto-01.t 
    5  
    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_description 
    16 ); 
    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         \$stdout 
    89     ); 
    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         \$stdout 
    99     ); 
    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 NAME 
    111  
    112 auto/cgoto-01.t - test auto::cgoto 
    113  
    114 =head1 SYNOPSIS 
    115  
    116     % prove t/steps/auto/cgoto-01.t 
    117  
    118 =head1 DESCRIPTION 
    119  
    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 AUTHOR 
    125  
    126 James E Keenan 
    127  
    128 =head1 SEE ALSO 
    129  
    130 config::auto::cgoto, F<Configure.pl>. 
    131  
    132 =cut 
    133  
    134 # Local Variables: 
    135 #   mode: cperl 
    136 #   cperl-indent-level: 4 
    137 #   fill-column: 100 
    138 # End: 
    139 # vim: expandtab shiftwidth=4: 
  • t/tools/install/testlib/README

     
    104104 
    105105    perldoc -F docs/intro.pod 
    106106 
    107 NOTES 
    108 ----- 
    109  
    110 On some older computers with little RAM, the computed-goto dispatch core 
    111 (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-goto 
    113 core, at a slight cost in runtime speed. 
    114  
    115107CHANGES 
    116108------- 
    117109 
  • t/tools/ops2cutils/04-print_c_source_top.t

     
    1919    } 
    2020    unshift @INC, qq{$topdir/lib}; 
    2121} 
    22 use Test::More tests => 26; 
     22use Test::More tests => 10; 
    2323use Carp; 
    2424use Cwd; 
    2525use File::Copy; 
     
    4747    require Parrot::Ops2c::Utils; 
    4848 
    4949    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 )] ); 
    5450 
    5551    ok( chdir($cwd), "returned to starting directory" ); 
    5652} 
  • t/tools/ops2cutils/09-dynamic_nolines.t

     
    1919    } 
    2020    unshift @INC, qq{$topdir/lib}; 
    2121} 
    22 use Test::More tests => 22; 
     22use Test::More tests => 10; 
    2323use Carp; 
    2424use Cwd; 
    2525use File::Copy; 
     
    5252    } 
    5353    chdir "src/dynoplibs" or croak "Unable to change to src/dynoplibs: $!"; 
    5454 
    55     test_dynops_nolines( [qw( CGoto    obscure.ops )] ); 
    56     test_dynops_nolines( [qw( CGP      obscure.ops )] ); 
    5755    test_dynops_nolines( [qw( C        obscure.ops )] ); 
    58     test_dynops_nolines( [qw( CSwitch  obscure.ops )] ); 
    5956 
    6057    ok( chdir($cwd), "returned to starting directory" ); 
    6158} 
  • t/tools/ops2cutils/05-print_c_source_bottom.t

     
    1919    } 
    2020    unshift @INC, qq{$topdir/lib}; 
    2121} 
    22 use Test::More tests => 26; 
     22use Test::More tests => 10; 
    2323use Carp; 
    2424use Cwd; 
    2525use File::Copy; 
     
    4848    require Parrot::Ops2c::Utils; 
    4949 
    5050    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 )] ); 
    5551 
    5652    ok( chdir($cwd), "returned to starting directory" ); 
    5753} 
  • t/tools/ops2cutils/03-print_c_header_file.t

     
    1919    } 
    2020    unshift @INC, qq{$topdir/lib}; 
    2121} 
    22 use Test::More tests => 24; 
     22use Test::More tests => 12; 
    2323use Carp; 
    2424use Cwd; 
    2525use File::Copy; 
     
    4747    require Parrot::Ops2c::Utils; 
    4848 
    4949    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}); 
    5450 
    5551    { 
    56         local @ARGV = qw( C CGoto CGP CSwitch CPrederef ); 
     52        local @ARGV = qw( C ); 
    5753        my $self = Parrot::Ops2c::Utils->new( 
    5854            { 
    5955                argv => [@ARGV], 
     
    7369 
    7470sub test_single_trans_and_header { 
    7571    my $trans = shift; 
    76     my %available = map { $_, 1 } qw( C CGoto CGP CSwitch CPrederef ); 
     72    my %available = map { $_, 1 } qw( C ); 
    7773    croak "Bad argument $trans to test_single_trans()" 
    7874        unless $available{$trans}; 
    7975 
  • t/tools/ops2cutils/01-new.t

     
    1919    } 
    2020    unshift @INC, qq{$topdir/lib}; 
    2121} 
    22 use Test::More tests => 19; 
     22use Test::More tests => 15; 
    2323use Carp; 
    2424use Cwd; 
    2525use File::Copy; 
     
    8787            "Constructor correctly returned undef due to bad class name command-line argument" ); 
    8888        like( 
    8989            $stderr, 
    90             qr/Parrot::Ops2c::Utils::new\(\) requires C, CGoto, CGP, CSwitch and\/or  CPrederef/, 
     90            qr/Parrot::Ops2c::Utils::new\(\) requires C/, 
    9191            "Got correct error message" 
    9292        ); 
    9393    } 
    9494 
    9595    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}); 
    10096 
    10197    { 
    102         local @ARGV = qw( C CGoto CGP CSwitch CPrederef ); 
     98        local @ARGV = qw( C ); 
    10399        my $self = Parrot::Ops2c::Utils->new( 
    104100            { argv => [@ARGV], flag => { core => 1 } } 
    105101        ); 
     
    107103    } 
    108104 
    109105    { 
    110         local @ARGV = qw( C CGoto CGP CSwitch CPrederef ); 
     106        local @ARGV = qw( C ); 
    111107        my $self = Parrot::Ops2c::Utils->new( 
    112108            { 
    113109                argv   => [@ARGV], 
     
    146142 
    147143sub test_single_trans { 
    148144    my $trans = shift; 
    149     my %available = map { $_, 1 } qw( C CGoto CGP CSwitch CPrederef ); 
     145    my %available = map { $_, 1 } qw( C ); 
    150146    croak "Bad argument $trans to test_single_trans()" 
    151147        unless $available{$trans}; 
    152148 
  • t/tools/ops2cutils/06-dynamic.t

     
    1919    } 
    2020    unshift @INC, qq{$topdir/lib}; 
    2121} 
    22 use Test::More tests => 27; 
     22use Test::More tests => 15; 
    2323use Carp; 
    2424use Cwd; 
    2525use File::Copy; 
     
    5555    } 
    5656    chdir "src/dynoplibs" or croak "Unable to change to src/dynoplibs: $!"; 
    5757 
    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 )] ); 
    6259 
    6360    { 
    6461        my ($self, $stdout, $stderr); 
    6562        capture( 
    6663            sub { $self = Parrot::Ops2c::Utils->new( { 
    67                         argv => [qw( CSwitch obscure.ops obscure.ops )], 
     64                        argv => [qw( C obscure.ops obscure.ops )], 
    6865                        flag => { dynamic => 1 }, 
    6966                } ); }, 
    7067            \$stdout, 
  • t/tools/ops2cutils/07-make_incdir.t

     
    8181    require Parrot::Ops2c::Utils; 
    8282 
    8383    { 
    84         local @ARGV = qw( C CGoto CGP CSwitch CPrederef ); 
     84        local @ARGV = qw( C ); 
    8585        my $self = Parrot::Ops2c::Utils->new( 
    8686            { 
    8787                argv => [@ARGV], 
     
    9898 
    9999sub test_single_trans { 
    100100    my $trans = shift; 
    101     my %available = map { $_, 1 } qw( C CGoto CGP CSwitch CPrederef ); 
     101    my %available = map { $_, 1 } qw( C ); 
    102102    croak "Bad argument $trans to test_single_trans()" 
    103103        unless $available{$trans}; 
    104104 
  • t/tools/ops2cutils/10-print_c_source_file.t

     
    1919    } 
    2020    unshift @INC, qq{$topdir/lib}; 
    2121} 
    22 use Test::More tests => 21; 
     22use Test::More tests => 12; 
    2323use Carp; 
    2424use Cwd; 
    2525use File::Copy; 
     
    4747    require Parrot::Ops2c::Utils; 
    4848 
    4949    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}); 
    5350 
    5451    { 
    55         local @ARGV = qw( C CGoto CGP CSwitch ); 
     52        local @ARGV = qw( C ); 
    5653        my $self = Parrot::Ops2c::Utils->new( 
    5754            { 
    5855                argv => [@ARGV], 
     
    7269 
    7370sub test_single_trans_and_source { 
    7471    my $trans = shift; 
    75     my %available = map { $_, 1 } qw( C CGoto CGP CSwitch CPrederef ); 
     72    my %available = map { $_, 1 } qw( C ); 
    7673    croak "Bad argument $trans to test_single_trans()" 
    7774        unless $available{$trans}; 
    7875 
  • t/tools/ops2cutils/08-nolines.t

     
    4747    require Parrot::Ops2c::Utils; 
    4848 
    4949    { 
    50         local @ARGV = qw( C CGoto CGP CSwitch CPrederef ); 
     50        local @ARGV = qw( C ); 
    5151        my $self = Parrot::Ops2c::Utils->new( 
    5252            { 
    5353                argv => [@ARGV], 
  • t/harness

     
    134134 
    135135Turn warnings on. 
    136136 
    137 =item C<-g> 
    138  
    139 Run the C<CGoto> core. 
    140  
    141137=item C<-G> 
    142138 
    143139Run the C<GCDebug> core. 
     
    146142 
    147143Alias for running with the fast core. 
    148144 
    149 =item C<-C> 
    150  
    151 Run the C<CGP> core. 
    152  
    153 =item C<-S> 
    154  
    155 Run Switched. 
    156  
    157145=item C<-b> 
    158146 
    159147Run bounds checking enabled. 
  • t/examples/shootout.t

     
    3535To add a new test, you do not have to modify this script: 
    3636 
    3737 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") 
    3939 3. make sure you have default argument values 
    4040 4. put the expected output as a file : toto.pir_output 
    4141 5. if you need an input file (to be read from stdin), call it toto.pir_input 
     
    7474        $args =~ s/-j/-C/; 
    7575        $args =~ s/-Cj/-C/; 
    7676    } 
    77     unless ( $PConfig{cg_flag} =~ /HAVE/ ) { 
    78         $args =~ s/-Cj/-j/; 
     77    $args =~ s/-Cj/-j/; 
    7978 
    80         # Remove any plain -C option. 
    81         $args =~ s/(^|\s)-C(\s|$)/$1$2/; 
     79    # Remove any plain -C option. 
     80    $args =~ s/(^|\s)-C(\s|$)/$1$2/; 
    8281 
    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//; 
    8684 
    8785    # look for input files 
    8886    my $input = "$file$INPUT_EXT"; 
  • t/op/interp.t

     
    154154    $I0 = interpinfo .INTERPINFO_CURRENT_RUNCORE 
    155155    if $I0 == .PARROT_FUNCTION_CORE   goto ok1 
    156156    if $I0 == .PARROT_FAST_CORE       goto ok1 
    157     if $I0 == .PARROT_SWITCH_CORE     goto ok1 
    158     if $I0 == .PARROT_CGOTO_CORE      goto ok1 
    159     if $I0 == .PARROT_CGP_CORE        goto ok1 
    160157    if $I0 == .PARROT_EXEC_CORE       goto ok1 
    161158    if $I0 == .PARROT_GC_DEBUG_CORE   goto ok1 
    162159    print 'not ' 
  • t/op/annotate-old.t

     
    2424=cut 
    2525 
    2626TODO: { 
    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/; 
    2929 
    3030pir_error_output_like( <<CODE, <<OUTPUT, 'unhandled exception from loaded function'); 
    3131.sub main :main 
  • t/op/debuginfo.t

     
    2424=cut 
    2525 
    2626$ENV{TEST_PROG_ARGS} ||= ''; 
    27 my $nolineno = $ENV{TEST_PROG_ARGS} =~ /--runcore=(fast|cgoto)/ 
     27my $nolineno = $ENV{TEST_PROG_ARGS} =~ /--runcore=fast/ 
    2828    ? "\\(unknown file\\)\n-1" : "debuginfo_\\d+\\.pasm\n\\d"; 
    2929 
    3030#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/; 
    3232 
    3333pasm_output_like( <<'CODE', <<"OUTPUT", "getline, getfile" ); 
    3434.pcc_sub main: 
     
    158158called from Sub 'main' pc (\d+|-1) \(.*?:(\d+|-1)\)$/ 
    159159OUTPUT 
    160160 
    161 $nolineno = $ENV{TEST_PROG_ARGS} =~ /--runcore=(fast|cgoto)/ 
     161$nolineno = $ENV{TEST_PROG_ARGS} =~ /--runcore=fast/ 
    162162    ? '\(\(unknown file\):-1\)' : '\(xyz.pir:126\)'; 
    163163 
    164164pir_error_output_like( <<'CODE', <<"OUTPUT", "setfile and setline" ); 
     
    173173/$nolineno/ 
    174174OUTPUT 
    175175 
    176 $nolineno = $ENV{TEST_PROG_ARGS} =~ /--runcore=(fast|cgoto)/ 
     176$nolineno = $ENV{TEST_PROG_ARGS} =~ /--runcore=fast/ 
    177177    ? '\(\(unknown file\):-1\)' : '\(foo.p6:128\)'; 
    178178pir_error_output_like( <<'CODE', <<"OUTPUT", "setfile and setline" ); 
    179179.sub main :main 
  • MANIFEST.generated

     
    3737include/parrot/extend_vtable.h                    [main]include 
    3838include/parrot/feature.h                          [main]include 
    3939include/parrot/has_header.h                       [main]include 
    40 include/parrot/oplib/core_ops_cg.h                [main]include 
    41 include/parrot/oplib/core_ops_cgp.h               [main]include 
    4240include/parrot/oplib/core_ops.h                   [main]include 
    43 include/parrot/oplib/core_ops_switch.h            [main]include 
    4441include/parrot/oplib/ops.h                        [main]include 
    4542include/parrot/pbcversion.h                       [devel]include 
    4643include/parrot/platform.h                         [main]include 
     
    229226src/jit_emit.h                                    [] 
    230227src/nci.c                                         [] 
    231228src/null_config.c                                 [] 
    232 src/ops/core_ops_cgp.c                            [] 
    233 src/ops/core_ops_switch.c                         [] 
    234229src/parrot_config.c                               [] 
    235230src/pmc/boolean.dump                              [devel]src 
    236231src/pmc/continuation.dump                         [devel]src 
  • config/init/optimize.pm

     
    7474    $conf->data->set( cc_debug => '' ); 
    7575    $conf->data->add( ' ', ccflags => "-DDISABLE_GC_DEBUG=1 -DNDEBUG" ); 
    7676 
    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  
    8877    # TT #405 
    8978    if ($conf->data->get('cpuarch') eq 'amd64') { 
    9079        $conf->data->set('optimize::src/gc/system.c',''); 
  • config/auto/cgoto.pm

     
    1 # Copyright (C) 2001-2005, Parrot Foundation. 
    2 # $Id$ 
    3  
    4 =head1 NAME 
    5  
    6 config/auto/cgoto.pm - Computed C<goto> 
    7  
    8 =head1 DESCRIPTION 
    9  
    10 Determines whether the compiler supports computed C<goto>. 
    11  
    12 =cut 
    13  
    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: cperl 
    79 #   cperl-indent-level: 4 
    80 #   fill-column: 100 
    81 # End: 
    82 # vim: expandtab shiftwidth=4: 
  • config/gen/makefiles/dynpmc.in

     
    1414LD            = @ld@ 
    1515LDFLAGS       = @ldflags@ @ld_debug@ @rpath_blib@ 
    1616LD_LOAD_FLAGS = @ld_load_flags@ 
    17 CFLAGS        = @ccflags@ @cc_shared@ @cc_debug@ @ccwarn@ @cc_hasjit@ @cg_flag@ @gc_flag@ @optimize@ 
     17CFLAGS        = @ccflags@ @cc_shared@ @cc_debug@ @ccwarn@ @cc_hasjit@ @gc_flag@ @optimize@ 
    1818LIBPARROT     = @libparrot_ldflags@ 
    1919 
    2020BUILD_TOOLS_DIR = $(BUILD_DIR)/tools/build 
  • config/gen/makefiles/root.in

     
    8484CC_SHARED        = @cc_shared@ 
    8585CC_O_OUT         = @cc_o_out@ 
    8686CC_WARN          = @ccwarn@ 
    87 CFLAGS           = $(CC_INC) @ccflags@ @cc_build_call_frames@ @cc_debug@ @cg_flag@ @gc_flag@ @clock_best@ $(CC_SHARED) 
     87CFLAGS           = $(CC_INC) @ccflags@ @cc_build_call_frames@ @cc_debug@ @gc_flag@ @clock_best@ $(CC_SHARED) 
    8888LINK_DYNAMIC     = @link_dynamic@ 
    8989LINK             = @link@ 
    9090LINKFLAGS        = @linkflags@ @link_debug@ @ld_debug@ 
     
    170170    parrot.pc \ 
    171171    compilers/imcc/imcc.y.flag \ 
    172172    compilers/imcc/imcc.l.flag \ 
    173     src/ops/core_ops.c \ 
    174     src/ops/core_ops_switch.c 
     173    src/ops/core_ops.c 
    175174 
    176175GEN_PASM_INCLUDES = \ 
    177176        runtime/parrot/include/cclass.pasm \ 
     
    237236    $(INC_DIR)/vtable.h \ 
    238237    $(INC_DIR)/oplib/core_ops.h \ 
    239238    $(INC_DIR)/oplib/ops.h \ 
    240     $(INC_DIR)/oplib/core_ops_switch.h \ 
    241239    $(INC_DIR)/extend_vtable.h \ 
    242240    $(INC_DIR)/pbcversion.h 
    243241 
     
    245243    src/core_ops.c \ 
    246244    src/nci.c \ 
    247245    src/glut_nci_thunks.c \ 
    248     src/core_ops_switch.c \ 
    249246    src/parrot_config.c \ 
    250247    src/null_config.c \ 
    251248    src/install_config.c \ 
     
    409406 
    410407# generated list of header files 
    411408GENERAL_H_FILES   = $(NONGEN_HEADERS) $(GEN_HEADERS) \ 
    412 #IF(cg_flag): $(INC_DIR)/oplib/core_ops_cg.h $(INC_DIR)/oplib/core_ops_cgp.h 
    413409 
    414410 
    415411CHARSET_O_FILES   = @TEMP_charset_o@ 
     
    433429 
    434430INTERP_O_FILES = \ 
    435431    src/string/api$(O) \ 
    436     \ 
    437432    src/ops/core_ops$(O) \ 
    438     src/ops/core_ops_switch$(O) \ 
    439     \ 
    440433#IF(i386_has_gcc_cmpxchg):    src/atomic/gcc_x86$(O) \ 
    441434    src/byteorder$(O) \ 
    442435    src/string/charset$(O) \ 
     
    500493    @TEMP_atomic_o@ \ 
    501494    @TEMP_gc_o@ \ 
    502495#IF(platform_asm):    src/platform_asm$(O) \ 
    503 #IF(cg_flag):     src/ops/core_ops_cg$(O) src/ops/core_ops_cgp$(O) \ 
    504496 
    505497 
    506498OPS_FILES = @ops@ $(GEN_OPSFILES) 
     
    13131305        src/runcore/main.str \ 
    13141306        include/pmc/pmc_parrotlibrary.h \ 
    13151307        $(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 \ 
    13171309        $(PARROT_H_HEADERS) $(INC_DIR)/runcore_api.h \ 
    13181310        $(INC_DIR)/runcore_profiling.h 
    13191311 
     
    14181410src/runcore/cores$(O) : src/runcore/cores.str \ 
    14191411        include/pmc/pmc_sub.h \ 
    14201412        $(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 \ 
    14221414        $(INC_DIR)/runcore_api.h $(INC_DIR)/runcore_trace.h \ 
    14231415        $(PARROT_H_HEADERS) 
    14241416 
     
    15281520        include/pmc/pmc_continuation.h 
    15291521        $(PERL) $(BUILD_TOOLS_DIR)/ops2c.pl C --core @no_lines_flag@ 
    15301522 
    1531 ## SUFFIX OVERRIDE 
    1532 src/ops/core_ops_switch$(O) : $(GENERAL_H_FILES) src/ops/core_ops_switch.c \ 
    1533         include/pmc/pmc_parrotlibrary.h 
    1534         $(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.c 
    1535  
    1536 $(INC_DIR)/oplib/core_ops_switch.h : src/ops/core_ops_switch.c 
    1537  
    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.pm 
    1542         $(PERL) $(BUILD_TOOLS_DIR)/ops2c.pl CSwitch --core @no_lines_flag@ 
    1543  
    1544 ## SUFFIX OVERRIDE 
    1545 src/ops/core_ops_cg$(O): $(GENERAL_H_FILES) src/ops/core_ops_cg.c \ 
    1546         include/pmc/pmc_parrotlibrary.h 
    1547         $(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.c 
    1548  
    1549 ## SUFFIX OVERRIDE 
    1550 src/ops/core_ops_cgp$(O): $(GENERAL_H_FILES) src/ops/core_ops_cgp.c \ 
    1551         include/pmc/pmc_parrotlibrary.h 
    1552         $(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.c 
    1553  
    1554 src/runcore/cores.c: $(INC_DIR)/oplib/core_ops_cgp.h 
    1555  
    1556 $(INC_DIR)/oplib/core_ops_cg.h: src/ops/core_ops_cg.c 
    1557  
    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.pm 
    1559         $(PERL) $(BUILD_TOOLS_DIR)/ops2c.pl CGoto --core 
    1560  
    1561 $(INC_DIR)/oplib/core_ops_cgp.h: src/ops/core_ops_cgp.c 
    1562  
    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.pm 
    1564         $(PERL) $(BUILD_TOOLS_DIR)/ops2c.pl CGP --core 
    1565  
    15661523@TEMP_gc_c@ 
    15671524 
    15681525@TEMP_pmc_build@ 
     
    17461703check : test 
    17471704 
    17481705# Test various run cores and other stuff 
    1749 # 'testC', 'testg' and 'testj' are tested only 
     1706# 'testg' and 'testj' are tested only 
    17501707# when the needed runcores are available 
    17511708fulltest : 
    17521709        -@make@ testb \ 
    1753 #IF(cg_flag):   testC \ 
    17541710        testf \ 
    1755 #IF(cg_flag):   testg \ 
    17561711        testr \ 
    1757         testS \ 
    17581712        src_tests \ 
    17591713        run_tests \ 
    17601714        buildtools_tests \ 
     
    17711725testb : test_prep 
    17721726        $(PERL) t/harness $(EXTRA_TEST_ARGS) -b $(RUNCORE_TEST_FILES) 
    17731727 
    1774 # CGP core 
    1775 testC : test_prep 
    1776         $(PERL) t/harness $(EXTRA_TEST_ARGS) -C $(RUNCORE_TEST_FILES) 
    1777  
    17781728# fast core 
    17791729testf : test_prep 
    17801730        $(PERL) t/harness $(EXTRA_TEST_ARGS) -f $(RUNCORE_TEST_FILES) 
     
    17951745testr : test_prep 
    17961746        $(PERL) t/harness $(EXTRA_TEST_ARGS) -r $(RUNCORE_TEST_FILES) 
    17971747 
    1798 # switched core 
    1799 testS : test_prep 
    1800         $(PERL) t/harness $(EXTRA_TEST_ARGS) -S $(RUNCORE_TEST_FILES) 
    1801  
    1802 # Computed goto jitted core - target retained, but falls back to standard core 
    1803 testCj : test_prep 
    1804         $(PERL) t/harness $(EXTRA_TEST_ARGS) $(RUNCORE_TEST_FILES) 
    1805  
    1806 # switched jitted core - target retained, but falls back to standard core 
    1807 testSj : test_prep 
    1808         $(PERL) t/harness $(EXTRA_TEST_ARGS) $(RUNCORE_TEST_FILES) 
    1809  
    18101748# test the EXEC stuff 
    18111749testexec: test_prep 
    18121750        $(PERL) t/harness $(EXTRA_TEST_ARGS) --run-exec $(RUNCORE_TEST_FILES) 
     
    18811819#UNLESS(win32):    cover-clean \ 
    18821820    editor-clean 
    18831821        $(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.c 
    18851822        $(RM_F) chartypes "*.s" "*~" 
    18861823        $(RM_F) $(FLUID_FILES_1) 
    18871824        $(RM_F) $(FLUID_FILES_2) 
     
    23312268cover: \ 
    23322269    cover.dummy \ 
    23332270    cover-testb \ 
    2334 #IF(cg_flag):    cover-testC \ 
    23352271    cover-testf \ 
    2336 #IF(cg_flag):    cover-testg \ 
    23372272    cover-testr \ 
    2338     cover-testS \ 
    23392273    cover-src \ 
    23402274    cover-run \ 
    23412275    cover-perl \ 
     
    23632297cover-testb: cover.dummy 
    23642298        -@make@ testb 
    23652299 
    2366 cover-testC: cover.dummy 
    2367         -@make@ testC 
    2368  
    23692300cover-testf: cover.dummy 
    23702301        -@make@ testf 
    23712302 
     
    23782309cover-testr: cover.dummy 
    23792310        -@make@ testr 
    23802311 
    2381 cover-testS: cover.dummy 
    2382         -@make@ testS 
    2383  
    23842312cover-src: cover.dummy 
    23852313        -@make@ src_tests 
    23862314 
  • config/gen/config_h/config_h.in

     
    152152/* Oplib and dynamic ops related. */ 
    153153#define PARROT_CORE_OPLIB_NAME "core" 
    154154#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@ 
    159155 
    160156/* ICU. */ 
    161157#define PARROT_HAS_ICU @has_icu@ 
  • examples/sdl/mandel.pir

     
    556556Optimized build 
    557557 
    558558  [2] plain  runcore 64 bit                  3.0s 
    559   [2] -R cgp runcore 64 bit                  1.5s 
    560559  [2] plain  runcore 32 bit                  3.6s 
    561   [2] -R cgp runcore 32 bit                  1.6s 
    562560  [1] -R jit                                 1.1s 
    563561  [2] -R jit                                 0.8s 
    564562  [3] -R jit                                 0.5s 
  • examples/c/test_main.c

     
    209209static void 
    210210usage(void) 
    211211{ 
    212 #ifdef HAVE_COMPUTED_GOTO 
    213     const char* cgoto_info = "Deactivate computed goto"; 
    214 #else 
    215     const char* cgoto_info = 
    216         "Deactivate computed goto (not available on this platform)"; 
    217 #endif 
    218  
    219212    fprintf(stderr, 
    220213"Usage: parrot [switches] [--] programfile [arguments]\n\ 
    221214  -b  --bounds-checks           Activate bounds checks\n\ 
     
    223216  -h  --help                    Display this message\n\ 
    224217  -j  --jit                     Activate Just-In-Time compiler\n\ 
    225218  -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\ 
    229219  -t  --trace                   Activate tracing\n\ 
    230220  -v  --version                 Display version information\n\ 
    231221  -.  --wait                    Wait for a keypress (gives Windows users\n\ 
     
    233223      --gc-debug\n\ 
    234224        Enable garbage collection debugging mode. This may also be enabled\n\ 
    235225        by setting the environment variable $PARROT_GC_DEBUG to 1.\n\ 
    236 \n", 
    237             cgoto_info); 
     226\n"); 
    238227 
    239228    Parrot_exit(interp, 0); 
    240229} 
  • examples/shootout/binarytrees.pir

     
    1 #!./parrot -R cgp 
     1#!./parrot 
    22# Copyright (C) 2005-2009, Parrot Foundation. 
    33# $Id$ 
    44# 
  • examples/shootout/fasta.pir

     
    1 #!./parrot -R cgp 
     1#!./parrot 
    22# Copyright (C) 2005-2009, Parrot Foundation. 
    33# $Id$ 
    44# 
  • examples/shootout/partialsums.pir

     
    1 #!./parrot -R cgp 
     1#!./parrot 
    22# Copyright (C) 2006-2009, Parrot Foundation. 
    33# $Id$ 
    44# 
  • examples/shootout/takfp.pir

     
    1 #!./parrot -R cgp 
     1#!./parrot 
    22# Copyright (C) 2005-2009, Parrot Foundation. 
    33# $Id$ 
    44# 
    5 # ./parrot -R cgp takfp.pir N         (N = 10 for shootout) 
     5# ./parrot takfp.pir N         (N = 10 for shootout) 
    66# by Joshua Isom 
    77# changed default value to N=7 (shootout default before being deprecated) 
    88# anyway N=10 froze my laptop. Karl Forner 
  • examples/shootout/recursive-2.pir

     
    66# Fib and Tak by Joshua Isom 
    77 
    88# use less registers (leo) 
    9 # time ./parrot -Oc -R cgp-jit recursive-2.pir 11 
     9# time ./parrot -Oc recursive-2.pir 11 
    1010# real 2.32 s   (AMD X2@2000) 
    1111# modified default value to n=3. Karl Forner 
    1212 
  • examples/shootout/recursive.pir

     
    55# Ack by Leopold Toetsch 
    66# Fib and Tak by Joshua Isom 
    77# modified default value to n=3. Karl Forner 
    8 # ./parrot -Oc -R cgp-jit recursive.pir N 
     8# ./parrot -Oc recursive.pir N 
    99 
    1010.sub main :main 
    1111        .param pmc argv 
  • examples/shootout/pidigits.pir

     
    1 #!./parrot -R cgp 
     1#!./parrot 
    22# Copyright (C) 2005-2009, Parrot Foundation. 
    33# $Id$ 
    44# 
  • examples/shootout/ack.pir

     
    33# $Id$ 
    44# OUTPUT="Ack(3, 9) = 4093\n" 
    55# 
    6 # ./parrot -Oc -R cgp-jit 
     6# ./parrot -Oc 
    77# RQ (Karl) 
    88# Seems to be an old benchmark, now deprecated by the shootout 
    99# 
  • examples/shootout/random.pir

     
    1 #!./parrot -R cgp 
     1#!./parrot 
    22# Copyright (C) 2005-2009, Parrot Foundation. 
    33# $Id$ 
    44# 
  • examples/config/file/configcompiler

     
    5050auto::jit 
    5151auto::cpu 
    5252auto::funcptr 
    53 auto::cgoto 
    5453auto::inline 
    5554auto::gc 
    5655auto::memalign 
  • examples/config/file/configwithfatalstep

     
    4242auto::jit 
    4343auto::cpu 
    4444auto::funcptr 
    45 auto::cgoto 
    4645auto::inline 
    4746auto::gc 
    4847auto::memalign 
  • examples/embed/cotorra.c

     
    108108{ 
    109109    static const struct runcoreinfo cores [] = { 
    110110        { PARROT_SLOW_CORE,     "slow" }, 
    111         { PARROT_FAST_CORE,     "fast" }, 
    112         { PARROT_CGOTO_CORE,    "cgoto" }, 
    113111        { PARROT_GC_DEBUG_CORE, "gcdebug" }, 
    114         { PARROT_SWITCH_CORE,   "switch" } 
    115112    }; 
    116113    static const unsigned int n = sizeof (cores)/sizeof (struct runcoreinfo); 
    117114    unsigned int i; 
  • examples/benchmarks/oo1.pir

     
    1111# python oo1.py                 1.2 (first time) 
    1212# python oo1.py                 0.51 
    1313 
    14 # parrot -R cgp oo1.pasm            -g           -O3 
    15  
    1614# original list fixed           4.9     (leaks mem ~ 110 M used) 
    1715# don't clone vtable            4.4 
    1816# Dan's vtable cache            4.3           3.8 
     
    3129# Dan's new object layout                     1.00 
    3230 
    3331 
    34 # parrot -R cgp oo1-prop.pasm 
    35 #   invokecc                                  0.75 
    36 #   RetCont out of loop                       0.57 
    3732# parrot -R jit oo1-prop.pasm                     0.54 
    3833 
    3934.namespace [ "Foo" ] 
  • examples/benchmarks/oo2.pir

     
    1111# python oo2.py                               2.9 (first time) 
    1212# python oo2.py                               2.4 
    1313 
    14 # parrot -R cgp oo2.pasm            -g           -O3 
    15 #   with reuse regsave mem                    6.15 
    16 # anchor P1                                   6.7 
    17 # Dan's new object layout                     5.1 
    18  
    1914# parrot -R jit oo2.pasm            -g           -O3 
    2015#   with reuse regsave mem                    6.1 
    2116# anchor P1                                   6.5 
    2217# Dan's new object layout                     4.9 
    2318 
    24 # parrot -R cgp oo2-prop.pasm                     2.8 
    2519# parrot -R jit oo2-prop.pasm                     2.6 
    2620 
    2721.namespace [ "Foo" ]