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

Simplify object pinning interactions with string deduplication

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 21
    • 21
    • hotspot
    • None
    • gc
    • b06

      When raw char* String contents are exposed to JNI code, we

      1. Load the string.value and pin it
      2. Run native code
      3. Load the string.value and unpin it

      Given this sequence we would be in trouble if between 1 and 3, string deduplication changed the value object. Then the pinning and unpinning wouldn't be balanced.

      The current approach for dealing with this is to have a bunch of code to guard against deduplication. An alternative simpler solution is to just change step 3 to pass in the same value. We already have enough information available to do that. Then the pinning and unpinning is also balanced, and we don't need to have any special interactions with string deduplication and can decouple these orthogonal concerns.

            eosterlund Erik Ă–sterlund
            eosterlund Erik Ă–sterlund
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: