author | kzhaldyb |
Wed, 13 Jan 2016 20:26:54 +0300 | |
changeset 35524 | a761ec11cbd5 |
child 38152 | 80e5da81fb2c |
permissions | -rw-r--r-- |
35524
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
1 |
/* |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
2 |
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
4 |
* |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
8 |
* |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
13 |
* accompanied this code). |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
14 |
* |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
18 |
* |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
21 |
* questions. |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
22 |
* |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
23 |
*/ |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
24 |
|
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
25 |
package gc.g1.humongousObjects; |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
26 |
|
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
27 |
import jdk.test.lib.Asserts; |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
28 |
import sun.hotspot.WhiteBox; |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
29 |
|
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
30 |
import java.io.IOException; |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
31 |
import java.net.URL; |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
32 |
import java.net.URLClassLoader; |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
33 |
import java.nio.file.Files; |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
34 |
import java.nio.file.Path; |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
35 |
import java.nio.file.Paths; |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
36 |
|
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
37 |
/** |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
38 |
* @test gc.g1.humongousObjects.TestHumongousNonArrayAllocation |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
39 |
* @summary Checks that huge class' instances (ie with huge amount of fields) are allocated successfully |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
40 |
* @requires vm.gc=="G1" | vm.gc=="null" |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
41 |
* @requires vm.opt.G1HeapRegionSize == "null" | vm.opt.G1HeapRegionSize == "1M" |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
42 |
* @library /testlibrary /test/lib / |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
43 |
* @modules java.management |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
44 |
* @build sun.hotspot.WhiteBox |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
45 |
* gc.testlibrary.Helpers |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
46 |
* gc.g1.humongousObjects.G1SampleClass |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
47 |
* gc.g1.humongousObjects.TestHumongousNonArrayAllocation |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
48 |
* |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
49 |
* @run driver ClassFileInstaller sun.hotspot.WhiteBox |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
50 |
* sun.hotspot.WhiteBox$WhiteBoxPermission |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
51 |
* |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
52 |
* @run main/othervm -Xms128M -Xmx128M -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
53 |
* -XX:G1HeapRegionSize=1M |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
54 |
* gc.g1.humongousObjects.TestHumongousNonArrayAllocation LARGEST_NON_HUMONGOUS |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
55 |
* |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
56 |
* @run main/othervm -Xms128M -Xmx128M -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
57 |
* -XX:G1HeapRegionSize=1M |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
58 |
* gc.g1.humongousObjects.TestHumongousNonArrayAllocation SMALLEST_HUMONGOUS |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
59 |
* |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
60 |
* @run main/othervm -Xms128M -Xmx128M -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
61 |
* -XX:G1HeapRegionSize=1M |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
62 |
* gc.g1.humongousObjects.TestHumongousNonArrayAllocation ONE_REGION_HUMONGOUS |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
63 |
* |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
64 |
* @run main/othervm -Xms128M -Xmx128M -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
65 |
* -XX:G1HeapRegionSize=1M |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
66 |
* gc.g1.humongousObjects.TestHumongousNonArrayAllocation TWO_REGION_HUMONGOUS |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
67 |
* |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
68 |
* @run main/othervm -Xms128M -Xmx128M -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
69 |
* -XX:G1HeapRegionSize=1M |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
70 |
* gc.g1.humongousObjects.TestHumongousNonArrayAllocation MORE_THAN_TWO_REGION_HUMONGOUS |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
71 |
* |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
72 |
*/ |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
73 |
|
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
74 |
/** |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
75 |
* The test for objects which are instances of classes with a huge amount of fields. It's an alternative way to create |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
76 |
* a humongous object rather to allocate a long array. |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
77 |
* The size of a class object depends on the field declared in the class. So, the tests generates such classes to cover |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
78 |
* the following cases: |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
79 |
* largest non-humongous object (exactly half a region) |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
80 |
* smallest humongous object (half a region + sizeof(long)) |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
81 |
* humongous object that takes exactly one region |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
82 |
* humongous object that takes more than one region (region + sizeof(long)) |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
83 |
* humongous object that takes more than two regions (region * 2 + sizeof(long)) |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
84 |
* |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
85 |
*/ |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
86 |
public class TestHumongousNonArrayAllocation { |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
87 |
private static final WhiteBox WB = WhiteBox.getWhiteBox(); |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
88 |
private static final String CLASS_NAME_PREFIX = TestHumongousNonArrayAllocation.class.getSimpleName() + "_"; |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
89 |
|
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
90 |
public static void main(String[] args) throws ClassNotFoundException, InstantiationException, |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
91 |
IllegalAccessException, IOException { |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
92 |
|
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
93 |
if (args.length != 1) { |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
94 |
throw new Error("Test Bug: Expected class name wasn't provided as command line argument"); |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
95 |
} |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
96 |
G1SampleClass sampleClass = G1SampleClass.valueOf(args[0]); |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
97 |
|
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
98 |
Path wrkDir = Files.createTempDirectory(Paths.get(""), CLASS_NAME_PREFIX); |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
99 |
URL[] url = {wrkDir.toUri().toURL()}; |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
100 |
URLClassLoader urlLoader = new URLClassLoader(url); |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
101 |
|
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
102 |
Object sampleObject; |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
103 |
try { |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
104 |
sampleObject = sampleClass.getCls(urlLoader, wrkDir, CLASS_NAME_PREFIX).newInstance(); |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
105 |
} catch (Throwable throwable) { |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
106 |
throw new AssertionError("Test Bug: Cannot create object of provided class", throwable); |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
107 |
} |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
108 |
|
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
109 |
boolean isHumongous = WB.g1IsHumongous(sampleObject); |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
110 |
boolean shouldBeHumongous = (sampleClass.expectedInstanceSize() > (WB.g1RegionSize() / 2)); |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
111 |
|
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
112 |
// Sanity check |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
113 |
Asserts.assertEquals(WB.getObjectSize(sampleObject), sampleClass.expectedInstanceSize(), |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
114 |
String.format("Test Bug: Object of class %s is expected to take %d bytes but it takes %d.", |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
115 |
sampleClass.name(), sampleClass.expectedInstanceSize(), WB.getObjectSize(sampleObject))); |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
116 |
|
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
117 |
// Test check |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
118 |
Asserts.assertEquals(isHumongous, shouldBeHumongous, |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
119 |
String.format("Object of class %s is expected to be %shumongous but it is not", |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
120 |
sampleClass.name(), (shouldBeHumongous ? "" : "non-"))); |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
121 |
} |
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
122 |
|
a761ec11cbd5
8132717: Add tests checking that instances of j.l.Classes of a large size are allocated as Humongous
kzhaldyb
parents:
diff
changeset
|
123 |
} |