[macruby-changes] [4122] MacRuby/trunk/vm.cpp
source_changes at macosforge.org
source_changes at macosforge.org
Tue May 18 13:48:35 PDT 2010
Revision: 4122
http://trac.macosforge.org/projects/ruby/changeset/4122
Author: lsansonetti at apple.com
Date: 2010-05-18 13:48:33 -0700 (Tue, 18 May 2010)
Log Message:
-----------
fixed a bug in the ivar get primitive, better debug logging
Modified Paths:
--------------
MacRuby/trunk/vm.cpp
Modified: MacRuby/trunk/vm.cpp
===================================================================
--- MacRuby/trunk/vm.cpp 2010-05-18 19:29:05 UTC (rev 4121)
+++ MacRuby/trunk/vm.cpp 2010-05-18 20:48:33 UTC (rev 4122)
@@ -1458,26 +1458,22 @@
VALUE
rb_vm_ivar_get(VALUE obj, ID name, struct icache *cache)
{
-#if ROXOR_VM_DEBUG
- printf("get ivar <%s %p>.%s cache klass %p slot %d\n",
- class_getName((Class)CLASS_OF(obj)), (void *)obj,
- rb_id2name(name), (void *)cache->klass, cache->slot);
-#endif
-
VALUE klass = CLASS_OF(obj);
if (LIKELY(klass == cache->klass)) {
use_slot:
- VALUE val = Qundef;
if ((unsigned int)cache->slot < ROBJECT(obj)->num_slots) {
rb_object_ivar_slot_t *slot = &ROBJECT(obj)->slots[cache->slot];
if (slot->name == name) {
- val = slot->value;
+#if ROXOR_VM_DEBUG
+ printf("get ivar <%s %p> %s slot %d -> %p\n",
+ class_getName((Class)CLASS_OF(obj)), (void *)obj,
+ rb_id2name(name), cache->slot, (void *)slot->value);
+#endif
+ VALUE val = slot->value;
+ return val == Qundef ? Qnil : val;
}
- else {
- goto recache;
- }
}
- return val == Qundef ? Qnil : val;
+ goto recache;
}
else {
goto recache;
@@ -1496,6 +1492,10 @@
}
assert(cache->slot == SLOT_CACHE_CANNOT);
+#if ROXOR_VM_DEBUG
+ printf("get ivar <%s %p> %s without slot\n",
+ class_getName((Class)CLASS_OF(obj)), (void *)obj, rb_id2name(name));
+#endif
return rb_ivar_get(obj, name);
}
@@ -1504,13 +1504,6 @@
rb_vm_ivar_set(VALUE obj, ID name, VALUE val, void *cache_ptr)
{
struct icache *cache = (struct icache *)cache_ptr;
-
-#if ROXOR_VM_DEBUG
- printf("set ivar <%s %p>.%s cache klass %p slot %d val %p\n",
- class_getName((Class)CLASS_OF(obj)), (void *)obj,
- rb_id2name(name), (void *)cache->klass, cache->slot, (void *)val);
-#endif
-
VALUE klass = CLASS_OF(obj);
if (LIKELY(klass == cache->klass)) {
use_slot:
@@ -1520,6 +1513,11 @@
if ((ROBJECT(obj)->basic.flags & FL_FREEZE) == FL_FREEZE) {
rb_error_frozen("object");
}
+#if ROXOR_VM_DEBUG
+ printf("set ivar <%s %p> %s to %p slot %d\n",
+ class_getName((Class)CLASS_OF(obj)), (void *)obj,
+ rb_id2name(name), (void *)val, cache->slot);
+#endif
GC_WB(&slot->value, val);
return;
}
@@ -1542,6 +1540,11 @@
}
assert(cache->slot == SLOT_CACHE_CANNOT);
+#if ROXOR_VM_DEBUG
+ printf("set ivar <%s %p> %s to %p without slot\n",
+ class_getName((Class)CLASS_OF(obj)), (void *)obj,
+ rb_id2name(name), (void *)val);
+#endif
rb_ivar_set(obj, name, val);
}
@@ -5201,6 +5204,15 @@
#endif
+ if (getenv("VM_VERIFY_IR") != NULL) {
+ printf("Verifying IR...\n");
+ if (verifyModule(*RoxorCompiler::module, PrintMessageAction)) {
+ printf("Error during module verification\n");
+ exit(1);
+ }
+ printf("Good!\n");
+ }
+
// XXX: deleting the core is not safe at this point because there might be
// threads still running and trying to unregister.
// delete RoxorCore::shared;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100518/361e640a/attachment-0001.html>
More information about the macruby-changes
mailing list