RFR: 8285436: riscv: Fix broken MacroAssembler::debug64
Xiaolin Zheng
xlinzheng at openjdk.java.net
Fri Apr 22 11:40:24 UTC 2022
On Fri, 22 Apr 2022 11:15:46 GMT, Yadong Wang <yadongwang 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).
Thank you for the explanation, Yadong. That would be better if you have future plans for this part, and I feel fine to retract this one as well because it might be not so important.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8357
More information about the hotspot-compiler-dev
mailing list