[llvm-dev] Reuse llvm::ExecutionEngine

Gaier, Bjoern via llvm-dev llvm-dev at lists.llvm.org
Tue May 7 23:00:06 PDT 2019


Heyho,

I can only provide you with a screenshot for the first problem I noticed:
[https://media.discordapp.net/attachments/534012750045642783/575369402195640321/unknown.png]

This code will crash when calling "eeBuilder.create".

But I also looked at what happens if I do reuse the llvm::ExecutionEngine. After the call to "finalizeObject" I use "removeModule" for the Module I used.
If I know parse the same module again and pass it to that llvm::ExecutionEngine, it will notice the duplication and rename the symbols, like when it does when you add the same module two times.
If I add a different module everything behaves as before - so overall it seems like you can't reuse a llvm::ExecutionEngine...

From: llvm-dev <llvm-dev-bounces at lists.llvm.org> On Behalf Of preejackie via llvm-dev
Sent: Dienstag, 7. Mai 2019 15:28
To: llvm-dev at lists.llvm.org
Subject: Re: [llvm-dev] Reuse llvm::ExecutionEngine


Hi Bjoern,

Could you please give me a minimal code sample to produce this behavior?
On 07/05/19 5:17 PM, Gaier, Bjoern via llvm-dev wrote:
Dear LLVM-Mailing-List,

I'm using the llvm::EngineBuilder to create an instance of the llvm::ExecutionEngine, I then JIT my code, take the addresses I need and delete the llvm::ExecutionEngine. But now I started to wonder, if I could reuse that instance for a new module again?

I first tried calling llvm::EngineBuilder without setting a Module, I planned to add it later - but when I do this the "create" function will crash.
What crash you get? By quickly looking through interface, EngineBuilder uses nullptr if no module are provided.


Another test I ran was calling "removeModule" of the llvm::ExecutionEngine  after the call to finalizeObject. Then I added the same module again and ran finalizeObject again. The result was weird, I suddenly became error messages about the relocation - I take this came because I applied a memory mapping in the first run.

So to make it short: Is the llvm::ExecutionEngine designed for a reuse or is it better to create a new instance again?

Kind greetings
Björn
Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816, USt.ID-Nr. DE 114 165 789 Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert Plank, Markus Bode, Heiko Lampert, Takashi Nagano, Takeshi Fukushima. Junichi Tajika


_______________________________________________

LLVM Developers mailing list

llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>

https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

--

Have a great day!

PreeJackie

Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816, USt.ID-Nr. DE 114 165 789 Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert Plank, Markus Bode, Heiko Lampert, Takashi Nagano, Takeshi Fukushima. Junichi Tajika
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190508/239db4fc/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 46413 bytes
Desc: image001.png
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190508/239db4fc/attachment-0001.png>


More information about the llvm-dev mailing list