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

David Holmes dholmes at openjdk.java.net
Sat Nov 28 13:00:58 UTC 2020


On Fri, 27 Nov 2020 09:30:10 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> Manifests on tier1 test:
>> 
>> $ CONF=linux-x86_64-zero-fastdebug make run-test TEST=runtime/exceptionMsgs/ArrayIndexOutOfBoundsException/
>> test ArrayIndexOutOfBoundsExceptionTest.testAIOOBMessages(): failure
>> java.lang.AssertionError: expected [Index -5 out of bounds for length 0] but found [-5]
>> 
>> Fix does similar thing to what `Runtime1::throw_range_check_exception` does, but using a safer `jio_snprintf`.
>> 
>> Additional testing:
>>  - [x] AIOBB tests on Linux x86_64 Zero fastdebug
>
> Aleksey Shipilev has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Even cleaner, with comments

Marked as reviewed by dholmes (Reviewer).

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.

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

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


More information about the hotspot-runtime-dev mailing list