[macruby-changes] [4271] MacRuby/trunk

source_changes at macosforge.org source_changes at macosforge.org
Thu Jun 24 16:16:46 PDT 2010


Revision: 4271
          http://trac.macosforge.org/projects/ruby/changeset/4271
Author:   lsansonetti at apple.com
Date:     2010-06-24 16:16:45 -0700 (Thu, 24 Jun 2010)
Log Message:
-----------
now requires LLVM r106781

Revision Links:
--------------
    http://trac.macosforge.org/projects/ruby/changeset/106781

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

Modified: MacRuby/trunk/README.rdoc
===================================================================
--- MacRuby/trunk/README.rdoc	2010-06-23 21:30:12 UTC (rev 4270)
+++ MacRuby/trunk/README.rdoc	2010-06-24 23:16:45 UTC (rev 4271)
@@ -24,10 +24,10 @@
 * LLVM ToT, compiled for both i386 and x86_64.
 
   LLVM is a moving target and breaks periodically. We recommend to install
-  revision 89156, being sure to specify the correct C and C++ compilers through 
+  revision 106781, being sure to specify the correct C and C++ compilers through 
   environment variables. 
 
-    $ svn co -r 89156 https://llvm.org/svn/llvm-project/llvm/trunk llvm-trunk
+    $ svn co -r 106781 https://llvm.org/svn/llvm-project/llvm/trunk llvm-trunk
     $ cd llvm-trunk
     $ env UNIVERSAL=1 UNIVERSAL_ARCH="i386 x86_64" CC=/usr/bin/gcc CXX=/usr/bin/g++ ./configure --enable-bindings=none --enable-optimized --with-llvmgccdir=/tmp
     $ env UNIVERSAL=1 UNIVERSAL_ARCH="i386 x86_64" CC=/usr/bin/gcc CXX=/usr/bin/g++ make

Modified: MacRuby/trunk/bridgesupport.cpp
===================================================================
--- MacRuby/trunk/bridgesupport.cpp	2010-06-23 21:30:12 UTC (rev 4270)
+++ MacRuby/trunk/bridgesupport.cpp	2010-06-24 23:16:45 UTC (rev 4271)
@@ -16,9 +16,6 @@
 # include <llvm/Constants.h>
 # include <llvm/CallingConv.h>
 # include <llvm/Instructions.h>
-# if !defined(LLVM_TOT)
-#  include <llvm/ModuleProvider.h>
-# endif
 # include <llvm/Intrinsics.h>
 # include <llvm/Analysis/DebugInfo.h>
 # include <llvm/ExecutionEngine/JIT.h>
@@ -331,7 +328,6 @@
 
 	const size_t type_size = GET_CORE()->get_sizeof(llvm_type);
 
-#if LLVM_TOT
 	Value *args[] = {
 	    new BitCastInst(fval, PtrTy, "", bb),  	// start
 	    ConstantInt::get(Int8Ty, 0),		// value
@@ -344,19 +340,6 @@
 		Intrinsic::memset, Tys, 2);
 	assert(memset_func != NULL);
 	CallInst::Create(memset_func, args, args + 5, "", bb);
-#else
-	const Type *Tys[] = { IntTy };
-	Function *memset_func = Intrinsic::getDeclaration(module,
-		Intrinsic::memset, Tys, 1);
-	assert(memset_func != NULL);
-	Value *args[] = {
-	    new BitCastInst(fval, PtrTy, "", bb),
-	    ConstantInt::get(Int8Ty, 0),
-	    ConstantInt::get(IntTy, type_size),
-	    ConstantInt::get(Int32Ty, 0)
-	};
-	CallInst::Create(memset_func, args, args + 4, "", bb);
-#endif
 
 	fval = new LoadInst(fval, "", bb);
 	fval = compile_conversion_to_ruby(ftype, llvm_type, fval);

Modified: MacRuby/trunk/compiler.cpp
===================================================================
--- MacRuby/trunk/compiler.cpp	2010-06-23 21:30:12 UTC (rev 4270)
+++ MacRuby/trunk/compiler.cpp	2010-06-24 23:16:45 UTC (rev 4271)
@@ -307,14 +307,7 @@
     level = 0;
 #endif
 
-#if LLVM_TOT
     dbg_mdkind = context.getMDKindID("dbg");
-#else
-    dbg_mdkind = context.getMetadata().getMDKind("dbg");
-    if (dbg_mdkind == 0) {
-	dbg_mdkind = context.getMetadata().registerMDKind("dbg");
-    }
-#endif
     assert(dbg_mdkind != 0);
 }
 
@@ -799,12 +792,7 @@
     if (fname != NULL) {
 	DILocation loc = debug_info->CreateLocation(current_line, 0,
 		debug_compile_unit, DILocation(NULL));
-#if LLVM_TOT
 	insn->setMetadata(dbg_mdkind, loc);
-	//insn->setDebugLoc(DebugLoc::getFromDILocation(loc.getNode()));
-#else
-	context.getMetadata().addMD(dbg_mdkind, loc.getNode(), insn);
-#endif
     }
 }
 
@@ -2528,18 +2516,11 @@
 	}
     }
 
-#if LLVM_TOT
     InlineFunctionInfo IFI;
     for (std::vector<CallInst *>::iterator i = insns.begin();
 	    i != insns.end(); ++i) {
 	InlineFunction(*i, IFI);
     }
-#else
-    for (std::vector<CallInst *>::iterator i = insns.begin();
-	    i != insns.end(); ++i) {
-	InlineFunction(*i);
-    }
-#endif
 }
 
 Function *
@@ -2832,7 +2813,6 @@
 
 	    // Transform the InvokeInst in CallInst.
 	    std::vector<Value *> params;
-#if LLVM_TOT
 	    for (unsigned i = 0; i < invoke->getNumOperands() - 3; i++) {
 		params.push_back(invoke->getOperand(i));
 	    }
@@ -2843,22 +2823,7 @@
 		    invoke);
 
 	    invoke->replaceAllUsesWith(call_inst);
-	    BasicBlock *normal_bb = dyn_cast<BasicBlock>
-		(invoke->getNormalDest());
-#else
-	    for (InvokeInst::op_iterator op_it = invoke->op_begin()+3;
-		    op_it != invoke->op_end(); ++op_it) {
-		params.push_back(op_it->get());
-	    }
-	    CallInst *call_inst = CallInst::Create(
-		    invoke->getOperand(0),
-		    params.begin(), params.end(),
-		    invoke->getNameStr(),
-		    invoke);
-
-	    invoke->replaceAllUsesWith(call_inst);
-	    BasicBlock *normal_bb = dyn_cast<BasicBlock>(invoke->getOperand(1));
-#endif
+	    BasicBlock *normal_bb = dyn_cast<BasicBlock>(invoke->getNormalDest());
 	    assert(normal_bb != NULL);
 	    BranchInst::Create(normal_bb, invoke);
 	    invoke->eraseFromParent();

Modified: MacRuby/trunk/debugger.cpp
===================================================================
--- MacRuby/trunk/debugger.cpp	2010-06-23 21:30:12 UTC (rev 4270)
+++ MacRuby/trunk/debugger.cpp	2010-06-24 23:16:45 UTC (rev 4271)
@@ -13,9 +13,6 @@
 #include <llvm/Constants.h>
 #include <llvm/CallingConv.h>
 #include <llvm/Instructions.h>
-#if !defined(LLVM_TOT)
-# include <llvm/ModuleProvider.h>
-#endif
 #include <llvm/Intrinsics.h>
 #include <llvm/Analysis/DebugInfo.h>
 #include <llvm/ExecutionEngine/JIT.h>

Modified: MacRuby/trunk/llvm.h
===================================================================
--- MacRuby/trunk/llvm.h	2010-06-23 21:30:12 UTC (rev 4270)
+++ MacRuby/trunk/llvm.h	2010-06-24 23:16:45 UTC (rev 4271)
@@ -15,9 +15,6 @@
 #include <llvm/Constants.h>
 #include <llvm/CallingConv.h>
 #include <llvm/Instructions.h>
-#if !defined(LLVM_TOT)
-# include <llvm/ModuleProvider.h>
-#endif
 #include <llvm/Intrinsics.h>
 #include <llvm/Analysis/DebugInfo.h>
 #include <llvm/ExecutionEngine/JIT.h>

Modified: MacRuby/trunk/vm.cpp
===================================================================
--- MacRuby/trunk/vm.cpp	2010-06-23 21:30:12 UTC (rev 4270)
+++ MacRuby/trunk/vm.cpp	2010-06-24 23:16:45 UTC (rev 4271)
@@ -19,9 +19,6 @@
 # include <llvm/Constants.h>
 # include <llvm/CallingConv.h>
 # include <llvm/Instructions.h>
-# if !defined(LLVM_TOT)
-#  include <llvm/ModuleProvider.h>
-# endif
 # include <llvm/PassManager.h>
 # include <llvm/Analysis/DebugInfo.h>
 # include <llvm/Analysis/Verifier.h>
@@ -267,7 +264,6 @@
 
 	    std::string path;
 	    for (std::vector<EmittedFunctionDetails::LineStart>::const_iterator iter = Details.LineStarts.begin(); iter != Details.LineStarts.end(); ++iter) {
-#if LLVM_TOT
 		MDNode *scope = iter->Loc.getAsMDNode(F.getContext());
 		DILocation dil = DILocation(scope);
 		if (path.size() == 0) {
@@ -277,16 +273,6 @@
 		    path.append(scope.getFilename());
 		}
 		RoxorFunction::Line line(iter->Address, dil.getLineNumber());
-#else
-		DebugLocTuple dlt = Details.MF->getDebugLocTuple(iter->Loc);
-		if (path.size() == 0) {
-		    DICompileUnit unit(dlt.Scope);
-		    path.append(unit.getDirectory());
-		    path.append("/");
-		    path.append(unit.getFilename());
-		}
-		RoxorFunction::Line line(iter->Address, dlt.Line);
-#endif
 		function->lines.push_back(line);
 	    }
 
@@ -326,9 +312,6 @@
 
     // The JIT is created later, if necessary.
     InitializeNativeTarget();
-# if !defined(LLVM_TOT)
-    emp = NULL;
-# endif
     jmm = NULL; 
     ee = NULL;
     fpm = NULL;
@@ -344,9 +327,6 @@
 {
 #if !defined(MACRUBY_STATIC)
     assert(ee == NULL);
-# if !defined(LLVM_TOT)
-    emp = new ExistingModuleProvider(RoxorCompiler::module);
-# endif
     jmm = new RoxorJITManager;
 
     CodeGenOpt::Level opt = CodeGenOpt::Default;
@@ -376,12 +356,8 @@
     }
 
     std::string err;
-# if LLVM_TOT
     ee = ExecutionEngine::createJIT(RoxorCompiler::module, &err, jmm, opt,
 	    false);
-# else
-    ee = ExecutionEngine::createJIT(emp, &err, jmm, opt, false);
-# endif
     if (ee == NULL) {
 	fprintf(stderr, "error while creating JIT: %s\n", err.c_str());
 	abort();
@@ -389,11 +365,7 @@
     ee->DisableLazyCompilation();
     ee->RegisterJITEventListener(jmm);
 
-# if LLVM_TOT
     fpm = new FunctionPassManager(RoxorCompiler::module);
-# else
-    fpm = new FunctionPassManager(emp);
-# endif
     fpm->add(new TargetData(*ee->getTargetData()));
 
     // Do simple "peephole" optimizations and bit-twiddling optzns.
@@ -4720,11 +4692,7 @@
 {
 #if !defined(MACRUBY_STATIC)
     // To emit DWARF exception tables. 
-#if LLVM_TOT
     llvm::JITExceptionHandling = true;
-#else
-    llvm::DwarfExceptionHandling = true; 
-#endif
     // To emit DWARF debug metadata. 
     llvm::JITEmitDebugInfo = true; 
     // To not interfere with our signal handling mechanism.
@@ -4756,13 +4724,7 @@
 	kernel_end = kernel_beg + _objs_kernel_i386_bc_len - 1;
 #endif
 
-#if LLVM_TOT
-	mbuf = MemoryBuffer::getMemBuffer(StringRef(kernel_beg,
-		    kernel_end - kernel_beg));
-#else
-	mbuf = MemoryBuffer::getMemBuffer(kernel_beg, kernel_end);
-	assert(mbuf != NULL);
-#endif
+	mbuf = MemoryBuffer::getMemBuffer(StringRef(kernel_beg, kernel_end - kernel_beg));
     }
     std::string err;
     RoxorCompiler::module = ParseBitcodeFile(mbuf, getGlobalContext(), &err);

Modified: MacRuby/trunk/vm.h
===================================================================
--- MacRuby/trunk/vm.h	2010-06-23 21:30:12 UTC (rev 4270)
+++ MacRuby/trunk/vm.h	2010-06-24 23:16:45 UTC (rev 4271)
@@ -669,9 +669,6 @@
     private:
 	// LLVM objects.
 #if !defined(MACRUBY_STATIC)
-# if !defined(LLVM_TOT)
-	ExistingModuleProvider *emp;
-# endif
 	RoxorJITManager *jmm;
 	ExecutionEngine *ee;
 	FunctionPassManager *fpm;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100624/c446775d/attachment-0001.html>


More information about the macruby-changes mailing list