[llvm] 8380d07 - [JITLink] Add assertions, fix a comment.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 24 02:04:22 PST 2021


Author: Lang Hames
Date: 2021-02-24T21:02:37+11:00
New Revision: 8380d07e398e5f7d6edd877d293a2e28db058d8c

URL: https://github.com/llvm/llvm-project/commit/8380d07e398e5f7d6edd877d293a2e28db058d8c
DIFF: https://github.com/llvm/llvm-project/commit/8380d07e398e5f7d6edd877d293a2e28db058d8c.diff

LOG: [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.

Added: 
    

Modified: 
    llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h b/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
index 28058b73dc72..a1f895b5b94f 100644
--- a/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
+++ b/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
@@ -1012,6 +1012,10 @@ class LinkGraph {
     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 @@ class LinkGraph {
            "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;


        


More information about the llvm-commits mailing list