author | goetz |
Thu, 03 Aug 2017 10:24:34 +0200 | |
changeset 46779 | d80ca591ae48 |
parent 46417 | 1593c061e6af |
permissions | -rw-r--r-- |
42580
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
1 |
/* |
46389 | 2 |
* Copyright (c) 2016, 2017, 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 |
46779
d80ca591ae48
8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents:
46417
diff
changeset
|
26 |
* @requires vm.cds |
42580
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
27 |
* @bug 8169711 |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
28 |
* @summary Test interpreter method entries for intrinsics with CDS (class data sharing) |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
29 |
* and different settings of the intrinsic flag during dump/use of the archive. |
46417
1593c061e6af
8179243: [TESTBUG] CDS tests should be excluded from running with -UseCompressedOops
mseledtsov
parents:
46399
diff
changeset
|
30 |
* @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) |
42580
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
31 |
* @library /test/lib |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
32 |
* @modules java.base/jdk.internal.misc |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
33 |
* java.management |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
34 |
* @run main TestInterpreterMethodEntries |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
35 |
*/ |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
36 |
|
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
37 |
import java.lang.Math; |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
38 |
import java.util.zip.CRC32; |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
39 |
import java.util.zip.CRC32C; |
46389 | 40 |
import jdk.test.lib.cds.CDSOptions; |
41 |
import jdk.test.lib.cds.CDSTestUtils; |
|
42580
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
42 |
import jdk.test.lib.process.OutputAnalyzer; |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
43 |
|
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
44 |
public class TestInterpreterMethodEntries { |
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 |
public static void main(String[] args) throws Exception { |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
47 |
if (args.length == 0) { |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
48 |
// Dump and use shared archive with different flag combinations |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
49 |
dumpAndUseSharedArchive("+", "-"); |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
50 |
dumpAndUseSharedArchive("-", "+"); |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
51 |
} else { |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
52 |
// Call intrinsified java.lang.Math::fma() |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
53 |
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
|
54 |
|
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
55 |
byte[] buffer = new byte[256]; |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
56 |
// Call intrinsified java.util.zip.CRC32::update() |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
57 |
CRC32 crc32 = new CRC32(); |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
58 |
crc32.update(buffer, 0, 256); |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
59 |
|
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
60 |
// Call intrinsified java.util.zip.CRC32C::updateBytes(..) |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
61 |
CRC32C crc32c = new CRC32C(); |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
62 |
crc32c.update(buffer, 0, 256); |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
63 |
} |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
64 |
} |
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 |
private static void dumpAndUseSharedArchive(String dump, String use) throws Exception { |
46399
ba815aa3765d
8179064: TestInterpreterMethodEntries.java is missing -XX:+UnlockDiagnosticVMOptions
ehelin
parents:
46389
diff
changeset
|
67 |
String unlock = "-XX:+UnlockDiagnosticVMOptions"; |
ba815aa3765d
8179064: TestInterpreterMethodEntries.java is missing -XX:+UnlockDiagnosticVMOptions
ehelin
parents:
46389
diff
changeset
|
68 |
|
42580
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
69 |
String dumpFMA = "-XX:" + dump + "UseFMA"; |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
70 |
String dumpCRC32 = "-XX:" + dump + "UseCRC32Intrinsics"; |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
71 |
String dumpCRC32C = "-XX:" + dump + "UseCRC32CIntrinsics"; |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
72 |
String useFMA = "-XX:" + use + "UseFMA"; |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
73 |
String useCRC32 = "-XX:" + use + "UseCRC32Intrinsics"; |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
74 |
String useCRC32C = "-XX:" + use + "UseCRC32CIntrinsics"; |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
75 |
|
46399
ba815aa3765d
8179064: TestInterpreterMethodEntries.java is missing -XX:+UnlockDiagnosticVMOptions
ehelin
parents:
46389
diff
changeset
|
76 |
CDSTestUtils.createArchiveAndCheck(unlock, dumpFMA, dumpCRC32, dumpCRC32C); |
42580
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
77 |
|
46389 | 78 |
CDSOptions opts = (new CDSOptions()) |
46399
ba815aa3765d
8179064: TestInterpreterMethodEntries.java is missing -XX:+UnlockDiagnosticVMOptions
ehelin
parents:
46389
diff
changeset
|
79 |
.addPrefix(unlock, useFMA, useCRC32, useCRC32C, "-showversion") |
46389 | 80 |
.addSuffix("TestInterpreterMethodEntries", "run") |
81 |
.setUseVersion(false); |
|
82 |
CDSTestUtils.runWithArchiveAndCheck(opts); |
|
42580
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
83 |
} |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
84 |
} |
56304dee97f3
8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents:
diff
changeset
|
85 |