RFR: 8278384: Bytecodes::result_type() for arraylength returns T_VOID instead of T_INT

Harold Seigel hseigel at openjdk.java.net
Fri Dec 17 15:14:29 UTC 2021


On Thu, 16 Dec 2021 13:39:18 GMT, Harold Seigel <hseigel at openjdk.org> wrote:

> Please review this small change to specify T_INT instead of T_VOID as the return type for the arraylength bytecode.  The fix was tested with Mach5 tiers 1-2 on Linux, Mac OS, and Windows, and Mach5 tiers 3-5 on Linux x64.
> 
> Thanks, Harold

Thanks Lois and David for the reviews.

In some cases, such as in this code in ExceptionMessageBuilder::do_instruction(int bci), a work-around was used to avoid the bug:


    case Bytecodes::_newarray:
    case Bytecodes::_anewarray:
    case Bytecodes::_instanceof:
      stack->pop(1);
      stack->push(bci, Bytecodes::result_type(code));
      break;

    case Bytecodes::_arraylength:
      // The return type of arraylength is wrong in the bytecodes table (T_VOID).
      stack->pop(1);
      stack->push(bci, T_INT);
      break;


In other cases, as mentioned in JBS-8278384, this issue caused a crash when running test CanonicalizeArrayLength.java with options -XX:+DeoptimizeALot -XX:+VerifyStack.  I ran test CanonicalizeArrayLength.java with those options several times, with the fix, and was unable to reproduce the crash.

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

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


More information about the hotspot-runtime-dev mailing list