test/hotspot/jtreg/gc/survivorAlignment/TestAllocationInEden.java
author pliden
Tue, 12 Jun 2018 17:40:28 +0200
changeset 50525 767cdb97f103
parent 48791 6e079ff6c83c
child 52925 9c18c9d839d3
permissions -rw-r--r--
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental) Reviewed-by: pliden, stefank, eosterlund, ehelin, sjohanss, rbackman, coleenp, ihse, jgeorge, lmesnik, rkennke Contributed-by: per.liden@oracle.com, stefan.karlsson@oracle.com, erik.osterlund@oracle.com, mikael.gerdin@oracle.com, kim.barrett@oracle.com, nils.eliasson@oracle.com, rickard.backman@oracle.com, rwestrel@redhat.com, coleen.phillimore@oracle.com, robbin.ehn@oracle.com, gerard.ziemski@oracle.com, hugh.wilkinson@intel.com, sandhya.viswanathan@intel.com, bill.npo.wheeler@intel.com, vinay.k.awasthi@intel.com, yasuenag@gmail.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
27890
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
     1
/*
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 36851
diff changeset
     2
 * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
27890
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
     4
 *
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
     7
 * published by the Free Software Foundation.
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
     8
 *
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    13
 * accompanied this code).
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    14
 *
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    18
 *
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    21
 * questions.
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    22
 */
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    23
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    24
/**
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    25
 * @test
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    26
 * @bug 8031323
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    27
 * @summary Verify that object's alignment in eden space is not affected by
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    28
 *          SurvivorAlignmentInBytes option.
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 48791
diff changeset
    29
 * @requires vm.gc != "Z"
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 36851
diff changeset
    30
 * @library /test/lib
36851
03e2f4d0a421 8153737: Unsupported Module
chegar
parents: 33730
diff changeset
    31
 * @modules java.base/jdk.internal.misc
29678
dd2f3932c21e 8075586: Add @modules as needed to the open hotspot tests
ykantser
parents: 28203
diff changeset
    32
 *          java.management
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 36851
diff changeset
    33
 * @build sun.hotspot.WhiteBox
48791
6e079ff6c83c 8186635: ClassFileInstaller should be run as a driver
iignatyev
parents: 47216
diff changeset
    34
 * @run driver ClassFileInstaller sun.hotspot.WhiteBox
27890
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    35
 *                              sun.hotspot.WhiteBox$WhiteBoxPermission
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    36
 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    37
 *                   -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    38
 *                   -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions
31370
e27de7435453 8078669: G1 applies SurvivorAlignmentInBytes to both survivor and old gen
tschatzl
parents: 29678
diff changeset
    39
 *                   -XX:SurvivorAlignmentInBytes=32 -XX:-UseTLAB -XX:-ResizePLAB
28182
8a51e754d3d8 8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents: 27890
diff changeset
    40
 *                   -XX:OldSize=128m -XX:MaxHeapSize=192m
8a51e754d3d8 8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents: 27890
diff changeset
    41
 *                   -XX:-ExplicitGCInvokesConcurrent
27890
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    42
 *                   TestAllocationInEden 10m 9 EDEN
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    43
 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    44
 *                   -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    45
 *                   -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions
31370
e27de7435453 8078669: G1 applies SurvivorAlignmentInBytes to both survivor and old gen
tschatzl
parents: 29678
diff changeset
    46
 *                   -XX:SurvivorAlignmentInBytes=32 -XX:-UseTLAB -XX:-ResizePLAB
28182
8a51e754d3d8 8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents: 27890
diff changeset
    47
 *                   -XX:OldSize=128m -XX:MaxHeapSize=192m
8a51e754d3d8 8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents: 27890
diff changeset
    48
 *                   -XX:-ExplicitGCInvokesConcurrent
27890
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    49
 *                   TestAllocationInEden 10m 47 EDEN
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    50
 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    51
 *                   -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    52
 *                   -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions
31370
e27de7435453 8078669: G1 applies SurvivorAlignmentInBytes to both survivor and old gen
tschatzl
parents: 29678
diff changeset
    53
 *                   -XX:SurvivorAlignmentInBytes=64 -XX:-UseTLAB -XX:-ResizePLAB
28182
8a51e754d3d8 8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents: 27890
diff changeset
    54
 *                   -XX:OldSize=128m  -XX:MaxHeapSize=192m
8a51e754d3d8 8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents: 27890
diff changeset
    55
 *                   -XX:-ExplicitGCInvokesConcurrent
27890
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    56
 *                   TestAllocationInEden 10m 9 EDEN
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    57
 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    58
 *                   -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    59
 *                   -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions
31370
e27de7435453 8078669: G1 applies SurvivorAlignmentInBytes to both survivor and old gen
tschatzl
parents: 29678
diff changeset
    60
 *                   -XX:SurvivorAlignmentInBytes=64 -XX:-UseTLAB -XX:-ResizePLAB
28182
8a51e754d3d8 8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents: 27890
diff changeset
    61
 *                   -XX:OldSize=128m  -XX:MaxHeapSize=192m
8a51e754d3d8 8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents: 27890
diff changeset
    62
 *                   -XX:-ExplicitGCInvokesConcurrent
27890
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    63
 *                   TestAllocationInEden 10m 87 EDEN
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    64
 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    65
 *                   -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    66
 *                   -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions
31370
e27de7435453 8078669: G1 applies SurvivorAlignmentInBytes to both survivor and old gen
tschatzl
parents: 29678
diff changeset
    67
 *                   -XX:SurvivorAlignmentInBytes=128 -XX:-UseTLAB -XX:-ResizePLAB
28182
8a51e754d3d8 8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents: 27890
diff changeset
    68
 *                   -XX:OldSize=128m -XX:MaxHeapSize=192m
8a51e754d3d8 8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents: 27890
diff changeset
    69
 *                   -XX:-ExplicitGCInvokesConcurrent
27890
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    70
 *                   TestAllocationInEden 10m 9 EDEN
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    71
 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    72
 *                   -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    73
 *                   -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions
31370
e27de7435453 8078669: G1 applies SurvivorAlignmentInBytes to both survivor and old gen
tschatzl
parents: 29678
diff changeset
    74
 *                   -XX:SurvivorAlignmentInBytes=128 -XX:-UseTLAB -XX:-ResizePLAB
28182
8a51e754d3d8 8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents: 27890
diff changeset
    75
 *                   -XX:OldSize=128m -XX:MaxHeapSize=192m
8a51e754d3d8 8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents: 27890
diff changeset
    76
 *                   -XX:-ExplicitGCInvokesConcurrent
27890
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    77
 *                   TestAllocationInEden 10m 147 EDEN
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    78
 */
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    79
public class TestAllocationInEden {
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    80
    public static void main(String args[]) {
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    81
        SurvivorAlignmentTestMain test
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    82
                = SurvivorAlignmentTestMain.fromArgs(args);
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    83
        System.out.println(test);
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    84
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    85
        long expectedMemoryUsage = test.getExpectedMemoryUsage();
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    86
        test.baselineMemoryAllocation();
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    87
        System.gc();
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    88
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    89
        test.allocate();
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    90
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    91
        test.verifyMemoryUsage(expectedMemoryUsage);
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    92
    }
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    93
}