<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi Christian<br>
    <br>
    Your use case seems to have similar requirements as remote JITing in
    ORC. So far I haven't used that part myself and I am sure Lang can
    tell you much more about it. However, this comment on the
    RemoteObjectClientLayer class sounds promising for your questions
    (1) and (2):<br>
    <br>
    /// Sending relocatable objects to the server (rather than fully
    relocated<br>
    /// bits) allows JIT'd code to be cached on the server side and
    re-used in<br>
    /// subsequent JIT sessions.<br>
    <br>
    There are a few tests here that illustrate its usage:<br>
<a class="moz-txt-link-freetext" href="https://github.com/llvm-mirror/llvm/blob/master/unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp">https://github.com/llvm-mirror/llvm/blob/master/unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp</a><br>
    <br>
    Note that it still uses LegacyJITSymbolResolver, so I guess it may
    change any time soon.<br>
    <br>
    Hope it helps for the time being.<br>
    Cheers, Stefan<br>
    <br>
    <div class="moz-cite-prefix">Am 05.11.18 um 19:44 schrieb Christian
      Schafmeister via llvm-dev:<br>
    </div>
    <blockquote type="cite"
cite="mid:CABk4j8dXv=paDbnaeJB6x6NrMVNtZqfOcgk+8T-XK9JAGV6Mug@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=utf-8">
      <div dir="ltr">I think I found the answer to #3 and #4.
        <div>(a) I overloaded the
          SectionMemoryManager::finalizeMemory(...) method. </div>
        <div>(b) I first call the base classes method (maybe not
          necessary).</div>
        <div>(c) At this point the __llvm_stackmaps section that I saved
          in thread local memory when allocateDataSection was called
          appears to be fully set up and relocated.</div>
        <div><br>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr">On Mon, Nov 5, 2018 at 12:36 PM Christian
          Schafmeister <<a href="mailto:meister@temple.edu"
            moz-do-not-send="true">meister@temple.edu</a>> wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <div dir="ltr">
            <div dir="ltr">
              <div>I have a few questions about the new ORC JIT.</div>
              <div><br>
              </div>
              <div>I saw Lang Hames (hi!) excellent talk at the llvm-dev
                meeting a few weeks ago. The ORC JIT is undergoing some
                API changes and I'd like/need to take advantage of them.</div>
              <div><br>
              </div>
              <div>(1) How do I take ownership of the ObjectFile once
                the ORC JIT has created it?</div>
              <div>    I'd like to take ownership of object files
                generated by the ORC JIT so that I can save them to disk
                and in later sessions reload them.</div>
              <div>(2) How would I pass an ObjectFile saved in
                question#1 back to ORC so that it will relocate it and
                generate function pointers?</div>
              <div>(3) How do I get access to the relocated ObjectFile
                sections?</div>
              <div>    Currently I subclass SectionMemoryManager and
                implement allocateDataSection(...)</div>
              <div>    I can get the memory for the "__llvm_stackmaps"
                section - but I don't know when/if the contents have
                been fully set up with relocated function pointers.</div>
              <div>(4) For the "__llvm_stackmaps" section - will I need
                to do any relocation to obtain the function pointers?</div>
              <div><br>
              </div>
              <div>Background:</div>
              <div>I'm using llvm.experimental.stackmaps to register one
                variable in each stack frame that contains spilled
                register arguments.</div>
              <div>I've figured out how to get access to the stackmaps
                for code that I load into my system from dynamic
                libraries that our compiler generates.</div>
              <div>The answers to questions above will help me get
                access to the stackmaps from ORC JITted code.</div>
              <div><br>
              </div>
              -- <br>
              <div dir="ltr"
                class="m_5097034966196357672gmail_signature">
                <div dir="ltr">
                  <div style="font-size:small">Christian Schafmeister</div>
                  <div style="font-size:small">Professor, Chemistry
                    Department</div>
                  <div style="font-size:small">Temple University</div>
                </div>
              </div>
            </div>
          </div>
        </blockquote>
      </div>
      <br clear="all">
      <div><br>
      </div>
      -- <br>
      <div dir="ltr" class="gmail_signature"
        data-smartmail="gmail_signature">
        <div dir="ltr">
          <div style="font-size:small">Christian Schafmeister</div>
          <div style="font-size:small">Professor, Chemistry Department</div>
          <div style="font-size:small">Temple University</div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
<a class="moz-txt-link-freetext" href="https://weliveindetail.github.io/blog/">https://weliveindetail.github.io/blog/</a>
<a class="moz-txt-link-freetext" href="https://cryptup.org/pub/stefan.graenitz@gmail.com">https://cryptup.org/pub/stefan.graenitz@gmail.com</a></pre>
  </body>
</html>