< prev index next >

src/hotspot/cpu/aarch64/gc/shenandoah/c1/shenandoahBarrierSetC1_aarch64.cpp

Print this page

 70 #endif
 71 
 72 LIR_Opr ShenandoahBarrierSetC1::atomic_cmpxchg_at_resolved(LIRAccess& access, LIRItem& cmp_value, LIRItem& new_value) {
 73   BasicType bt = access.type();
 74   if (access.is_oop()) {
 75     LIRGenerator *gen = access.gen();
 76     if (ShenandoahSATBBarrier) {
 77       pre_barrier(gen, access.access_emit_info(), access.decorators(), access.resolved_addr(),
 78                   LIR_OprFact::illegalOpr /* pre_val */);
 79     }
 80     if (ShenandoahCASBarrier) {
 81       cmp_value.load_item();
 82       new_value.load_item();
 83 
 84       LIR_Opr t1 = gen->new_register(T_OBJECT);
 85       LIR_Opr t2 = gen->new_register(T_OBJECT);
 86       LIR_Opr addr = access.resolved_addr()->as_address_ptr()->base();
 87       LIR_Opr result = gen->new_register(T_INT);
 88 
 89       __ append(new LIR_OpShenandoahCompareAndSwap(addr, cmp_value.result(), new_value.result(), t1, t2, result));


 90       return result;
 91     }
 92   }
 93   return BarrierSetC1::atomic_cmpxchg_at_resolved(access, cmp_value, new_value);







 94 }
 95 
 96 LIR_Opr ShenandoahBarrierSetC1::atomic_xchg_at_resolved(LIRAccess& access, LIRItem& value) {
 97   LIRGenerator* gen = access.gen();
 98   BasicType type = access.type();
 99 
100   LIR_Opr result = gen->new_register(type);
101   value.load_item();
102   LIR_Opr value_opr = value.result();
103 
104   if (access.is_oop()) {
105     value_opr = iu_barrier(access.gen(), value_opr, access.access_emit_info(), access.decorators());
106   }
107 
108   assert(type == T_INT || is_reference_type(type) LP64_ONLY( || type == T_LONG ), "unexpected type");
109   LIR_Opr tmp = gen->new_register(T_INT);
110   __ xchg(access.resolved_addr(), value_opr, result, tmp);
111 
112   if (access.is_oop()) {
113     result = load_reference_barrier(access.gen(), result, LIR_OprFact::addressConst(0), access.decorators());
114     LIR_Opr tmp = gen->new_register(type);
115     __ move(result, tmp);
116     result = tmp;
117     if (ShenandoahSATBBarrier) {
118       pre_barrier(access.gen(), access.access_emit_info(), access.decorators(), LIR_OprFact::illegalOpr,
119                   result /* pre_val */);
120     }

121   }
122 
123   return result;
124 }

 70 #endif
 71 
 72 LIR_Opr ShenandoahBarrierSetC1::atomic_cmpxchg_at_resolved(LIRAccess& access, LIRItem& cmp_value, LIRItem& new_value) {
 73   BasicType bt = access.type();
 74   if (access.is_oop()) {
 75     LIRGenerator *gen = access.gen();
 76     if (ShenandoahSATBBarrier) {
 77       pre_barrier(gen, access.access_emit_info(), access.decorators(), access.resolved_addr(),
 78                   LIR_OprFact::illegalOpr /* pre_val */);
 79     }
 80     if (ShenandoahCASBarrier) {
 81       cmp_value.load_item();
 82       new_value.load_item();
 83 
 84       LIR_Opr t1 = gen->new_register(T_OBJECT);
 85       LIR_Opr t2 = gen->new_register(T_OBJECT);
 86       LIR_Opr addr = access.resolved_addr()->as_address_ptr()->base();
 87       LIR_Opr result = gen->new_register(T_INT);
 88 
 89       __ append(new LIR_OpShenandoahCompareAndSwap(addr, cmp_value.result(), new_value.result(), t1, t2, result));
 90 
 91       post_barrier(access, access.resolved_addr(), new_value.result());
 92       return result;
 93     }
 94   }
 95 
 96   LIR_Opr result =  BarrierSetC1::atomic_cmpxchg_at_resolved(access, cmp_value, new_value);
 97 
 98   if (access.is_oop()) {
 99     post_barrier(access, access.resolved_addr(), new_value.result());
100   }
101 
102   return result;
103 }
104 
105 LIR_Opr ShenandoahBarrierSetC1::atomic_xchg_at_resolved(LIRAccess& access, LIRItem& value) {
106   LIRGenerator* gen = access.gen();
107   BasicType type = access.type();
108 
109   LIR_Opr result = gen->new_register(type);
110   value.load_item();
111   LIR_Opr value_opr = value.result();
112 
113   if (access.is_oop()) {
114     value_opr = iu_barrier(access.gen(), value_opr, access.access_emit_info(), access.decorators());
115   }
116 
117   assert(type == T_INT || is_reference_type(type) LP64_ONLY( || type == T_LONG ), "unexpected type");
118   LIR_Opr tmp = gen->new_register(T_INT);
119   __ xchg(access.resolved_addr(), value_opr, result, tmp);
120 
121   if (access.is_oop()) {
122     result = load_reference_barrier(access.gen(), result, LIR_OprFact::addressConst(0), access.decorators());
123     LIR_Opr tmp = gen->new_register(type);
124     __ move(result, tmp);
125     result = tmp;
126     if (ShenandoahSATBBarrier) {
127       pre_barrier(access.gen(), access.access_emit_info(), access.decorators(), LIR_OprFact::illegalOpr,
128                   result /* pre_val */);
129     }
130     post_barrier(access, access.resolved_addr(), result);
131   }
132 
133   return result;
134 }
< prev index next >