From 8380d07e398e5f7d6edd877d293a2e28db058d8c Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Wed, 24 Feb 2021 19:17:35 +1100 Subject: [PATCH] [JITLink] Add assertions, fix a comment. The new assertions check that Addressables removed when removing external or absolute symbols are not referenced by another symbol. A comment on post-fixup passes is updated: vmaddrs have all been set up by the time the pre-fixup passes are run, post-fixup passes run after fixups have been applied to content. --- llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h b/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h index 28058b7..a1f895b 100644 --- a/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h +++ b/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h @@ -1012,6 +1012,10 @@ public: assert(ExternalSymbols.count(&Sym) && "Symbol is not in the externals set"); ExternalSymbols.erase(&Sym); Addressable &Base = *Sym.Base; + assert(llvm::find_if(ExternalSymbols, + [&](Symbol *AS) { return AS->Base == &Base; }) == + ExternalSymbols.end() && + "Base addressable still in use"); destroySymbol(Sym); destroyAddressable(Base); } @@ -1024,6 +1028,10 @@ public: "Symbol is not in the absolute symbols set"); AbsoluteSymbols.erase(&Sym); Addressable &Base = *Sym.Base; + assert(llvm::find_if(ExternalSymbols, + [&](Symbol *AS) { return AS->Base == &Base; }) == + ExternalSymbols.end() && + "Base addressable still in use"); destroySymbol(Sym); destroyAddressable(Base); } @@ -1263,8 +1271,8 @@ struct PassConfiguration { /// Post-fixup passes. /// /// These passes are called on the graph after block contents has been copied - /// to working memory, and fixups applied. Graph nodes have been updated to - /// their final target vmaddrs. + /// to working memory, and fixups applied. Blocks have been updated to point + /// to their fixed up content. /// /// Notable use cases: Testing and validation. LinkGraphPassList PostFixupPasses; -- 2.7.4