RFR: 8364360: Defining hidden class with no room in constant pool crashes the VM [v2]

David Holmes dholmes at openjdk.org
Tue Oct 28 03:48:00 UTC 2025


On Mon, 27 Oct 2025 12:21:28 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> src/hotspot/share/classfile/classFileParser.cpp line 5528:
>> 
>>> 5526:     cp_size++;
>>> 5527:     // Check for overflow.  cp_size is a u2.
>>> 5528:     precond(sizeof(cp_size) == sizeof(u2));
>> 
>> Why do you need to assert this given `u2 cp_size = ...` is the declaration?
>
> In case somebody changes it to int.  There used to be talk about doing this so then the overflow check might have to be different.

Hmm ... then I would prefer simply:

// Don't change the type of cp_size without updating the overflow
// check below.
u2 cp_size = ...;

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27964#discussion_r2467790726


More information about the hotspot-runtime-dev mailing list