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

[lworld] Unsafe support for flattened field of value type

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Won't Fix
    • Affects Version/s: repo-valhalla
    • Fix Version/s: repo-valhalla
    • Component/s: hotspot
    • Labels:

      Description

      Unsafe::getObjectXXX does not work for flattened field of value type.

      See attached test case.

      $ cat Main.java
      import java.lang.reflect.Field;

      public class Main {
          public static void main(String... args) throws Throwable {
              Line l = Line.makeLine(1,2,3,4);
              for (Field f : Line.class.getDeclaredFields()) {
                  System.out.println(f.getName() + " = " + f.get(l));
              }
          }
      }

      Unsafe::getObjectVolatile returns null when accessing a field of value type. Similarly MethodHandle::invoke also fails.

      Stack: [0x0000000104c40000,0x0000000104d40000], sp=0x0000000104d3f640, free space=1021k
      Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
      V [libjvm.dylib+0xb8bd22] oopDesc::is_oop(oop, bool)+0x80
      V [libjvm.dylib+0x836483] JNIHandles::make_local(JNIEnv_*, oop)+0x6d
      V [libjvm.dylib+0xd9968b] Unsafe_GetObjectVolatile(JNIEnv_*, _jobject*, _jobject*, long)+0x15b
      j jdk.internal.misc.Unsafe.getObjectVolatile(Ljava/lang/Object;J)Ljava/lang/Object;+0 java.base

        Attachments

          Activity

            People

            • Assignee:
              fparain Frederic Parain
              Reporter:
              mchung Mandy Chung
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: