[PATCH] D72486: Add ThinLtoJIT example

Stefan Gränitz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 14 08:31:25 PST 2020


sgraenitz marked an inline comment as done.
sgraenitz added inline comments.


================
Comment at: llvm/examples/ThinLtoJIT/ThinLtoJIT.cpp:100
+                            "request for it was in progress. Reparsing!",
+                            KV.first().data(), KV.second.front().data()));
+
----------------
sgraenitz wrote:
> I am struggling to find a solution for this: The discovery thread is about to add the required module, but it's waiting for the session lock in JITDylib::define(). As the lock is recursive, I can load it again and add it from here, but that's expensive and I cannot prevent the other one from getting into defineImpl() anymore! This causes a lot of duplicate symbol errors. They are not fatal, but add too much extra overhead.
> 
> I am currently working on parallel module parsing which makes this much more likely to happen. The only way I see so far is to change the design and avoid concurrent AddModule() calls. Would be possible, but I'd lose some speculation performance.
> 
> Happy about any suggestions. Thanks!
Ok, I should probably not add modules in parallel, but instead issue a lookup for one of their symbols from the DiscoveryThread. The lookup will end up in the definition generator and I can do the AddModule there. What do you think?

I have a first patch for it here, but it has some open todos:
https://reviews.llvm.org/differential/diff/237989/#change-u8RDZezBvAb6


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72486/new/

https://reviews.llvm.org/D72486





More information about the llvm-commits mailing list