[llvm] r334535 - [MCJIT] Call materializeAll on modules before compiling them in MCJIT.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 28 17:10:54 PDT 2018


There are no in-tree JITs that use lazy bitcode parsing, so writing a
regression test was not possible at the time. I might add lazy bitcode
parsing to LLJIT. Then we would be trivially testing this everywhere.

-- Lang.

On Mon, Jun 18, 2018 at 11:46 AM David Blaikie <dblaikie at gmail.com> wrote:

> 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/20180628/668b9178/attachment.html>


More information about the llvm-commits mailing list