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