Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8272566: [lworld] [AArch64] G1 write barrier slow path needs to save more registers #534

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -154,12 +154,26 @@ void G1BarrierSetAssembler::g1_write_barrier_pre(MacroAssembler* masm,
__ b(done);

__ bind(runtime);

// save the live input values
RegSet saved = RegSet::of(pre_val);
FloatRegSet fsaved;
if (tosca_live) saved += RegSet::of(r0);
if (obj != noreg) saved += RegSet::of(obj);

// Barriers might be emitted when converting between (scalarized) calling
// conventions for inline types. Save all argument registers before calling
// into the runtime.
if (EnableValhalla && InlineTypePassFieldsAsArgs) {
saved += RegSet::of(j_rarg0, j_rarg1, j_rarg2, j_rarg3);
saved += RegSet::of(j_rarg4, j_rarg5, j_rarg6, j_rarg7);

fsaved += FloatRegSet::of(j_farg0, j_farg1, j_farg2, j_farg3);
fsaved += FloatRegSet::of(j_farg4, j_farg5, j_farg6, j_farg7);
}

__ push(saved, sp);
__ push_fp(fsaved, sp);

// Calling the runtime using the regular call_VM_leaf mechanism generates
// code (generated by InterpreterMacroAssember::call_VM_leaf_base)
@@ -180,6 +194,7 @@ void G1BarrierSetAssembler::g1_write_barrier_pre(MacroAssembler* masm,
__ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_pre_entry), pre_val, thread);
}

__ pop_fp(fsaved, sp);
__ pop(saved, sp);

__ bind(done);
@@ -254,10 +269,26 @@ void G1BarrierSetAssembler::g1_write_barrier_post(MacroAssembler* masm,
__ b(done);

__ bind(runtime);

// save the live input values
RegSet saved = RegSet::of(store_addr);
FloatRegSet fsaved;

// Barriers might be emitted when converting between (scalarized) calling
// conventions for inline types. Save all argument registers before calling
// into the runtime.
if (EnableValhalla && InlineTypePassFieldsAsArgs) {
saved += RegSet::of(j_rarg0, j_rarg1, j_rarg2, j_rarg3);
saved += RegSet::of(j_rarg4, j_rarg5, j_rarg6, j_rarg7);

fsaved += FloatRegSet::of(j_farg0, j_farg1, j_farg2, j_farg3);
fsaved += FloatRegSet::of(j_farg4, j_farg5, j_farg6, j_farg7);
}

__ push(saved, sp);
__ push_fp(fsaved, sp);
__ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_post_entry), card_addr, thread);
__ pop_fp(fsaved, sp);
__ pop(saved, sp);

__ bind(done);
@@ -311,13 +342,13 @@ void G1BarrierSetAssembler::oop_store_at(MacroAssembler* masm, DecoratorSet deco
}

if (needs_pre_barrier) {
g1_write_barrier_pre(masm,
tmp1 /* obj */,
tmp2 /* pre_val */,
rthread /* thread */,
tmp3 /* tmp */,
val != noreg /* tosca_live */,
false /* expand_call */);
g1_write_barrier_pre(masm,
tmp1 /* obj */,
tmp2 /* pre_val */,
rthread /* thread */,
tmp3 /* tmp */,
val != noreg /* tosca_live */,
false /* expand_call */);
}

if (val == noreg) {
@@ -5742,8 +5742,12 @@ bool MacroAssembler::pack_inline_helper(const GrowableArray<SigEntry>* sig, int&
return true; // Already written
}

Register val_obj_tmp = r11;
Register from_reg_tmp = r10;
// The GC barrier expanded by store_heap_oop below may call into the
// runtime so use callee-saved registers for any values that need to be
// preserved. The GC barrier assembler should take care of saving the
// Java argument registers.
Register val_obj_tmp = r21;
Register from_reg_tmp = r22;
Register tmp1 = r14;
Register tmp2 = r13;
Register tmp3 = r12;