--- a/src/hotspot/share/c1/c1_Runtime1.cpp Sat May 12 17:22:56 2018 +0530
+++ b/src/hotspot/share/c1/c1_Runtime1.cpp Mon May 07 09:11:21 2018 +0200
@@ -641,10 +641,12 @@
}
-JRT_ENTRY(void, Runtime1::throw_range_check_exception(JavaThread* thread, int index))
+JRT_ENTRY(void, Runtime1::throw_range_check_exception(JavaThread* thread, int index, arrayOopDesc* a))
NOT_PRODUCT(_throw_range_check_exception_count++;)
- char message[jintAsStringSize];
- sprintf(message, "%d", index);
+ const int len = 35;
+ assert(len < strlen("Index %d out of bounds for length %d"), "Must allocate more space for message.");
+ char message[2 * jintAsStringSize + len];
+ sprintf(message, "Index %d out of bounds for length %d", index, a->length());
SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), message);
JRT_END