hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java
author dpochepk
Wed, 20 Jul 2016 19:29:10 +0300
changeset 40076 1e283716fd17
parent 40059 c2304140ed64
child 40631 ed82623d7831
permissions -rw-r--r--
8161508: JVMCI: MaterializeVirtualObjectTest fails w/ "CASE: invalidate=true: has no virtual object before materialization Reviewed-by: kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
     1
/*
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
     4
 *
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
     7
 * published by the Free Software Foundation.
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
     8
 *
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    13
 * accompanied this code).
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    14
 *
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    18
 *
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    21
 * questions.
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    22
 */
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    23
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    24
/*
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    25
 * @test
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    26
 * @bug 8136421
39291
a4efe145313d 8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents: 38700
diff changeset
    27
 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
40076
1e283716fd17 8161508: JVMCI: MaterializeVirtualObjectTest fails w/ "CASE: invalidate=true: has no virtual object before materialization
dpochepk
parents: 40059
diff changeset
    28
 *         & (vm.compMode != "Xcomp" | vm.opt.TieredCompilation == null | vm.opt.TieredCompilation == true)
1e283716fd17 8161508: JVMCI: MaterializeVirtualObjectTest fails w/ "CASE: invalidate=true: has no virtual object before materialization
dpochepk
parents: 40059
diff changeset
    29
 * @summary no "-Xcomp -XX:-TieredCompilation" combination allowed until JDK-8140018 is resolved
33730
30e064828045 8140189: [TESTBUG] Get rid of "@library /../../test/lib" in jtreg tests
cjplummer
parents: 33191
diff changeset
    30
 * @library / /testlibrary /test/lib
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35148
diff changeset
    31
 * @library ../common/patches
38152
80e5da81fb2c 8154258: [TESTBUG] Various serviceability tests fail compilation
dsamersoff
parents: 36508
diff changeset
    32
 * @modules java.base/jdk.internal.misc
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35148
diff changeset
    33
 * @modules java.base/jdk.internal.org.objectweb.asm
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35148
diff changeset
    34
 *          java.base/jdk.internal.org.objectweb.asm.tree
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35148
diff changeset
    35
 *          jdk.vm.ci/jdk.vm.ci.hotspot
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35148
diff changeset
    36
 *          jdk.vm.ci/jdk.vm.ci.code
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35148
diff changeset
    37
 *          jdk.vm.ci/jdk.vm.ci.meta
40053
b3617982544e 8160657: Compiler HotSpot tests should use the "run driver" directive where applicable
iignatyev
parents: 39291
diff changeset
    38
 *
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35148
diff changeset
    39
 * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35148
diff changeset
    40
 * @build compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35148
diff changeset
    41
 * @build sun.hotspot.WhiteBox
40053
b3617982544e 8160657: Compiler HotSpot tests should use the "run driver" directive where applicable
iignatyev
parents: 39291
diff changeset
    42
 * @run driver ClassFileInstaller sun.hotspot.WhiteBox
b3617982544e 8160657: Compiler HotSpot tests should use the "run driver" directive where applicable
iignatyev
parents: 39291
diff changeset
    43
 *                                sun.hotspot.WhiteBox$WhiteBoxPermission
38688
ad115177801f 8139703: [TESTBUG] compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest fails using -Xcomp
dpochepk
parents: 38152
diff changeset
    44
 * @run main/othervm -Xmixed -Xbootclasspath/a:.
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35148
diff changeset
    45
 *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35148
diff changeset
    46
 *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35148
diff changeset
    47
 *                   -XX:CompileCommand=exclude,*::check
40076
1e283716fd17 8161508: JVMCI: MaterializeVirtualObjectTest fails w/ "CASE: invalidate=true: has no virtual object before materialization
dpochepk
parents: 40059
diff changeset
    48
 *                   -XX:+DoEscapeAnalysis -XX:-UseCounterDecay
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35148
diff changeset
    49
 *                   -Xbatch
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35148
diff changeset
    50
 *                   -Dcompiler.jvmci.compilerToVM.MaterializeVirtualObjectTest.invalidate=false
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35148
diff changeset
    51
 *                   compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest
38688
ad115177801f 8139703: [TESTBUG] compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest fails using -Xcomp
dpochepk
parents: 38152
diff changeset
    52
 * @run main/othervm -Xmixed -Xbootclasspath/a:.
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35148
diff changeset
    53
 *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35148
diff changeset
    54
 *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35148
diff changeset
    55
 *                   -XX:CompileCommand=exclude,*::check
40076
1e283716fd17 8161508: JVMCI: MaterializeVirtualObjectTest fails w/ "CASE: invalidate=true: has no virtual object before materialization
dpochepk
parents: 40059
diff changeset
    56
 *                   -XX:+DoEscapeAnalysis -XX:-UseCounterDecay
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35148
diff changeset
    57
 *                   -Xbatch
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35148
diff changeset
    58
 *                   -Dcompiler.jvmci.compilerToVM.MaterializeVirtualObjectTest.invalidate=true
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35148
diff changeset
    59
 *                   compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    60
 */
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    61
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    62
package compiler.jvmci.compilerToVM;
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    63
33632
038347770a9e 8139170: JVMCI refresh
twisti
parents: 33191
diff changeset
    64
import compiler.jvmci.common.CTVMUtilities;
038347770a9e 8139170: JVMCI refresh
twisti
parents: 33191
diff changeset
    65
import compiler.testlibrary.CompilerUtils;
38688
ad115177801f 8139703: [TESTBUG] compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest fails using -Xcomp
dpochepk
parents: 38152
diff changeset
    66
import compiler.whitebox.CompilerWhiteBoxTest;
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 40053
diff changeset
    67
import jdk.test.lib.Asserts;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 40053
diff changeset
    68
import jdk.vm.ci.hotspot.CompilerToVMHelper;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 40053
diff changeset
    69
import jdk.vm.ci.hotspot.HotSpotStackFrameReference;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 40053
diff changeset
    70
import jdk.vm.ci.meta.ResolvedJavaMethod;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 40053
diff changeset
    71
import sun.hotspot.WhiteBox;
33632
038347770a9e 8139170: JVMCI refresh
twisti
parents: 33191
diff changeset
    72
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 40053
diff changeset
    73
import java.lang.reflect.Method;
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    74
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    75
public class MaterializeVirtualObjectTest {
38688
ad115177801f 8139703: [TESTBUG] compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest fails using -Xcomp
dpochepk
parents: 38152
diff changeset
    76
    private static final WhiteBox WB;
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    77
    private static final Method METHOD;
33632
038347770a9e 8139170: JVMCI refresh
twisti
parents: 33191
diff changeset
    78
    private static final ResolvedJavaMethod RESOLVED_METHOD;
38688
ad115177801f 8139703: [TESTBUG] compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest fails using -Xcomp
dpochepk
parents: 38152
diff changeset
    79
    private static final boolean INVALIDATE;
38700
6aa6444c1b48 8157438: JVMCI: MaterializeVirtualObjectTest fails w/ "CASE: invalidate=true: has no virtual object before"
dpochepk
parents: 38688
diff changeset
    80
    private static final int COMPILE_THRESHOLD;
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    81
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    82
    static {
38688
ad115177801f 8139703: [TESTBUG] compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest fails using -Xcomp
dpochepk
parents: 38152
diff changeset
    83
        WB = WhiteBox.getWhiteBox();
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    84
        try {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    85
            METHOD = MaterializeVirtualObjectTest.class.getDeclaredMethod(
38688
ad115177801f 8139703: [TESTBUG] compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest fails using -Xcomp
dpochepk
parents: 38152
diff changeset
    86
                    "testFrame", String.class, int.class);
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    87
        } catch (NoSuchMethodException e) {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    88
            throw new Error("Can't get executable for test method", e);
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    89
        }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    90
        RESOLVED_METHOD = CTVMUtilities.getResolvedMethod(METHOD);
38688
ad115177801f 8139703: [TESTBUG] compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest fails using -Xcomp
dpochepk
parents: 38152
diff changeset
    91
        INVALIDATE = Boolean.getBoolean(
38700
6aa6444c1b48 8157438: JVMCI: MaterializeVirtualObjectTest fails w/ "CASE: invalidate=true: has no virtual object before"
dpochepk
parents: 38688
diff changeset
    92
                "compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest.invalidate");
6aa6444c1b48 8157438: JVMCI: MaterializeVirtualObjectTest fails w/ "CASE: invalidate=true: has no virtual object before"
dpochepk
parents: 38688
diff changeset
    93
        COMPILE_THRESHOLD = WB.getBooleanVMFlag("TieredCompilation")
6aa6444c1b48 8157438: JVMCI: MaterializeVirtualObjectTest fails w/ "CASE: invalidate=true: has no virtual object before"
dpochepk
parents: 38688
diff changeset
    94
                ? CompilerWhiteBoxTest.THRESHOLD
6aa6444c1b48 8157438: JVMCI: MaterializeVirtualObjectTest fails w/ "CASE: invalidate=true: has no virtual object before"
dpochepk
parents: 38688
diff changeset
    95
                : CompilerWhiteBoxTest.THRESHOLD * 2;
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    96
    }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    97
33184
db796ab93ba7 8139438: [TESTBUG] JVMCI test fails with RuntimeException: Has no virtual object before materialization
dpochepk
parents: 33160
diff changeset
    98
    public static void main(String[] args) {
db796ab93ba7 8139438: [TESTBUG] JVMCI test fails with RuntimeException: Has no virtual object before materialization
dpochepk
parents: 33160
diff changeset
    99
        int levels[] = CompilerUtils.getAvailableCompilationLevels();
db796ab93ba7 8139438: [TESTBUG] JVMCI test fails with RuntimeException: Has no virtual object before materialization
dpochepk
parents: 33160
diff changeset
   100
        // we need compilation level 4 to use EscapeAnalysis
db796ab93ba7 8139438: [TESTBUG] JVMCI test fails with RuntimeException: Has no virtual object before materialization
dpochepk
parents: 33160
diff changeset
   101
        if (levels.length < 1 || levels[levels.length - 1] != 4) {
db796ab93ba7 8139438: [TESTBUG] JVMCI test fails with RuntimeException: Has no virtual object before materialization
dpochepk
parents: 33160
diff changeset
   102
            System.out.println("INFO: Test needs compilation level 4 to"
db796ab93ba7 8139438: [TESTBUG] JVMCI test fails with RuntimeException: Has no virtual object before materialization
dpochepk
parents: 33160
diff changeset
   103
                    + " be available. Skipping.");
db796ab93ba7 8139438: [TESTBUG] JVMCI test fails with RuntimeException: Has no virtual object before materialization
dpochepk
parents: 33160
diff changeset
   104
        } else {
db796ab93ba7 8139438: [TESTBUG] JVMCI test fails with RuntimeException: Has no virtual object before materialization
dpochepk
parents: 33160
diff changeset
   105
            new MaterializeVirtualObjectTest().test();
db796ab93ba7 8139438: [TESTBUG] JVMCI test fails with RuntimeException: Has no virtual object before materialization
dpochepk
parents: 33160
diff changeset
   106
        }
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   107
    }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   108
33184
db796ab93ba7 8139438: [TESTBUG] JVMCI test fails with RuntimeException: Has no virtual object before materialization
dpochepk
parents: 33160
diff changeset
   109
    private static String getName() {
db796ab93ba7 8139438: [TESTBUG] JVMCI test fails with RuntimeException: Has no virtual object before materialization
dpochepk
parents: 33160
diff changeset
   110
        return "CASE: invalidate=" + INVALIDATE;
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   111
    }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   112
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   113
    private void test() {
33184
db796ab93ba7 8139438: [TESTBUG] JVMCI test fails with RuntimeException: Has no virtual object before materialization
dpochepk
parents: 33160
diff changeset
   114
        System.out.println(getName());
db796ab93ba7 8139438: [TESTBUG] JVMCI test fails with RuntimeException: Has no virtual object before materialization
dpochepk
parents: 33160
diff changeset
   115
        Asserts.assertFalse(WB.isMethodCompiled(METHOD), getName()
db796ab93ba7 8139438: [TESTBUG] JVMCI test fails with RuntimeException: Has no virtual object before materialization
dpochepk
parents: 33160
diff changeset
   116
                + " : method unexpectedly compiled");
38688
ad115177801f 8139703: [TESTBUG] compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest fails using -Xcomp
dpochepk
parents: 38152
diff changeset
   117
        /* need to trigger compilation by multiple method invocations
ad115177801f 8139703: [TESTBUG] compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest fails using -Xcomp
dpochepk
parents: 38152
diff changeset
   118
           in order to have method profile data to be gathered */
ad115177801f 8139703: [TESTBUG] compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest fails using -Xcomp
dpochepk
parents: 38152
diff changeset
   119
        for (int i = 0; i < COMPILE_THRESHOLD; i++) {
ad115177801f 8139703: [TESTBUG] compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest fails using -Xcomp
dpochepk
parents: 38152
diff changeset
   120
            testFrame("someString", i);
ad115177801f 8139703: [TESTBUG] compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest fails using -Xcomp
dpochepk
parents: 38152
diff changeset
   121
        }
33184
db796ab93ba7 8139438: [TESTBUG] JVMCI test fails with RuntimeException: Has no virtual object before materialization
dpochepk
parents: 33160
diff changeset
   122
        Asserts.assertTrue(WB.isMethodCompiled(METHOD), getName()
db796ab93ba7 8139438: [TESTBUG] JVMCI test fails with RuntimeException: Has no virtual object before materialization
dpochepk
parents: 33160
diff changeset
   123
                + "Method unexpectedly not compiled");
38700
6aa6444c1b48 8157438: JVMCI: MaterializeVirtualObjectTest fails w/ "CASE: invalidate=true: has no virtual object before"
dpochepk
parents: 38688
diff changeset
   124
        testFrame("someString", COMPILE_THRESHOLD);
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   125
    }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   126
38688
ad115177801f 8139703: [TESTBUG] compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest fails using -Xcomp
dpochepk
parents: 38152
diff changeset
   127
    private void testFrame(String str, int iteration) {
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   128
        Helper helper = new Helper(str);
38688
ad115177801f 8139703: [TESTBUG] compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest fails using -Xcomp
dpochepk
parents: 38152
diff changeset
   129
        check(iteration);
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   130
        Asserts.assertTrue((helper.string != null) && (this != null)
33184
db796ab93ba7 8139438: [TESTBUG] JVMCI test fails with RuntimeException: Has no virtual object before materialization
dpochepk
parents: 33160
diff changeset
   131
                && (helper != null), getName() + " : some locals are null");
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   132
    }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   133
38688
ad115177801f 8139703: [TESTBUG] compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest fails using -Xcomp
dpochepk
parents: 38152
diff changeset
   134
    private void check(int iteration) {
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   135
        // Materialize virtual objects on last invocation
38700
6aa6444c1b48 8157438: JVMCI: MaterializeVirtualObjectTest fails w/ "CASE: invalidate=true: has no virtual object before"
dpochepk
parents: 38688
diff changeset
   136
        if (iteration == COMPILE_THRESHOLD) {
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   137
            HotSpotStackFrameReference hsFrame = CompilerToVMHelper
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   138
                    .getNextStackFrame(/* topmost frame */ null,
33632
038347770a9e 8139170: JVMCI refresh
twisti
parents: 33191
diff changeset
   139
                            new ResolvedJavaMethod[]{
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   140
                                RESOLVED_METHOD}, /* don't skip any */ 0);
33184
db796ab93ba7 8139438: [TESTBUG] JVMCI test fails with RuntimeException: Has no virtual object before materialization
dpochepk
parents: 33160
diff changeset
   141
            Asserts.assertNotNull(hsFrame, getName() + " : got null frame");
db796ab93ba7 8139438: [TESTBUG] JVMCI test fails with RuntimeException: Has no virtual object before materialization
dpochepk
parents: 33160
diff changeset
   142
            Asserts.assertTrue(WB.isMethodCompiled(METHOD), getName()
db796ab93ba7 8139438: [TESTBUG] JVMCI test fails with RuntimeException: Has no virtual object before materialization
dpochepk
parents: 33160
diff changeset
   143
                    + "Test method should be compiled");
db796ab93ba7 8139438: [TESTBUG] JVMCI test fails with RuntimeException: Has no virtual object before materialization
dpochepk
parents: 33160
diff changeset
   144
            Asserts.assertTrue(hsFrame.hasVirtualObjects(), getName()
db796ab93ba7 8139438: [TESTBUG] JVMCI test fails with RuntimeException: Has no virtual object before materialization
dpochepk
parents: 33160
diff changeset
   145
                    + ": has no virtual object before materialization");
db796ab93ba7 8139438: [TESTBUG] JVMCI test fails with RuntimeException: Has no virtual object before materialization
dpochepk
parents: 33160
diff changeset
   146
            CompilerToVMHelper.materializeVirtualObjects(hsFrame, INVALIDATE);
db796ab93ba7 8139438: [TESTBUG] JVMCI test fails with RuntimeException: Has no virtual object before materialization
dpochepk
parents: 33160
diff changeset
   147
            Asserts.assertFalse(hsFrame.hasVirtualObjects(), getName()
db796ab93ba7 8139438: [TESTBUG] JVMCI test fails with RuntimeException: Has no virtual object before materialization
dpochepk
parents: 33160
diff changeset
   148
                    + " : has virtual object after materialization");
db796ab93ba7 8139438: [TESTBUG] JVMCI test fails with RuntimeException: Has no virtual object before materialization
dpochepk
parents: 33160
diff changeset
   149
            Asserts.assertEQ(WB.isMethodCompiled(METHOD), !INVALIDATE, getName()
db796ab93ba7 8139438: [TESTBUG] JVMCI test fails with RuntimeException: Has no virtual object before materialization
dpochepk
parents: 33160
diff changeset
   150
                    + " : unexpected compiled status");
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   151
        }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   152
    }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   153
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   154
    private class Helper {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   155
        public String string;
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   156
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   157
        public Helper(String s) {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   158
            this.string = s;
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   159
        }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   160
    }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   161
}