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

[lworld] C2 should not scalarize private inline type buffers

    Details

      Description

      Currently, Unsafe.makePrivateBuffer returns an inline type. As a result, C2 attempts scalarization which leads to incorrect results.

      We need to:
      - Make sure private buffers are never scalarized (also not in safepoints)
      - Be careful when removing redundant allocations to not replace larval buffer allocations by "normal" buffer allocations
      - Make sure the Unsafe.get*/put* operations have an effect
      - Scalarize only after finishPrivateBuffer

      This manifests, for example, with TestIntrinsics when being executed with -XX:DisableIntrinsic=_putInt because the call to Unsafe.putInt has no effect on the scalarized inline type.

      Also, code like this currently crashes C2's typesystem:
          MyValue incrementAndCheckUnsafe() {
              MyValue vt = U.makePrivateBuffer(this);
              U.putInt(vt, X_OFFSET, x + 1);
              U.putInt(vt, Y_OFFSET, y + 1);
              return vt;
          }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                thartmann Tobias Hartmann
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: