RFR: 8256726: Zero: print proper message in ArrayIndexOutOfBoundException [v3]

Aleksey Shipilev shade at openjdk.java.net
Sat Nov 28 13:58:58 UTC 2020


On Sat, 28 Nov 2020 12:58:14 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Aleksey Shipilev has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Even cleaner, with comments
>
> src/hotspot/share/interpreter/zero/bytecodeInterpreter.cpp line 1377:
> 
>> 1375:       jint     index  = STACK_INT(arrayOff + 1);                               \
>> 1376:       const int add_len = 32;                                                  \
>> 1377:       STATIC_ASSERT(add_len == strlen("Index  out of bounds for length "));    \
> 
> The double-space there is a bit subtle. I'm not sure static_asserting the length of a different string literal really aids the reader here at all. A simple comment would have sufficed in my view.

I think it captures the intent well enough. The code in `Runtime1` uses a similar assert, and it helped me to get the gist of the "35" as the length. So, I prefer to static assert it here.

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

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


More information about the hotspot-runtime-dev mailing list