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

2016-05-20 Thread Artem Smotrakov

Hello,

Could someone review this fix, please?

http://cr.openjdk.java.net/~asmotrak/8152207/hotspot/webrev.01/
http://cr.openjdk.java.net/~asmotrak/8152207/jdk/webrev.00/

Artem

On 05/10/2016 01:49 PM, Artem Smotrakov wrote:

Hi Christian,

Thank you for review. Here is updated webrev

http://cr.openjdk.java.net/~asmotrak/8152207/hotspot/webrev.01/

Artem

On 05/09/2016 01:24 PM, Christian Thalinger wrote:


On May 4, 2016, at 1:48 PM, Artem Smotrakov 
> 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 boolis_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








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

2016-05-10 Thread Artem Smotrakov

Hi Christian,

Thank you for review. Here is updated webrev

http://cr.openjdk.java.net/~asmotrak/8152207/hotspot/webrev.01/

Artem

On 05/09/2016 01:24 PM, Christian Thalinger wrote:


On May 4, 2016, at 1:48 PM, Artem Smotrakov 
> 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 boolis_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






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

2016-05-09 Thread Christian Thalinger

> On May 4, 2016, at 1:48 PM, Artem Smotrakov  
> 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 boolis_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