With the introduction of flat arrays, it is strongly recommended to not use the method objArrayOop->obj_at(int) anymore. When this method is called with a flat array, the JVM has to buffer the element before returning it, which means performing an allocation in the Java heap, which can trigger an OOM. The method has no way to handle this OOM situation and would simply crash the whole JVM.
The recommended fixes are:
- use objArrayOop->obj_at(int, TRAPS) instead and add handling of a potential OOM error
- or ensure and enforce that the code is operating on non-flat arrays, by using refArrayKlass/refArrayOop types and calling refArrayOop->obj_at(int)
The backtrace builder code uses the problematic objArrayOop->obj_at(int) in the following methods:
typeArrayOop BacktraceBuilder::get_methods(objArrayHandle chunk);
typeArrayOop BacktraceBuilder::get_bcis(objArrayHandle chunk);
objArrayOop BacktraceBuilder::get_mirrors(objArrayHandle chunk);
typeArrayOop BacktraceBuilder::get_names(objArrayHandle chunk);
bool BacktraceBuilder::has_hidden_top_frame(objArrayHandle chunk);
BacktraceElement BacktraceElement::next(Thread* thread);
bool BacktraceElement::repeat();
The recommended fixes are:
- use objArrayOop->obj_at(int, TRAPS) instead and add handling of a potential OOM error
- or ensure and enforce that the code is operating on non-flat arrays, by using refArrayKlass/refArrayOop types and calling refArrayOop->obj_at(int)
The backtrace builder code uses the problematic objArrayOop->obj_at(int) in the following methods:
typeArrayOop BacktraceBuilder::get_methods(objArrayHandle chunk);
typeArrayOop BacktraceBuilder::get_bcis(objArrayHandle chunk);
objArrayOop BacktraceBuilder::get_mirrors(objArrayHandle chunk);
typeArrayOop BacktraceBuilder::get_names(objArrayHandle chunk);
bool BacktraceBuilder::has_hidden_top_frame(objArrayHandle chunk);
BacktraceElement BacktraceElement::next(Thread* thread);
bool BacktraceElement::repeat();
- duplicates
-
JDK-8378531 [lworld] Remove obj_at(int) from objArrayOopDesc and flatArrayOopDesc
-
- New
-