[macruby-changes] [1040] MacRuby/branches/experimental

source_changes at macosforge.org source_changes at macosforge.org
Fri Mar 20 21:16:13 PDT 2009


Revision: 1040
          http://trac.macosforge.org/projects/ruby/changeset/1040
Author:   lsansonetti at apple.com
Date:     2009-03-20 21:16:12 -0700 (Fri, 20 Mar 2009)
Log Message:
-----------
fixed another bug in robject slots regrowth + added a test case

Modified Paths:
--------------
    MacRuby/branches/experimental/roxor.h
    MacRuby/branches/experimental/test_roxor.rb

Modified: MacRuby/branches/experimental/roxor.h
===================================================================
--- MacRuby/branches/experimental/roxor.h	2009-03-21 03:10:17 UTC (rev 1039)
+++ MacRuby/branches/experimental/roxor.h	2009-03-21 04:16:12 UTC (rev 1040)
@@ -41,13 +41,13 @@
 	GC_WB(&obj->slots, new_slots);
     }
 #else
-    VALUE *new_slots = (VALUE *)xmalloc(sizeof(VALUE) * new_num_slot);
-    for (i = 0; i < obj->num_slots; i++) {
+    VALUE *new_slots = (VALUE *)xmalloc(sizeof(VALUE) * (new_num_slot + 1));
+    for (i = 0; i <= obj->num_slots; i++) {
 	GC_WB(&new_slots[i], obj->slots[i]);
     }
     GC_WB(&obj->slots, new_slots);
 #endif
-    for (i = obj->num_slots; i < new_num_slot; i++) {
+    for (i = obj->num_slots + 1; i < new_num_slot; i++) {
 	obj->slots[i] = Qundef;
     }
     obj->num_slots = new_num_slot;
@@ -72,7 +72,7 @@
     if (robj->num_slots < (unsigned int)slot) {
 	rb_vm_regrow_robject_slots(robj, (unsigned int)slot);
     }
-    robj->slots[slot] = val;
+    GC_WB(&robj->slots[slot], val);
 }
 
 typedef struct {

Modified: MacRuby/branches/experimental/test_roxor.rb
===================================================================
--- MacRuby/branches/experimental/test_roxor.rb	2009-03-21 03:10:17 UTC (rev 1039)
+++ MacRuby/branches/experimental/test_roxor.rb	2009-03-21 04:16:12 UTC (rev 1040)
@@ -1050,6 +1050,27 @@
     p Foo.foo
   }
 
+  assert '231', %q{
+    class Foo
+      def initialize
+        @v1 = 1;   @v2 = 2;   @v3 = 3
+        @v4 = 4;   @v5 = 5;   @v6 = 6
+        @v7 = 7;   @v8 = 8;   @v9 = 9
+        @v10 = 10; @v11 = 11; @v12 = 12
+        @v13 = 13; @v14 = 14; @v15 = 15
+        @v16 = 16; @v17 = 17; @v18 = 18
+        @v19 = 19; @v20 = 20; @v21 = 21
+      end
+      def foo
+        @v1 + @v2 + @v3 + @v4 + @v5 + @v6 +
+        @v7 + @v8 + @v9 + @v10 + @v11 + @v12 +
+        @v13 + @v14 + @v15 + @v16 + @v17 + @v18 +
+        @v19 + @v20 + @v21
+      end
+    end
+    p Foo.new.foo
+  }
+
 end
 
 =begin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090320/35dbc946/attachment-0001.html>


More information about the macruby-changes mailing list