RFR: 8367406: Simple refactoring AOTCodeAddressTable::id_for_address

Hamlin Li mli at openjdk.org
Thu Sep 11 12:29:48 UTC 2025


On Thu, 11 Sep 2025 11:04:54 GMT, Francesco Andreuzzi <fandreuzzi at openjdk.org> wrote:

>> Hi,
>> Can you help to review this simple refactoring?
>> 
>> AOTCodeAddressTable::id_for_address currently is implemented in a way that introduce too many nested if/else, seems we could make the code more readable by removing these nested if/else. But it's quite subjective, so I'll let you tell if the patch is helpful.
>> 
>> Run tests (test/hotspot/jtreg/runtime/cds/appcds/aot*), no new failures on x64.
>> 
>> Thanks!
>
> src/hotspot/share/code/aotCodeCache.cpp line 1685:
> 
>> 1683:       desc = StubCodeDesc::desc_for(addr + frame::pc_return_offset);
>> 1684:     }
>> 1685:     const char* sub_name = (desc != nullptr) ? desc->name() : "<unknown>";
> 
> This seems to be used only in the assertion, maybe it could be hidden behind a `#ifdef ASSERT`?

I assume the compiler will remove it in product version, as the sub_name is not used anywhere else, and there is no side effect of its generation.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27217#discussion_r2340594415


More information about the hotspot-compiler-dev mailing list