On Fri, 26 Jun 2026 15:05:03 GMT, Ehsan Behrangi <[email protected]> wrote:
>> src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp line 9427:
>>
>>> 9425: __ emit_int32(1u); // 31^0
>>> 9426:
>>> 9427: __ bind(L_after_table);
>>
>> Use a `for` loop here to generate powers of 31.
>
> Replaced the handwritten power table with a loop using intpow().
I was hoping for something a bit more like this:
uint32_t* pow_table = (uint32_t*) __ pc();
__ code_section()->set_end(address(pow_table + 16));
uint32_t n = 1;
for (int i = 15; i >= 0; i--, n *= 31) {
pow_table[i] = n;
}
which GCC optimizes away almost entirely, leaving just a few stores. Sorry, I
should have been more explicit.
Perhaps more important, though: we don't need 5 copies of the table.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/31674#discussion_r3491812201