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

[lworld] Unsafe.getValue() and Unsafe.putValue() have expensive lookup code

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • None
    • repo-valhalla
    • hotspot

      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.

            fparain Frederic Parain
            fparain Frederic Parain
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: