90
91 if (access.is_oop()) {
92 LIRGenerator* gen = access.gen();
93
94 if (ShenandoahSATBBarrier) {
95 pre_barrier(gen, access.access_emit_info(), access.decorators(), access.resolved_addr(),
96 LIR_OprFact::illegalOpr);
97 }
98
99 if (ShenandoahCASBarrier) {
100 cmp_value.load_item();
101 new_value.load_item();
102
103 LIR_Opr t1 = gen->new_register(T_OBJECT);
104 LIR_Opr t2 = gen->new_register(T_OBJECT);
105 LIR_Opr addr = access.resolved_addr()->as_address_ptr()->base();
106 LIR_Opr result = gen->new_register(T_INT);
107
108 __ append(new LIR_OpShenandoahCompareAndSwap(addr, cmp_value.result(), new_value.result(), t1, t2, result));
109
110 return result;
111 }
112 }
113
114 return BarrierSetC1::atomic_cmpxchg_at_resolved(access, cmp_value, new_value);
115 }
116
117 LIR_Opr ShenandoahBarrierSetC1::atomic_xchg_at_resolved(LIRAccess &access, LIRItem &value) {
118 LIRGenerator* gen = access.gen();
119 BasicType type = access.type();
120
121 LIR_Opr result = gen->new_register(type);
122 value.load_item();
123 LIR_Opr value_opr = value.result();
124
125 if (access.is_oop()) {
126 value_opr = iu_barrier(access.gen(), value_opr, access.access_emit_info(), access.decorators());
127 }
128
129 assert(type == T_INT || is_reference_type(type) LP64_ONLY( || type == T_LONG ), "unexpected type");
130 LIR_Opr tmp_xchg = gen->new_register(T_INT);
131 __ xchg(access.resolved_addr(), value_opr, result, tmp_xchg);
132
133 if (access.is_oop()) {
134 result = load_reference_barrier_impl(access.gen(), result, LIR_OprFact::addressConst(0),
135 access.decorators());
136
137 LIR_Opr tmp_barrier = gen->new_register(type);
138 __ move(result, tmp_barrier);
139 result = tmp_barrier;
140
141 if (ShenandoahSATBBarrier) {
142 pre_barrier(access.gen(), access.access_emit_info(), access.decorators(), LIR_OprFact::illegalOpr, result);
143 }
144 }
145
146 return result;
147 }
|
90
91 if (access.is_oop()) {
92 LIRGenerator* gen = access.gen();
93
94 if (ShenandoahSATBBarrier) {
95 pre_barrier(gen, access.access_emit_info(), access.decorators(), access.resolved_addr(),
96 LIR_OprFact::illegalOpr);
97 }
98
99 if (ShenandoahCASBarrier) {
100 cmp_value.load_item();
101 new_value.load_item();
102
103 LIR_Opr t1 = gen->new_register(T_OBJECT);
104 LIR_Opr t2 = gen->new_register(T_OBJECT);
105 LIR_Opr addr = access.resolved_addr()->as_address_ptr()->base();
106 LIR_Opr result = gen->new_register(T_INT);
107
108 __ append(new LIR_OpShenandoahCompareAndSwap(addr, cmp_value.result(), new_value.result(), t1, t2, result));
109
110 if (ShenandoahCardBarrier) {
111 post_barrier(access, access.resolved_addr(), new_value.result());
112 }
113
114 return result;
115 }
116 }
117
118 LIR_Opr result = BarrierSetC1::atomic_cmpxchg_at_resolved(access, cmp_value, new_value);
119
120 if (ShenandoahCardBarrier && access.is_oop()) {
121 post_barrier(access, access.resolved_addr(), new_value.result());
122 }
123
124 return result;
125 }
126
127 LIR_Opr ShenandoahBarrierSetC1::atomic_xchg_at_resolved(LIRAccess &access, LIRItem &value) {
128 LIRGenerator* gen = access.gen();
129 BasicType type = access.type();
130
131 LIR_Opr result = gen->new_register(type);
132 value.load_item();
133 LIR_Opr value_opr = value.result();
134
135 if (access.is_oop()) {
136 value_opr = iu_barrier(access.gen(), value_opr, access.access_emit_info(), access.decorators());
137 }
138
139 assert(type == T_INT || is_reference_type(type) LP64_ONLY( || type == T_LONG ), "unexpected type");
140 LIR_Opr tmp_xchg = gen->new_register(T_INT);
141 __ xchg(access.resolved_addr(), value_opr, result, tmp_xchg);
142
143 if (access.is_oop()) {
144 result = load_reference_barrier_impl(access.gen(), result, LIR_OprFact::addressConst(0),
145 access.decorators());
146
147 LIR_Opr tmp_barrier = gen->new_register(type);
148 __ move(result, tmp_barrier);
149 result = tmp_barrier;
150
151 if (ShenandoahSATBBarrier) {
152 pre_barrier(access.gen(), access.access_emit_info(), access.decorators(), LIR_OprFact::illegalOpr, result);
153 }
154
155 if (ShenandoahCardBarrier) {
156 post_barrier(access, access.resolved_addr(), result);
157 }
158 }
159
160 return result;
161 }
|