Thu, 15 Aug 2013 20:04:10 -0400
8003424: Enable Class Data Sharing for CompressedOops
8016729: ObjectAlignmentInBytes=16 now forces the use of heap based compressed oops
8005933: The -Xshare:auto option is ignored for -server
Summary: Move klass metaspace above the heap and support CDS with compressed klass ptrs.
Reviewed-by: coleenp, kvn, mgerdin, tschatzl, stefank
hseigel@5528 | 1 | /* |
hseigel@5528 | 2 | * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
hseigel@5528 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
hseigel@5528 | 4 | * |
hseigel@5528 | 5 | * This code is free software; you can redistribute it and/or modify it |
hseigel@5528 | 6 | * under the terms of the GNU General Public License version 2 only, as |
hseigel@5528 | 7 | * published by the Free Software Foundation. |
hseigel@5528 | 8 | * |
hseigel@5528 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
hseigel@5528 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
hseigel@5528 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
hseigel@5528 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
hseigel@5528 | 13 | * accompanied this code). |
hseigel@5528 | 14 | * |
hseigel@5528 | 15 | * You should have received a copy of the GNU General Public License version |
hseigel@5528 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
hseigel@5528 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
hseigel@5528 | 18 | * |
hseigel@5528 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
hseigel@5528 | 20 | * or visit www.oracle.com if you need additional information or have any |
hseigel@5528 | 21 | * questions. |
hseigel@5528 | 22 | */ |
hseigel@5528 | 23 | |
hseigel@5528 | 24 | /* |
hseigel@5528 | 25 | * @test |
hseigel@5528 | 26 | * @bug 8003424 |
hseigel@5528 | 27 | * @summary Test that cannot use CDS if UseCompressedKlassPointers is turned off. |
hseigel@5528 | 28 | * @library /testlibrary |
hseigel@5528 | 29 | * @run main CDSCompressedKPtrsError |
hseigel@5528 | 30 | */ |
hseigel@5528 | 31 | |
hseigel@5528 | 32 | import com.oracle.java.testlibrary.*; |
hseigel@5528 | 33 | |
hseigel@5528 | 34 | public class CDSCompressedKPtrsError { |
hseigel@5528 | 35 | public static void main(String[] args) throws Exception { |
hseigel@5528 | 36 | ProcessBuilder pb; |
hseigel@5528 | 37 | if (Platform.is64bit()) { |
hseigel@5528 | 38 | pb = ProcessTools.createJavaProcessBuilder( |
hseigel@5528 | 39 | "-XX:+UseCompressedOops", "-XX:+UseCompressedKlassPointers", "-XX:+UnlockDiagnosticVMOptions", |
hseigel@5528 | 40 | "-XX:SharedArchiveFile=./sample.jsa", "-Xshare:dump"); |
hseigel@5528 | 41 | OutputAnalyzer output = new OutputAnalyzer(pb.start()); |
hseigel@5528 | 42 | try { |
hseigel@5528 | 43 | output.shouldContain("Loading classes to share"); |
hseigel@5528 | 44 | output.shouldHaveExitValue(0); |
hseigel@5528 | 45 | |
hseigel@5528 | 46 | pb = ProcessTools.createJavaProcessBuilder( |
hseigel@5528 | 47 | "-XX:-UseCompressedKlassPointers", "-XX:-UseCompressedOops", |
hseigel@5528 | 48 | "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./sample.jsa", "-Xshare:on", "-version"); |
hseigel@5528 | 49 | output = new OutputAnalyzer(pb.start()); |
hseigel@5528 | 50 | output.shouldContain("Unable to use shared archive"); |
hseigel@5528 | 51 | output.shouldHaveExitValue(0); |
hseigel@5528 | 52 | |
hseigel@5528 | 53 | pb = ProcessTools.createJavaProcessBuilder( |
hseigel@5528 | 54 | "-XX:-UseCompressedKlassPointers", "-XX:+UseCompressedOops", |
hseigel@5528 | 55 | "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./sample.jsa", "-Xshare:on", "-version"); |
hseigel@5528 | 56 | output = new OutputAnalyzer(pb.start()); |
hseigel@5528 | 57 | output.shouldContain("Unable to use shared archive"); |
hseigel@5528 | 58 | output.shouldHaveExitValue(0); |
hseigel@5528 | 59 | |
hseigel@5528 | 60 | pb = ProcessTools.createJavaProcessBuilder( |
hseigel@5528 | 61 | "-XX:+UseCompressedKlassPointers", "-XX:-UseCompressedOops", |
hseigel@5528 | 62 | "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./sample.jsa", "-Xshare:on", "-version"); |
hseigel@5528 | 63 | output = new OutputAnalyzer(pb.start()); |
hseigel@5528 | 64 | output.shouldContain("Unable to use shared archive"); |
hseigel@5528 | 65 | output.shouldHaveExitValue(0); |
hseigel@5528 | 66 | |
hseigel@5528 | 67 | } catch (RuntimeException e) { |
hseigel@5528 | 68 | output.shouldContain("Unable to use shared archive"); |
hseigel@5528 | 69 | output.shouldHaveExitValue(1); |
hseigel@5528 | 70 | } |
hseigel@5528 | 71 | |
hseigel@5528 | 72 | // Test bad options with -Xshare:dump. |
hseigel@5528 | 73 | pb = ProcessTools.createJavaProcessBuilder( |
hseigel@5528 | 74 | "-XX:-UseCompressedOops", "-XX:+UseCompressedKlassPointers", "-XX:+UnlockDiagnosticVMOptions", |
hseigel@5528 | 75 | "-XX:SharedArchiveFile=./sample.jsa", "-Xshare:dump"); |
hseigel@5528 | 76 | output = new OutputAnalyzer(pb.start()); |
hseigel@5528 | 77 | output.shouldContain("Cannot dump shared archive"); |
hseigel@5528 | 78 | |
hseigel@5528 | 79 | pb = ProcessTools.createJavaProcessBuilder( |
hseigel@5528 | 80 | "-XX:+UseCompressedOops", "-XX:-UseCompressedKlassPointers", "-XX:+UnlockDiagnosticVMOptions", |
hseigel@5528 | 81 | "-XX:SharedArchiveFile=./sample.jsa", "-Xshare:dump"); |
hseigel@5528 | 82 | output = new OutputAnalyzer(pb.start()); |
hseigel@5528 | 83 | output.shouldContain("Cannot dump shared archive"); |
hseigel@5528 | 84 | |
hseigel@5528 | 85 | pb = ProcessTools.createJavaProcessBuilder( |
hseigel@5528 | 86 | "-XX:-UseCompressedOops", "-XX:-UseCompressedKlassPointers", "-XX:+UnlockDiagnosticVMOptions", |
hseigel@5528 | 87 | "-XX:SharedArchiveFile=./sample.jsa", "-Xshare:dump"); |
hseigel@5528 | 88 | output = new OutputAnalyzer(pb.start()); |
hseigel@5528 | 89 | output.shouldContain("Cannot dump shared archive"); |
hseigel@5528 | 90 | |
hseigel@5528 | 91 | } |
hseigel@5528 | 92 | } |
hseigel@5528 | 93 | } |