author | zmajo |
Fri, 03 Jul 2015 07:25:03 +0200 | |
changeset 31587 | e48945b7849c |
parent 30604 | b8d532cb6420 |
child 36508 | 5f9eee6b383b |
permissions | -rw-r--r-- |
27700
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
1 |
/* |
29678
dd2f3932c21e
8075586: Add @modules as needed to the open hotspot tests
ykantser
parents:
28040
diff
changeset
|
2 |
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. |
27700
a402738ebfcf
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. |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
4 |
* |
a402738ebfcf
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 |
a402738ebfcf
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 |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
8 |
* |
a402738ebfcf
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 |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
a402738ebfcf
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 |
a402738ebfcf
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 |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
13 |
* accompanied this code). |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
14 |
* |
a402738ebfcf
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 |
a402738ebfcf
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, |
a402738ebfcf
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. |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
18 |
* |
a402738ebfcf
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 |
a402738ebfcf
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 |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
21 |
* questions. |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
22 |
*/ |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
23 |
|
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
24 |
import java.io.File; |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
25 |
import java.util.ArrayList; |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
26 |
import java.util.Collections; |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
27 |
|
30604
b8d532cb6420
8067013: Rename the com.oracle.java.testlibary package
ykantser
parents:
29678
diff
changeset
|
28 |
import jdk.test.lib.*; |
27700
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
29 |
|
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
30 |
/* |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
31 |
* @test |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
32 |
* @bug 8050079 |
a402738ebfcf
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. |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
34 |
* @library /testlibrary |
29678
dd2f3932c21e
8075586: Add @modules as needed to the open hotspot tests
ykantser
parents:
28040
diff
changeset
|
35 |
* @modules java.base/sun.misc |
dd2f3932c21e
8075586: Add @modules as needed to the open hotspot tests
ykantser
parents:
28040
diff
changeset
|
36 |
* java.management |
31587
e48945b7849c
8076112: Add @HotSpotIntrinsicCandidate annotation to indicate methods for which Java Runtime has intrinsics
zmajo
parents:
30604
diff
changeset
|
37 |
* java.base/jdk.internal |
27700
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
38 |
* @compile -XDignore.symbol.file java/lang/Object.java TestMonomorphicObjectCall.java |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
39 |
* @run main TestMonomorphicObjectCall |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
40 |
*/ |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
41 |
public class TestMonomorphicObjectCall { |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
42 |
final static String testClasses = System.getProperty("test.classes") + File.separator; |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
43 |
|
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
44 |
private static void callFinalize(Object object) throws Throwable { |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
45 |
// Call modified version of java.lang.Object::finalize() that is |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
46 |
// not overridden by any subclass. C1 CHA should mark the call site |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
47 |
// as monomorphic and inline the method. |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
48 |
object.finalizeObject(); |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
49 |
} |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
50 |
|
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
51 |
public static void main(String[] args) throws Throwable { |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
52 |
if (args.length == 0) { |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
53 |
// Execute new instance with modified java.lang.Object |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
54 |
executeTestJvm(); |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
55 |
} else { |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
56 |
// Trigger compilation of 'callFinalize' |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
57 |
callFinalize(new Object()); |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
58 |
} |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
59 |
} |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
60 |
|
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
61 |
public static void executeTestJvm() throws Throwable { |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
62 |
// Execute test with modified version of java.lang.Object |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
63 |
// in -Xbootclasspath. |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
64 |
String[] vmOpts = new String[] { |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
65 |
"-Xbootclasspath/p:" + testClasses, |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
66 |
"-Xcomp", |
28040
e68bdf210a7e
8066250: compiler/dependencies/MonomorphicObjectCall/TestMonomorphicObjectCall.java fails product
iignatyev
parents:
27700
diff
changeset
|
67 |
"-XX:+IgnoreUnrecognizedVMOptions", |
27700
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
68 |
"-XX:-VerifyDependencies", |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
69 |
"-XX:CompileOnly=TestMonomorphicObjectCall::callFinalize", |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
70 |
"-XX:CompileOnly=Object::finalizeObject", |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
71 |
"-XX:TieredStopAtLevel=1", |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
72 |
TestMonomorphicObjectCall.class.getName(), |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
73 |
"true"}; |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
74 |
OutputAnalyzer output = ProcessTools.executeTestJvm(vmOpts); |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
75 |
output.shouldHaveExitValue(0); |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
76 |
} |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
77 |
} |