RFR: 8352426: RelocIterator should correctly handle nullptr address of relocation data

Boris Ulasevich bulasevich at openjdk.org
Tue Mar 25 13:58:16 UTC 2025


On Tue, 25 Mar 2025 01:57:48 GMT, Dean Long <dlong at openjdk.org> wrote:

> instead of the more modern range-for loop

@dean-long 
Let's look at this code. Would it be better with a for loop?


    RelocIterator iter(nm, instruction_address(), next_instruction_address());
    while (iter.next()) {
      if (iter.type() == relocInfo::oop_type) {
        oop* oop_addr = iter.oop_reloc()->oop_addr();
        *oop_addr = cast_to_oop(x);
        break;
      } else if (iter.type() == relocInfo::metadata_type) {
        Metadata** metadata_addr = iter.metadata_reloc()->metadata_addr();
        *metadata_addr = (Metadata*)x;
        break;
      }
    }

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

PR Comment: https://git.openjdk.org/jdk/pull/24203#issuecomment-2751347913


More information about the hotspot-compiler-dev mailing list