RFR: JDK-8294902: Undefined Behavior in C2 regalloc with null references [v7]

Kim Barrett kbarrett at openjdk.org
Mon Dec 12 15:34:49 UTC 2022


On Mon, 12 Dec 2022 13:59:00 GMT, Andrew Haley <aph at openjdk.org> wrote:

>> Andrew Haley has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Align temp buffer used by offset_of().
>
> src/hotspot/share/utilities/globalDefinitions_gcc.hpp line 151:
> 
>> 149: #define offset_of(klass,field)                          \
>> 150: []() {                                                  \
>> 151:   char space[sizeof (klass)] ATTRIBUTE_ALIGNED(16);     \
> 
> So I aligned this, and it constant folds everything nicely.
> I have a nagging worry in the back of my mind that on some platforms this might be over-aligned, which would be another instancde of unspecified behaviour, but i don't think we have any supported targets where this might be a problem.

Is 16 over-aligned on 32bit platforms?  Too bad https://git.openjdk.org/jdk/pull/11446 isn't approved yet, else you could use `alignas(std::max_align_t)`.  (I wouldn't object if you were forward-looking here, though can't speak for anyone else.)

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

PR: https://git.openjdk.org/jdk/pull/10920


More information about the hotspot-dev mailing list