[llvm] r334535 - [MCJIT] Call materializeAll on modules before compiling them in MCJIT.
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 18 11:46:16 PDT 2018
Test case? (commit message mentions this avoids a crash - so I'd imagine a
test case can be constructed - or was the crash showing up on existing
tests (or would show up in existing tests once the additional assertion was
included?)?)
On Tue, Jun 12, 2018 at 1:47 PM Lang Hames via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
> Author: lhames
> Date: Tue Jun 12 13:43:15 2018
> New Revision: 334535
>
> URL: http://llvm.org/viewvc/llvm-project?rev=334535&view=rev
> Log:
> [MCJIT] Call materializeAll on modules before compiling them in MCJIT.
>
> This only affects modules with lazy GVMaterializers attached (usually
> modules
> read off disk using the lazy bitcode reader). For such modules,
> materializing
> before compiling prevents crashes due to missing function bodies /
> initializers.
>
> Modified:
> llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp
>
> Modified: llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp?rev=334535&r1=334534&r2=334535&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp (original)
> +++ llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp Tue Jun 12 13:43:15 2018
> @@ -142,8 +142,14 @@ void MCJIT::setObjectCache(ObjectCache*
> }
>
> std::unique_ptr<MemoryBuffer> MCJIT::emitObject(Module *M) {
> + assert(M && "Can not emit a null module");
> +
> MutexGuard locked(lock);
>
> + // Materialize all globals in the module if they have not been
> + // materialized already.
> + cantFail(M->materializeAll());
> +
> // This must be a module which has already been added but not loaded to
> this
> // MCJIT instance, since these conditions are tested by our caller,
> // generateCodeForModule.
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180618/e0b66b5a/attachment-0001.html>
More information about the llvm-commits
mailing list