The recent fix (JDK-8348215) to Unsafe code calls find_field_from_offset() which is an expensive search we don't want in a frequently used Unsafe method. The solution to avoid this is to provide a way for Unsafe to get the layout of a field/array so it can pass it to the getValue()/putValue() methods to avoid the costly lookup. This is the same approach as for the "offset" argument.
But changing prototypes of getValue()/putValue() would immediately break all Java code using those methods, including VarHandle code and substitutability test code. So the solution is to provide two new methods: getFlatValue() and putFlatValue() with the new prototype and implementation, to allow an incremental migration of the Java code. Once the migration competed, getValue() and putValue() would be removed from the Unsafe class.
But changing prototypes of getValue()/putValue() would immediately break all Java code using those methods, including VarHandle code and substitutability test code. So the solution is to provide two new methods: getFlatValue() and putFlatValue() with the new prototype and implementation, to allow an incremental migration of the Java code. Once the migration competed, getValue() and putValue() would be removed from the Unsafe class.
- duplicates
-
JDK-8341760 Revisit/redesign Unsafe accesses to flat fields
-
- Closed
-
-
JDK-8341768 Revisit/redesign Unsafe accesses to new flat arrays
-
- Closed
-
- links to
-
Commit(lworld) openjdk/valhalla/4d7ba024
-
Review(lworld) openjdk/valhalla/1336