RFR: 8366341: [BACKOUT] JDK-8365256: RelocIterator should use indexes instead of pointers

Johan Sjölen jsjolen at openjdk.org
Thu Aug 28 11:03:52 UTC 2025


Hi,

 When a null pointer is accessed in SA it's serialized into the null Java object, this in turn causes runtime NPE:s when attempts are made to perform arithmetic on them. As we changed `_immutable_data` to be null when missing, this hits that corner case in the SA.

Example of code which fails:


  public PCDesc getPCDescAt(Address pc) {
    // NOTE: scopesPCsBegin() depends on the value of _immutable_data and will throw NPE if immutable_data is null
    for (Address p = scopesPCsBegin(); p.lessThan(scopesPCsEnd()); p = p.addOffsetTo(pcDescSize)) {
      PCDesc pcDesc = new PCDesc(p);
      if (pcDesc.getRealPC(this).equals(pc)) {
        return pcDesc;
      }
    }
    return null;
  }


There are similar iterators in Hotspot code, they will cause UBSAN to complain instead as we're adding something to a null pointer.

The "real fix" requires a lot of work on the SA side, and we cannot prioritize that. Instead, I'm backing out my changes.

-------------

Commit messages:
 - Revert "8365256: RelocIterator should use indexes instead of pointers"

Changes: https://git.openjdk.org/jdk/pull/26984/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=26984&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8366341
  Stats: 88 lines in 4 files changed: 24 ins; 19 del; 45 mod
  Patch: https://git.openjdk.org/jdk/pull/26984.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/26984/head:pull/26984

PR: https://git.openjdk.org/jdk/pull/26984


More information about the hotspot-compiler-dev mailing list