|
32 | 32 | #include "gc/g1/heapRegion.hpp"
|
33 | 33 | #include "interpreter/interp_masm.hpp"
|
34 | 34 | #include "runtime/sharedRuntime.hpp"
|
| 35 | +#include "utilities/debug.hpp" |
35 | 36 | #include "utilities/macros.hpp"
|
36 | 37 | #ifdef COMPILER1
|
37 | 38 | #include "c1/c1_LIRAssembler.hpp"
|
@@ -264,6 +265,8 @@ void G1BarrierSetAssembler::g1_write_barrier_post(MacroAssembler* masm,
|
264 | 265 | Register thread,
|
265 | 266 | Register tmp,
|
266 | 267 | Register tmp2) {
|
| 268 | + // Generated code assumes that buffer index is pointer sized. |
| 269 | + STATIC_ASSERT(in_bytes(SATBMarkQueue::byte_width_of_index()) == sizeof(intptr_t)); |
267 | 270 | #ifdef _LP64
|
268 | 271 | assert(thread == r15_thread, "must be");
|
269 | 272 | #endif // _LP64
|
@@ -314,18 +317,13 @@ void G1BarrierSetAssembler::g1_write_barrier_post(MacroAssembler* masm,
|
314 | 317 |
|
315 | 318 | __ movb(Address(card_addr, 0), (int)G1CardTable::dirty_card_val());
|
316 | 319 |
|
317 |
| - __ cmpl(queue_index, 0); |
318 |
| - __ jcc(Assembler::equal, runtime); |
319 |
| - __ subl(queue_index, wordSize); |
320 |
| - __ movptr(tmp2, buffer); |
321 |
| -#ifdef _LP64 |
322 |
| - __ movslq(rscratch1, queue_index); |
323 |
| - __ addq(tmp2, rscratch1); |
324 |
| - __ movq(Address(tmp2, 0), card_addr); |
325 |
| -#else |
326 |
| - __ addl(tmp2, queue_index); |
327 |
| - __ movl(Address(tmp2, 0), card_addr); |
328 |
| -#endif |
| 320 | + __ movptr(tmp2, queue_index); |
| 321 | + __ testptr(tmp2, tmp2); |
| 322 | + __ jcc(Assembler::zero, runtime); |
| 323 | + __ subptr(tmp2, wordSize); |
| 324 | + __ movptr(queue_index, tmp2); |
| 325 | + __ addptr(tmp2, buffer); |
| 326 | + __ movptr(Address(tmp2, 0), card_addr); |
329 | 327 | __ jmp(done);
|
330 | 328 |
|
331 | 329 | __ bind(runtime);
|
@@ -453,6 +451,9 @@ void G1BarrierSetAssembler::gen_post_barrier_stub(LIR_Assembler* ce, G1PostBarri
|
453 | 451 | #define __ sasm->
|
454 | 452 |
|
455 | 453 | void G1BarrierSetAssembler::generate_c1_pre_barrier_runtime_stub(StubAssembler* sasm) {
|
| 454 | + // Generated code assumes that buffer index is pointer sized. |
| 455 | + STATIC_ASSERT(in_bytes(SATBMarkQueue::byte_width_of_index()) == sizeof(intptr_t)); |
| 456 | + |
456 | 457 | __ prologue("g1_pre_barrier", false);
|
457 | 458 | // arg0 : previous value of memory
|
458 | 459 |
|
|
0 commit comments