To catch bugs like the one fixed in

http://llvm.org/viewvc/llvm-project?view=rev&revision=78127, I'm changing the
ExecutionEngine's global mappings to hold AssertingVH<const GlobalValue>. That
way, if unregistering a mapping fails to actually unregister it, we'll get an
assert. Running the jit nightly tests didn't uncover any actual instances of
the problem.

This also uncovered the fact that AssertingVH<const X> didn't work, so I fixed
that too.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78400 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jeffrey Yasskin
2009-08-07 19:54:29 +00:00
parent f12288e8aa
commit 0d5bd59553
4 changed files with 37 additions and 19 deletions

View File

@@ -37,26 +37,27 @@ class ModuleProvider;
class MutexGuard;
class TargetData;
class Type;
template<typename> class AssertingVH;
class ExecutionEngineState {
private:
/// GlobalAddressMap - A mapping between LLVM global values and their
/// actualized version...
std::map<const GlobalValue*, void *> GlobalAddressMap;
std::map<AssertingVH<const GlobalValue>, void *> GlobalAddressMap;
/// GlobalAddressReverseMap - This is the reverse mapping of GlobalAddressMap,
/// used to convert raw addresses into the LLVM global value that is emitted
/// at the address. This map is not computed unless getGlobalValueAtAddress
/// is called at some point.
std::map<void *, const GlobalValue*> GlobalAddressReverseMap;
std::map<void *, AssertingVH<const GlobalValue> > GlobalAddressReverseMap;
public:
std::map<const GlobalValue*, void *> &
std::map<AssertingVH<const GlobalValue>, void *> &
getGlobalAddressMap(const MutexGuard &) {
return GlobalAddressMap;
}
std::map<void*, const GlobalValue*> &
std::map<void*, AssertingVH<const GlobalValue> > &
getGlobalAddressReverseMap(const MutexGuard &) {
return GlobalAddressReverseMap;
}