When splitting a basic block, retranslate

This commit should fix some bugs due to the fact that when we're
splitting a basic block we don't retranslate the basic block at the
split point but preserve the existing code. This lead to problems, in
particular in x86-64 where certain QEMU local variables were not
available. This change should fix it.

Basically, every time we split a basic block in
`JumpTargetManager::registerJT` we note down that the new basic block
must be purged, and in `JumpTargetManager::harvest` we perform the
purge. `harvest` has been chosen since it's a particularly quiet moment,
i.e., there should be no pending references/iterator to code we have to
delete.
This commit is contained in:
Alessandro Di Federico
2017-03-01 17:04:54 +01:00
parent 7babafacc0
commit 04a4591f5c
5 changed files with 122 additions and 8 deletions
+1
View File
@@ -632,6 +632,7 @@ void CodeGenerator::translate(uint64_t VirtualAddress) {
while (Entry != nullptr) {
Builder.SetInsertPoint(Entry);
// TODO: what if create a new instance of an InstructionTranslator here?
Translator.reset();
// TODO: rename this type