RFR (XS) 8055146: Split Verifier incorrectly throws VerifyError for getstatic of an array field

David Holmes david.holmes at oracle.com
Mon Jan 5 02:13:04 UTC 2015


Hi Harold,

On 1/01/2015 2:38 AM, harold seigel wrote:
> Hi,
>
> Please review this small fix for bug 8055146.  The fix allows the
> operands of getstatic and putstatic bytecodes to be arrays, instead of
> throwing VerifyError exceptions.
>
> Open webrev:  http://cr.openjdk.java.net/~hseigel/bug_8055146/
>
> JBS bug: https://bugs.openjdk.java.net/browse/JDK-8055146

I'm missing something here. It says for getField that it must not be an 
array type; but doesn't say that for getStatic. This puzzles me on two 
fronts:

1. Why should there be any difference between accessing a static versus 
a non-static field in this regard?

2. If I code this:

public class ArrayField {
   static Object[] sarray;
   Object[] array;

   public void test() {
     Object o = sarray;
     Object o2 = array;
     if (o == o2) throw new RuntimeException();
   }
}

the bytecode generated is:

   public void test();
     Code:
        0: getstatic     #2                  // Field 
sarray:[Ljava/lang/Object;
        3: astore_1
        4: aload_0
        5: getfield      #3                  // Field 
array:[Ljava/lang/Object;
        ...

so this seems to be using getField for an array field when it is not 
allowed ??

Thanks,
David

> The fix was tested with JCK lang and VM tests, hotspot JTReg, and NSK
> split_verifier tests.
>
> Thanks, Harold


More information about the hotspot-runtime-dev mailing list