Skip to content

Commit 3a8a15b

Browse files
committedJul 28, 2020
8250588: Shenandoah: LRB needs to save/restore fp registers for runtime call
Reviewed-by: rkennke
1 parent fcd5d41 commit 3a8a15b

File tree

1 file changed

+31
-18
lines changed

1 file changed

+31
-18
lines changed
 

‎src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp

+31-18
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,30 @@
4646

4747
address ShenandoahBarrierSetAssembler::_shenandoah_lrb = NULL;
4848

49+
static void save_xmm_registers(MacroAssembler* masm) {
50+
__ subptr(rsp, 64);
51+
__ movdbl(Address(rsp, 0), xmm0);
52+
__ movdbl(Address(rsp, 8), xmm1);
53+
__ movdbl(Address(rsp, 16), xmm2);
54+
__ movdbl(Address(rsp, 24), xmm3);
55+
__ movdbl(Address(rsp, 32), xmm4);
56+
__ movdbl(Address(rsp, 40), xmm5);
57+
__ movdbl(Address(rsp, 48), xmm6);
58+
__ movdbl(Address(rsp, 56), xmm7);
59+
}
60+
61+
static void restore_xmm_registers(MacroAssembler* masm) {
62+
__ movdbl(xmm0, Address(rsp, 0));
63+
__ movdbl(xmm1, Address(rsp, 8));
64+
__ movdbl(xmm2, Address(rsp, 16));
65+
__ movdbl(xmm3, Address(rsp, 24));
66+
__ movdbl(xmm4, Address(rsp, 32));
67+
__ movdbl(xmm5, Address(rsp, 40));
68+
__ movdbl(xmm6, Address(rsp, 48));
69+
__ movdbl(xmm7, Address(rsp, 56));
70+
__ addptr(rsp, 64);
71+
}
72+
4973
void ShenandoahBarrierSetAssembler::arraycopy_prologue(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
5074
Register src, Register dst, Register count) {
5175

@@ -290,7 +314,9 @@ void ShenandoahBarrierSetAssembler::load_reference_barrier_not_null(MacroAssembl
290314
__ lea(src_addr, src);
291315
}
292316

317+
save_xmm_registers(masm);
293318
__ call(RuntimeAddress(CAST_FROM_FN_PTR(address, ShenandoahBarrierSetAssembler::shenandoah_lrb())));
319+
restore_xmm_registers(masm);
294320

295321
if (need_addr_setup) {
296322
if (dst != rax) {
@@ -368,7 +394,10 @@ void ShenandoahBarrierSetAssembler::load_reference_barrier_native(MacroAssembler
368394

369395
assert_different_registers(dst, rsi);
370396
__ lea(rsi, src);
397+
398+
save_xmm_registers(masm);
371399
__ call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahRuntime::load_reference_barrier_native), dst, rsi);
400+
restore_xmm_registers(masm);
372401

373402
#ifdef _LP64
374403
__ pop(r15);
@@ -514,15 +543,7 @@ void ShenandoahBarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet d
514543
// That path can be reached from the c2i adapter with live fp
515544
// arguments in registers.
516545
LP64_ONLY(assert(Argument::n_float_register_parameters_j == 8, "8 fp registers to save at java call"));
517-
__ subptr(rsp, 64);
518-
__ movdbl(Address(rsp, 0), xmm0);
519-
__ movdbl(Address(rsp, 8), xmm1);
520-
__ movdbl(Address(rsp, 16), xmm2);
521-
__ movdbl(Address(rsp, 24), xmm3);
522-
__ movdbl(Address(rsp, 32), xmm4);
523-
__ movdbl(Address(rsp, 40), xmm5);
524-
__ movdbl(Address(rsp, 48), xmm6);
525-
__ movdbl(Address(rsp, 56), xmm7);
546+
save_xmm_registers(masm);
526547

527548
Register thread = NOT_LP64(tmp_thread) LP64_ONLY(r15_thread);
528549
assert_different_registers(dst, tmp1, tmp_thread);
@@ -539,15 +560,7 @@ void ShenandoahBarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet d
539560
tmp1 /* tmp */,
540561
true /* tosca_live */,
541562
true /* expand_call */);
542-
__ movdbl(xmm0, Address(rsp, 0));
543-
__ movdbl(xmm1, Address(rsp, 8));
544-
__ movdbl(xmm2, Address(rsp, 16));
545-
__ movdbl(xmm3, Address(rsp, 24));
546-
__ movdbl(xmm4, Address(rsp, 32));
547-
__ movdbl(xmm5, Address(rsp, 40));
548-
__ movdbl(xmm6, Address(rsp, 48));
549-
__ movdbl(xmm7, Address(rsp, 56));
550-
__ addptr(rsp, 64);
563+
restore_xmm_registers(masm);
551564
__ pop_IU_state();
552565
}
553566
}

0 commit comments

Comments
 (0)
Please sign in to comment.