comparison src/share/vm/opto/runtime.cpp @ 4063:7e0e43cf86d6

7109887: java/util/Arrays/CopyMethods.java fails with -XX:+DeoptimizeALot Summary: zero array when compiled code is deoptimized. Reviewed-by: never, twisti
author kvn
date Wed, 09 Nov 2011 06:14:32 -0800
parents cec1757a0134
children 4a1894e1cfc7 0105f367a14c 1e76463170b3
comparison
equal deleted inserted replaced
4062:83d0b5cd1438 4063:7e0e43cf86d6
336 336
337 if (GraphKit::use_ReduceInitialCardMarks()) { 337 if (GraphKit::use_ReduceInitialCardMarks()) {
338 // inform GC that we won't do card marks for initializing writes. 338 // inform GC that we won't do card marks for initializing writes.
339 new_store_pre_barrier(thread); 339 new_store_pre_barrier(thread);
340 } 340 }
341
342 oop result = thread->vm_result();
343 if ((len > 0) && (result != NULL) &&
344 is_deoptimized_caller_frame(thread)) {
345 // Zero array here if the caller is deoptimized.
346 int size = ((typeArrayOop)result)->object_size();
347 BasicType elem_type = typeArrayKlass::cast(array_type)->element_type();
348 const size_t hs = arrayOopDesc::header_size(elem_type);
349 // Align to next 8 bytes to avoid trashing arrays's length.
350 const size_t aligned_hs = align_object_offset(hs);
351 HeapWord* obj = (HeapWord*)result;
352 if (aligned_hs > hs) {
353 Copy::zero_to_words(obj+hs, aligned_hs-hs);
354 }
355 // Optimized zeroing.
356 Copy::fill_to_aligned_words(obj+aligned_hs, size-aligned_hs);
357 }
358
341 JRT_END 359 JRT_END
342 360
343 // Note: multianewarray for one dimension is handled inline by GraphKit::new_array. 361 // Note: multianewarray for one dimension is handled inline by GraphKit::new_array.
344 362
345 // multianewarray for 2 dimensions 363 // multianewarray for 2 dimensions
1134 Deoptimization::deoptimize_frame(thread, caller_frame.id()); 1152 Deoptimization::deoptimize_frame(thread, caller_frame.id());
1135 } 1153 }
1136 } 1154 }
1137 1155
1138 1156
1157 bool OptoRuntime::is_deoptimized_caller_frame(JavaThread *thread) {
1158 // Called from within the owner thread, so no need for safepoint
1159 RegisterMap reg_map(thread);
1160 frame stub_frame = thread->last_frame();
1161 assert(stub_frame.is_runtime_frame() || exception_blob()->contains(stub_frame.pc()), "sanity check");
1162 frame caller_frame = stub_frame.sender(&reg_map);
1163 return caller_frame.is_deoptimized_frame();
1164 }
1165
1166
1139 const TypeFunc *OptoRuntime::register_finalizer_Type() { 1167 const TypeFunc *OptoRuntime::register_finalizer_Type() {
1140 // create input type (domain) 1168 // create input type (domain)
1141 const Type **fields = TypeTuple::fields(1); 1169 const Type **fields = TypeTuple::fields(1);
1142 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // oop; Receiver 1170 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // oop; Receiver
1143 // // The JavaThread* is passed to each routine as the last argument 1171 // // The JavaThread* is passed to each routine as the last argument