RFR: 8285436: riscv: Fix broken MacroAssembler::debug64

Xiaolin Zheng xlinzheng at openjdk.java.net
Fri Apr 22 07:42:03 UTC 2022


`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

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

Commit messages:
 - Fix: broken MacroAssembler::debug64

Changes: https://git.openjdk.java.net/jdk/pull/8357/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=8357&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8285436
  Stats: 2 lines in 2 files changed: 0 ins; 0 del; 2 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8357.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8357/head:pull/8357

PR: https://git.openjdk.java.net/jdk/pull/8357


More information about the hotspot-dev mailing list