[macruby-changes] [2529] MacRuby/trunk

source_changes at macosforge.org source_changes at macosforge.org
Wed Sep 9 18:10:22 PDT 2009


Revision: 2529
          http://trac.macosforge.org/projects/ruby/changeset/2529
Author:   lsansonetti at apple.com
Date:     2009-09-09 18:10:17 -0700 (Wed, 09 Sep 2009)
Log Message:
-----------
adding missing write barriers

Modified Paths:
--------------
    MacRuby/trunk/marshal.c
    MacRuby/trunk/st.c

Modified: MacRuby/trunk/marshal.c
===================================================================
--- MacRuby/trunk/marshal.c	2009-09-09 18:01:51 UTC (rev 2528)
+++ MacRuby/trunk/marshal.c	2009-09-10 01:10:17 UTC (rev 2529)
@@ -1844,10 +1844,9 @@
     rb_define_const(rb_mMarshal, "MINOR_VERSION", INT2FIX(MARSHAL_MINOR));
 
     compat_allocator_tbl = st_init_numtable();
-    rb_gc_register_address(&compat_allocator_tbl_wrapper);
     compat_allocator_tbl_wrapper =
 	Data_Wrap_Struct(rb_cData, mark_marshal_compat_t, 0, compat_allocator_tbl);
-    rb_objc_retain((void *)compat_allocator_tbl_wrapper);
+    GC_RETAIN(compat_allocator_tbl_wrapper);
 }
 
 VALUE

Modified: MacRuby/trunk/st.c
===================================================================
--- MacRuby/trunk/st.c	2009-09-09 18:01:51 UTC (rev 2528)
+++ MacRuby/trunk/st.c	2009-09-10 01:10:17 UTC (rev 2529)
@@ -346,14 +346,16 @@
     entry->hash = hash_val;\
     entry->key = key;\
     GC_WB(&entry->record, value); \
-    entry->next = table->bins[bin_pos];\
+    GC_WB(&entry->next, table->bins[bin_pos]);\
     if ((head = table->head) != 0) {\
-	entry->fore = head;\
+	GC_WB(&entry->fore, head);\
 	(entry->back = head->back)->fore = entry;\
-	head->back = entry;\
+	GC_WB(&head->back, entry);\
     }\
     else {\
-	table->head = entry->fore = entry->back = entry;\
+	GC_WB(&table->head, entry);\
+	GC_WB(&entry->fore, entry);\
+	GC_WB(&entry->back, entry);\
     }\
     GC_WB(&table->bins[bin_pos], entry); \
     table->num_entries++;\
@@ -391,7 +393,7 @@
         }
         if ((table->num_entries+1) * 2 <= table->num_bins && table->num_entries+1 <= MAX_PACKED_NUMHASH) {
             i = table->num_entries++;
-            table->bins[i*2] = (struct st_table_entry*)key;
+            GC_WB(&table->bins[i*2], (struct st_table_entry*)key);
 	    GC_WB(&table->bins[i*2+1], (struct st_table_entry*)value);
             return 0;
         }
@@ -500,12 +502,13 @@
 	    entry->next = new_table->bins[hash_val];
 	    GC_WB(&new_table->bins[hash_val], entry);
 	    entry->back = prev;
-	    *tail = prev = entry;
+	    prev = entry;
+	    GC_WB(tail, entry);
 	    tail = &entry->fore;
 	} while ((ptr = ptr->fore) != old_table->head);
 	entry = new_table->head;
 	entry->back = prev;
-	*tail = entry;
+	GC_WB(tail, entry);
     }
 
     return new_table;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090909/422e06cb/attachment.html>


More information about the macruby-changes mailing list