提交 f2a17338 编写于 作者: K kvn

7109887: java/util/Arrays/CopyMethods.java fails with -XX:+DeoptimizeALot

Summary: zero array when compiled code is deoptimized.
Reviewed-by: never, twisti
上级 bbe54b4a
...@@ -338,6 +338,24 @@ JRT_BLOCK_ENTRY(void, OptoRuntime::new_array_nozero_C(klassOopDesc* array_type, ...@@ -338,6 +338,24 @@ JRT_BLOCK_ENTRY(void, OptoRuntime::new_array_nozero_C(klassOopDesc* array_type,
// inform GC that we won't do card marks for initializing writes. // inform GC that we won't do card marks for initializing writes.
new_store_pre_barrier(thread); new_store_pre_barrier(thread);
} }
oop result = thread->vm_result();
if ((len > 0) && (result != NULL) &&
is_deoptimized_caller_frame(thread)) {
// Zero array here if the caller is deoptimized.
int size = ((typeArrayOop)result)->object_size();
BasicType elem_type = typeArrayKlass::cast(array_type)->element_type();
const size_t hs = arrayOopDesc::header_size(elem_type);
// Align to next 8 bytes to avoid trashing arrays's length.
const size_t aligned_hs = align_object_offset(hs);
HeapWord* obj = (HeapWord*)result;
if (aligned_hs > hs) {
Copy::zero_to_words(obj+hs, aligned_hs-hs);
}
// Optimized zeroing.
Copy::fill_to_aligned_words(obj+aligned_hs, size-aligned_hs);
}
JRT_END JRT_END
// Note: multianewarray for one dimension is handled inline by GraphKit::new_array. // Note: multianewarray for one dimension is handled inline by GraphKit::new_array.
...@@ -1136,6 +1154,16 @@ void OptoRuntime::deoptimize_caller_frame(JavaThread *thread, bool doit) { ...@@ -1136,6 +1154,16 @@ void OptoRuntime::deoptimize_caller_frame(JavaThread *thread, bool doit) {
} }
bool OptoRuntime::is_deoptimized_caller_frame(JavaThread *thread) {
// Called from within the owner thread, so no need for safepoint
RegisterMap reg_map(thread);
frame stub_frame = thread->last_frame();
assert(stub_frame.is_runtime_frame() || exception_blob()->contains(stub_frame.pc()), "sanity check");
frame caller_frame = stub_frame.sender(&reg_map);
return caller_frame.is_deoptimized_frame();
}
const TypeFunc *OptoRuntime::register_finalizer_Type() { const TypeFunc *OptoRuntime::register_finalizer_Type() {
// create input type (domain) // create input type (domain)
const Type **fields = TypeTuple::fields(1); const Type **fields = TypeTuple::fields(1);
......
...@@ -175,6 +175,7 @@ private: ...@@ -175,6 +175,7 @@ private:
static address handle_exception_C_helper(JavaThread* thread, nmethod*& nm); static address handle_exception_C_helper(JavaThread* thread, nmethod*& nm);
static address rethrow_C (oopDesc* exception, JavaThread *thread, address return_pc ); static address rethrow_C (oopDesc* exception, JavaThread *thread, address return_pc );
static void deoptimize_caller_frame (JavaThread *thread, bool doit); static void deoptimize_caller_frame (JavaThread *thread, bool doit);
static bool is_deoptimized_caller_frame (JavaThread *thread);
// CodeBlob support // CodeBlob support
// =================================================================== // ===================================================================
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册