RFR: 8285436: riscv: Fix broken MacroAssembler::debug64
Yadong Wang
yadongwang at openjdk.java.net
Fri Apr 22 11:19:35 UTC 2022
On Fri, 22 Apr 2022 07:33:43 GMT, Xiaolin Zheng <xlinzheng at openjdk.org> wrote:
> `MacroAssembler::stop()`[1] and `StubGenerator::generate_verify_oop()`[2] would first push all regs (calling `MacroAssembler::pusha()`[3]) onto the stack and then call `MacroAssembler::debug64()`[4] to print the pushed regs. But `MacroAssembler::pusha()`[3] won't push x0~x4 so the result of `MacroAssembler::debug64()` is broken.
>
> Tested by manually adding a `__ verify_oop(x1)` and option `-XX:+VerifyOops -XX:+ShowMessageBoxOnError` to deliberately crash the VM to make sure the new result matches the fact. Also a hotspot tier1.
>
> [1] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp#L533
> [2] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp#L581
> [3] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp#L1126-L1130
> [4] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp#L473-L503
>
> Thanks,
> Xiaolin
src/hotspot/cpu/riscv/macroAssembler_riscv.cpp line 533:
> 531: void MacroAssembler::stop(const char* msg) {
> 532: address ip = pc();
> 533: push_reg(0xffffffff, sp);
Good catch, Xiaolin. But I plan to follow JDK-8245986 to use a specific instruction which will raise a SIGILL according to riscv spec. The patch will remove all these push/pop(s).
-------------
PR: https://git.openjdk.java.net/jdk/pull/8357
More information about the hotspot-compiler-dev
mailing list