[lworld] Calling convention - repair C1 stack

XMLWordPrintable

    • Type: Sub-task
    • Resolution: Fixed
    • Priority: P4
    • repo-valhalla
    • Affects Version/s: repo-valhalla
    • Component/s: hotspot
    • None

      See http://cr.openjdk.java.net/~thartmann/talks/2019-ValueType_Optimizations.pdf

      The verified_entry and verified_value_ro_entry of a C1-compiled method may need to extend the stack. On x64, this happens when some incoming scalarized parameters are passed in XMM registers. E.g.,

          static value class FloatPoint {
              final float x;
              final float y;
              public FloatPoint(float x, float y) {
                  this.x = x;
                  this.y = y;
              }
          }
          @ForceCompile(compLevel = C1)
          private static float test43_helper(FloatPoint fp, int a1, int a2, int a3, int a4, int a5, int a6) {
              // On x64:
              // Scalarized entry -- all parameters are passed in registers
              // Non-scalarized entry -- a6 is passed on stack[0]
              return fp.x + fp.y + a1 + a2 + a3 + a4 + a5 + a6;
          }

      We need to save the stack extension amount (0x10 bytes in this case) in the stack, and change the return code sequence from

         pop %rbp
         retq

      to this:

          mov 0x10(%rsp),%rbp ; restore rbp
          add 0x8(%rsp),%rsp ; repair stack
          retq

            Assignee:
            Ioi Lam
            Reporter:
            Ioi Lam
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: