-
Bug
-
Resolution: Won't Fix
-
P3
-
repo-valhalla
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
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