RFR: 8341415: Optimize RawBytecodeHelper::next

Chen Liang liach at openjdk.org
Wed Oct 2 20:31:34 UTC 2024


On Wed, 2 Oct 2024 19:59:07 GMT, ExE Boss <duke at openjdk.org> wrote:

>> The checkSpecialInstruction has already added the 'len <= 0' process, so there is no need to check 'len <= '0' again.
>
> `checkSpecialInstruction` will return `-1` in the following cases:
> * `code == WIDE` and `bci + 1 >= end`
> * `code == TABLESWITCH` and `align(bci + 1) + 3 * 4 >= end`
> * `code == LOOKUPSWITCH` and
>   * `align(bci + 1) + 2 * 4 >= end`
>   * or `npairs` is out of range
> 
> Which will cause `nextBci` to be decremented in those cases in the proposed implementation.

`nextBci` is used only if we proceed. I believe none of the use sites processing untrusted bytecode (including verification but excluding stack map generation) proceeds when it receives an `INVALID` result, so change to `nextBci` in that case has no impact.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21300#discussion_r1785213182


More information about the core-libs-dev mailing list