<div dir="ltr">Hi,<div><br></div><div>Could someone please explain the idea behind GuaranteedSafepointInterval induced safepoints being gated on InlineCacheBuffer::is_empty() returning false? This code in safepoint.cpp:</div><div><br></div><div><pre class="" style="margin-top:0px;margin-bottom:0px;font-size:11.6999998092651px;color:rgb(0,0,0);line-height:15px"><span id="l479" style="white-space:pre-wrap;display:inline-block;width:1762px;padding:1px 0px;background-color:rgb(240,240,240)">bool SafepointSynchronize::is_cleanup_needed() {</span><a href="http://hg.openjdk.java.net/jdk9/hs-comp/hotspot/file/1aef080fd28d/src/share/vm/runtime/safepoint.cpp#l479" style="text-decoration:none;color:rgb(102,102,102);display:inline-block;width:4em;height:1em"></a>
<span id="l480" style="white-space:pre-wrap;display:inline-block;width:1762px;padding:1px 0px">  // Need a safepoint if some inline cache buffers is non-empty</span><a href="http://hg.openjdk.java.net/jdk9/hs-comp/hotspot/file/1aef080fd28d/src/share/vm/runtime/safepoint.cpp#l480" style="text-decoration:none;color:rgb(102,102,102);display:inline-block;width:4em;height:1em"></a>
<span id="l481" style="white-space:pre-wrap;display:inline-block;width:1762px;padding:1px 0px;background-color:rgb(240,240,240)">  if (!InlineCacheBuffer::is_empty()) return true;</span><a href="http://hg.openjdk.java.net/jdk9/hs-comp/hotspot/file/1aef080fd28d/src/share/vm/runtime/safepoint.cpp#l481" style="text-decoration:none;color:rgb(102,102,102);display:inline-block;width:4em;height:1em"></a>
<span id="l482" style="white-space:pre-wrap;display:inline-block;width:1762px;padding:1px 0px">  return false;</span><a href="http://hg.openjdk.java.net/jdk9/hs-comp/hotspot/file/1aef080fd28d/src/share/vm/runtime/safepoint.cpp#l482" style="text-decoration:none;color:rgb(102,102,102);display:inline-block;width:4em;height:1em"></a>
<span id="l483" style="white-space:pre-wrap;display:inline-block;width:1762px;padding:1px 0px;background-color:rgb(240,240,240)">}</span></pre></div><div><br></div><div>Looking at icBuffer.cpp:</div><div><br></div><div><pre class="" style="margin-top:0px;margin-bottom:0px;font-size:11.6999998092651px;color:rgb(0,0,0);line-height:15px"><span id="l146" style="white-space:pre-wrap;display:inline-block;width:1762px;padding:1px 0px">void InlineCacheBuffer::update_inline_caches() {</span><a href="http://hg.openjdk.java.net/jdk9/hs-comp/hotspot/file/1aef080fd28d/src/share/vm/code/icBuffer.cpp#l146" style="text-decoration:none;color:rgb(102,102,102);display:inline-block;width:4em;height:1em"></a>
<span id="l147" style="white-space:pre-wrap;display:inline-block;width:1762px;padding:1px 0px;background-color:rgb(240,240,240)">  if (buffer()->number_of_stubs() > 1) {</span><a href="http://hg.openjdk.java.net/jdk9/hs-comp/hotspot/file/1aef080fd28d/src/share/vm/code/icBuffer.cpp#l147" style="text-decoration:none;color:rgb(102,102,102);display:inline-block;width:4em;height:1em"></a>
<span id="l148" style="white-space:pre-wrap;display:inline-block;width:1762px;padding:1px 0px">    if (TraceICBuffer) {</span><a href="http://hg.openjdk.java.net/jdk9/hs-comp/hotspot/file/1aef080fd28d/src/share/vm/code/icBuffer.cpp#l148" style="text-decoration:none;color:rgb(102,102,102);display:inline-block;width:4em;height:1em"></a>
<span id="l149" style="white-space:pre-wrap;display:inline-block;width:1762px;padding:1px 0px;background-color:rgb(240,240,240)">      tty->print_cr("[updating inline caches with %d stubs]", buffer()->number_of_stubs());</span><a href="http://hg.openjdk.java.net/jdk9/hs-comp/hotspot/file/1aef080fd28d/src/share/vm/code/icBuffer.cpp#l149" style="text-decoration:none;color:rgb(102,102,102);display:inline-block;width:4em;height:1em"></a>
<span id="l150" style="white-space:pre-wrap;display:inline-block;width:1762px;padding:1px 0px">    }</span><a href="http://hg.openjdk.java.net/jdk9/hs-comp/hotspot/file/1aef080fd28d/src/share/vm/code/icBuffer.cpp#l150" style="text-decoration:none;color:rgb(102,102,102);display:inline-block;width:4em;height:1em"></a>
<span id="l151" style="white-space:pre-wrap;display:inline-block;width:1762px;padding:1px 0px;background-color:rgb(240,240,240)">    buffer()->remove_all();</span><a href="http://hg.openjdk.java.net/jdk9/hs-comp/hotspot/file/1aef080fd28d/src/share/vm/code/icBuffer.cpp#l151" style="text-decoration:none;color:rgb(102,102,102);display:inline-block;width:4em;height:1em"></a>
<span id="l152" style="white-space:pre-wrap;display:inline-block;width:1762px;padding:1px 0px">    init_next_stub();</span><a href="http://hg.openjdk.java.net/jdk9/hs-comp/hotspot/file/1aef080fd28d/src/share/vm/code/icBuffer.cpp#l152" style="text-decoration:none;color:rgb(102,102,102);display:inline-block;width:4em;height:1em"></a>
<span id="l153" style="white-space:pre-wrap;display:inline-block;width:1762px;padding:1px 0px;background-color:rgb(240,240,240)">  }</span><a href="http://hg.openjdk.java.net/jdk9/hs-comp/hotspot/file/1aef080fd28d/src/share/vm/code/icBuffer.cpp#l153" style="text-decoration:none;color:rgb(102,102,102);display:inline-block;width:4em;height:1em"></a>
<span id="l154" style="white-space:pre-wrap;display:inline-block;width:1762px;padding:1px 0px">  release_pending_icholders();</span><a href="http://hg.openjdk.java.net/jdk9/hs-comp/hotspot/file/1aef080fd28d/src/share/vm/code/icBuffer.cpp#l154" style="text-decoration:none;color:rgb(102,102,102);display:inline-block;width:4em;height:1em"></a>
<span id="l155" style="white-space:pre-wrap;display:inline-block;width:1762px;padding:1px 0px;background-color:rgb(240,240,240)">}</span><a href="http://hg.openjdk.java.net/jdk9/hs-comp/hotspot/file/1aef080fd28d/src/share/vm/code/icBuffer.cpp#l155" style="text-decoration:none;color:rgb(102,102,102);display:inline-block;width:4em;height:1em"></a>
<span id="l156" style="white-space:pre-wrap;display:inline-block;width:1762px;padding:1px 0px">What exactly triggers IC holders to be eligible for deletion?</span></pre><pre class="" style="margin-top:0px;margin-bottom:0px;font-size:11.6999998092651px;color:rgb(0,0,0);line-height:15px"><span style="white-space:pre-wrap;display:inline-block;width:1762px;padding:1px 0px"><br></span></pre><pre class="" style="margin-top:0px;margin-bottom:0px;font-size:11.6999998092651px;color:rgb(0,0,0);line-height:15px"><span style="white-space:pre-wrap;display:inline-block;width:1762px;padding:1px 0px">The reason behind this question is I'd like to eliminate "unnecessary" safepoints that I'm seeing, but would like to understand implications of this with respect to compiler infrastructure (C2, specifically).  I have a fairly large code cache reserved, and the # of compiled methods isn't too big, so space there shouldn't be an issue.</span></pre><pre class="" style="margin-top:0px;margin-bottom:0px;font-size:11.6999998092651px;color:rgb(0,0,0);line-height:15px"><span style="white-space:pre-wrap;display:inline-block;width:1762px;padding:1px 0px"><br></span></pre><pre class="" style="margin-top:0px;margin-bottom:0px;font-size:11.6999998092651px;color:rgb(0,0,0);line-height:15px"><span style="white-space:pre-wrap;display:inline-block;width:1762px;padding:1px 0px">Why is GuaranteedSafepointInterval based safepoint actually gated on this particular check? If I turn off background safepoints (i.e. GuaranteedSafepointInterval=0) or set them very far apart, am I risking stability problems, at least in terms of compiler?</span></pre><pre class="" style="margin-top:0px;margin-bottom:0px;font-size:11.6999998092651px;color:rgb(0,0,0);line-height:15px"><span style="white-space:pre-wrap;display:inline-block;width:1762px;padding:1px 0px"><br></span></pre><pre class="" style="margin-top:0px;margin-bottom:0px;font-size:11.6999998092651px;color:rgb(0,0,0);line-height:15px"><span style="white-space:pre-wrap;display:inline-block;width:1762px;padding:1px 0px">Thanks</span></pre></div><div><br></div><div><br></div><div><br></div></div>