RFR: 8255737: Zero: DO_UPDATE_INSTRUCTION_COUNT should only update when relevant VM flags are set

Severin Gehwolf sgehwolf at openjdk.java.net
Tue Nov 3 11:22:55 UTC 2020


On Mon, 2 Nov 2020 08:58:56 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> Everywhere else in VM code we effectively do:
> 
>   if (CountBytecodes || TraceBytecodes || StopInterpreterAt) BytecodeCounter::...
>   if (PrintBytecodeHistogram) BytecodeHistogram::...
> 
> But not in `DO_UPDATE_INSTRUCTION_COUNT` macro.
> Adding these flags avoid the writes to statistics what would never be used (and those writes can even contend, afaics).
> This change drops the Linux x86_64 Zero fastdebug build time from ~18m to ~17.5m.
> 
> Testing:
>  - [x] Ad-hoc runs with Zero and affected flags

One nit. Good to go otherwise.

src/hotspot/share/interpreter/zero/bytecodeInterpreter.cpp line 138:

> 136: #define DO_UPDATE_INSTRUCTION_COUNT(opcode)                                                          \
> 137: {                                                                                                    \
> 138:     if (CountBytecodes || TraceBytecodes || StopInterpreterAt) BytecodeCounter::_counter_value++;    \

Elsewhere we do `[...] || StopInterpreterAt > 0` which is clearer as it's a flag expecting an int value. Perhaps you could use that instead of the implicit boolean conversion?

Yes, this doesn't seem consistent throughout the code, but while at it...

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

PR: https://git.openjdk.java.net/jdk/pull/997


More information about the hotspot-runtime-dev mailing list