|
1 | 1 | /* |
2 | | - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 | 4 | * |
5 | 5 | * This code is free software; you can redistribute it and/or modify it |
@@ -436,12 +436,12 @@ void GenerateOopMap::mark_bbheaders_and_count_gc_points() { |
436 | 436 | /* We will also mark successors of jsr's as basic block headers. */ |
437 | 437 | switch (bytecode) { |
438 | 438 | case Bytecodes::_jsr: |
439 | | - assert(!fellThrough, "should not happen"); |
440 | | - bb_mark_fct(this, bci + Bytecodes::length_for(bytecode), nullptr); |
441 | | - break; |
442 | 439 | case Bytecodes::_jsr_w: |
443 | 440 | assert(!fellThrough, "should not happen"); |
444 | | - bb_mark_fct(this, bci + Bytecodes::length_for(bytecode), nullptr); |
| 441 | + // If this is the last bytecode, there is no successor to mark |
| 442 | + if (bci + Bytecodes::length_for(bytecode) < method()->code_size()) { |
| 443 | + bb_mark_fct(this, bci + Bytecodes::length_for(bytecode), nullptr); |
| 444 | + } |
445 | 445 | break; |
446 | 446 | default: |
447 | 447 | break; |
@@ -502,7 +502,10 @@ void GenerateOopMap::mark_reachable_code() { |
502 | 502 | case Bytecodes::_jsr: |
503 | 503 | case Bytecodes::_jsr_w: |
504 | 504 | assert(!fell_through, "should not happen"); |
505 | | - reachable_basicblock(this, bci + Bytecodes::length_for(bytecode), &change); |
| 505 | + // If this is the last bytecode, there is no successor to mark |
| 506 | + if (bci + Bytecodes::length_for(bytecode) < method()->code_size()) { |
| 507 | + reachable_basicblock(this, bci + Bytecodes::length_for(bytecode), &change); |
| 508 | + } |
506 | 509 | break; |
507 | 510 | default: |
508 | 511 | break; |
@@ -586,9 +589,6 @@ bool GenerateOopMap::jump_targets_do(BytecodeStream *bcs, jmpFct_t jmpFct, int * |
586 | 589 | case Bytecodes::_jsr: |
587 | 590 | assert(bcs->is_wide()==false, "sanity check"); |
588 | 591 | (*jmpFct)(this, bcs->dest(), data); |
589 | | - |
590 | | - |
591 | | - |
592 | 592 | break; |
593 | 593 | case Bytecodes::_jsr_w: |
594 | 594 | (*jmpFct)(this, bcs->dest_w(), data); |
|
0 commit comments