[macruby-changes] [5269] MacRuby/trunk

source_changes at macosforge.org source_changes at macosforge.org
Wed Mar 9 16:01:04 PST 2011


Revision: 5269
          http://trac.macosforge.org/projects/ruby/changeset/5269
Author:   lsansonetti at apple.com
Date:     2011-03-09 16:01:04 -0800 (Wed, 09 Mar 2011)
Log Message:
-----------
add support for llvm 2.9, test it by passing CFLAGS=-D__SUPPORT_LLVM_29__ to rake

Modified Paths:
--------------
    MacRuby/trunk/bridgesupport.cpp
    MacRuby/trunk/compiler.cpp
    MacRuby/trunk/compiler.h
    MacRuby/trunk/debugger.cpp
    MacRuby/trunk/llvm.h
    MacRuby/trunk/vm.cpp

Modified: MacRuby/trunk/bridgesupport.cpp
===================================================================
--- MacRuby/trunk/bridgesupport.cpp	2011-03-09 23:59:37 UTC (rev 5268)
+++ MacRuby/trunk/bridgesupport.cpp	2011-03-10 00:01:04 UTC (rev 5269)
@@ -18,6 +18,9 @@
 # include <llvm/Instructions.h>
 # include <llvm/Intrinsics.h>
 # include <llvm/Analysis/DebugInfo.h>
+# if __SUPPORT_LLVM_29__
+#  include <llvm/Analysis/DIBuilder.h>
+# endif
 # include <llvm/ExecutionEngine/JIT.h>
 # include <llvm/PassManager.h>
 # include <llvm/Target/TargetData.h>

Modified: MacRuby/trunk/compiler.cpp
===================================================================
--- MacRuby/trunk/compiler.cpp	2011-03-09 23:59:37 UTC (rev 5268)
+++ MacRuby/trunk/compiler.cpp	2011-03-10 00:01:04 UTC (rev 5269)
@@ -150,7 +150,11 @@
 RoxorCompiler::RoxorCompiler(bool _debug_mode)
 {
     assert(RoxorCompiler::module != NULL);
+#if __SUPPORT_LLVM_29__
+    debug_info = new DIBuilder(*RoxorCompiler::module);
+#else
     debug_info = new DIFactory(*RoxorCompiler::module);
+#endif
 
     can_interpret = false;
     debug_mode = _debug_mode;
@@ -835,8 +839,18 @@
 RoxorCompiler::attach_current_line_metadata(Instruction *insn)
 {
     if (fname != NULL) {
+#if __SUPPORT_LLVM_29__
+	Value *args[] = {
+	    ConstantInt::get(Int32Ty, current_line),
+	    ConstantInt::get(Int32Ty, 0),
+	    debug_compile_unit,
+	    DILocation(NULL) 
+	};
+	DILocation loc = DILocation(MDNode::get(context, args, 4));
+#else
 	DILocation loc = debug_info->CreateLocation(current_line, 0,
 		debug_compile_unit, DILocation(NULL));
+#endif
 	insn->setMetadata(dbg_mdkind, loc);
     }
 }
@@ -4880,8 +4894,14 @@
 	    assert(strlen(dir) > 0);
 	    assert(strlen(base) > 0);
 
+#if __SUPPORT_LLVM_29__
+	    debug_info->createCompileUnit(DW_LANG_Ruby, base, dir,
+		    RUBY_DESCRIPTION, true, "", 1);
+	    debug_compile_unit = DICompileUnit(debug_info->getCU());
+#else
 	    debug_compile_unit = debug_info->CreateCompileUnit(DW_LANG_Ruby,
 		    base, dir, RUBY_DESCRIPTION, false, false, "");
+#endif
 	}
     }
 }

Modified: MacRuby/trunk/compiler.h
===================================================================
--- MacRuby/trunk/compiler.h	2011-03-09 23:59:37 UTC (rev 5268)
+++ MacRuby/trunk/compiler.h	2011-03-10 00:01:04 UTC (rev 5269)
@@ -79,7 +79,11 @@
 	void generate_location_path(std::string &path, DILocation loc);
 
     protected:
+#if __SUPPORT_LLVM_29__
+	DIBuilder *debug_info;
+#else
 	DIFactory *debug_info;
+#endif
 	DICompileUnit debug_compile_unit;
 	DISubprogram debug_subprogram;
 

Modified: MacRuby/trunk/debugger.cpp
===================================================================
--- MacRuby/trunk/debugger.cpp	2011-03-09 23:59:37 UTC (rev 5268)
+++ MacRuby/trunk/debugger.cpp	2011-03-10 00:01:04 UTC (rev 5269)
@@ -15,6 +15,9 @@
 #include <llvm/Instructions.h>
 #include <llvm/Intrinsics.h>
 #include <llvm/Analysis/DebugInfo.h>
+#if __SUPPORT_LLVM_29__
+# include <llvm/Analysis/DIBuilder.h>
+#endif
 #include <llvm/ExecutionEngine/JIT.h>
 #include <llvm/PassManager.h>
 #include <llvm/Target/TargetData.h>

Modified: MacRuby/trunk/llvm.h
===================================================================
--- MacRuby/trunk/llvm.h	2011-03-09 23:59:37 UTC (rev 5268)
+++ MacRuby/trunk/llvm.h	2011-03-10 00:01:04 UTC (rev 5269)
@@ -17,6 +17,9 @@
 #include <llvm/Instructions.h>
 #include <llvm/Intrinsics.h>
 #include <llvm/Analysis/DebugInfo.h>
+#if __SUPPORT_LLVM_29__
+# include <llvm/Analysis/DIBuilder.h>
+#endif
 #include <llvm/ExecutionEngine/JIT.h>
 #include <llvm/PassManager.h>
 #include <llvm/Target/TargetData.h>

Modified: MacRuby/trunk/vm.cpp
===================================================================
--- MacRuby/trunk/vm.cpp	2011-03-09 23:59:37 UTC (rev 5268)
+++ MacRuby/trunk/vm.cpp	2011-03-10 00:01:04 UTC (rev 5269)
@@ -21,6 +21,9 @@
 # include <llvm/Instructions.h>
 # include <llvm/PassManager.h>
 # include <llvm/Analysis/DebugInfo.h>
+# if __SUPPORT_LLVM_29__
+#  include <llvm/Analysis/DIBuilder.h>
+# endif
 # include <llvm/Analysis/Verifier.h>
 # include <llvm/Target/TargetData.h>
 # include <llvm/CodeGen/MachineFunction.h>
@@ -35,6 +38,9 @@
 # include <llvm/Transforms/Scalar.h>
 # include <llvm/Transforms/IPO.h>
 # include <llvm/Support/raw_ostream.h>
+# if __SUPPORT_LLVM_29__
+#  include <llvm/Support/system_error.h>
+# endif
 # include <llvm/Support/PrettyStackTrace.h>
 # include <llvm/Support/MemoryBuffer.h>
 # include <llvm/Support/StandardPasses.h>
@@ -4923,11 +4929,23 @@
     // To not corrupt stack pointer (essential for backtracing).
     llvm::NoFramePointerElim = true;
 
-    MemoryBuffer *mbuf;
+    MemoryBuffer *mbuf = NULL;
     const char *kernel_file = getenv("VM_KERNEL_PATH");
     if (kernel_file != NULL) {
 	std::string err;
+#if __SUPPORT_LLVM_29__
+	OwningPtr<MemoryBuffer> MB;
+	error_code errcode = MemoryBuffer::getFile(kernel_file, MB);
+	if (errcode) {
+	    err = errcode.message();
+	}
+	else {
+	    mbuf = MB.take();
+	    assert(mbuf != NULL);
+	}
+#else
 	mbuf = MemoryBuffer::getFile(kernel_file, &err);
+#endif
 	if (mbuf == NULL) {
 	    printf("can't open given kernel file `%s': %s\n", kernel_file,
 		    err.c_str());
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20110309/90b094d0/attachment-0001.html>


More information about the macruby-changes mailing list