RFR: 8345159: RISCV: Fix -Wzero-as-null-pointer-constant warning in emit_static_call_stub
Kim Barrett
kbarrett at openjdk.org
Fri Nov 29 17:08:38 UTC 2024
On Fri, 29 Nov 2024 08:48:42 GMT, Robbin Ehn <rehn at openjdk.org> wrote:
> > > Change is okay and I sanity tested, all ok.
Thanks.
> In this particular case we really want to generate code which moves the address **0** into a register. Hence your fix is good as you avoid nullptr by using movptr2. But my concerns was this may not always be possible.
Actually, we want to generate code which moves the address **don't care** into
a register, planning to patch the address with the correct value later.
Looking at how patching is done, we could use any value at all here, as the
patching overwrites whatever it finds.
A different approach that I think also works is to change the literal 0 to
`(address)uint(0)` so we're not casting a "literal 0".
I think using movptr2 directly rather than sticking with movptr with one of
the above adjustments is better. But this code belongs to you folks, so
whatever you think is best.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/22435#issuecomment-2508165768
More information about the hotspot-compiler-dev
mailing list