RFR: 8344880: AArch64: Add compile time check for class offsets

Chad Rakoczy duke at openjdk.org
Thu Dec 12 18:52:09 UTC 2024


On Fri, 6 Dec 2024 23:57:41 GMT, Chad Rakoczy <duke at openjdk.org> wrote:

> [JDK-8344880](https://bugs.openjdk.org/browse/JDK-8344880)
> 
> Adds compile time checks for str/ldr instructions to verify that the immediate offset will fit. This adds static_assert for constant offsets that are checked at compile time. The macro offset_of is not constexpr so instead the class size is checked. If the size of a class fits into a memory instructions then any offset in it will fit.

I think all immediate offsets should be safe (constant or non-constant) and this addresses the constants.

You're correct the non-constants are the main problem. As for those [JDK-8342736](https://bugs.openjdk.org/browse/JDK-8342736) can be to go through remaining instructions and update. My opinion is that providing a temp register should be required for all non-constant in the event of an overflow. This will guarantee the size always gets checked. Compile when possible and runtime if not.

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

PR Comment: https://git.openjdk.org/jdk/pull/22623#issuecomment-2539768611


More information about the shenandoah-dev mailing list