Skip to content

Commit

Permalink
Add ops for temporarily enabling/disabling the SCWB.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Apr 20, 2012
1 parent ba5c237 commit 2be3071
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions src/ops/nqp.ops
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,12 @@ static INTVAL nqpdebflags_i = 0;
* may have multiple on the go due to compiling nested module dependencies. */
PMC *compiling_scs = NULL;

/* Flag we can use to disable the SC write barrier temporarily. */
INTVAL sc_write_barrier_off = 0;

/* SC write barrier for objects. */
static void SC_write_barrier_obj(PARROT_INTERP, PMC *obj) {
if (VTABLE_get_bool(interp, compiling_scs)) {
if (!sc_write_barrier_off && VTABLE_get_bool(interp, compiling_scs)) {
PMC *comp_sc = VTABLE_get_pmc_keyed_int(interp, compiling_scs, 0);
if (SC_PMC(obj) != comp_sc) {
SC_repossess_object(interp, comp_sc, SC_PMC(obj), obj);
Expand All @@ -58,7 +61,7 @@ static void SC_write_barrier_obj(PARROT_INTERP, PMC *obj) {

/* SC write barrier for STables. */
static void SC_write_barrier_st(PARROT_INTERP, STable *st) {
if (VTABLE_get_bool(interp, compiling_scs)) {
if (!sc_write_barrier_off && VTABLE_get_bool(interp, compiling_scs)) {
PMC *comp_sc = VTABLE_get_pmc_keyed_int(interp, compiling_scs, 0);
if (st->sc != comp_sc) {
SC_repossess_stable(interp, comp_sc, st->sc, st->stable_pmc);
Expand Down Expand Up @@ -1715,6 +1718,27 @@ inline op nqp_pop_compiling_sc() :base_core {
}


/*

=item nqp_disable_sc_write_barrier

Disables the SC write barrier.

=item nqp_enable_sc_write_barrier

Enables the SC write barrier.

=cut

*/
inline op nqp_disable_sc_write_barrier() :base_core {
sc_write_barrier_off = 1;
}

inline op nqp_enable_sc_write_barrier() :base_core {
sc_write_barrier_off = 0;
}

/*

=item nqp_get_package_through_who
Expand Down

0 comments on commit 2be3071

Please sign in to comment.