Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8287550

Improve stack bang sp update granularity

    XMLWordPrintable

Details

    • 19
    • generic
    • generic

    Description

      file this on hehalf of xiangyuan@tencent.com

      https://bugs.openjdk.java.net/browse/JDK-8072070 has optimzied stack bang performance. In this optimization when the sp is below than growth watermark, the value of sp will set as growth watermark directly. In fact, when the sp remains in the same page, the n_shadow_pages pages below sp are all banged. Therefore, sp can be aligned to page boundary first, and set the aligned value to growth watermark, it will likely save some unnecessary growth watermark saving operations and stack banging.

      test Xint with following recursive example, both x86-64 and aarch64 show improvements up to 50%.

        @Param({"128",  "256", "512", "1024"})
        public int depth = 0;
        @Param({"1", "10", "100", "1000"})
        public int count = 0;

        @Benchmark
        public void testStackBang() throws Exception {
          Thread thread = new Thread(new Runnable() {
            public void run() {
              for (int i = 0;i < count; i++) {
                recursive(depth);
              }
            }
          });
          thread.start();
          thread.join();
        }

        private void recursive(int i) {
          if (i == 0) {
            return;
          }
          recursive(i - 1);
        }

      Attachments

        Issue Links

          Activity

            People

              hshi Hui Shi
              hshi Hui Shi
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: