[premain] need help merging g1BarrierSetC2.cpp
Andrew Dinn
adinn at redhat.com
Mon Oct 14 14:49:16 UTC 2024
Hi Ioi,
I believe I have worked out what was causing the aarch64 code to break.
A call from archived C2 code to
G1BarrierSetRuntime::write_ref_field_pre_entry was not being relocated
and so we ended up jumping to an address in the old VM 0xffff76c77578
rather than the correct address in the new VM 0xfffff4c77578.
This was happening because the C2 barrier code was refactored to use
some new helper methods and one of them,
generate_c2_barrier_runtime_call, failed to load its branch target using
a RuntimeAddress wrapper
static void generate_c2_barrier_runtime_call(MacroAssembler* masm,
G1BarrierStubC2* stub, const Register arg, const address runtime_path) {
SaveLiveRegisters save_registers(masm, stub);
if (c_rarg0 != arg) {
__ mov(c_rarg0, arg);
}
__ mov(c_rarg1, rthread);
__ mov(rscratch1, runtime_path);
__ blr(rscratch1);
}
The mov to rscratch1 above needs to be replaced with
__ lea(rscratch1, RuntimeAddress(runtime_path));
I have pushed a patch to the branch in my repo and with this patch the
ExcludedClasses, JavacBench, MicronautFirstApp, HelidonQuickStart and
SpringPetclinic tests all passed.
I am not sure what is breaking x86 but it is not the same problem -- the
x86 implementation of generate_c2_barrier_runtime_call is defined
correctly as follows:
static void generate_c2_barrier_runtime_call(MacroAssembler* masm,
G1BarrierStubC2* stub, const Register arg, const address runtime_path) {
#ifdef _LP64
SaveLiveRegisters save_registers(masm, stub);
if (c_rarg0 != arg) {
__ mov(c_rarg0, arg);
}
__ mov(c_rarg1, r15_thread);
// rax is a caller-saved, non-argument-passing register, so it
does not
// interfere with c_rarg0 or c_rarg1. If it contained any live
value before
// entering this stub, it is saved at this point, and restored
after the
// call. If it did not contain any live value, it is free to be
used. In
// either case, it is safe to use it here as a call scratch register.
__ call(RuntimeAddress(runtime_path), rax);
#else
Unimplemented();
#endif // _LP64
}
I will move on now to debugging the problems on x86.
regards,
Andrew Dinn
-----------
More information about the leyden-dev
mailing list