[llvm-dev] VModuleKey K not valid here

Lang Hames via llvm-dev llvm-dev at lists.llvm.org
Tue Aug 13 14:14:55 PDT 2019


Hi Dibyendu,

1) Can 0 ever be a valid VModuleKey? How can one reliably detect an invalid
> VModuleKey?


I believe 0 was a valid VModuleKey in ORCv1. The assertion is checking the
the VModuleKey is present in the LogicalDylibs map. That means that you
have to have used that key in an addModule call, e.g.:

CODLayer.addModule(K, std::move(M));

and not subsequently removed the key with a call to removeModule.

2) Secondly it seems to me that  following the assertion there should be a
check so that the code dosn't continue? It is causing segmentation fault in
release builds.

There should not be any check other than the assertion. Assertions aren't
for recoverable errors or logging, they're only for verifying that code is
being used according to contract. In this case the contract is that
removeModule is only called with valid keys. If the assertion is triggering
then either the key you're using is invalid, or my implementation of
CompileOnDemandLayer (or the assert itself) is invalid. We just need to fix
the offending code.

Out of interest: What are your plans for removeModule? It's currently
unimplemented in ORCv2. Understanding people's use cases will help with
design and prioritization.

Cheers,
Lang.

On Tue, Aug 13, 2019 at 1:50 PM Dibyendu Majumdar via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> Hi,
>
> I am getting following assertion failure when attempting to remove a
> module.
>
> /llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h:311: llvm::Error
> llvm::orc::LegacyCompileOnDemandLayer<BaseLayerT, CompileCallbackMgrT,
> IndirectStubsMgrT>::removeModule(llvm::orc::VModuleKey) [with
> BaseLayerT =
> llvm::orc::LegacyIRTransformLayer<llvm::orc::LegacyIRCompileLayer<llvm::orc::LegacyRTDyldObjectLinkingLayer,
> llvm::orc::SimpleCompiler>,
> std::function<std::unique_ptr<llvm::Module>(std::unique_ptr<llvm::Module>)>
> >; CompileCallbackMgrT = llvm::orc::JITCompileCallbackManager;
> IndirectStubsMgrT = llvm::orc::IndirectStubsManager;
> llvm::orc::VModuleKey = long unsigned int]: Assertion `I !=
> LogicalDylibs.end() && "VModuleKey K not valid here"' failed.
>
> 1) Can 0 ever be a valid VModuleKey? How can one reliably detect an
> invalid VModuleKey?
> 2) Secondly it seems to me that  following the assertion there should
> be a check so that the code dosn't continue? It is causing
> segmentation fault in release builds.
>
> Regards
> Dibyendu
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190813/93c7a506/attachment.html>


More information about the llvm-dev mailing list