void Parrot_runcore_profiling_init(PARROT_INTERP) { ASSERT_ARGS(Parrot_runcore_profiling_init) Parrot_profiling_runcore_t *coredata = mem_gc_allocate_zeroed_typed(interp, Parrot_profiling_runcore_t); coredata->name = CONST_STRING(interp, "profiling"); coredata->id = PARROT_PROFILING_CORE; coredata->opinit = PARROT_CORE_OPLIB_INIT; coredata->runops = (Parrot_runcore_runops_fn_t) init_profiling_core; coredata->destroy = NULL; coredata->prepare_run = NULL; coredata->flags = 0; PARROT_RUNCORE_FUNC_TABLE_SET(coredata); Parrot_runcore_register(interp, (Parrot_runcore_t *) coredata); }
PARROT_EXPORT void new_runloop_jump_point(PARROT_INTERP) { ASSERT_ARGS(new_runloop_jump_point) Parrot_runloop *jump_point; if (interp->runloop_jmp_free_list) { jump_point = interp->runloop_jmp_free_list; interp->runloop_jmp_free_list = jump_point->prev; } else jump_point = mem_gc_allocate_zeroed_typed(interp, Parrot_runloop); jump_point->prev = interp->current_runloop; jump_point->id = ++runloop_id_counter; interp->current_runloop = jump_point; interp->current_runloop_id = jump_point->id; ++interp->current_runloop_level; }
/* =item C<void Parrot_runcore_slow_init(PARROT_INTERP)> Registers the slow runcore with Parrot. =cut */ void Parrot_runcore_slow_init(PARROT_INTERP) { ASSERT_ARGS(Parrot_runcore_slow_init) Parrot_runcore_t * const coredata = mem_gc_allocate_zeroed_typed(interp, Parrot_runcore_t); coredata->name = CONST_STRING(interp, "slow"); coredata->id = PARROT_SLOW_CORE; coredata->opinit = PARROT_CORE_OPLIB_INIT; coredata->runops = runops_slow_core; coredata->prepare_run = NULL; coredata->destroy = NULL; coredata->flags = 0; PARROT_RUNCORE_FUNC_TABLE_SET(coredata); Parrot_runcore_register(interp, coredata); } /*
PARROT_EXPORT void Parrot_disassemble(PARROT_INTERP, ARGIN_NULLOK(const char *outfile), Parrot_disassemble_options options) { ASSERT_ARGS(Parrot_disassemble) PDB_line_t *line; PDB_t * const pdb = mem_gc_allocate_zeroed_typed(interp, PDB_t); int num_mappings = 0; int curr_mapping = 0; int op_code_seq_num = 0; int debugs; PMC *output; if (outfile != NULL) { output = Parrot_io_open_handle(interp, PMCNULL, Parrot_str_new(interp, outfile, 0), Parrot_str_new_constant(interp, "tw")); } else output = Parrot_io_stdhandle(interp, PIO_STDOUT_FILENO, PMCNULL); interp->pdb = pdb; pdb->cur_opcode = interp->code->base.data; PDB_disassemble(interp, NULL); line = pdb->file->line; debugs = (interp->code->debugs != NULL); print_constant_table(interp, output); if (options & enum_DIS_HEADER) return; if (!(options & enum_DIS_BARE)) Parrot_io_fprintf(interp, output, "# %12s-%12s", "Seq_Op_Num", "Relative-PC"); if (debugs) { if (!(options & enum_DIS_BARE)) Parrot_io_fprintf(interp, output, " %6s:\n", "SrcLn#"); num_mappings = interp->code->debugs->num_mappings; } else { Parrot_io_fprintf(interp, output, "\n"); } while (line->next) { const char *c; /* Parrot_io_fprintf(interp, output, "%i < %i %i == %i \n", curr_mapping, * num_mappings, op_code_seq_num, * interp->code->debugs->mappings[curr_mapping].offset); */ if (debugs && curr_mapping < num_mappings) { if (op_code_seq_num == interp->code->debugs->mappings[curr_mapping].offset) { const int filename_const_offset = interp->code->debugs->mappings[curr_mapping].filename; Parrot_io_fprintf(interp, output, "# Current Source Filename '%Ss'\n", interp->code->const_table->str.constants[filename_const_offset]); ++curr_mapping; } } if (!(options & enum_DIS_BARE)) Parrot_io_fprintf(interp, output, "%012i-%012i", op_code_seq_num, line->opcode - interp->code->base.data); if (debugs && !(options & enum_DIS_BARE)) Parrot_io_fprintf(interp, output, " %06i: ", interp->code->debugs->base.data[op_code_seq_num]); /* If it has a label print it */ if (line->label) Parrot_io_fprintf(interp, output, "L%li:\t", line->label->number); else Parrot_io_fprintf(interp, output, "\t"); c = pdb->file->source + line->source_offset; while (c && *c != '\n') Parrot_io_fprintf(interp, output, "%c", *(c++)); Parrot_io_fprintf(interp, output, "\n"); line = line->next; ++op_code_seq_num; } if (outfile != NULL) Parrot_io_close_handle(interp, output); return; }
=item C<void Parrot_runcore_profiling_init(PARROT_INTERP)> Register the profiling runcore with Parrot. =cut */ void Parrot_runcore_profiling_init(PARROT_INTERP) { ASSERT_ARGS(Parrot_runcore_profiling_init) Parrot_profiling_runcore_t * const coredata = mem_gc_allocate_zeroed_typed(interp, Parrot_profiling_runcore_t); coredata->name = CONST_STRING(interp, "profiling"); coredata->id = PARROT_PROFILING_CORE; coredata->opinit = PARROT_CORE_OPLIB_INIT; coredata->runops = (Parrot_runcore_runops_fn_t) init_profiling_core; coredata->destroy = NULL; coredata->prepare_run = NULL; coredata->flags = 0; PARROT_RUNCORE_FUNC_TABLE_SET(coredata); Parrot_runcore_register(interp, (Parrot_runcore_t *) coredata); }