test/gc/g1/TestHumongousAllocInitialMark.java

Mon, 28 Jul 2014 15:06:38 -0700

author
fzhinkin
date
Mon, 28 Jul 2014 15:06:38 -0700
changeset 6997
dbb05f6d93c4
parent 6198
55fb97c4c58d
child 6876
710a3c8b516e
permissions
-rw-r--r--

8051344: JVM crashed in Compile::start() during method parsing w/ UseRTMDeopt turned on
Summary: call rtm_deopt() only if there were no compilation bailouts before.
Reviewed-by: kvn

mnunez@3808 1 /*
mikael@6198 2 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
mnunez@3808 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
mnunez@3808 4 *
mnunez@3808 5 * This code is free software; you can redistribute it and/or modify it
mnunez@3808 6 * under the terms of the GNU General Public License version 2 only, as
mnunez@3808 7 * published by the Free Software Foundation.
mnunez@3808 8 *
mnunez@3808 9 * This code is distributed in the hope that it will be useful, but WITHOUT
mnunez@3808 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
mnunez@3808 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
mnunez@3808 12 * version 2 for more details (a copy is included in the LICENSE file that
mnunez@3808 13 * accompanied this code).
mnunez@3808 14 *
mnunez@3808 15 * You should have received a copy of the GNU General Public License version
mnunez@3808 16 * 2 along with this work; if not, write to the Free Software Foundation,
mnunez@3808 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
mnunez@3808 18 *
mnunez@3808 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
mnunez@3808 20 * or visit www.oracle.com if you need additional information or have any
mnunez@3808 21 * questions.
mnunez@3808 22 */
mnunez@3808 23
mnunez@3808 24 /*
pliden@5937 25 * @test TestHumongousAllocInitialMark
mnunez@3808 26 * @bug 7168848
mnunez@3808 27 * @summary G1: humongous object allocations should initiate marking cycles when necessary
pliden@5937 28 * @library /testlibrary
mnunez@3808 29 */
mnunez@3808 30
pliden@5937 31 import com.oracle.java.testlibrary.*;
mnunez@3808 32
pliden@5937 33 public class TestHumongousAllocInitialMark {
pliden@5937 34 private static final int heapSize = 200; // MB
pliden@5937 35 private static final int heapRegionSize = 1; // MB
pliden@5937 36 private static final int initiatingHeapOccupancyPercent = 50; // %
mnunez@3808 37
pliden@5937 38 public static void main(String[] args) throws Exception {
pliden@5937 39 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
pliden@5937 40 "-XX:+UseG1GC",
pliden@5937 41 "-Xms" + heapSize + "m",
pliden@5937 42 "-Xmx" + heapSize + "m",
pliden@5937 43 "-XX:G1HeapRegionSize=" + heapRegionSize + "m",
pliden@5937 44 "-XX:InitiatingHeapOccupancyPercent=" + initiatingHeapOccupancyPercent,
pliden@5937 45 "-XX:+PrintGC",
pliden@5937 46 HumongousObjectAllocator.class.getName());
pliden@5937 47
pliden@5937 48 OutputAnalyzer output = new OutputAnalyzer(pb.start());
pliden@5937 49 output.shouldContain("GC pause (G1 Humongous Allocation) (young) (initial-mark)");
pliden@5937 50 output.shouldNotContain("Full GC");
pliden@5937 51 output.shouldHaveExitValue(0);
mnunez@3808 52 }
mnunez@3808 53
pliden@5937 54 static class HumongousObjectAllocator {
pliden@5937 55 private static byte[] dummy;
pliden@5937 56
pliden@5937 57 public static void main(String [] args) throws Exception {
pliden@5937 58 // Make object size 75% of region size
pliden@5937 59 final int humongousObjectSize =
pliden@5937 60 (int)(heapRegionSize * 1024 * 1024 * 0.75);
pliden@5937 61
pliden@5937 62 // Number of objects to allocate to go above IHOP
pliden@5937 63 final int humongousObjectAllocations =
pliden@5937 64 (int)((heapSize * initiatingHeapOccupancyPercent / 100.0) / heapRegionSize) + 1;
pliden@5937 65
pliden@5937 66 // Allocate
pliden@5937 67 for (int i = 1; i <= humongousObjectAllocations; i++) {
pliden@5937 68 System.out.println("Allocating humongous object " + i + "/" + humongousObjectAllocations +
pliden@5937 69 " of size " + humongousObjectSize + " bytes");
pliden@5937 70 dummy = new byte[humongousObjectSize];
mnunez@3808 71 }
mnunez@3808 72 }
mnunez@3808 73 }
mnunez@3808 74 }
mnunez@3808 75

mercurial