Skip to content

Commit

Permalink
The compreg hash is autovivified in the Parrot_interp_set_compiler fu…
Browse files Browse the repository at this point in the history
…nction. Make sure we use that function (and Parrot_interp_get_compiler) for accessing the compreg hash in the compreg_s_p and compreg_p_s ops for cases where the only compiler get/set operations are done from the pbc level. brrt++ for the find.
  • Loading branch information
Whiteknight committed Jun 2, 2012
1 parent db9fc12 commit 22d7d59
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
8 changes: 2 additions & 6 deletions src/ops/core.ops
Original file line number Diff line number Diff line change
Expand Up @@ -1409,15 +1409,11 @@ op dlvar(out PMC, invar PMC, in STR) {
}

inline op compreg(in STR, invar PMC) {
PMC * const compreg_hash = VTABLE_get_pmc_keyed_int(interp,
interp->iglobals, IGLOBALS_COMPREG_HASH);
VTABLE_set_pmc_keyed_str(interp, compreg_hash, $1, $2);
Parrot_interp_set_compiler(interp, $1, $2);
}

inline op compreg(out PMC, in STR) {
PMC * const compreg_hash = VTABLE_get_pmc_keyed_int(interp,
interp->iglobals, IGLOBALS_COMPREG_HASH);
$1 = VTABLE_get_pmc_keyed_str(interp, compreg_hash, $2);
$1 = Parrot_interp_get_compiler(interp, $2);
}

op new_callback(out PMC, invar PMC, invar PMC, in STR) {
Expand Down
16 changes: 4 additions & 12 deletions src/ops/core_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -14949,34 +14949,26 @@ Parrot_dlvar_p_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {

opcode_t *
Parrot_compreg_s_p(opcode_t *cur_opcode, PARROT_INTERP) {
PMC * const compreg_hash = VTABLE_get_pmc_keyed_int(interp, interp->iglobals, IGLOBALS_COMPREG_HASH);

VTABLE_set_pmc_keyed_str(interp, compreg_hash, SREG(1), PREG(2));
Parrot_interp_set_compiler(interp, SREG(1), PREG(2));
return cur_opcode + 3;
}

opcode_t *
Parrot_compreg_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
PMC * const compreg_hash = VTABLE_get_pmc_keyed_int(interp, interp->iglobals, IGLOBALS_COMPREG_HASH);

VTABLE_set_pmc_keyed_str(interp, compreg_hash, SCONST(1), PREG(2));
Parrot_interp_set_compiler(interp, SCONST(1), PREG(2));
return cur_opcode + 3;
}

opcode_t *
Parrot_compreg_p_s(opcode_t *cur_opcode, PARROT_INTERP) {
PMC * const compreg_hash = VTABLE_get_pmc_keyed_int(interp, interp->iglobals, IGLOBALS_COMPREG_HASH);

PREG(1) = VTABLE_get_pmc_keyed_str(interp, compreg_hash, SREG(2));
PREG(1) = Parrot_interp_get_compiler(interp, SREG(2));
PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp));
return cur_opcode + 3;
}

opcode_t *
Parrot_compreg_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
PMC * const compreg_hash = VTABLE_get_pmc_keyed_int(interp, interp->iglobals, IGLOBALS_COMPREG_HASH);

PREG(1) = VTABLE_get_pmc_keyed_str(interp, compreg_hash, SCONST(2));
PREG(1) = Parrot_interp_get_compiler(interp, SCONST(2));
PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp));
return cur_opcode + 3;
}
Expand Down

0 comments on commit 22d7d59

Please sign in to comment.