[macruby-changes] [1419] MacRuby/branches/experimental/roxor.cpp

source_changes at macosforge.org source_changes at macosforge.org
Tue Apr 14 18:54:36 PDT 2009


Revision: 1419
          http://trac.macosforge.org/projects/ruby/changeset/1419
Author:   lsansonetti at apple.com
Date:     2009-04-14 18:54:36 -0700 (Tue, 14 Apr 2009)
Log Message:
-----------
added interpreter helpers for rb_vm_define_class and rb_vm_prepare_method

Modified Paths:
--------------
    MacRuby/branches/experimental/roxor.cpp

Modified: MacRuby/branches/experimental/roxor.cpp
===================================================================
--- MacRuby/branches/experimental/roxor.cpp	2009-04-14 23:45:08 UTC (rev 1418)
+++ MacRuby/branches/experimental/roxor.cpp	2009-04-15 01:54:36 UTC (rev 1419)
@@ -4,6 +4,7 @@
 #define ROXOR_VM_DEBUG			0
 #define ROXOR_DUMP_IR_BEFORE_EXIT	0
 #define ROXOR_ULTRA_LAZY_JIT		0
+#define ROXOR_INTERPRET_EVAL		0
 
 #include <llvm/Module.h>
 #include <llvm/DerivedTypes.h>
@@ -40,6 +41,20 @@
 #include "roxor.h"
 #include <execinfo.h>
 
+#define FROM_GV(gv,t) ((t)(gv.IntVal.getZExtValue()))
+static GenericValue
+value2gv(VALUE v)
+{
+    GenericValue GV;
+#if __LP64__
+    GV.IntVal = APInt(64, v);
+#else
+    GV.IntVal = APInt(32, v);
+#endif
+    return GV;
+}
+#define VALUE_TO_GV(v) (value2gv((VALUE)v))
+
 extern "C" const char *ruby_node_name(int node);
 
 #define DISPATCH_VCALL 1
@@ -4895,6 +4910,21 @@
 }
 
 extern "C"
+GenericValue
+lle_X_rb_vm_define_class(const FunctionType *FT,
+			 const std::vector<GenericValue> &Args)
+{
+    assert(Args.size() == 4);
+
+    return VALUE_TO_GV(
+	    rb_vm_define_class(
+		FROM_GV(Args[0], ID),
+		FROM_GV(Args[1], VALUE),
+		FROM_GV(Args[2], VALUE),
+		FROM_GV(Args[3], unsigned char)));
+}
+
+extern "C"
 VALUE
 rb_vm_ivar_get(VALUE obj, ID name, int *slot_cache)
 {
@@ -5316,6 +5346,24 @@
 }
 
 extern "C"
+GenericValue
+lle_X_rb_vm_prepare_method(const FunctionType *FT,
+			   const std::vector<GenericValue> &Args)
+{
+    assert(Args.size() == 4);
+
+    rb_vm_prepare_method(
+	    FROM_GV(Args[0], Class),
+	    (SEL)GVTOP(Args[1]),
+	    (Function *)GVTOP(Args[2]),
+	    (NODE *)GVTOP(Args[3]));
+
+    GenericValue GV;
+    GV.IntVal = 0;
+    return GV;
+}
+
+extern "C"
 void
 rb_vm_copy_methods(Class from_class, Class to_class)
 {
@@ -6939,8 +6987,7 @@
 	GET_VM()->bindings.pop_back();
     }
 
-#if 0
-    // TODO the LLVM interpreter is not ready yet
+#if ROXOR_INTERPRET_EVAL
     if (try_interpreter) {
 	return GET_VM()->interpret(function);
     }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090414/62fc81a6/attachment.html>


More information about the macruby-changes mailing list