author | goetz |
Thu, 03 Aug 2017 10:24:34 +0200 | |
changeset 46779 | d80ca591ae48 |
parent 46389 | d55896236dfd |
permissions | -rw-r--r-- |
39615
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
1 |
/* |
46389 | 2 |
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. |
39615
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
4 |
* |
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
8 |
* |
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
13 |
* accompanied this code). |
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
14 |
* |
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
18 |
* |
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
21 |
* questions. |
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
22 |
*/ |
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
23 |
|
46779
d80ca591ae48
8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents:
46389
diff
changeset
|
24 |
/** |
39615
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
25 |
* @test SharedStringsDedup |
46779
d80ca591ae48
8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents:
46389
diff
changeset
|
26 |
* @requires vm.cds |
39615
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
27 |
* @summary Test -Xshare:auto with shared strings and -XX:+UseStringDeduplication |
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
28 |
* Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows |
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
29 |
* @requires (sun.arch.data.model != "32") & (os.family != "windows") |
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
30 |
* @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) |
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
31 |
* @requires vm.gc.G1 |
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
39615
diff
changeset
|
32 |
* @library /test/lib |
39615
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
33 |
* @modules java.base/jdk.internal.misc |
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
34 |
* java.management |
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
35 |
* @run main SharedStringsDedup |
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
36 |
*/ |
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
37 |
|
46389 | 38 |
import jdk.test.lib.cds.CDSTestUtils; |
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
39615
diff
changeset
|
39 |
import jdk.test.lib.process.OutputAnalyzer; |
39615
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
40 |
import java.io.File; |
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
41 |
|
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
42 |
// The main purpose is to test the interaction between shared strings |
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
43 |
// and -XX:+UseStringDeduplication. We run in -Xshare:auto mode so |
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
44 |
// we don't need to worry about CDS archive mapping failure (which |
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
45 |
// doesn't happen often so it won't impact coverage). |
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
46 |
public class SharedStringsDedup { |
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
47 |
public static void main(String[] args) throws Exception { |
46389 | 48 |
OutputAnalyzer out = |
49 |
CDSTestUtils.createArchive("-XX:+UseCompressedOops", "-XX:+UseG1GC"); |
|
50 |
CDSTestUtils.checkDump(out, "Shared string table stats"); |
|
51 |
CDSTestUtils.runWithArchiveAndCheck("-XX:+UseCompressedOops", "-XX:+UseG1GC", |
|
52 |
"-XX:+UseStringDeduplication"); |
|
39615
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
53 |
} |
9ab0913a0e65
8159890: SIGSEGV with UseStringDeduplication and UseSharedSpaces/RequireSharedSpaces
pliden
parents:
diff
changeset
|
54 |
} |