<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Man,<div class=""><br class=""></div><div class="">Thank you for your proposal. The runtime is the correct team.</div><div class=""><br class=""></div><div class="">Could you please file an rfe under hotspot/runtime with the information below and the patch as well as any</div><div class="">tests you have run and any performance results you have?</div><div class=""><br class=""></div><div class="">That will help us track this information and find you a sponsor.</div><div class=""><br class=""></div><div class="">thanks,</div><div class="">Karen<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Jul 18, 2018, at 9:53 PM, Man Cao <<a href="mailto:manc@google.com" class="">manc@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">Hello,</div><div class=""><br class=""></div><div class="">The Java platform team at Google has maintained a local patch to inline os::SpinPause() since 2014. We would like to upstream this patch to OpenJDK. Could someone sponsor this patch?</div><div class=""><br class=""></div><div class="">It is difficult to demonstrate performance improvement in Java benchmarks. It is more of a code refactoring to better utilize modern GCC. It partly addresses the comment about inlining SpinPause() above its declaration in os.hpp.</div><div class="">I found an interesting discussion about PAUSE and a microbenchmark in:<br class=""></div><div class=""><a href="http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2012-August/004352.html" target="_blank" class="">http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2012-August/004352.html</a><br class=""></div><div class="">However, the microbenchmark has a large variance in our experiment, making it difficult to tell if there's any benefit from inlining PAUSE. Inlining PAUSE does seem to reduce the variance a bit.</div><div class=""><br class=""></div><div class="">The patch is inlined and attached below:</div><div class=""><br class=""></div><div class=""><div class="">diff --git a/src/hotspot/os_cpu/bsd_x86/bsd_x86_32.s b/src/hotspot/os_cpu/bsd_x86/bsd_x86_32.s<br class=""></div><div class="">--- a/src/hotspot/os_cpu/bsd_x86/bsd_x86_32.s</div><div class="">+++ b/src/hotspot/os_cpu/bsd_x86/bsd_x86_32.s</div><div class="">@@ -63,15 +63,6 @@</div><div class="">         popl     %eax</div><div class="">         ret</div><div class=""> </div><div class="">-        .globl  SYMBOL(SpinPause)</div><div class="">-        ELF_TYPE(SpinPause,@function)</div><div class="">-        .p2align 4,,15</div><div class="">-SYMBOL(SpinPause):</div><div class="">-        rep</div><div class="">-        nop</div><div class="">-        movl    $1, %eax</div><div class="">-        ret</div><div class="">-</div><div class="">         # Support for void Copy::conjoint_bytes(void* from,</div><div class="">         #                                       void* to,</div><div class="">         #                                       size_t count)</div><div class="">diff --git a/src/hotspot/os_cpu/bsd_x86/bsd_x86_64.s b/src/hotspot/os_cpu/bsd_x86/bsd_x86_64.s</div><div class="">--- a/src/hotspot/os_cpu/bsd_x86/bsd_x86_64.s</div><div class="">+++ b/src/hotspot/os_cpu/bsd_x86/bsd_x86_64.s</div><div class="">@@ -46,15 +46,6 @@</div><div class=""> </div><div class=""> <span style="white-space:pre" class="">      </span>.text</div><div class=""> </div><div class="">-        .globl SYMBOL(SpinPause)</div><div class="">-        .p2align 4,,15</div><div class="">-        ELF_TYPE(SpinPause,@function)</div><div class="">-SYMBOL(SpinPause):</div><div class="">-        rep</div><div class="">-        nop</div><div class="">-        movq   $1, %rax</div><div class="">-        ret</div><div class="">-</div><div class="">         # Support for void Copy::arrayof_conjoint_bytes(void* from,</div><div class="">         #                                               void* to,</div><div class="">         #                                               size_t count)</div><div class="">diff --git a/src/hotspot/os_cpu/linux_x86/linux_x86_32.s b/src/hotspot/os_cpu/linux_x86/linux_x86_32.s</div><div class="">--- a/src/hotspot/os_cpu/linux_x86/linux_x86_32.s</div><div class="">+++ b/src/hotspot/os_cpu/linux_x86/linux_x86_32.s</div><div class="">@@ -42,15 +42,6 @@</div><div class=""> </div><div class=""> <span style="white-space:pre" class="">        </span>.text</div><div class=""> </div><div class="">-        .globl  SpinPause</div><div class="">-<span style="white-space:pre" class="">     </span>.type   SpinPause,@function</div><div class="">-        .p2align 4,,15</div><div class="">-SpinPause:</div><div class="">-        rep</div><div class="">-        nop</div><div class="">-        movl    $1, %eax</div><div class="">-        ret</div><div class="">-</div><div class="">         # Support for void Copy::conjoint_bytes(void* from,</div><div class="">         #                                       void* to,</div><div class="">         #                                       size_t count)</div><div class="">diff --git a/src/hotspot/os_cpu/linux_x86/linux_x86_64.s b/src/hotspot/os_cpu/linux_x86/linux_x86_64.s</div><div class="">--- a/src/hotspot/os_cpu/linux_x86/linux_x86_64.s</div><div class="">+++ b/src/hotspot/os_cpu/linux_x86/linux_x86_64.s</div><div class="">@@ -38,15 +38,6 @@</div><div class=""> </div><div class=""> <span style="white-space:pre" class="">  </span>.text</div><div class=""> </div><div class="">-        .globl SpinPause</div><div class="">-        .align 16</div><div class="">-        .type  SpinPause,@function</div><div class="">-SpinPause:</div><div class="">-        rep</div><div class="">-        nop</div><div class="">-        movq   $1, %rax</div><div class="">-        ret</div><div class="">-</div><div class="">         # Support for void Copy::arrayof_conjoint_bytes(void* from,</div><div class="">         #                                               void* to,</div><div class="">         #                                               size_t count)</div><div class="">diff --git a/src/hotspot/os_cpu/solaris_x86/solaris_x86_64.s b/src/hotspot/os_cpu/solaris_x86/solaris_x86_64.s</div><div class="">--- a/src/hotspot/os_cpu/solaris_x86/solaris_x86_64.s</div><div class="">+++ b/src/hotspot/os_cpu/solaris_x86/solaris_x86_64.s</div><div class="">@@ -51,15 +51,6 @@</div><div class="">         movq %fs:0x0,%rax</div><div class="">         ret</div><div class=""> </div><div class="">-        .globl  SpinPause</div><div class="">-        .align  16</div><div class="">-SpinPause:</div><div class="">-        rep</div><div class="">-        nop</div><div class="">-        movq    $1, %rax</div><div class="">-        ret</div><div class="">-</div><div class="">-</div><div class="">         / Support for void Copy::arrayof_conjoint_bytes(void* from,</div><div class="">         /                                               void* to,</div><div class="">         /                                               size_t count)</div><div class="">diff --git a/src/hotspot/share/runtime/os.hpp b/src/hotspot/share/runtime/os.hpp</div><div class="">--- a/src/hotspot/share/runtime/os.hpp</div><div class="">+++ b/src/hotspot/share/runtime/os.hpp</div><div class="">@@ -1031,6 +1031,13 @@</div><div class=""> // of the global SpinPause() with C linkage.</div><div class=""> // It'd also be eligible for inlining on many platforms.</div><div class=""> </div><div class="">+#if defined(X86) && !defined(_WINDOWS)</div><div class="">+extern "C" int inline SpinPause() {</div><div class="">+  __asm__ __volatile__ ("pause");</div><div class="">+  return 1;</div><div class="">+}</div><div class="">+#else</div><div class=""> extern "C" int SpinPause();</div><div class="">+#endif</div><div class=""> </div><div class=""> #endif // SHARE_VM_RUNTIME_OS_HPP</div></div><div class=""><br class=""></div><div class="">-Man<br class=""></div></div>
<span id="cid:f_jjrvy2sw0"><inline_spinpause.patch></span></div></blockquote></div><br class=""></div></body></html>