72 void BarrierSetC1::store_at(LIRAccess& access, LIR_Opr value) {
73 DecoratorSet decorators = access.decorators();
74 bool in_heap = (decorators & IN_HEAP) != 0;
75 assert(in_heap, "not supported yet");
76
77 LIR_Opr resolved = resolve_address(access, false);
78 access.set_resolved_addr(resolved);
79 store_at_resolved(access, value);
80 }
81
82 void BarrierSetC1::load_at(LIRAccess& access, LIR_Opr result) {
83 DecoratorSet decorators = access.decorators();
84 bool in_heap = (decorators & IN_HEAP) != 0;
85 assert(in_heap, "not supported yet");
86
87 LIR_Opr resolved = resolve_address(access, false);
88 access.set_resolved_addr(resolved);
89 load_at_resolved(access, result);
90 }
91
92 LIR_Opr BarrierSetC1::atomic_cmpxchg_at(LIRAccess& access, LIRItem& cmp_value, LIRItem& new_value) {
93 DecoratorSet decorators = access.decorators();
94 bool in_heap = (decorators & IN_HEAP) != 0;
95 assert(in_heap, "not supported yet");
96
97 access.load_address();
98
99 LIR_Opr resolved = resolve_address(access, true);
100 access.set_resolved_addr(resolved);
101 return atomic_cmpxchg_at_resolved(access, cmp_value, new_value);
102 }
103
104 LIR_Opr BarrierSetC1::atomic_xchg_at(LIRAccess& access, LIRItem& value) {
105 DecoratorSet decorators = access.decorators();
106 bool in_heap = (decorators & IN_HEAP) != 0;
107 assert(in_heap, "not supported yet");
108
109 access.load_address();
110
|
72 void BarrierSetC1::store_at(LIRAccess& access, LIR_Opr value) {
73 DecoratorSet decorators = access.decorators();
74 bool in_heap = (decorators & IN_HEAP) != 0;
75 assert(in_heap, "not supported yet");
76
77 LIR_Opr resolved = resolve_address(access, false);
78 access.set_resolved_addr(resolved);
79 store_at_resolved(access, value);
80 }
81
82 void BarrierSetC1::load_at(LIRAccess& access, LIR_Opr result) {
83 DecoratorSet decorators = access.decorators();
84 bool in_heap = (decorators & IN_HEAP) != 0;
85 assert(in_heap, "not supported yet");
86
87 LIR_Opr resolved = resolve_address(access, false);
88 access.set_resolved_addr(resolved);
89 load_at_resolved(access, result);
90 }
91
92 void BarrierSetC1::load(LIRAccess& access, LIR_Opr result) {
93 DecoratorSet decorators = access.decorators();
94 bool in_heap = (decorators & IN_HEAP) != 0;
95 assert(!in_heap, "consider using load_at");
96 load_at_resolved(access, result);
97 }
98
99 LIR_Opr BarrierSetC1::atomic_cmpxchg_at(LIRAccess& access, LIRItem& cmp_value, LIRItem& new_value) {
100 DecoratorSet decorators = access.decorators();
101 bool in_heap = (decorators & IN_HEAP) != 0;
102 assert(in_heap, "not supported yet");
103
104 access.load_address();
105
106 LIR_Opr resolved = resolve_address(access, true);
107 access.set_resolved_addr(resolved);
108 return atomic_cmpxchg_at_resolved(access, cmp_value, new_value);
109 }
110
111 LIR_Opr BarrierSetC1::atomic_xchg_at(LIRAccess& access, LIRItem& value) {
112 DecoratorSet decorators = access.decorators();
113 bool in_heap = (decorators & IN_HEAP) != 0;
114 assert(in_heap, "not supported yet");
115
116 access.load_address();
117
|
141 }
142
143 LIR_PatchCode patch_code = needs_patching ? lir_patch_normal : lir_patch_none;
144 if (is_volatile && !needs_patching) {
145 gen->volatile_field_store(value, access.resolved_addr()->as_address_ptr(), access.access_emit_info());
146 } else {
147 __ store(value, access.resolved_addr()->as_address_ptr(), access.access_emit_info(), patch_code);
148 }
149
150 if (is_volatile && !support_IRIW_for_not_multiple_copy_atomic_cpu) {
151 __ membar();
152 }
153 }
154
155 void BarrierSetC1::load_at_resolved(LIRAccess& access, LIR_Opr result) {
156 LIRGenerator *gen = access.gen();
157 DecoratorSet decorators = access.decorators();
158 bool is_volatile = (((decorators & MO_SEQ_CST) != 0) || AlwaysAtomicAccesses) && os::is_MP();
159 bool needs_patching = (decorators & C1_NEEDS_PATCHING) != 0;
160 bool mask_boolean = (decorators & C1_MASK_BOOLEAN) != 0;
161
162 if (support_IRIW_for_not_multiple_copy_atomic_cpu && is_volatile) {
163 __ membar();
164 }
165
166 LIR_PatchCode patch_code = needs_patching ? lir_patch_normal : lir_patch_none;
167 if (is_volatile && !needs_patching) {
168 gen->volatile_field_load(access.resolved_addr()->as_address_ptr(), result, access.access_emit_info());
169 } else {
170 __ load(access.resolved_addr()->as_address_ptr(), result, access.access_emit_info(), patch_code);
171 }
172
173 if (is_volatile && os::is_MP()) {
174 __ membar_acquire();
175 }
176
177 /* Normalize boolean value returned by unsafe operation, i.e., value != 0 ? value = true : value false. */
178 if (mask_boolean) {
179 LabelObj* equalZeroLabel = new LabelObj();
180 __ cmp(lir_cond_equal, result, 0);
181 __ branch(lir_cond_equal, T_BOOLEAN, equalZeroLabel->label());
182 __ move(LIR_OprFact::intConst(1), result);
183 __ branch_destination(equalZeroLabel->label());
184 }
185 }
186
|
148 }
149
150 LIR_PatchCode patch_code = needs_patching ? lir_patch_normal : lir_patch_none;
151 if (is_volatile && !needs_patching) {
152 gen->volatile_field_store(value, access.resolved_addr()->as_address_ptr(), access.access_emit_info());
153 } else {
154 __ store(value, access.resolved_addr()->as_address_ptr(), access.access_emit_info(), patch_code);
155 }
156
157 if (is_volatile && !support_IRIW_for_not_multiple_copy_atomic_cpu) {
158 __ membar();
159 }
160 }
161
162 void BarrierSetC1::load_at_resolved(LIRAccess& access, LIR_Opr result) {
163 LIRGenerator *gen = access.gen();
164 DecoratorSet decorators = access.decorators();
165 bool is_volatile = (((decorators & MO_SEQ_CST) != 0) || AlwaysAtomicAccesses) && os::is_MP();
166 bool needs_patching = (decorators & C1_NEEDS_PATCHING) != 0;
167 bool mask_boolean = (decorators & C1_MASK_BOOLEAN) != 0;
168 bool in_native = (decorators & IN_NATIVE) != 0;
169
170 if (support_IRIW_for_not_multiple_copy_atomic_cpu && is_volatile) {
171 __ membar();
172 }
173
174 LIR_PatchCode patch_code = needs_patching ? lir_patch_normal : lir_patch_none;
175 if (in_native) {
176 __ move_wide(access.resolved_addr()->as_address_ptr(), result);
177 } else if (is_volatile && !needs_patching) {
178 gen->volatile_field_load(access.resolved_addr()->as_address_ptr(), result, access.access_emit_info());
179 } else {
180 __ load(access.resolved_addr()->as_address_ptr(), result, access.access_emit_info(), patch_code);
181 }
182
183 if (is_volatile && os::is_MP()) {
184 __ membar_acquire();
185 }
186
187 /* Normalize boolean value returned by unsafe operation, i.e., value != 0 ? value = true : value false. */
188 if (mask_boolean) {
189 LabelObj* equalZeroLabel = new LabelObj();
190 __ cmp(lir_cond_equal, result, 0);
191 __ branch(lir_cond_equal, T_BOOLEAN, equalZeroLabel->label());
192 __ move(LIR_OprFact::intConst(1), result);
193 __ branch_destination(equalZeroLabel->label());
194 }
195 }
196
|