hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Test.java
author vdeshpande
Fri, 26 Aug 2016 12:20:09 -0700
changeset 41362 e09e871860a7
parent 40059 c2304140ed64
permissions -rw-r--r--
8154122: Intrinsify fused mac operations Summary: added FMA intrinsics on x86 Reviewed-by: kvn, aph, darcy
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 25635
diff changeset
     1
package compiler.profiling.spectrapredefineclass_classloaders;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 25635
diff changeset
     2
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 25635
diff changeset
     3
import java.lang.reflect.Method;
25635
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
     4
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
     5
public class Test {
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
     6
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
     7
    public boolean m1(A a, Boolean early_return) {
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
     8
        if (early_return.booleanValue()) return true;
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
     9
        boolean res =  m2(a);
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    10
        return res;
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    11
    }
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    12
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    13
    public boolean m2(A a) {
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    14
        boolean res = false;
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    15
        if (a.getClass() == B.class) {
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    16
            a.m();
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    17
        } else {
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    18
            res = true;
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    19
        }
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    20
        return res;
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    21
    }
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    22
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    23
    public void m3(ClassLoader loader) throws Exception {
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 25635
diff changeset
    24
        String packageName = Test.class.getPackage().getName();
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 25635
diff changeset
    25
        Class Test_class = loader.loadClass(packageName + ".Test");
25635
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    26
        Object test = Test_class.newInstance();
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 25635
diff changeset
    27
        Class A_class = loader.loadClass(packageName + ".A");
25635
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    28
        Object a = A_class.newInstance();
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 25635
diff changeset
    29
        Class B_class = loader.loadClass(packageName + ".B");
25635
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    30
        Object b = B_class.newInstance();
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    31
        Method m1 = Test_class.getMethod("m1", A_class, Boolean.class);
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    32
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    33
        // So we don't hit uncommon trap in the next loop
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    34
        for (int i = 0; i < 4000; i++) {
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    35
            m4(m1, test, a, Boolean.TRUE);
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    36
            m4(m1, test, b, Boolean.TRUE);
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    37
        }
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    38
        for (int i = 0; i < 20000; i++) {
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    39
            m4(m1, test, a, Boolean.FALSE);
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    40
        }
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    41
        for (int i = 0; i < 4; i++) {
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    42
            m4(m1, test, b, Boolean.FALSE);
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    43
        }
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    44
    }
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    45
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    46
    public Object m4(Method m, Object test, Object a, Object early_return) throws Exception {
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    47
        return m.invoke(test, a, early_return);
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    48
    }
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    49
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    50
    static public A a = new A();
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    51
    static public B b = new B();
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    52
}
d2f8ae0c908b 8040237: nsk/jvmti/RetransformClasses/retransform001 crashed the VM on all platforms when run with with -server -Xcomp
roland
parents:
diff changeset
    53