RFR: 8283441: C2: segmentation fault in ciMethodBlocks::make_block_at(int)

Tobias Hartmann thartmann at openjdk.java.net
Mon Apr 25 06:47:43 UTC 2022


On Sat, 23 Apr 2022 03:50:39 GMT, Dean Long <dlong at openjdk.org> wrote:

> The new verifier checks for bytecodes falling off the end of the method, and the old verify does the same, but only for reachable code. So we need to be careful of falling off the end when compiling unreachable code verified by the old verifier.

src/hotspot/share/ci/ciMethodBlocks.cpp line 36:

> 34: 
> 35: ciBlock *ciMethodBlocks::block_containing(int bci) {
> 36:   assert(bci >=0 && bci < _code_size, "valid bytecode range");

Suggestion:

  assert(bci >= 0 && bci < _code_size, "valid bytecode range");

src/hotspot/share/ci/ciMethodBlocks.cpp line 151:

> 149:         cur_block->set_control_bci(bci);
> 150:         if (s.next_bci() < limit_bci) {
> 151:           ciBlock *fall_through = make_block_at(s.next_bci());

I see that we already have this check in place for some usages of `make_block_at`. Could we simply move the checks into that method (and assert `!= NULL` at use sides where this should never happen)? 

If not, can we at least remove the unused local variables? Like so:

Suggestion:

          make_block_at(s.next_bci());

test/hotspot/jtreg/compiler/parsing/UnreachableBlockFallsThroughEndOfCode.java line 29:

> 27:  * @bug 8283441
> 28:  * @compile Custom.jasm UnreachableBlockFallsThroughEndOfCode.java
> 29:  * @summary Compilng method that falls off the end of the code array

Suggestion:

 * @summary Compiling method that falls off the end of the code array

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

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


More information about the hotspot-compiler-dev mailing list