<div dir="ltr">Hi Manoel,<div><br></div><div>CC'ing the dev list, since the answer may be relevant to others...</div><div><br></div>> Do you have news about  Modify a module at runtime in MCJIT?<br>> We need this feature. Who develops dynamic language like lua, javascript has the same problem.<div class="gmail_extra"><br></div><div class="gmail_extra">MCJIT does not support modification of modules that have already been added to the JIT. There is nothing preventing you from modifying the IR, but if the module has already been compiled then your modifications will have no effect.</div><div class="gmail_extra"><br></div><div class="gmail_extra">To modify code in MCJIT you would usually delete the JIT state containing the module (often this just means deleting the whole MCJIT instance), then adding the new version of the Module to the JIT (or building a new MCJIT instance), then update any callers. How this is done is left up to the client - MCJIT provides no built-in support.</div><div class="gmail_extra"><br></div><div class="gmail_extra">You can build on MCJIT to do this, and several clients have, but you won't get much help from the infrastructure. I would suggest the new Orc JIT APIs instead, as they offer two advantages over MCJIT:</div><div class="gmail_extra"><br></div><div class="gmail_extra">(1) The Orc layers don't take ownership of the IR by default. This means you can retain ownership of the Module and modify it place.</div><div class="gmail_extra"><br></div><div class="gmail_extra">(2) The Orc layers provide a "removeModuleSet" method that enables you to delete the JIT state associated with a particular module (or set of modules) that you have added. This saves you from manually managing multiple MCJIT interfaces.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Some of the functions in "include/llvm/ExecutionEngine/Orc/IndirectionUtils.h" may also be of use to you if you want to partition multi-function modules or use stubs to handle redirecting function calls.</div><div class="gmail_extra"><br></div><div class="gmail_extra">The basic Orc-JIT setup shown in examples/Kaleidoscope/Orc/initial/toy.cpp may help you get up and running with the new APIs if you would like to try them.</div><div class="gmail_extra"><br></div><div class="gmail_extra">I hope this helps!</div><div class="gmail_extra"><br></div><div class="gmail_extra">Cheers,</div><div class="gmail_extra">Lang.</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 26, 2015 at 10:58 PM, Manoel Teixeira <span dir="ltr"><<a href="mailto:mbsteixeira@gmail.com" target="_blank">mbsteixeira@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><br><div> Hello, Lang.</div><div><br></div><div> Do you have news about  <span style="color:rgb(0,0,0);font-family:'Times New Roman'">Modify a module at runtime in MCJIT?</span></div><div><span style="color:rgb(0,0,0);font-family:'Times New Roman'"> We need this feature. Who develops dynamic language like lua, javascript has the same problem.</span></div><div><span style="color:rgb(0,0,0);font-family:'Times New Roman'"><br></span></div><div><span style="color:rgb(0,0,0);font-family:'Times New Roman'"> Cheers,</span></div><div><span style="color:rgb(0,0,0);font-family:'Times New Roman'"> Manoel</span></div></div>
</blockquote></div><br></div></div>