Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

The new GC needs write barriers for certain ops #26

Merged
merged 1 commit into from almost 3 years ago

3 participants

Jon Gentle Patrick R. Michaud Rakudo Perl
Jon Gentle
atrodo commented July 08, 2011

This is a patch by bacek++ that allows rakudo to build and run on some systems, in particular, my system running the tests for isparrotfastyet.com. Without this, rakudo will not build because of a "dead object found" error. The system is lower memory (512M), which probably exacerbates the problem, but any system could see this error.

Rakudo Perl rakudo merged commit 1c91ecb into from July 17, 2011
Rakudo Perl rakudo closed this July 17, 2011
Patrick R. Michaud
Owner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 11 additions and 0 deletions. Show diff stats Hide diff stats

  1. 11  src/ops/perl6.ops
11  src/ops/perl6.ops
@@ -154,6 +154,9 @@ inline op rebless_subclass(in PMC, in PMC) :base_core {
154 154
         memmove(value, new_ins, sizeof (PMC));
155 155
         memmove(new_ins, temp, sizeof (PMC));
156 156
 
  157
+        /* Trigger writebarrier after poking into guts directly */
  158
+        PARROT_GC_WRITE_BARRIER(interp, value);
  159
+
157 160
         Parrot_unblock_GC_mark(interp);
158 161
         mem_sys_free(temp);
159 162
 
@@ -171,6 +174,9 @@ inline op rebless_subclass(in PMC, in PMC) :base_core {
171 174
             "Object to be reblessed does not appear to be of the expected class.");
172 175
     }
173 176
     else {
  177
+        /* Block GC before fiddling with C<value> guts to avoid multiple WBs */
  178
+        Parrot_block_GC_mark(interp);
  179
+
174 180
         /* We have a standard Parrot class and object and can tweak it's guts.
175 181
          * Shuffle up attributes to the point of the difference between the number
176 182
          * 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 {
182 188
         /* Now switch object's class pointer to point at the new class. This is
183 189
          * also evil. */
184 190
         PARROT_OBJECT(value)->_class = $2;
  191
+
  192
+        /* Trigger writebarrier after poking into guts directly */
  193
+        PARROT_GC_WRITE_BARRIER(interp, value);
  194
+
  195
+        Parrot_unblock_GC_mark(interp);
185 196
     }
186 197
 
187 198
     goto NEXT();
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.