[macruby-changes] [4303] MacRuby/trunk/interpreter.cpp

source_changes at macosforge.org source_changes at macosforge.org
Mon Jun 28 18:09:46 PDT 2010


Revision: 4303
          http://trac.macosforge.org/projects/ruby/changeset/4303
Author:   lsansonetti at apple.com
Date:     2010-06-28 18:09:44 -0700 (Mon, 28 Jun 2010)
Log Message:
-----------
fixed the interpretation of arities in 32-bit mode + misc cleaning

Modified Paths:
--------------
    MacRuby/trunk/interpreter.cpp

Modified: MacRuby/trunk/interpreter.cpp
===================================================================
--- MacRuby/trunk/interpreter.cpp	2010-06-28 20:08:16 UTC (rev 4302)
+++ MacRuby/trunk/interpreter.cpp	2010-06-29 01:09:44 UTC (rev 4303)
@@ -48,12 +48,6 @@
     return cast<ConstantInt>(val)->getZExtValue();
 }
 
-static inline void *
-get_const_ptr(Value *val)
-{
-    return (void *)get_const_int(cast<ConstantExpr>(val)->getOperand(0));
-}
-
 // A macro to avoid stupid compiler warnings.
 #define oops(msg, val) \
 	printf("interpreter: %s (ID: %d)\n", msg, val->getValueID()); \
@@ -70,7 +64,7 @@
 	uint8_t dynamic_class = value_as(call_arg(call, 1), uint8_t);
 	SEL sel = value_as(call_arg(call, 2), SEL);
 	Function *func = value_as(call_arg(call, 3), Function *);
-	uint64_t arity_data = value_as(call_arg(call, 4), uint64_t);
+	uint64_t arity_data = get_const_int(call_arg(call, 4));
 	rb_vm_arity_t arity;
 	memcpy(&arity, &arity_data, sizeof(rb_vm_arity_t));
 	int flags = value_as(call_arg(call, 5), int);
@@ -183,7 +177,20 @@
 	    val = static_cast<ConstantExpr *>(val)->getOperand(0);
 	    // fall through
 	case Value::ConstantIntVal:
-	    return static_cast<ConstantInt *>(val)->getZExtValue();
+	    {
+		ConstantInt *ci = static_cast<ConstantInt *>(val);
+		const unsigned w = ci->getBitWidth();
+#if __LP64__
+		if (w > 64) {
+		    break;
+		}
+#else
+		if (w > 32) {
+		    break;
+		}
+#endif
+		return ci->getZExtValue();
+	    }
 
 	case Value::ArgumentVal:
 	    switch (static_cast<Argument *>(val)->getArgNo()) {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100628/9eb379be/attachment.html>


More information about the macruby-changes mailing list