diff options
author | Jeffrey Yasskin <jyasskin@google.com> | 2009-10-13 21:32:57 +0000 |
---|---|---|
committer | Jeffrey Yasskin <jyasskin@google.com> | 2009-10-13 21:32:57 +0000 |
commit | d162dbac7fa371fcb9d657c744865f8f95d5642e (patch) | |
tree | 3c9546c9b764c9ebce959144aa66df5ec451b278 /llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp | |
parent | 7373095ebf27093d88878fd1b13ee0f04750f1e1 (diff) | |
download | bcm5719-llvm-d162dbac7fa371fcb9d657c744865f8f95d5642e.tar.gz bcm5719-llvm-d162dbac7fa371fcb9d657c744865f8f95d5642e.zip |
Keep track of stubs that are created. This fixes PR5162 and probably PR4822 and
4406. Patch by Nick Lewycky!
llvm-svn: 84032
Diffstat (limited to 'llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp')
-rw-r--r-- | llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp b/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp index e8314a1d866..3d69c3ff5ed 100644 --- a/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp +++ b/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp @@ -64,7 +64,7 @@ namespace { class JITResolverState { public: typedef std::map<AssertingVH<Function>, void*> FunctionToStubMapTy; - typedef std::map<void*, Function*> StubToFunctionMapTy; + typedef std::map<void*, AssertingVH<Function> > StubToFunctionMapTy; typedef std::map<AssertingVH<GlobalValue>, void*> GlobalToIndirectSymMapTy; private: /// FunctionToStubMap - Keep track of the stub created for a particular @@ -198,9 +198,9 @@ void *JITResolver::getFunctionStub(Function *F) { // Call the lazy resolver function unless we are JIT'ing non-lazily, in which // case we must resolve the symbol now. - void *Actual = TheJIT->isLazyCompilationDisabled() + void *Actual = TheJIT->isLazyCompilationDisabled() ? (void *)0 : (void *)(intptr_t)LazyResolverFn; - + // If this is an external declaration, attempt to resolve the address now // to place in the stub. if (F->isDeclaration() && !F->hasNotBeenReadFromBitcode()) { @@ -231,14 +231,14 @@ void *JITResolver::getFunctionStub(Function *F) { // Finally, keep track of the stub-to-Function mapping so that the // JITCompilerFn knows which function to compile! state.getStubToFunctionMap(locked)[Stub] = F; - + // If we are JIT'ing non-lazily but need to call a function that does not // exist yet, add it to the JIT's work list so that we can fill in the stub // address later. if (!Actual && TheJIT->isLazyCompilationDisabled()) if (!F->isDeclaration() || F->hasNotBeenReadFromBitcode()) TheJIT->addPendingFunction(F); - + return Stub; } @@ -696,11 +696,8 @@ void *JITEmitter::getPointerToGVIndirectSym(GlobalValue *V, void *Reference, } void JITEmitter::AddStubToCurrentFunction(void *StubAddr) { - if (!TheJIT->areDlsymStubsEnabled()) - return; - assert(CurFn && "Stub added to current function, but current function is 0!"); - + SmallVectorImpl<void*> &StubsUsed = CurFnStubUses[CurFn]; StubsUsed.push_back(StubAddr); |