author | lana |
Thu, 29 Jan 2015 15:36:21 -0800 | |
changeset 28708 | ac59fe6cd98f |
parent 27890 | 9c0e6a049e1f |
child 30604 | b8d532cb6420 |
permissions | -rw-r--r-- |
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 |
import java.lang.management.ManagementFactory; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
25 |
import java.lang.management.MemoryPoolMXBean; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
26 |
import java.util.Objects; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
27 |
import java.util.Optional; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
28 |
import java.util.regex.Matcher; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
29 |
import java.util.regex.Pattern; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
30 |
|
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
31 |
import com.oracle.java.testlibrary.Asserts; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
32 |
import com.sun.management.ThreadMXBean; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
33 |
import sun.hotspot.WhiteBox; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
34 |
import sun.misc.Unsafe; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
35 |
|
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
36 |
/** |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
37 |
* Main class for tests on {@code SurvivorAlignmentInBytes} option. |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
38 |
* |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
39 |
* Typical usage is to obtain instance using fromArgs method, allocate objects |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
40 |
* and verify that actual memory usage in tested heap space is close to |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
41 |
* expected. |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
42 |
*/ |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
43 |
public class SurvivorAlignmentTestMain { |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
44 |
enum HeapSpace { |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
45 |
EDEN, |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
46 |
SURVIVOR, |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
47 |
TENURED |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
48 |
} |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
49 |
|
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
50 |
public static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
51 |
|
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
52 |
public static final long MAX_TENURING_THRESHOLD = Optional.ofNullable( |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
53 |
SurvivorAlignmentTestMain.WHITE_BOX.getIntxVMFlag( |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
54 |
"MaxTenuringThreshold")).orElse(15L); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
55 |
|
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
56 |
/** |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
57 |
* Regexp used to parse memory size params, like 2G, 34m or 15k. |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
58 |
*/ |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
59 |
private static final Pattern SIZE_REGEX |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
60 |
= Pattern.compile("(?<size>[0-9]+)(?<multiplier>[GMKgmk])?"); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
61 |
|
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
62 |
// Names of different heap spaces. |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
63 |
private static final String DEF_NEW_EDEN = "Eden Space"; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
64 |
private static final String DEF_NEW_SURVIVOR = "Survivor Space"; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
65 |
private static final String PAR_NEW_EDEN = "Par Eden Space"; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
66 |
private static final String PAR_NEW_SURVIVOR = "Par Survivor Space"; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
67 |
private static final String PS_EDEN = "PS Eden Space"; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
68 |
private static final String PS_SURVIVOR = "PS Survivor Space"; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
69 |
private static final String G1_EDEN = "G1 Eden Space"; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
70 |
private static final String G1_SURVIVOR = "G1 Survivor Space"; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
71 |
private static final String SERIAL_TENURED = "Tenured Gen"; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
72 |
private static final String CMS_TENURED = "CMS Old Gen"; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
73 |
private static final String PS_TENURED = "PS Old Gen"; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
74 |
private static final String G1_TENURED = "G1 Old Gen"; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
75 |
|
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
76 |
private static final long G1_HEAP_REGION_SIZE = Optional.ofNullable( |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
77 |
SurvivorAlignmentTestMain.WHITE_BOX.getUintxVMFlag( |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
78 |
"G1HeapRegionSize")).orElse(-1L); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
79 |
|
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
80 |
/** |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
81 |
* Min size of free chunk in CMS generation. |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
82 |
* An object allocated in CMS generation will at least occupy this amount |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
83 |
* of bytes. |
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 |
private static final long CMS_MIN_FREE_CHUNK_SIZE |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
86 |
= 3L * Unsafe.ADDRESS_SIZE; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
87 |
|
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
88 |
private static final AlignmentHelper EDEN_SPACE_HELPER; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
89 |
private static final AlignmentHelper SURVIVOR_SPACE_HELPER; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
90 |
private static final AlignmentHelper TENURED_SPACE_HELPER; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
91 |
/** |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
92 |
* Amount of memory that should be filled during a test run. |
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 |
private final long memoryToFill; |
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 |
* The size of an objects that will be allocated during a test run. |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
97 |
*/ |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
98 |
private final long objectSize; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
99 |
/** |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
100 |
* Amount of memory that will be actually occupied by an object in eden |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
101 |
* space. |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
102 |
*/ |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
103 |
private final long actualObjectSize; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
104 |
/** |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
105 |
* Storage for allocated objects. |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
106 |
*/ |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
107 |
private final Object[] garbage; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
108 |
/** |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
109 |
* Heap space whose memory usage is a subject of assertions during the test |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
110 |
* run. |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
111 |
*/ |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
112 |
private final HeapSpace testedSpace; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
113 |
|
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
114 |
private long[] baselinedThreadMemoryUsage = null; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
115 |
private long[] threadIds = null; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
116 |
|
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
117 |
/** |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
118 |
* Initialize {@code EDEN_SPACE_HELPER}, {@code SURVIVOR_SPACE_HELPER} and |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
119 |
* {@code TENURED_SPACE_HELPER} to represent heap spaces in use. |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
120 |
* |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
121 |
* Note that regardless to GC object's alignment in survivor space is |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
122 |
* expected to be equal to {@code SurvivorAlignmentInBytes} value and |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
123 |
* alignment in other spaces is expected to be equal to |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
124 |
* {@code ObjectAlignmentInBytes} value. |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
125 |
* |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
126 |
* In CMS generation we can't allocate less then {@code MinFreeChunk} value, |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
127 |
* for other CGs we expect that object of size {@code MIN_OBJECT_SIZE} |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
128 |
* could be allocated as it is (of course, its size could be aligned |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
129 |
* according to alignment value used in a particular space). |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
130 |
* |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
131 |
* For G1 GC MXBeans could report memory usage only with region size |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
132 |
* precision (if an object allocated in some G1 heap region, then all region |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
133 |
* will claimed as used), so for G1's spaces precision is equal to |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
134 |
* {@code G1HeapRegionSize} value. |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
135 |
*/ |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
136 |
static { |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
137 |
AlignmentHelper edenHelper = null; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
138 |
AlignmentHelper survivorHelper = null; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
139 |
AlignmentHelper tenuredHelper = null; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
140 |
for (MemoryPoolMXBean pool : ManagementFactory.getMemoryPoolMXBeans()) { |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
141 |
switch (pool.getName()) { |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
142 |
case SurvivorAlignmentTestMain.DEF_NEW_EDEN: |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
143 |
case SurvivorAlignmentTestMain.PAR_NEW_EDEN: |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
144 |
case SurvivorAlignmentTestMain.PS_EDEN: |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
145 |
Asserts.assertNull(edenHelper, |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
146 |
"Only one bean for eden space is expected."); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
147 |
edenHelper = new AlignmentHelper( |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
148 |
AlignmentHelper.OBJECT_ALIGNMENT_IN_BYTES, |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
149 |
AlignmentHelper.OBJECT_ALIGNMENT_IN_BYTES, |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
150 |
AlignmentHelper.MIN_OBJECT_SIZE, pool); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
151 |
break; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
152 |
case SurvivorAlignmentTestMain.G1_EDEN: |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
153 |
Asserts.assertNull(edenHelper, |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
154 |
"Only one bean for eden space is expected."); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
155 |
edenHelper = new AlignmentHelper( |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
156 |
SurvivorAlignmentTestMain.G1_HEAP_REGION_SIZE, |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
157 |
AlignmentHelper.OBJECT_ALIGNMENT_IN_BYTES, |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
158 |
AlignmentHelper.MIN_OBJECT_SIZE, pool); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
159 |
break; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
160 |
case SurvivorAlignmentTestMain.DEF_NEW_SURVIVOR: |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
161 |
case SurvivorAlignmentTestMain.PAR_NEW_SURVIVOR: |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
162 |
case SurvivorAlignmentTestMain.PS_SURVIVOR: |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
163 |
Asserts.assertNull(survivorHelper, |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
164 |
"Only one bean for survivor space is expected."); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
165 |
survivorHelper = new AlignmentHelper( |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
166 |
AlignmentHelper.OBJECT_ALIGNMENT_IN_BYTES, |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
167 |
AlignmentHelper.SURVIVOR_ALIGNMENT_IN_BYTES, |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
168 |
AlignmentHelper.MIN_OBJECT_SIZE, pool); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
169 |
break; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
170 |
case SurvivorAlignmentTestMain.G1_SURVIVOR: |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
171 |
Asserts.assertNull(survivorHelper, |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
172 |
"Only one bean for survivor space is expected."); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
173 |
survivorHelper = new AlignmentHelper( |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
174 |
SurvivorAlignmentTestMain.G1_HEAP_REGION_SIZE, |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
175 |
AlignmentHelper.SURVIVOR_ALIGNMENT_IN_BYTES, |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
176 |
AlignmentHelper.MIN_OBJECT_SIZE, pool); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
177 |
break; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
178 |
case SurvivorAlignmentTestMain.SERIAL_TENURED: |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
179 |
case SurvivorAlignmentTestMain.PS_TENURED: |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
180 |
case SurvivorAlignmentTestMain.G1_TENURED: |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
181 |
Asserts.assertNull(tenuredHelper, |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
182 |
"Only one bean for tenured space is expected."); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
183 |
tenuredHelper = new AlignmentHelper( |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
184 |
AlignmentHelper.OBJECT_ALIGNMENT_IN_BYTES, |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
185 |
AlignmentHelper.OBJECT_ALIGNMENT_IN_BYTES, |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
186 |
AlignmentHelper.MIN_OBJECT_SIZE, pool); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
187 |
break; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
188 |
case SurvivorAlignmentTestMain.CMS_TENURED: |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
189 |
Asserts.assertNull(tenuredHelper, |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
190 |
"Only one bean for tenured space is expected."); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
191 |
tenuredHelper = new AlignmentHelper( |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
192 |
AlignmentHelper.OBJECT_ALIGNMENT_IN_BYTES, |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
193 |
AlignmentHelper.OBJECT_ALIGNMENT_IN_BYTES, |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
194 |
SurvivorAlignmentTestMain.CMS_MIN_FREE_CHUNK_SIZE, |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
195 |
pool); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
196 |
break; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
197 |
} |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
198 |
} |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
199 |
EDEN_SPACE_HELPER = Objects.requireNonNull(edenHelper, |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
200 |
"AlignmentHelper for eden space should be initialized."); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
201 |
SURVIVOR_SPACE_HELPER = Objects.requireNonNull(survivorHelper, |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
202 |
"AlignmentHelper for survivor space should be initialized."); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
203 |
TENURED_SPACE_HELPER = Objects.requireNonNull(tenuredHelper, |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
204 |
"AlignmentHelper for tenured space should be initialized."); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
205 |
} |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
206 |
/** |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
207 |
* Returns an SurvivorAlignmentTestMain instance constructed using CLI |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
208 |
* options. |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
209 |
* |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
210 |
* Following options are expected: |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
211 |
* <ul> |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
212 |
* <li>memoryToFill</li> |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
213 |
* <li>objectSize</li> |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
214 |
* </ul> |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
215 |
* |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
216 |
* Both argument may contain multiplier suffix k, m or g. |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
217 |
*/ |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
218 |
public static SurvivorAlignmentTestMain fromArgs(String[] args) { |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
219 |
Asserts.assertEQ(args.length, 3, "Expected three arguments: " |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
220 |
+ "memory size, object size and tested heap space name."); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
221 |
|
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
222 |
long memoryToFill = parseSize(args[0]); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
223 |
long objectSize = Math.max(parseSize(args[1]), |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
224 |
AlignmentHelper.MIN_ARRAY_SIZE); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
225 |
HeapSpace testedSpace = HeapSpace.valueOf(args[2]); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
226 |
|
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
227 |
return new SurvivorAlignmentTestMain(memoryToFill, objectSize, |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
228 |
testedSpace); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
229 |
} |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
230 |
|
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
231 |
/** |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
232 |
* Returns a value parsed from a string with format |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
233 |
* <integer><multiplier>. |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
234 |
*/ |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
235 |
private static long parseSize(String sizeString) { |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
236 |
Matcher matcher = SIZE_REGEX.matcher(sizeString); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
237 |
Asserts.assertTrue(matcher.matches(), |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
238 |
"sizeString should have following format \"[0-9]+([MBK])?\""); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
239 |
long size = Long.valueOf(matcher.group("size")); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
240 |
|
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
241 |
if (matcher.group("multiplier") != null) { |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
242 |
long K = 1024L; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
243 |
// fall through multipliers |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
244 |
switch (matcher.group("multiplier").toLowerCase()) { |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
245 |
case "g": |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
246 |
size *= K; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
247 |
case "m": |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
248 |
size *= K; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
249 |
case "k": |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
250 |
size *= K; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
251 |
} |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
252 |
} |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
253 |
return size; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
254 |
} |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
255 |
|
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
256 |
private SurvivorAlignmentTestMain(long memoryToFill, long objectSize, |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
257 |
HeapSpace testedSpace) { |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
258 |
this.objectSize = objectSize; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
259 |
this.memoryToFill = memoryToFill; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
260 |
this.testedSpace = testedSpace; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
261 |
|
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
262 |
AlignmentHelper helper = SurvivorAlignmentTestMain.EDEN_SPACE_HELPER; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
263 |
|
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
264 |
this.actualObjectSize = helper.getObjectSizeInThisSpace( |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
265 |
this.objectSize); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
266 |
int arrayLength = helper.getObjectsCount(memoryToFill, this.objectSize); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
267 |
garbage = new Object[arrayLength]; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
268 |
} |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
269 |
|
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
270 |
/** |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
271 |
* Allocate byte arrays to fill {@code memoryToFill} memory. |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
272 |
*/ |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
273 |
public void allocate() { |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
274 |
int byteArrayLength = Math.max((int) (objectSize |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
275 |
- Unsafe.ARRAY_BYTE_BASE_OFFSET), 0); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
276 |
|
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
277 |
for (int i = 0; i < garbage.length; i++) { |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
278 |
garbage[i] = new byte[byteArrayLength]; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
279 |
} |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
280 |
} |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
281 |
|
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
282 |
/** |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
283 |
* Release memory occupied after {@code allocate} call. |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
284 |
*/ |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
285 |
public void release() { |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
286 |
for (int i = 0; i < garbage.length; i++) { |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
287 |
garbage[i] = null; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
288 |
} |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
289 |
} |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
290 |
|
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
291 |
/** |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
292 |
* Returns expected amount of memory occupied in a {@code heapSpace} by |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
293 |
* objects referenced from {@code garbage} array. |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
294 |
*/ |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
295 |
public long getExpectedMemoryUsage() { |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
296 |
AlignmentHelper alignmentHelper = getAlignmentHelper(testedSpace); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
297 |
return alignmentHelper.getExpectedMemoryUsage(objectSize, |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
298 |
garbage.length); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
299 |
} |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
300 |
|
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
301 |
/** |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
302 |
* Verifies that memory usage in a {@code heapSpace} deviates from |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
303 |
* {@code expectedUsage} for no more than {@code MAX_RELATIVE_DEVIATION}. |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
304 |
*/ |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
305 |
public void verifyMemoryUsage(long expectedUsage) { |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
306 |
AlignmentHelper alignmentHelper = getAlignmentHelper(testedSpace); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
307 |
|
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
308 |
long actualMemoryUsage = alignmentHelper.getActualMemoryUsage(); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
309 |
boolean otherThreadsAllocatedMemory = areOtherThreadsAllocatedMemory(); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
310 |
|
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
311 |
long memoryUsageDiff = Math.abs(actualMemoryUsage - expectedUsage); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
312 |
long maxAllowedUsageDiff |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
313 |
= alignmentHelper.getAllowedMemoryUsageDeviation(expectedUsage); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
314 |
|
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
315 |
System.out.println("Verifying memory usage in space: " + testedSpace); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
316 |
System.out.println("Allocated objects count: " + garbage.length); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
317 |
System.out.println("Desired object size: " + objectSize); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
318 |
System.out.println("Actual object size: " + actualObjectSize); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
319 |
System.out.println("Expected object size in space: " |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
320 |
+ alignmentHelper.getObjectSizeInThisSpace(objectSize)); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
321 |
System.out.println("Expected memory usage: " + expectedUsage); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
322 |
System.out.println("Actual memory usage: " + actualMemoryUsage); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
323 |
System.out.println("Memory usage diff: " + memoryUsageDiff); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
324 |
System.out.println("Max allowed usage diff: " + maxAllowedUsageDiff); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
325 |
|
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
326 |
if (memoryUsageDiff > maxAllowedUsageDiff |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
327 |
&& otherThreadsAllocatedMemory) { |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
328 |
System.out.println("Memory usage diff is incorrect, but it seems " |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
329 |
+ "like someone else allocated objects"); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
330 |
return; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
331 |
} |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
332 |
|
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
333 |
Asserts.assertLTE(memoryUsageDiff, maxAllowedUsageDiff, |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
334 |
"Actual memory usage should not deviate from expected for " + |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
335 |
"more then " + maxAllowedUsageDiff); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
336 |
} |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
337 |
|
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
338 |
/** |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
339 |
* Baselines amount of memory allocated by each thread. |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
340 |
*/ |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
341 |
public void baselineMemoryAllocation() { |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
342 |
ThreadMXBean bean = (ThreadMXBean) ManagementFactory.getThreadMXBean(); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
343 |
threadIds = bean.getAllThreadIds(); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
344 |
baselinedThreadMemoryUsage = bean.getThreadAllocatedBytes(threadIds); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
345 |
} |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
346 |
|
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
347 |
/** |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
348 |
* Checks if threads other then the current thread were allocating objects |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
349 |
* after baselinedThreadMemoryUsage call. |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
350 |
* |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
351 |
* If baselinedThreadMemoryUsage was not called, then this method will return |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
352 |
* {@code false}. |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
353 |
*/ |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
354 |
public boolean areOtherThreadsAllocatedMemory() { |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
355 |
if (baselinedThreadMemoryUsage == null) { |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
356 |
return false; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
357 |
} |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
358 |
|
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
359 |
ThreadMXBean bean = (ThreadMXBean) ManagementFactory.getThreadMXBean(); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
360 |
long currentMemoryAllocation[] |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
361 |
= bean.getThreadAllocatedBytes(threadIds); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
362 |
boolean otherThreadsAllocatedMemory = false; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
363 |
|
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
364 |
System.out.println("Verifying amount of memory allocated by threads:"); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
365 |
for (int i = 0; i < threadIds.length; i++) { |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
366 |
System.out.format("Thread %d%nbaseline allocation: %d" |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
367 |
+ "%ncurrent allocation:%d%n", threadIds[i], |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
368 |
baselinedThreadMemoryUsage[i], currentMemoryAllocation[i]); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
369 |
System.out.println(bean.getThreadInfo(threadIds[i])); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
370 |
|
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
371 |
long bytesAllocated = Math.abs(currentMemoryAllocation[i] |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
372 |
- baselinedThreadMemoryUsage[i]); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
373 |
if (bytesAllocated > 0 |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
374 |
&& threadIds[i] != Thread.currentThread().getId()) { |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
375 |
otherThreadsAllocatedMemory = true; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
376 |
} |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
377 |
} |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
378 |
|
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
379 |
return otherThreadsAllocatedMemory; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
380 |
} |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
381 |
|
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
382 |
@Override |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
383 |
public String toString() { |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
384 |
StringBuilder builder = new StringBuilder(); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
385 |
|
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
386 |
builder.append(String.format("SurvivorAlignmentTestMain info:%n")); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
387 |
builder.append(String.format("Desired object size: %d%n", objectSize)); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
388 |
builder.append(String.format("Memory to fill: %d%n", memoryToFill)); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
389 |
builder.append(String.format("Objects to be allocated: %d%n", |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
390 |
garbage.length)); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
391 |
|
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
392 |
builder.append(String.format("Alignment helpers to be used: %n")); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
393 |
for (HeapSpace heapSpace: HeapSpace.values()) { |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
394 |
builder.append(String.format("For space %s:%n%s%n", heapSpace, |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
395 |
getAlignmentHelper(heapSpace))); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
396 |
} |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
397 |
|
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
398 |
return builder.toString(); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
399 |
} |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
400 |
|
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
401 |
/** |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
402 |
* Returns {@code AlignmentHelper} for a space {@code heapSpace}. |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
403 |
*/ |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
404 |
public static AlignmentHelper getAlignmentHelper(HeapSpace heapSpace) { |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
405 |
switch (heapSpace) { |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
406 |
case EDEN: |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
407 |
return SurvivorAlignmentTestMain.EDEN_SPACE_HELPER; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
408 |
case SURVIVOR: |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
409 |
return SurvivorAlignmentTestMain.SURVIVOR_SPACE_HELPER; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
410 |
case TENURED: |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
411 |
return SurvivorAlignmentTestMain.TENURED_SPACE_HELPER; |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
412 |
default: |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
413 |
throw new Error("Unexpected heap space: " + heapSpace); |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
414 |
} |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
415 |
} |
9c0e6a049e1f
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
416 |
} |