RFR: JDK-8304884: Update Bytecodes data to be mostly compile time constants [v2]

David Holmes dholmes at openjdk.org
Mon Mar 27 01:28:29 UTC 2023


On Fri, 24 Mar 2023 22:55:29 GMT, Justin King <jcking at openjdk.org> wrote:

>> src/hotspot/share/interpreter/bytecodes.cpp line 334:
>> 
>>> 332: };
>>> 333: 
>>> 334: jchar Bytecodes::_flags[(1<<BitsPerByte)*2];
>> 
>> Why is this not _flags[Bytecodes::number_of_codes] ?
>
> It should probably be `Bytecodes::number_of_codes * 2`. Two entry per byte-code. One for the normal format and one for wide. Wasn't sure if it was safe or some code was relying on there being exactly 512 entries even if bytecode count is less than 256.

When this was put in (JDK-6939207) the flags were arranged so that the two forms were at index N and N+256 rather than index N and N+number_of_codes. That seems to remain the case today - just grep for `1<<BitsPerByte`

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13179#discussion_r1148699447


More information about the hotspot-runtime-dev mailing list