<div dir="ltr">Hi Philip, are there any C++ APIs to generate the llvm statepoint instructions? I didn't found APIs similar to how to generate gcroot instructions.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Oct 21, 2019 at 2:03 PM Yafei Liu <<a href="mailto:yfliu@mobvoi.com">yfliu@mobvoi.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Thanks Philip,  I'll keep investigating.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Oct 21, 2019 at 9:52 AM Philip Reames <<a href="mailto:listmail@philipreames.com" target="_blank">listmail@philipreames.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF">
    <p>Correct, with a couple of nit picks.</p>
    <p>Relocation isn't an optimization the collector performs.  It's a
      key primitive the collector is built upon.  Being unable to
      relocate is not an allowed state.  (i.e. pinning can't be required
      by the compiler)</p>
    <p>When you talk about variables, that's true for the *source*
      language and for the *abstract* machine before lowering.  After
      lowering from the abstract machine, relocations are represented in
      the IR explicitly as an entirely new set of defs.</p>
    <p>Philip<br>
    </p>
    <div>On 10/20/19 6:40 PM, Yafei Liu wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">Correct me if I'm wrong:
        <div>Relocation in this conversation "relocation" means GC
          trying to move objects in the heap for optimization (make the
          data more impact for bigger room for example), this move is
          invisible to a programmer, and if a compiler support to
          " relocate objects directly reachable from running code", a
          variable (Foo foo) may points to a different address after a
          GC happens, while a programmer could still use the name foo in
          the code as if nothing happened.</div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Sun, Oct 20, 2019 at 4:35
          AM Philip Reames via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div bgcolor="#FFFFFF">
            <p>Exactly this.  (As the person who wrote the line in
              question.)  <br>
            </p>
            <div>On 10/18/19 8:50 AM, Hiroshi Yamauchi via llvm-dev
              wrote:<br>
            </div>
            <blockquote type="cite">
              <div dir="ltr">
                <div class="gmail_default" style="font-family:arial,helvetica,sans-serif">I think
                  it's referring to a "moving" garbage collector (as
                  opposed to a "non-moving" garbage collector that never
                  moves/relocates objects.) The difference is that for a
                  moving one, all pointers need to be tracked and
                  potentially updated, whereas for a non-moving one,
                  it's sufficient that at least one pointer to a live
                  object is seen (when there may be other pointers to
                  the same object elsewhere) for correctness.</div>
              </div>
              <br>
              <div class="gmail_quote">
                <div dir="ltr" class="gmail_attr">On Fri, Oct 18, 2019
                  at 2:12 AM Yafei Liu via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>>
                  wrote:<br>
                </div>
                <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
                  <div dir="ltr">
                    <p>Hi all,</p>
                    <p>I'm investigating on integrating a gc to my llvm
                      project, and when I read <a href="http://llvm.org/docs/Statepoints.html" rel="nofollow noreferrer" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit;color:rgb(0,89,153)" target="_blank">this
                        document</a>, one sentence confused me:</p>
                    <blockquote>
                      <p style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit;clear:both">However,
                        for a collector which wishes to relocate objects
                        directly reachable from running code, a higher
                        standard is required.</p>
                    </blockquote>
                    <p>I don't understand what the move "relocate
                      objects directly reachable from running code"
                      trying to do.</p>
                    <p>For my information, the concept "relocate" means
                      the gc pointer refereed to a new location of an
                      object, for example:</p>
                    <p>in Java:</p>
                    <pre style="margin-top:0px;margin-bottom:1em;padding:12px 8px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:inherit;line-height:inherit;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;font-size:13px;vertical-align:baseline;box-sizing:inherit;width:auto;max-height:600px;overflow:auto;background-color:rgb(239,240,241);border-radius:3px;color:rgb(36,39,41)"><code style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;vertical-align:baseline;box-sizing:inherit;white-space:inherit">Foo foo = new Foo();

foo = new Foo(); // ---> a relocation happens
</code></pre>
                    <p>So can anyone explain what the "relocate objects
                      directly reachable from running code" trying to
                      do?</p>
                  </div>
                  _______________________________________________<br>
                  LLVM Developers mailing list<br>
                  <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
                  <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
                </blockquote>
              </div>
              <br>
              <fieldset></fieldset>
              <pre>_______________________________________________
LLVM Developers mailing list
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
            </blockquote>
          </div>
          _______________________________________________<br>
          LLVM Developers mailing list<br>
          <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
          <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
        </blockquote>
      </div>
    </blockquote>
  </div>

</blockquote></div>
</blockquote></div>