test/compiler/dependencies/MonomorphicObjectCall/TestMonomorphicObjectCall.java

Thu, 20 Nov 2014 11:06:26 +0100

author
thartmann
date
Thu, 20 Nov 2014 11:06:26 +0100
changeset 7380
bee8095780db
child 8767
7b8c8cd1ee71
permissions
-rw-r--r--

8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
Summary: Ignore non-instance Klasses in the subclass hierarchy.
Reviewed-by: kvn, iignatyev, jrose

thartmann@7380 1 /*
thartmann@7380 2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
thartmann@7380 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
thartmann@7380 4 *
thartmann@7380 5 * This code is free software; you can redistribute it and/or modify it
thartmann@7380 6 * under the terms of the GNU General Public License version 2 only, as
thartmann@7380 7 * published by the Free Software Foundation.
thartmann@7380 8 *
thartmann@7380 9 * This code is distributed in the hope that it will be useful, but WITHOUT
thartmann@7380 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
thartmann@7380 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
thartmann@7380 12 * version 2 for more details (a copy is included in the LICENSE file that
thartmann@7380 13 * accompanied this code).
thartmann@7380 14 *
thartmann@7380 15 * You should have received a copy of the GNU General Public License version
thartmann@7380 16 * 2 along with this work; if not, write to the Free Software Foundation,
thartmann@7380 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
thartmann@7380 18 *
thartmann@7380 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
thartmann@7380 20 * or visit www.oracle.com if you need additional information or have any
thartmann@7380 21 * questions.
thartmann@7380 22 */
thartmann@7380 23
thartmann@7380 24 import java.io.File;
thartmann@7380 25 import java.util.ArrayList;
thartmann@7380 26 import java.util.Collections;
thartmann@7380 27
thartmann@7380 28 import com.oracle.java.testlibrary.*;
thartmann@7380 29
thartmann@7380 30 /*
thartmann@7380 31 * @test
thartmann@7380 32 * @bug 8050079
thartmann@7380 33 * @summary Compiles a monomorphic call to finalizeObject() on a modified java.lang.Object to test C1 CHA.
thartmann@7380 34 * @library /testlibrary
thartmann@7380 35 * @compile -XDignore.symbol.file java/lang/Object.java TestMonomorphicObjectCall.java
thartmann@7380 36 * @run main TestMonomorphicObjectCall
thartmann@7380 37 */
thartmann@7380 38 public class TestMonomorphicObjectCall {
thartmann@7380 39 final static String testClasses = System.getProperty("test.classes") + File.separator;
thartmann@7380 40
thartmann@7380 41 private static void callFinalize(Object object) throws Throwable {
thartmann@7380 42 // Call modified version of java.lang.Object::finalize() that is
thartmann@7380 43 // not overridden by any subclass. C1 CHA should mark the call site
thartmann@7380 44 // as monomorphic and inline the method.
thartmann@7380 45 object.finalizeObject();
thartmann@7380 46 }
thartmann@7380 47
thartmann@7380 48 public static void main(String[] args) throws Throwable {
thartmann@7380 49 if (args.length == 0) {
thartmann@7380 50 // Execute new instance with modified java.lang.Object
thartmann@7380 51 executeTestJvm();
thartmann@7380 52 } else {
thartmann@7380 53 // Trigger compilation of 'callFinalize'
thartmann@7380 54 callFinalize(new Object());
thartmann@7380 55 }
thartmann@7380 56 }
thartmann@7380 57
thartmann@7380 58 public static void executeTestJvm() throws Throwable {
thartmann@7380 59 // Execute test with modified version of java.lang.Object
thartmann@7380 60 // in -Xbootclasspath.
thartmann@7380 61 String[] vmOpts = new String[] {
thartmann@7380 62 "-Xbootclasspath/p:" + testClasses,
thartmann@7380 63 "-Xcomp",
thartmann@7380 64 "-XX:-VerifyDependencies",
thartmann@7380 65 "-XX:CompileOnly=TestMonomorphicObjectCall::callFinalize",
thartmann@7380 66 "-XX:CompileOnly=Object::finalizeObject",
thartmann@7380 67 "-XX:TieredStopAtLevel=1",
thartmann@7380 68 TestMonomorphicObjectCall.class.getName(),
thartmann@7380 69 "true"};
thartmann@7380 70 OutputAnalyzer output = ProcessTools.executeTestJvm(vmOpts);
thartmann@7380 71 output.shouldHaveExitValue(0);
thartmann@7380 72 }
thartmann@7380 73 }

mercurial