2021-02-02 11:40:07 +08:00
|
|
|
From 9aafe43836f718794f223e1484d20961a2858fc8 Mon Sep 17 00:00:00 2001
|
|
|
|
|
Date: Fri, 22 Jan 2021 11:31:40 +0800
|
|
|
|
|
Subject: Backport of JDK-8194246
|
2020-01-20 12:09:52 +08:00
|
|
|
|
|
|
|
|
summary: JVM crashes when calling getStackTrace if stack contains a method that is a member of a very large class
|
|
|
|
|
LLT:
|
|
|
|
|
Bug url: https://bugs.openjdk.java.net/browse/JDK-8194246
|
|
|
|
|
---
|
|
|
|
|
hotspot/src/share/vm/classfile/javaClasses.cpp | 12 ++++++------
|
|
|
|
|
1 file changed, 6 insertions(+), 6 deletions(-)
|
|
|
|
|
|
|
|
|
|
diff --git a/hotspot/src/share/vm/classfile/javaClasses.cpp b/hotspot/src/share/vm/classfile/javaClasses.cpp
|
2021-02-02 11:40:07 +08:00
|
|
|
index a6a452ff3..97a10ac02 100644
|
2020-01-20 12:09:52 +08:00
|
|
|
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp
|
|
|
|
|
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp
|
2021-02-02 11:40:07 +08:00
|
|
|
@@ -1454,9 +1454,9 @@ class BacktraceBuilder: public StackObj {
|
2020-01-20 12:09:52 +08:00
|
|
|
method = mhandle();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- _methods->short_at_put(_index, method->orig_method_idnum());
|
|
|
|
|
+ _methods->ushort_at_put(_index, method->orig_method_idnum());
|
|
|
|
|
_bcis->int_at_put(_index, merge_bci_and_version(bci, method->constants()->version()));
|
|
|
|
|
- _cprefs->short_at_put(_index, method->name_index());
|
|
|
|
|
+ _cprefs->ushort_at_put(_index, method->name_index());
|
|
|
|
|
|
|
|
|
|
// We need to save the mirrors in the backtrace to keep the class
|
|
|
|
|
// from being unloaded while we still have this stack trace.
|
2021-02-02 11:40:07 +08:00
|
|
|
@@ -1573,10 +1573,10 @@ void java_lang_Throwable::print_stack_trace(oop throwable, outputStream* st) {
|
2020-01-20 12:09:52 +08:00
|
|
|
Handle mirror(THREAD, mirrors->obj_at(index));
|
|
|
|
|
// NULL mirror means end of stack trace
|
|
|
|
|
if (mirror.is_null()) goto handle_cause;
|
|
|
|
|
- int method = methods->short_at(index);
|
|
|
|
|
+ int method = methods->ushort_at(index);
|
|
|
|
|
int version = version_at(bcis->int_at(index));
|
|
|
|
|
int bci = bci_at(bcis->int_at(index));
|
|
|
|
|
- int cpref = cprefs->short_at(index);
|
|
|
|
|
+ int cpref = cprefs->ushort_at(index);
|
|
|
|
|
print_stack_element(st, mirror, method, version, bci, cpref);
|
|
|
|
|
}
|
|
|
|
|
result = objArrayHandle(THREAD, objArrayOop(result->obj_at(trace_next_offset)));
|
2021-02-02 11:40:07 +08:00
|
|
|
@@ -1869,10 +1869,10 @@ oop java_lang_Throwable::get_stack_trace_element(oop throwable, int index, TRAPS
|
2020-01-20 12:09:52 +08:00
|
|
|
|
|
|
|
|
assert(methods != NULL && bcis != NULL && mirrors != NULL, "sanity check");
|
|
|
|
|
|
|
|
|
|
- int method = methods->short_at(chunk_index);
|
|
|
|
|
+ int method = methods->ushort_at(chunk_index);
|
|
|
|
|
int version = version_at(bcis->int_at(chunk_index));
|
|
|
|
|
int bci = bci_at(bcis->int_at(chunk_index));
|
|
|
|
|
- int cpref = cprefs->short_at(chunk_index);
|
|
|
|
|
+ int cpref = cprefs->ushort_at(chunk_index);
|
|
|
|
|
Handle mirror(THREAD, mirrors->obj_at(chunk_index));
|
|
|
|
|
|
|
|
|
|
// Chunk can be partial full
|
|
|
|
|
--
|
2021-02-02 11:40:07 +08:00
|
|
|
2.19.0
|
2020-01-20 12:09:52 +08:00
|
|
|
|