author | chegar |
Thu, 17 Oct 2019 20:54:25 +0100 | |
branch | datagramsocketimpl-branch |
changeset 58679 | 9c3209ff7550 |
parent 58678 | 9cf78a70fa4f |
parent 57705 | 7cf02b2c1455 |
permissions | -rw-r--r-- |
42580
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
1 |
/* |
55350
1224b16c8ff4
8225622: [AOT] runtime/SharedArchiveFile/TestInterpreterMethodEntries.java crashed with AOTed java.base
epavlova
parents:
51990
diff
changeset
|
2 |
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. |
42580
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
4 |
* |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
8 |
* |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
13 |
* accompanied this code). |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
14 |
* |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
18 |
* |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
21 |
* questions. |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
22 |
*/ |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
23 |
|
46779
d80ca591ae48
8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents:
46417
diff
changeset
|
24 |
/** |
42580
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
25 |
* @test InterpreterMethodEntries |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
26 |
* @bug 8169711 |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
27 |
* @summary Test interpreter method entries for intrinsics with CDS (class data sharing) |
55350
1224b16c8ff4
8225622: [AOT] runtime/SharedArchiveFile/TestInterpreterMethodEntries.java crashed with AOTed java.base
epavlova
parents:
51990
diff
changeset
|
28 |
* and the intrinsic flag enabled during dump and disabled during use of the archive. |
1224b16c8ff4
8225622: [AOT] runtime/SharedArchiveFile/TestInterpreterMethodEntries.java crashed with AOTed java.base
epavlova
parents:
51990
diff
changeset
|
29 |
* @requires vm.cds |
1224b16c8ff4
8225622: [AOT] runtime/SharedArchiveFile/TestInterpreterMethodEntries.java crashed with AOTed java.base
epavlova
parents:
51990
diff
changeset
|
30 |
* @comment the test disables intrinsics, so it can't be run w/ AOT'ed java module |
1224b16c8ff4
8225622: [AOT] runtime/SharedArchiveFile/TestInterpreterMethodEntries.java crashed with AOTed java.base
epavlova
parents:
51990
diff
changeset
|
31 |
* @requires !vm.aot.enabled |
1224b16c8ff4
8225622: [AOT] runtime/SharedArchiveFile/TestInterpreterMethodEntries.java crashed with AOTed java.base
epavlova
parents:
51990
diff
changeset
|
32 |
* @library /test/lib |
1224b16c8ff4
8225622: [AOT] runtime/SharedArchiveFile/TestInterpreterMethodEntries.java crashed with AOTed java.base
epavlova
parents:
51990
diff
changeset
|
33 |
* @run driver TestInterpreterMethodEntries true false |
1224b16c8ff4
8225622: [AOT] runtime/SharedArchiveFile/TestInterpreterMethodEntries.java crashed with AOTed java.base
epavlova
parents:
51990
diff
changeset
|
34 |
*/ |
1224b16c8ff4
8225622: [AOT] runtime/SharedArchiveFile/TestInterpreterMethodEntries.java crashed with AOTed java.base
epavlova
parents:
51990
diff
changeset
|
35 |
|
1224b16c8ff4
8225622: [AOT] runtime/SharedArchiveFile/TestInterpreterMethodEntries.java crashed with AOTed java.base
epavlova
parents:
51990
diff
changeset
|
36 |
/** |
1224b16c8ff4
8225622: [AOT] runtime/SharedArchiveFile/TestInterpreterMethodEntries.java crashed with AOTed java.base
epavlova
parents:
51990
diff
changeset
|
37 |
* @test InterpreterMethodEntries |
1224b16c8ff4
8225622: [AOT] runtime/SharedArchiveFile/TestInterpreterMethodEntries.java crashed with AOTed java.base
epavlova
parents:
51990
diff
changeset
|
38 |
* @bug 8169711 |
1224b16c8ff4
8225622: [AOT] runtime/SharedArchiveFile/TestInterpreterMethodEntries.java crashed with AOTed java.base
epavlova
parents:
51990
diff
changeset
|
39 |
* @summary Test interpreter method entries for intrinsics with CDS (class data sharing) |
1224b16c8ff4
8225622: [AOT] runtime/SharedArchiveFile/TestInterpreterMethodEntries.java crashed with AOTed java.base
epavlova
parents:
51990
diff
changeset
|
40 |
* and the intrinsic flag disabled during dump and enabled during use of the archive. |
48469
7312ae4465d6
8193672: [test] Enhance vm.cds property to check for all conditions required to run CDS tests
iklam
parents:
47216
diff
changeset
|
41 |
* @requires vm.cds |
42580
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
42 |
* @library /test/lib |
55350
1224b16c8ff4
8225622: [AOT] runtime/SharedArchiveFile/TestInterpreterMethodEntries.java crashed with AOTed java.base
epavlova
parents:
51990
diff
changeset
|
43 |
* @run driver TestInterpreterMethodEntries false true |
42580
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
44 |
*/ |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
45 |
|
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
46 |
import java.lang.Math; |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
47 |
import java.util.zip.CRC32; |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
48 |
import java.util.zip.CRC32C; |
46389 | 49 |
import jdk.test.lib.cds.CDSOptions; |
50 |
import jdk.test.lib.cds.CDSTestUtils; |
|
42580
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
51 |
import jdk.test.lib.process.OutputAnalyzer; |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
52 |
|
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
53 |
public class TestInterpreterMethodEntries { |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
54 |
|
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
55 |
public static void main(String[] args) throws Exception { |
55350
1224b16c8ff4
8225622: [AOT] runtime/SharedArchiveFile/TestInterpreterMethodEntries.java crashed with AOTed java.base
epavlova
parents:
51990
diff
changeset
|
56 |
if (args.length > 1) { |
1224b16c8ff4
8225622: [AOT] runtime/SharedArchiveFile/TestInterpreterMethodEntries.java crashed with AOTed java.base
epavlova
parents:
51990
diff
changeset
|
57 |
boolean dump = Boolean.parseBoolean(args[0]); |
1224b16c8ff4
8225622: [AOT] runtime/SharedArchiveFile/TestInterpreterMethodEntries.java crashed with AOTed java.base
epavlova
parents:
51990
diff
changeset
|
58 |
boolean use = Boolean.parseBoolean(args[1]); |
1224b16c8ff4
8225622: [AOT] runtime/SharedArchiveFile/TestInterpreterMethodEntries.java crashed with AOTed java.base
epavlova
parents:
51990
diff
changeset
|
59 |
|
42580
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
60 |
// Dump and use shared archive with different flag combinations |
55350
1224b16c8ff4
8225622: [AOT] runtime/SharedArchiveFile/TestInterpreterMethodEntries.java crashed with AOTed java.base
epavlova
parents:
51990
diff
changeset
|
61 |
dumpAndUseSharedArchive(dump ? "+" : "-", use ? "+" : "-"); |
42580
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
62 |
} else { |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
63 |
// Call intrinsified java.lang.Math::fma() |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
64 |
Math.fma(1.0, 2.0, 3.0); |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
65 |
|
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
66 |
byte[] buffer = new byte[256]; |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
67 |
// Call intrinsified java.util.zip.CRC32::update() |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
68 |
CRC32 crc32 = new CRC32(); |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
69 |
crc32.update(buffer, 0, 256); |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
70 |
|
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
71 |
// Call intrinsified java.util.zip.CRC32C::updateBytes(..) |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
72 |
CRC32C crc32c = new CRC32C(); |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
73 |
crc32c.update(buffer, 0, 256); |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
74 |
} |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
75 |
} |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
76 |
|
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
77 |
private static void dumpAndUseSharedArchive(String dump, String use) throws Exception { |
46399
ba815aa3765d
8179064: TestInterpreterMethodEntries.java is missing -XX:+UnlockDiagnosticVMOptions
ehelin
parents:
46389
diff
changeset
|
78 |
String unlock = "-XX:+UnlockDiagnosticVMOptions"; |
ba815aa3765d
8179064: TestInterpreterMethodEntries.java is missing -XX:+UnlockDiagnosticVMOptions
ehelin
parents:
46389
diff
changeset
|
79 |
|
42580
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
80 |
String dumpFMA = "-XX:" + dump + "UseFMA"; |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
81 |
String dumpCRC32 = "-XX:" + dump + "UseCRC32Intrinsics"; |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
82 |
String dumpCRC32C = "-XX:" + dump + "UseCRC32CIntrinsics"; |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
83 |
String useFMA = "-XX:" + use + "UseFMA"; |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
84 |
String useCRC32 = "-XX:" + use + "UseCRC32Intrinsics"; |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
85 |
String useCRC32C = "-XX:" + use + "UseCRC32CIntrinsics"; |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
86 |
|
46399
ba815aa3765d
8179064: TestInterpreterMethodEntries.java is missing -XX:+UnlockDiagnosticVMOptions
ehelin
parents:
46389
diff
changeset
|
87 |
CDSTestUtils.createArchiveAndCheck(unlock, dumpFMA, dumpCRC32, dumpCRC32C); |
42580
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
88 |
|
46389 | 89 |
CDSOptions opts = (new CDSOptions()) |
46399
ba815aa3765d
8179064: TestInterpreterMethodEntries.java is missing -XX:+UnlockDiagnosticVMOptions
ehelin
parents:
46389
diff
changeset
|
90 |
.addPrefix(unlock, useFMA, useCRC32, useCRC32C, "-showversion") |
46389 | 91 |
.addSuffix("TestInterpreterMethodEntries", "run") |
92 |
.setUseVersion(false); |
|
93 |
CDSTestUtils.runWithArchiveAndCheck(opts); |
|
42580
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
94 |
} |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
95 |
} |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
96 |