hotspot/test/gc/survivorAlignment/TestPromotionFromEdenToTenured.java
author kvn
Mon, 22 Dec 2014 10:41:57 -0800
changeset 28203 905c60857879
parent 28182 8a51e754d3d8
parent 28190 5a6b07edeb21
child 29678 dd2f3932c21e
permissions -rw-r--r--
Merge
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
/*
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
     2
 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
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 objects promoted from eden space to tenured space during
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    28
 *          full GC are not aligned to SurvivorAlignmentInBytes value.
28190
5a6b07edeb21 8066433: Move Whitebox test library to top level repository
thartmann
parents: 27890
diff changeset
    29
 * @library /testlibrary /../../test/lib
27890
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    30
 * @build TestPromotionFromEdenToTenured SurvivorAlignmentTestMain
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    31
 *        AlignmentHelper
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    32
 * @run main ClassFileInstaller sun.hotspot.WhiteBox
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    33
 *                              sun.hotspot.WhiteBox$WhiteBoxPermission
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    34
 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    35
 *                   -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m
28182
8a51e754d3d8 8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents: 27890
diff changeset
    36
 *                   -XX:OldSize=32m -XX:MaxHeapSize=96m -XX:SurvivorRatio=1
8a51e754d3d8 8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents: 27890
diff changeset
    37
 *                   -XX:-ExplicitGCInvokesConcurrent
27890
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    38
 *                   -XX:+UnlockExperimentalVMOptions
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    39
 *                   -XX:SurvivorAlignmentInBytes=32
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    40
 *                   TestPromotionFromEdenToTenured 10m 9 TENURED
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    41
 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    42
 *                   -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m
28182
8a51e754d3d8 8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents: 27890
diff changeset
    43
 *                   -XX:OldSize=32m -XX:MaxHeapSize=96m -XX:SurvivorRatio=1
8a51e754d3d8 8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents: 27890
diff changeset
    44
 *                   -XX:-ExplicitGCInvokesConcurrent
27890
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    45
 *                   -XX:+UnlockExperimentalVMOptions
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    46
 *                   -XX:SurvivorAlignmentInBytes=32
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    47
 *                   TestPromotionFromEdenToTenured 10m 47 TENURED
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    48
 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    49
 *                   -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m
28182
8a51e754d3d8 8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents: 27890
diff changeset
    50
 *                   -XX:OldSize=32m  -XX:MaxHeapSize=96m
8a51e754d3d8 8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents: 27890
diff changeset
    51
 *                   -XX:SurvivorRatio=1 -XX:-ExplicitGCInvokesConcurrent
27890
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    52
 *                   -XX:+UnlockExperimentalVMOptions
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    53
 *                   -XX:SurvivorAlignmentInBytes=64
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    54
 *                   TestPromotionFromEdenToTenured 10m 9 TENURED
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    55
 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    56
 *                   -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m
28182
8a51e754d3d8 8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents: 27890
diff changeset
    57
 *                   -XX:OldSize=32m -XX:MaxHeapSize=128m
8a51e754d3d8 8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents: 27890
diff changeset
    58
 *                   -XX:SurvivorRatio=1 -XX:-ExplicitGCInvokesConcurrent
27890
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    59
 *                   -XX:+UnlockExperimentalVMOptions
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    60
 *                   -XX:SurvivorAlignmentInBytes=64
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    61
 *                   TestPromotionFromEdenToTenured 10m 87 TENURED
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    62
 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    63
 *                   -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m
28182
8a51e754d3d8 8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents: 27890
diff changeset
    64
 *                   -XX:OldSize=32M -XX:MaxHeapSize=96m -XX:SurvivorRatio=1
8a51e754d3d8 8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents: 27890
diff changeset
    65
 *                   -XX:-ExplicitGCInvokesConcurrent
27890
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    66
 *                   -XX:+UnlockExperimentalVMOptions
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    67
 *                   -XX:SurvivorAlignmentInBytes=128
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    68
 *                   TestPromotionFromEdenToTenured 10m 9 TENURED
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    69
 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    70
 *                   -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m
28182
8a51e754d3d8 8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents: 27890
diff changeset
    71
 *                   -XX:OldSize=32m -XX:MaxHeapSize=96m -XX:SurvivorRatio=1
8a51e754d3d8 8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents: 27890
diff changeset
    72
 *                   -XX:-ExplicitGCInvokesConcurrent
27890
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    73
 *                   -XX:+UnlockExperimentalVMOptions
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    74
 *                   -XX:SurvivorAlignmentInBytes=128
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    75
 *                   TestPromotionFromEdenToTenured 10m 147 TENURED
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    76
 */
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    77
public class TestPromotionFromEdenToTenured {
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    78
    public static void main(String args[]) {
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    79
        SurvivorAlignmentTestMain test
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    80
                = SurvivorAlignmentTestMain.fromArgs(args);
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    81
        System.out.println(test);
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    82
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    83
        long expectedMemoryUsage = test.getExpectedMemoryUsage();
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    84
        test.baselineMemoryAllocation();
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    85
        System.gc();
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    86
        // increase expected usage by current old gen usage
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    87
        expectedMemoryUsage += SurvivorAlignmentTestMain.getAlignmentHelper(
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    88
                SurvivorAlignmentTestMain.HeapSpace.TENURED)
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    89
                .getActualMemoryUsage();
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.allocate();
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    92
        System.gc();
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    93
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    94
        test.verifyMemoryUsage(expectedMemoryUsage);
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    95
    }
9c0e6a049e1f 8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff changeset
    96
}