author | chegar |
Tue, 22 Mar 2016 15:26:07 +0000 | |
changeset 36694 | 182a5e7a519e |
parent 36508 | 5f9eee6b383b |
child 37273 | b4b83dd8f471 |
child 36851 | 03e2f4d0a421 |
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; |
36508 | 25 |
import java.nio.file.Files; |
26 |
import java.nio.file.Paths; |
|
27700
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
27 |
import java.util.ArrayList; |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
28 |
import java.util.Collections; |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
29 |
|
30604
b8d532cb6420
8067013: Rename the com.oracle.java.testlibary package
ykantser
parents:
29678
diff
changeset
|
30 |
import jdk.test.lib.*; |
27700
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
31 |
|
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
32 |
/* |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
33 |
* @test |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
34 |
* @bug 8050079 |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
35 |
* @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
|
36 |
* @library /testlibrary |
29678
dd2f3932c21e
8075586: Add @modules as needed to the open hotspot tests
ykantser
parents:
28040
diff
changeset
|
37 |
* @modules java.base/sun.misc |
dd2f3932c21e
8075586: Add @modules as needed to the open hotspot tests
ykantser
parents:
28040
diff
changeset
|
38 |
* java.management |
31587
e48945b7849c
8076112: Add @HotSpotIntrinsicCandidate annotation to indicate methods for which Java Runtime has intrinsics
zmajo
parents:
30604
diff
changeset
|
39 |
* java.base/jdk.internal |
36508 | 40 |
* @ignore 8132924 |
27700
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
41 |
* @compile -XDignore.symbol.file java/lang/Object.java TestMonomorphicObjectCall.java |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
42 |
* @run main TestMonomorphicObjectCall |
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 |
public class TestMonomorphicObjectCall { |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
45 |
|
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
46 |
private static void callFinalize(Object object) throws Throwable { |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
47 |
// Call modified version of java.lang.Object::finalize() that is |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
48 |
// 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
|
49 |
// as monomorphic and inline the method. |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
50 |
object.finalizeObject(); |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
51 |
} |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
52 |
|
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
53 |
public static void main(String[] args) throws Throwable { |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
54 |
if (args.length == 0) { |
36508 | 55 |
byte[] bytecode = Files.readAllBytes(Paths.get(System.getProperty("test.classes") + File.separator + |
56 |
"java" + File.separator + "lang" + File.separator + "Object.class")); |
|
57 |
ClassFileInstaller.writeClassToDisk("java.lang.Object", bytecode, "mods/java.base"); |
|
27700
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
58 |
// Execute new instance with modified java.lang.Object |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
59 |
executeTestJvm(); |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
60 |
} else { |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
61 |
// Trigger compilation of 'callFinalize' |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
62 |
callFinalize(new Object()); |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
63 |
} |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
64 |
} |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
65 |
|
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
66 |
public static void executeTestJvm() throws Throwable { |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
67 |
// Execute test with modified version of java.lang.Object |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
68 |
// in -Xbootclasspath. |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
69 |
String[] vmOpts = new String[] { |
36508 | 70 |
"-Xpatch:mods", |
27700
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
71 |
"-Xcomp", |
28040
e68bdf210a7e
8066250: compiler/dependencies/MonomorphicObjectCall/TestMonomorphicObjectCall.java fails product
iignatyev
parents:
27700
diff
changeset
|
72 |
"-XX:+IgnoreUnrecognizedVMOptions", |
27700
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
73 |
"-XX:-VerifyDependencies", |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
74 |
"-XX:CompileOnly=TestMonomorphicObjectCall::callFinalize", |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
75 |
"-XX:CompileOnly=Object::finalizeObject", |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
76 |
"-XX:TieredStopAtLevel=1", |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
77 |
TestMonomorphicObjectCall.class.getName(), |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
78 |
"true"}; |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
79 |
OutputAnalyzer output = ProcessTools.executeTestJvm(vmOpts); |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
80 |
output.shouldHaveExitValue(0); |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
81 |
} |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
82 |
} |