-
Bug
-
Resolution: Fixed
-
P4
-
19
-
b16
-
riscv
-
linux
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; it 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 fastdebug build:
```
// 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.
```
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; it 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 fastdebug build:
```
// 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.