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

Coleen Phillimore coleenp at openjdk.org
Fri Mar 24 18:53:32 UTC 2023


On Fri, 24 Mar 2023 17:59:15 GMT, Justin King <jcking at openjdk.org> wrote:

>> Change uses a few tricks to make most of the data in Bytecodes compile time constant, avoiding the overhead during VM initialization. `Bytecodes:_flags` likely can be made compile time constant as well using `constexpr` tricks, but that is out of scope for this specific PR.
>
> Justin King has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Update definition to match declaration
>   
>   Signed-off-by: Justin King <jcking at google.com>

This seems reasonable.  Some suggested changes.

src/hotspot/share/interpreter/bytecodes.cpp line 32:

> 30: #include "utilities/bytes.hpp"
> 31: 
> 32: #define JVM_BYTECODES(XX)                                                                                                        \

The convention for X macros in the code is usually naming the whole macro {JVM_}BYTECODES_DO and using a lower case argument.  "def" would work and look more consistent than XX.

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] ?

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

Changes requested by coleenp (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/13179#pullrequestreview-1357261883
PR Review Comment: https://git.openjdk.org/jdk/pull/13179#discussion_r1147946356
PR Review Comment: https://git.openjdk.org/jdk/pull/13179#discussion_r1147948241


More information about the hotspot-runtime-dev mailing list