@@ -176,14 +176,24 @@ void BarrierSetAssembler::eden_allocate(MacroAssembler* masm, Register obj,
176
176
} else {
177
177
Register end = tmp1;
178
178
Label retry;
179
- int32_t offset = 0 ;
180
179
__ bind (retry);
181
180
181
+ // Get the current end of the heap
182
+ ExternalAddress address_end ((address) Universe::heap ()->end_addr ());
183
+ {
184
+ int32_t offset;
185
+ __ la_patchable (t1, address_end, offset);
186
+ __ ld (t1, Address (t1, offset));
187
+ }
188
+
182
189
// Get the current top of the heap
183
190
ExternalAddress address_top ((address) Universe::heap ()->top_addr ());
184
- __ la_patchable (t0, address_top, offset);
185
- __ addi (t0, t0, offset);
186
- __ lr_d (obj, t0, Assembler::aqrl);
191
+ {
192
+ int32_t offset;
193
+ __ la_patchable (t0, address_top, offset);
194
+ __ addi (t0, t0, offset);
195
+ __ lr_d (obj, t0, Assembler::aqrl);
196
+ }
187
197
188
198
// Adjust it my the size of our new object
189
199
if (var_size_in_bytes == noreg) {
@@ -195,18 +205,12 @@ void BarrierSetAssembler::eden_allocate(MacroAssembler* masm, Register obj,
195
205
// if end < obj then we wrapped around high memory
196
206
__ bltu (end, obj, slow_case, is_far);
197
207
198
- Register heap_end = t1;
199
- // Get the current end of the heap
200
- ExternalAddress address_end ((address) Universe::heap ()->end_addr ());
201
- offset = 0 ;
202
- __ la_patchable (heap_end, address_end, offset);
203
- __ ld (heap_end, Address (heap_end, offset));
204
-
205
- __ bgtu (end, heap_end, slow_case, is_far);
208
+ __ bgtu (end, t1, slow_case, is_far);
206
209
207
210
// If heap_top hasn't been changed by some other thread, update it.
208
211
__ sc_d (t1, end, t0, Assembler::rl);
209
212
__ bnez (t1, retry);
213
+
210
214
incr_allocated_bytes (masm, var_size_in_bytes, con_size_in_bytes, tmp1);
211
215
}
212
216
}
0 commit comments