1.1 --- a/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp Tue Apr 05 19:14:03 2011 -0700 1.2 +++ b/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp Thu Apr 07 09:53:20 2011 -0700 1.3 @@ -408,13 +408,20 @@ 1.4 #ifndef SERIALGC 1.5 1.6 void G1PreBarrierStub::emit_code(LIR_Assembler* ce) { 1.7 + // At this point we know that marking is in progress. 1.8 + // If do_load() is true then we have to emit the 1.9 + // load of the previous value; otherwise it has already 1.10 + // been loaded into _pre_val. 1.11 + 1.12 __ bind(_entry); 1.13 1.14 assert(pre_val()->is_register(), "Precondition."); 1.15 - 1.16 Register pre_val_reg = pre_val()->as_register(); 1.17 1.18 - ce->mem2reg(addr(), pre_val(), T_OBJECT, patch_code(), info(), false /*wide*/, false /*unaligned*/); 1.19 + if (do_load()) { 1.20 + ce->mem2reg(addr(), pre_val(), T_OBJECT, patch_code(), info(), false /*wide*/, false /*unaligned*/); 1.21 + } 1.22 + 1.23 if (__ is_in_wdisp16_range(_continuation)) { 1.24 __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt, 1.25 pre_val_reg, _continuation); 1.26 @@ -431,6 +438,96 @@ 1.27 1.28 } 1.29 1.30 +void G1UnsafeGetObjSATBBarrierStub::emit_code(LIR_Assembler* ce) { 1.31 + // At this point we know that offset == referent_offset. 1.32 + // 1.33 + // So we might have to emit: 1.34 + // if (src == null) goto continuation. 1.35 + // 1.36 + // and we definitely have to emit: 1.37 + // if (klass(src).reference_type == REF_NONE) goto continuation 1.38 + // if (!marking_active) goto continuation 1.39 + // if (pre_val == null) goto continuation 1.40 + // call pre_barrier(pre_val) 1.41 + // goto continuation 1.42 + // 1.43 + __ bind(_entry); 1.44 + 1.45 + assert(src()->is_register(), "sanity"); 1.46 + Register src_reg = src()->as_register(); 1.47 + 1.48 + if (gen_src_check()) { 1.49 + // The original src operand was not a constant. 1.50 + // Generate src == null? 1.51 + if (__ is_in_wdisp16_range(_continuation)) { 1.52 + __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt, 1.53 + src_reg, _continuation); 1.54 + } else { 1.55 + __ cmp(src_reg, G0); 1.56 + __ brx(Assembler::equal, false, Assembler::pt, _continuation); 1.57 + } 1.58 + __ delayed()->nop(); 1.59 + } 1.60 + 1.61 + // Generate src->_klass->_reference_type() == REF_NONE)? 1.62 + assert(tmp()->is_register(), "sanity"); 1.63 + Register tmp_reg = tmp()->as_register(); 1.64 + 1.65 + __ load_klass(src_reg, tmp_reg); 1.66 + 1.67 + Address ref_type_adr(tmp_reg, instanceKlass::reference_type_offset_in_bytes() + sizeof(oopDesc)); 1.68 + __ ld(ref_type_adr, tmp_reg); 1.69 + 1.70 + if (__ is_in_wdisp16_range(_continuation)) { 1.71 + __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt, 1.72 + tmp_reg, _continuation); 1.73 + } else { 1.74 + __ cmp(tmp_reg, G0); 1.75 + __ brx(Assembler::equal, false, Assembler::pt, _continuation); 1.76 + } 1.77 + __ delayed()->nop(); 1.78 + 1.79 + // Is marking active? 1.80 + assert(thread()->is_register(), "precondition"); 1.81 + Register thread_reg = thread()->as_register(); 1.82 + 1.83 + Address in_progress(thread_reg, in_bytes(JavaThread::satb_mark_queue_offset() + 1.84 + PtrQueue::byte_offset_of_active())); 1.85 + 1.86 + if (in_bytes(PtrQueue::byte_width_of_active()) == 4) { 1.87 + __ ld(in_progress, tmp_reg); 1.88 + } else { 1.89 + assert(in_bytes(PtrQueue::byte_width_of_active()) == 1, "Assumption"); 1.90 + __ ldsb(in_progress, tmp_reg); 1.91 + } 1.92 + if (__ is_in_wdisp16_range(_continuation)) { 1.93 + __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt, 1.94 + tmp_reg, _continuation); 1.95 + } else { 1.96 + __ cmp(tmp_reg, G0); 1.97 + __ brx(Assembler::equal, false, Assembler::pt, _continuation); 1.98 + } 1.99 + __ delayed()->nop(); 1.100 + 1.101 + // val == null? 1.102 + assert(val()->is_register(), "Precondition."); 1.103 + Register val_reg = val()->as_register(); 1.104 + 1.105 + if (__ is_in_wdisp16_range(_continuation)) { 1.106 + __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt, 1.107 + val_reg, _continuation); 1.108 + } else { 1.109 + __ cmp(val_reg, G0); 1.110 + __ brx(Assembler::equal, false, Assembler::pt, _continuation); 1.111 + } 1.112 + __ delayed()->nop(); 1.113 + 1.114 + __ call(Runtime1::entry_for(Runtime1::Runtime1::g1_pre_barrier_slow_id)); 1.115 + __ delayed()->mov(val_reg, G4); 1.116 + __ br(Assembler::always, false, Assembler::pt, _continuation); 1.117 + __ delayed()->nop(); 1.118 +} 1.119 + 1.120 jbyte* G1PostBarrierStub::_byte_map_base = NULL; 1.121 1.122 jbyte* G1PostBarrierStub::byte_map_base_slow() {