RFR: JDK-8310020: MacroAssembler::call_VM(_leaf) doesn't consistently check for conflict with C calling convention. [v2]
Fei Yang
fyang at openjdk.org
Thu Jun 15 08:11:59 UTC 2023
On Thu, 15 Jun 2023 07:20:29 GMT, Damon Fenacci <duke at openjdk.org> wrote:
>> # Issue
>> The `MacroAssembler::call_VM` and `MacroAssembler::call_VM_leaf` methods don't include asserts to check if the passed arguments collide with the C calling convention registers **consistently**. Some versions omit them completely (e.g. aarch64 `MacroAssembler::call_VM_leaf`), other ones use regular asserts (where the `assert_different_registers` function should be used).
>>
>> # Solution
>> We use `assert_different_registers` across all `MacroAssembler::call_VM` and `MacroAssembler::call_VM_leaf` where a check is needed (except for the arm implementation, which doesn't change as it uses fixed registers).
>>
>> # Testing
>> This fix includes changes for x86_32/64 and aarch64, which I could test thoroughly but also for **ppc,** **riscv**, and **s390** for which I would **need some help with testing**.
>
> Damon Fenacci has updated the pull request incrementally with one additional commit since the last revision:
>
> Update src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
>
> Co-authored-by: Tobias Hartmann <tobias.hartmann at oracle.com>
Hello, I can help do some tests on linux-riscv64 platform.
But I think we need following extra changes for riscv. Could you please help add this? Thanks.
diff --git a/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp b/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp
index e6d1e66e0c0..32a144b2d42 100644
--- a/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp
+++ b/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp
@@ -666,6 +666,7 @@ void MacroAssembler::call_VM_leaf(address entry_point, Register arg_0) {
}
void MacroAssembler::call_VM_leaf(address entry_point, Register arg_0, Register arg_1) {
+ assert_different_registers(arg_1, c_rarg0);
pass_arg0(this, arg_0);
pass_arg1(this, arg_1);
call_VM_leaf_base(entry_point, 2);
@@ -673,6 +674,8 @@ void MacroAssembler::call_VM_leaf(address entry_point, Register arg_0, Register
void MacroAssembler::call_VM_leaf(address entry_point, Register arg_0,
Register arg_1, Register arg_2) {
+ assert_different_registers(arg_1, c_rarg0);
+ assert_different_registers(arg_2, c_rarg0, c_rarg1);
pass_arg0(this, arg_0);
pass_arg1(this, arg_1);
pass_arg2(this, arg_2);
-------------
PR Comment: https://git.openjdk.org/jdk/pull/14470#issuecomment-1592569161
More information about the hotspot-dev
mailing list