[9] RFR: 8152207: Perform array bound checks while getting a length of bytecode instructions

Christian Thalinger christian.thalinger at oracle.com
Mon May 9 20:24:27 UTC 2016


> On May 4, 2016, at 1:48 PM, Artem Smotrakov <artem.smotrakov at oracle.com> wrote:
> 
> Hello,
> 
> Please review two small patches for jdk and hotspot repos which add array bound checks to functions which return a length of bytecode instruction.
> 
> Please see details in https://bugs.openjdk.java.net/browse/JDK-8152207
> 
> http://cr.openjdk.java.net/~asmotrak/8152207/jdk/webrev.00/
> http://cr.openjdk.java.net/~asmotrak/8152207/hotspot/webrev.00/

  static bool        is_defined     (int  code)    { return 0 <= code && code < number_of_codes && flags(code, false) != 0; }
+  static int         length_for     (Code code)    { return 0 <= code && code < number_of_codes ? _lengths[code] & 0xF : -1; }
+  static int         wide_length_for(Code code)    { return 0 <= code && code < number_of_codes ? _lengths[code]  >> 4 : -1; }
You should factor the bound check into a separate method.

> 
> Artem



More information about the hotspot-runtime-dev mailing list