From 9402be960b4895217d009b6204cf08d8e697b8d5 Mon Sep 17 00:00:00 2001 From: Chad Rosier Date: Wed, 25 Jul 2012 19:06:29 +0000 Subject: You cannot call removeModule on a JIT with no modules. Patch by Verena Beckham . Reviewed by Jim Grosbach. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160753 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/ExecutionEngine/JIT/JIT.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/ExecutionEngine/JIT/JIT.cpp') diff --git a/lib/ExecutionEngine/JIT/JIT.cpp b/lib/ExecutionEngine/JIT/JIT.cpp index a942299..a54ee3b 100644 --- a/lib/ExecutionEngine/JIT/JIT.cpp +++ b/lib/ExecutionEngine/JIT/JIT.cpp @@ -361,7 +361,7 @@ bool JIT::removeModule(Module *M) { MutexGuard locked(lock); - if (jitstate->getModule() == M) { + if (jitstate && jitstate->getModule() == M) { delete jitstate; jitstate = 0; } -- cgit v1.1 From 847a32b78fefb3097b662bcd1156c202d4569d96 Mon Sep 17 00:00:00 2001 From: Nuno Lopes Date: Thu, 2 Aug 2012 12:09:32 +0000 Subject: JIT::runFunction(): add a fast path for functions with a single argument that is a pointer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161171 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/ExecutionEngine/JIT/JIT.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lib/ExecutionEngine/JIT/JIT.cpp') diff --git a/lib/ExecutionEngine/JIT/JIT.cpp b/lib/ExecutionEngine/JIT/JIT.cpp index a54ee3b..97995ad 100644 --- a/lib/ExecutionEngine/JIT/JIT.cpp +++ b/lib/ExecutionEngine/JIT/JIT.cpp @@ -433,13 +433,18 @@ GenericValue JIT::runFunction(Function *F, } break; case 1: - if (FTy->getNumParams() == 1 && - FTy->getParamType(0)->isIntegerTy(32)) { + if (FTy->getParamType(0)->isIntegerTy(32)) { GenericValue rv; int (*PF)(int) = (int(*)(int))(intptr_t)FPtr; rv.IntVal = APInt(32, PF(ArgValues[0].IntVal.getZExtValue())); return rv; } + if (FTy->getParamType(0)->isPointerTy()) { + GenericValue rv; + int (*PF)(char *) = (int(*)(char *))(intptr_t)FPtr; + rv.IntVal = APInt(32, PF((char*)GVTOP(ArgValues[0]))); + return rv; + } break; } } -- cgit v1.1