test/hotspot/jtreg/compiler/linkage/TestLinkageErrorInGenerateOopMap.java
author rwestberg
Mon, 04 Jun 2018 16:21:08 +0200
changeset 50391 2bea53d7a27b
parent 47822 7437dc810834
child 53853 7ca9e625d6b2
permissions -rw-r--r--
8202095: JFR TestBiasedLockRevocationEvents should cope with multiple events during a single safepoint Reviewed-by: mgronlun, egahlin
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
47822
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
     1
/*
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
     2
 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
     4
 *
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
     7
 * published by the Free Software Foundation.
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
     8
 *
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    13
 * accompanied this code).
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    14
 *
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    18
 *
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    21
 * questions.
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    22
 */
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    23
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    24
/*
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    25
 * @test
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    26
 * @bug 8190797
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    27
 * @summary Test OSR compilation with bad operand stack.
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    28
 * @library /test/lib /
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    29
 * @modules java.base/jdk.internal.misc
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    30
 *          java.management
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    31
 * @compile OSRWithBadOperandStack.jasm
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    32
 * @run driver compiler.linkage.TestLinkageErrorInGenerateOopMap
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    33
 */
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    34
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    35
package compiler.linkage;
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    36
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    37
import jdk.test.lib.process.OutputAnalyzer;
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    38
import jdk.test.lib.process.ProcessTools;
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    39
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    40
public class TestLinkageErrorInGenerateOopMap {
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    41
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    42
    public static void main(String args[]) throws Exception {
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    43
        if (args.length == 0) {
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    44
            // Spawn new VM instance to execute test
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    45
            String[] flags = {"-noverify", "-XX:-TieredCompilation",
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    46
                              "-XX:CompileCommand=dontinline,compiler/linkage/OSRWithBadOperandStack.m*",
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    47
                              "compiler.linkage.TestLinkageErrorInGenerateOopMap", "run"};
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    48
            ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(flags);
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    49
            OutputAnalyzer out = new OutputAnalyzer(pb.start());
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    50
            if (out.getExitValue() != 0) {
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    51
                // OSR compilation should exit with an error during OopMap verification
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    52
                // because a LinkageError cannot be thrown from a compiler thread.
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    53
                out.shouldContain("fatal error: Illegal class file encountered");
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    54
            }
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    55
        } else {
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    56
            // Execute test
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    57
            OSRWithBadOperandStack.test();
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    58
        }
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    59
    }
7437dc810834 8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"
thartmann
parents:
diff changeset
    60
}