Skip to content
Browse files
8272307: [lworld] [AArch64] TestCallingConventionC1 test63 and test64…
… get incorrect result

Reviewed-by: thartmann
  • Loading branch information
nick-arm authored and TobiHartmann committed Aug 13, 2021
1 parent a8994ba commit f85b10beff2404c370b175b1cd01bf209b5f3388
Showing 2 changed files with 12 additions and 13 deletions.
@@ -385,14 +385,6 @@ int C1_MacroAssembler::scalarized_entry(const CompiledEntrySignature* ces, int f
BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();

// The runtime call returns the new array in r0 which is also j_rarg7
// so we must avoid clobbering that. Temporarily save r0 in a
// non-argument register and pass the buffered array in r20 instead.
// This is safe because the runtime stub saves all registers.
Register val_array = r20;
Register tmp1 = r21;
mov(tmp1, j_rarg7);

// FIXME -- call runtime only if we cannot in-line allocate all the incoming inline type args.
mov(r19, (intptr_t) ces->method());
if (is_inline_ro_entry) {
@@ -402,8 +394,9 @@ int C1_MacroAssembler::scalarized_entry(const CompiledEntrySignature* ces, int f
int rt_call_offset = offset();

mov(val_array, r0);
mov(j_rarg7, tmp1);
// The runtime call returns the new array in r20 instead of the usual r0
// because r0 is also j_rarg7 which may be holding a live argument here.
Register val_array = r20;

// Remove the temp frame
@@ -892,11 +892,17 @@ OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) {
address entry = (id == buffer_inline_args_id) ?
CAST_FROM_FN_PTR(address, buffer_inline_args) :
CAST_FROM_FN_PTR(address, buffer_inline_args_no_receiver);
int call_offset = __ call_RT(r0, noreg, entry, method);
// This is called from a C1 method's scalarized entry point
// where r0-r7 may be holding live argument values so we can't
// return the result in r0 as the other stubs do. LR is used as
// a temporay below to avoid the result being clobbered by
// restore_live_registers.
int call_offset = __ call_RT(lr, noreg, entry, method);
oop_maps = new OopMapSet();
oop_maps->add_gc_map(call_offset, map);
__ verify_oop(r0); // r0: an array of buffered value objects
__ mov(r20, lr);
__ verify_oop(r20); // r20: an array of buffered value objects

0 comments on commit f85b10b

Please sign in to comment.