Integrated: 8283737: riscv: MacroAssembler::stop() should emit fixed-length instruction sequence
Xiaolin Zheng
xlinzheng at openjdk.java.net
Wed Mar 30 09:08:41 UTC 2022
On Mon, 28 Mar 2022 04:41:11 GMT, Xiaolin Zheng <xlinzheng at openjdk.org> wrote:
> 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);
> %}
>
>
> Tests passed in hotspot tier1 & jdk tier1 without new errors found.
>
> Thanks,
> Xiaolin
This pull request has now been integrated.
Changeset: b82b0090
Author: Xiaolin Zheng <xlinzheng at openjdk.org>
Committer: Fei Yang <fyang at openjdk.org>
URL: https://git.openjdk.java.net/jdk/commit/b82b0090474d1873ec8a42a3bfc71de972782e78
Stats: 5 lines in 1 file changed: 3 ins; 0 del; 2 mod
8283737: riscv: MacroAssembler::stop() should emit fixed-length instruction sequence
Reviewed-by: fyang, shade
-------------
PR: https://git.openjdk.java.net/jdk/pull/7982
More information about the hotspot-compiler-dev
mailing list