Permalink
Browse files

Corret nested SC write barrier enable/disable.

Unbusts the Rakudo build on latest NQP.
  • Loading branch information...
jnthn committed Feb 9, 2013
1 parent 61f7268 commit afaf87d1096406067fb33820cdfd3496259570c1
Showing with 7 additions and 6 deletions.
  1. +7 −6 src/ops/nqp.ops
View
@@ -61,12 +61,13 @@ static PMC *nfa_nextst = NULL;
* 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;
+/* Disables the SC write barrier temporarily. Zero is enabled, otherwise it's the
+ * number of nested enable/disable we are in. */
+INTVAL sc_write_barrier_off_depth = 0;
/* SC write barrier for objects. */
static void SC_write_barrier_obj(PARROT_INTERP, PMC *obj) {
- if (!sc_write_barrier_off && VTABLE_get_bool(interp, compiling_scs)) {
+ if (!sc_write_barrier_off_depth && 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);
@@ -79,7 +80,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 (!sc_write_barrier_off && VTABLE_get_bool(interp, compiling_scs)) {
+ if (!sc_write_barrier_off_depth && 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);
@@ -2012,11 +2013,11 @@ Enables the SC write barrier.
*/
inline op nqp_disable_sc_write_barrier() :base_core {
- sc_write_barrier_off = 1;
+ sc_write_barrier_off_depth++;
}
inline op nqp_enable_sc_write_barrier() :base_core {
- sc_write_barrier_off = 0;
+ sc_write_barrier_off_depth--;
}
/*

0 comments on commit afaf87d

Please sign in to comment.