RFR: JDK-8310020: MacroAssembler::call_VM(_leaf) doesn't consistently check for conflict with C calling convention.

Tobias Hartmann thartmann at openjdk.org
Thu Jun 15 07:13:00 UTC 2023


On Wed, 14 Jun 2023 14:12:12 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**.

src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp line 1628:

> 1626:   assert_different_registers(arg_0, c_rarg1, c_rarg2, c_rarg3);
> 1627:   assert_different_registers(arg_1, c_rarg2, c_rarg3);
> 1628:   assert_different_registers(arg_2, c_rarg2);

Shouldn't this be

Suggestion:

  assert_different_registers(arg_2, c_rarg3);

?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/14470#discussion_r1230540825


More information about the hotspot-dev mailing list