1.1 --- a/src/cpu/x86/vm/stubGenerator_x86_32.cpp Tue Mar 01 10:27:15 2011 -0800 1.2 +++ b/src/cpu/x86/vm/stubGenerator_x86_32.cpp Tue Mar 01 14:56:48 2011 -0800 1.3 @@ -729,18 +729,19 @@ 1.4 // Input: 1.5 // start - starting address 1.6 // count - element count 1.7 - void gen_write_ref_array_pre_barrier(Register start, Register count) { 1.8 + void gen_write_ref_array_pre_barrier(Register start, Register count, bool uninitialized_target) { 1.9 assert_different_registers(start, count); 1.10 BarrierSet* bs = Universe::heap()->barrier_set(); 1.11 switch (bs->kind()) { 1.12 case BarrierSet::G1SATBCT: 1.13 case BarrierSet::G1SATBCTLogging: 1.14 - { 1.15 - __ pusha(); // push registers 1.16 - __ call_VM_leaf(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_pre), 1.17 - start, count); 1.18 - __ popa(); 1.19 - } 1.20 + // With G1, don't generate the call if we statically know that the target in uninitialized 1.21 + if (!uninitialized_target) { 1.22 + __ pusha(); // push registers 1.23 + __ call_VM_leaf(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_pre), 1.24 + start, count); 1.25 + __ popa(); 1.26 + } 1.27 break; 1.28 case BarrierSet::CardTableModRef: 1.29 case BarrierSet::CardTableExtension: 1.30 @@ -919,7 +920,8 @@ 1.31 1.32 address generate_disjoint_copy(BasicType t, bool aligned, 1.33 Address::ScaleFactor sf, 1.34 - address* entry, const char *name) { 1.35 + address* entry, const char *name, 1.36 + bool dest_uninitialized = false) { 1.37 __ align(CodeEntryAlignment); 1.38 StubCodeMark mark(this, "StubRoutines", name); 1.39 address start = __ pc(); 1.40 @@ -950,7 +952,7 @@ 1.41 if (t == T_OBJECT) { 1.42 __ testl(count, count); 1.43 __ jcc(Assembler::zero, L_0_count); 1.44 - gen_write_ref_array_pre_barrier(to, count); 1.45 + gen_write_ref_array_pre_barrier(to, count, dest_uninitialized); 1.46 __ mov(saved_to, to); // save 'to' 1.47 } 1.48 1.49 @@ -1084,7 +1086,8 @@ 1.50 address generate_conjoint_copy(BasicType t, bool aligned, 1.51 Address::ScaleFactor sf, 1.52 address nooverlap_target, 1.53 - address* entry, const char *name) { 1.54 + address* entry, const char *name, 1.55 + bool dest_uninitialized = false) { 1.56 __ align(CodeEntryAlignment); 1.57 StubCodeMark mark(this, "StubRoutines", name); 1.58 address start = __ pc(); 1.59 @@ -1128,7 +1131,7 @@ 1.60 if (t == T_OBJECT) { 1.61 __ testl(count, count); 1.62 __ jcc(Assembler::zero, L_0_count); 1.63 - gen_write_ref_array_pre_barrier(dst, count); 1.64 + gen_write_ref_array_pre_barrier(dst, count, dest_uninitialized); 1.65 } 1.66 1.67 // copy from high to low 1.68 @@ -1415,7 +1418,7 @@ 1.69 // rax, == 0 - success 1.70 // rax, == -1^K - failure, where K is partial transfer count 1.71 // 1.72 - address generate_checkcast_copy(const char *name, address* entry) { 1.73 + address generate_checkcast_copy(const char *name, address* entry, bool dest_uninitialized = false) { 1.74 __ align(CodeEntryAlignment); 1.75 StubCodeMark mark(this, "StubRoutines", name); 1.76 address start = __ pc(); 1.77 @@ -1476,7 +1479,7 @@ 1.78 Address elem_klass_addr(elem, oopDesc::klass_offset_in_bytes()); 1.79 1.80 // Copy from low to high addresses, indexed from the end of each array. 1.81 - gen_write_ref_array_pre_barrier(to, count); 1.82 + gen_write_ref_array_pre_barrier(to, count, dest_uninitialized); 1.83 __ lea(end_from, end_from_addr); 1.84 __ lea(end_to, end_to_addr); 1.85 assert(length == count, ""); // else fix next line: 1.86 @@ -2039,6 +2042,15 @@ 1.87 generate_conjoint_copy(T_OBJECT, true, Address::times_ptr, entry, 1.88 &entry_oop_arraycopy, "oop_arraycopy"); 1.89 1.90 + StubRoutines::_oop_disjoint_arraycopy_uninit = 1.91 + generate_disjoint_copy(T_OBJECT, true, Address::times_ptr, &entry, 1.92 + "oop_disjoint_arraycopy_uninit", 1.93 + /*dest_uninitialized*/true); 1.94 + StubRoutines::_oop_arraycopy_uninit = 1.95 + generate_conjoint_copy(T_OBJECT, true, Address::times_ptr, entry, 1.96 + NULL, "oop_arraycopy_uninit", 1.97 + /*dest_uninitialized*/true); 1.98 + 1.99 StubRoutines::_jlong_disjoint_arraycopy = 1.100 generate_disjoint_long_copy(&entry, "jlong_disjoint_arraycopy"); 1.101 StubRoutines::_jlong_arraycopy = 1.102 @@ -2052,20 +2064,20 @@ 1.103 StubRoutines::_arrayof_jshort_fill = generate_fill(T_SHORT, true, "arrayof_jshort_fill"); 1.104 StubRoutines::_arrayof_jint_fill = generate_fill(T_INT, true, "arrayof_jint_fill"); 1.105 1.106 - StubRoutines::_arrayof_jint_disjoint_arraycopy = 1.107 - StubRoutines::_jint_disjoint_arraycopy; 1.108 - StubRoutines::_arrayof_oop_disjoint_arraycopy = 1.109 - StubRoutines::_oop_disjoint_arraycopy; 1.110 - StubRoutines::_arrayof_jlong_disjoint_arraycopy = 1.111 - StubRoutines::_jlong_disjoint_arraycopy; 1.112 + StubRoutines::_arrayof_jint_disjoint_arraycopy = StubRoutines::_jint_disjoint_arraycopy; 1.113 + StubRoutines::_arrayof_oop_disjoint_arraycopy = StubRoutines::_oop_disjoint_arraycopy; 1.114 + StubRoutines::_arrayof_oop_disjoint_arraycopy_uninit = StubRoutines::_oop_disjoint_arraycopy_uninit; 1.115 + StubRoutines::_arrayof_jlong_disjoint_arraycopy = StubRoutines::_jlong_disjoint_arraycopy; 1.116 1.117 - StubRoutines::_arrayof_jint_arraycopy = StubRoutines::_jint_arraycopy; 1.118 - StubRoutines::_arrayof_oop_arraycopy = StubRoutines::_oop_arraycopy; 1.119 - StubRoutines::_arrayof_jlong_arraycopy = StubRoutines::_jlong_arraycopy; 1.120 + StubRoutines::_arrayof_jint_arraycopy = StubRoutines::_jint_arraycopy; 1.121 + StubRoutines::_arrayof_oop_arraycopy = StubRoutines::_oop_arraycopy; 1.122 + StubRoutines::_arrayof_oop_arraycopy_uninit = StubRoutines::_oop_arraycopy_uninit; 1.123 + StubRoutines::_arrayof_jlong_arraycopy = StubRoutines::_jlong_arraycopy; 1.124 1.125 StubRoutines::_checkcast_arraycopy = 1.126 - generate_checkcast_copy("checkcast_arraycopy", 1.127 - &entry_checkcast_arraycopy); 1.128 + generate_checkcast_copy("checkcast_arraycopy", &entry_checkcast_arraycopy); 1.129 + StubRoutines::_checkcast_arraycopy_uninit = 1.130 + generate_checkcast_copy("checkcast_arraycopy_uninit", NULL, /*dest_uninitialized*/true); 1.131 1.132 StubRoutines::_unsafe_arraycopy = 1.133 generate_unsafe_copy("unsafe_arraycopy",