Permalink
Browse files

Merge pull request #26 from atrodo/master

The new GC needs write barriers for certain ops
  • Loading branch information...
2 parents 1ddda5e + 89da682 commit 1c91ecb6ea6e89944a5156dd97a2514e84bc15c6 Rakudo Perl committed Jul 17, 2011
Showing with 11 additions and 0 deletions.
  1. +11 −0 src/ops/perl6.ops
View
@@ -154,6 +154,9 @@ inline op rebless_subclass(in PMC, in PMC) :base_core {
memmove(value, new_ins, sizeof (PMC));
memmove(new_ins, temp, sizeof (PMC));
+ /* Trigger writebarrier after poking into guts directly */
+ PARROT_GC_WRITE_BARRIER(interp, value);
+
Parrot_unblock_GC_mark(interp);
mem_sys_free(temp);
@@ -171,6 +174,9 @@ inline op rebless_subclass(in PMC, in PMC) :base_core {
"Object to be reblessed does not appear to be of the expected class.");
}
else {
+ /* Block GC before fiddling with C<value> guts to avoid multiple WBs */
+ Parrot_block_GC_mark(interp);
+
/* We have a standard Parrot class and object and can tweak it's guts.
* Shuffle up attributes to the point of the difference between the number
* of attributes in the parent and the derived class. Yes, this is evil -
@@ -182,6 +188,11 @@ inline op rebless_subclass(in PMC, in PMC) :base_core {
/* Now switch object's class pointer to point at the new class. This is
* also evil. */
PARROT_OBJECT(value)->_class = $2;
+
+ /* Trigger writebarrier after poking into guts directly */
+ PARROT_GC_WRITE_BARRIER(interp, value);
+
+ Parrot_unblock_GC_mark(interp);
}
goto NEXT();

0 comments on commit 1c91ecb

Please sign in to comment.