mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-16 12:24:03 +00:00
Make the ExecutionEngine automatically remove global mappings on when their
GlobalValue is destroyed. Function destruction still leaks machine code and can crash on leaked stubs, but this is some progress. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83987 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -113,4 +113,17 @@ TEST_F(ExecutionEngineTest, ClearModuleMappings) {
|
||||
EXPECT_EQ(G2, Engine->getGlobalValueAtAddress(&Mem1));
|
||||
}
|
||||
|
||||
TEST_F(ExecutionEngineTest, DestructionRemovesGlobalMapping) {
|
||||
GlobalVariable *G1 =
|
||||
NewExtGlobal(Type::getInt32Ty(getGlobalContext()), "Global1");
|
||||
int32_t Mem1 = 3;
|
||||
Engine->addGlobalMapping(G1, &Mem1);
|
||||
// Make sure the reverse mapping is enabled.
|
||||
EXPECT_EQ(G1, Engine->getGlobalValueAtAddress(&Mem1));
|
||||
// When the GV goes away, the ExecutionEngine should remove any
|
||||
// mappings that refer to it.
|
||||
G1->eraseFromParent();
|
||||
EXPECT_EQ(NULL, Engine->getGlobalValueAtAddress(&Mem1));
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user