Skip to content

Commit

Permalink
eliminate Parrot_run_native, enternative, and run_native (old embed A…
Browse files Browse the repository at this point in the history
…PI, non-reentrant)
  • Loading branch information
plobsing committed Jan 23, 2011
1 parent ca961cb commit 986fa1b
Show file tree
Hide file tree
Showing 7 changed files with 4,219 additions and 4,309 deletions.
2 changes: 0 additions & 2 deletions include/parrot/interpreter.h
Expand Up @@ -341,8 +341,6 @@ typedef opcode_t *(*native_func_t)(PARROT_INTERP,
opcode_t * cur_opcode,
opcode_t * start_code);

VAR_SCOPE native_func_t run_native;

typedef PMC *(*Parrot_compiler_func_t)(PARROT_INTERP,
const char * program);

Expand Down
1 change: 0 additions & 1 deletion include/parrot/oplib/core_ops.h
Expand Up @@ -37,7 +37,6 @@ op_lib_t *Parrot_DynOp_core_3_0_0(PARROT_INTERP, long init);
opcode_t * Parrot_local_return_p(opcode_t *, PARROT_INTERP);
opcode_t * Parrot_jump_i(opcode_t *, PARROT_INTERP);
opcode_t * Parrot_jump_ic(opcode_t *, PARROT_INTERP);
opcode_t * Parrot_enternative(opcode_t *, PARROT_INTERP);
opcode_t * Parrot_if_i_ic(opcode_t *, PARROT_INTERP);
opcode_t * Parrot_if_n_ic(opcode_t *, PARROT_INTERP);
opcode_t * Parrot_if_s_ic(opcode_t *, PARROT_INTERP);
Expand Down
2,109 changes: 1,054 additions & 1,055 deletions include/parrot/oplib/ops.h

Large diffs are not rendered by default.

2,109 changes: 1,054 additions & 1,055 deletions include/parrot/opsenum.h

Large diffs are not rendered by default.

50 changes: 0 additions & 50 deletions src/embed.c
Expand Up @@ -885,56 +885,6 @@ Parrot_disassemble(PARROT_INTERP,
}


/*
=item C<void Parrot_run_native(PARROT_INTERP, native_func_t func)>
Runs the C function C<func> through the program C<[enternative, end]>. This
ensures that the function runs with the same setup as in other run loops.
This function is used in some of the source tests in F<t/src> which use
the interpreter outside a runloop.
=cut
*/

PARROT_EXPORT
void
Parrot_run_native(PARROT_INTERP, native_func_t func)
{
ASSERT_ARGS(Parrot_run_native)
op_lib_t *core_ops = PARROT_GET_CORE_OPLIB(interp);
PackFile * const pf = PackFile_new(interp, 0);
static opcode_t program_code[2] = {
0, /* enternative */
1 /* end */
};

static op_func_t op_func_table[2];
op_func_table[0] = core_ops->op_func_table[PARROT_OP_enternative];
op_func_table[1] = core_ops->op_func_table[PARROT_OP_end];


pf->cur_cs = (PackFile_ByteCode *)
(pf->PackFuncs[PF_BYTEC_SEG].new_seg)(interp, pf,
Parrot_str_new_constant(interp, "code"), 1);
pf->cur_cs->base.data = program_code;
pf->cur_cs->base.size = 2;
pf->cur_cs->op_func_table = op_func_table;
/* TODO fill out cur_cs with op_mapping */

Parrot_pf_set_current_packfile(interp, pf);

run_native = func;

if (interp->code && interp->code->const_table)
Parrot_pcc_set_constants(interp, interp->ctx, interp->code->const_table);

runops(interp, interp->resume_offset);
}


/*
=item C<Parrot_PMC Parrot_compile_string(PARROT_INTERP, Parrot_String type,
Expand Down
14 changes: 0 additions & 14 deletions src/ops/core.ops
Expand Up @@ -224,20 +224,6 @@ inline op jump(in LABEL) :base_loop :flow {
goto ADDRESS(loc);
}

########################################

=item B<enternative>()

Internal opcode used to jump from normal bytecode into a JITted version.

=cut

op enternative() :flow {
opcode_t * const addr = run_native(interp, CUR_OPCODE,
interp->code->base.data);
goto ADDRESS(addr);
}

=back

=cut
Expand Down
4,243 changes: 2,111 additions & 2,132 deletions src/ops/core_ops.c

Large diffs are not rendered by default.

0 comments on commit 986fa1b

Please sign in to comment.