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

Kim Barrett kbarrett at openjdk.org
Mon Dec 5 21:41:30 UTC 2022


On Mon, 5 Dec 2022 21:18:18 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

>> Andrew Haley has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Feedback from reviewers
>
> src/hotspot/share/runtime/vmStructs.hpp line 194:
> 
>> 192:     char space[sizeof (typeName)];                                                 \
>> 193:     typeName *dummyObj = (typeName *)space; type* dummy = &dummyObj->fieldName;    \
>> 194:     assert(offset_of(typeName, fieldName) < sizeof(typeName), "Illegal nonstatic struct entry, field offset too large"); \
> 
> I think what this assert is really trying to do is verify that fieldName designates an ordinary data member
> rather than a static data member.  That's probably possible to determine via some metaprogramming
> rather than using `offset_of`.  I'll see if I can come up with something.

The test of an ordinary data member turns out to be pretty simple, but doesn't work here.  Some of the "fieldName" values are not actually data members!  They are "paths to values", like `_data[0]` and `_metadata._klass`.  Oh well.

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

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


More information about the hotspot-dev mailing list