RFR: 8283737: riscv: MacroAssembler::stop() is used in AD file and it should generate a fixed-length size
Xiaolin Zheng
xlinzheng at openjdk.java.net
Mon Mar 28 04:48:09 UTC 2022
Hi team,
Could I have a review of this simple patch? -
`PhaseOutput::fill_buffer` detects if the real size of a node matches (<=) the size of it in scratch_emit(). The call chain for MacroAssembler::stop() is:
MachEpilogNode::emit
-> reserved_stack_check()
-> should_not_reach_here()
-> stop(const char *msg)
`li()` on RISCV could generate 1~6 instructions, and the msg argument could be an on-stack buffer; `stop()` also uses `__ pc()` that could also be different in `scratch_emit()` and `emit()`. They both have the potential issue here so the size generated in `MacroAssembler::stop()` needs to be a fixed value.
Could be reproduced in the fastdebug build by adding one line:
// Die now.
instruct ShouldNotReachHere() %{
match(Halt);
ins_cost(BRANCH_COST);
format %{ "#@ShouldNotReachHere" %}
ins_encode %{
Assembler::CompressibleRegion cr(&_masm);
if (is_reachable()) {
__ halt();
+ __ unimplemented("this is an on-stack char literal"); // assertion fail at 'assert(false, "wrong size of mach node");'
}
%}
ins_pipe(pipe_class_default);
%}
This patch also fixes a typo introduced in JDK-8278994: `c_bnez` is mistakenly written to `c_beqz`, though not used until now, needing a fix for future usage.
Tests passed in hotspot tier1 & jdk tier1 without new errors found.
Thanks,
Xiaolin
-------------
Commit messages:
- Fix a typo instroduced when refactoring: c.beqz
- MacroAssembler::stop() is used in adfile and it should generate a fixed-length size
Changes: https://git.openjdk.java.net/jdk/pull/7982/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=7982&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8283737
Stats: 5 lines in 2 files changed: 2 ins; 0 del; 3 mod
Patch: https://git.openjdk.java.net/jdk/pull/7982.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/7982/head:pull/7982
PR: https://git.openjdk.java.net/jdk/pull/7982
More information about the hotspot-dev
mailing list