[macruby-changes] [2679] MacRuby/trunk/compiler.cpp
source_changes at macosforge.org
source_changes at macosforge.org
Tue Sep 29 15:53:33 PDT 2009
Revision: 2679
http://trac.macosforge.org/projects/ruby/changeset/2679
Author: lsansonetti at apple.com
Date: 2009-09-29 15:53:30 -0700 (Tue, 29 Sep 2009)
Log Message:
-----------
some 32-bit compiler fixes
Modified Paths:
--------------
MacRuby/trunk/compiler.cpp
Modified: MacRuby/trunk/compiler.cpp
===================================================================
--- MacRuby/trunk/compiler.cpp 2009-09-29 22:53:11 UTC (rev 2678)
+++ MacRuby/trunk/compiler.cpp 2009-09-29 22:53:30 UTC (rev 2679)
@@ -6178,6 +6178,20 @@
extern "C"
VALUE
+rb_vm_float_to_rval(float f)
+{
+ return DOUBLE2NUM(f);
+}
+
+extern "C"
+VALUE
+rb_vm_double_to_rval(double d)
+{
+ return DOUBLE2NUM(d);
+}
+
+extern "C"
+VALUE
rb_vm_charptr_to_rval(const char *ptr)
{
return ptr == NULL ? Qnil : rb_str_new2(ptr);
@@ -6307,6 +6321,9 @@
case _C_CHR:
case _C_SHT:
case _C_INT:
+#if !__LP64__
+ if (*type != _C_INT)
+#endif
val = new SExtInst(val, RubyObjTy, "", bb);
val = BinaryOperator::CreateShl(val, twoVal, "", bb);
val = BinaryOperator::CreateOr(val, oneVal, "", bb);
@@ -6315,6 +6332,9 @@
case _C_UCHR:
case _C_USHT:
case _C_UINT:
+#if !__LP64__
+ if (*type != _C_UINT)
+#endif
val = new ZExtInst(val, RubyObjTy, "", bb);
val = BinaryOperator::CreateShl(val, twoVal, "", bb);
val = BinaryOperator::CreateOr(val, oneVal, "", bb);
@@ -6336,6 +6356,7 @@
func_name = "rb_vm_ulong_long_to_rval";
break;
+#if __LP64__
case _C_FLT:
val = new FPExtInst(val, DoubleTy, "", bb);
// fall through
@@ -6343,8 +6364,17 @@
val = new BitCastInst(val, RubyObjTy, "", bb);
val = BinaryOperator::CreateOr(val, threeVal, "", bb);
return val;
+#else
+ // TODO inline the right code for the 32-bit fixfloat optimization
+ case _C_FLT:
+ func_name = "rb_vm_float_to_rval";
break;
+ case _C_DBL:
+ func_name = "rb_vm_double_to_rval";
+ break;
+#endif
+
case _C_SEL:
func_name = "rb_vm_sel_to_rval";
break;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090929/c5ac1b03/attachment-0001.html>
More information about the macruby-changes
mailing list