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

Albert Mingkun Yang ayang at openjdk.org
Thu Aug 28 11:11:41 UTC 2025


On Thu, 28 Aug 2025 10:59:06 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:

> 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.

Marked as reviewed by ayang (Reviewer).

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

PR Review: https://git.openjdk.org/jdk/pull/26984#pullrequestreview-3164399186


More information about the hotspot-compiler-dev mailing list