Mercurial > hg > truffle
annotate test/runtime/CompressedOops/CompressedKlassPointerAndOops.java @ 20218:828056cf311f
8040792: G1: Memory usage calculation uses sizeof(this) instead of sizeof(classname)
Summary: A few locations in the code use sizeof(this) which returns the size of the pointer instead of sizeof(classname) which returns the size of the sum of its members. This change fixes these errors and adds a few tests.
Reviewed-by: mgerdin, brutisso
author | tschatzl |
---|---|
date | Mon, 21 Jul 2014 09:40:19 +0200 |
parents | 7944aba7ba41 |
children |
rev | line source |
---|---|
11987
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
1 /* |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
4 * |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
8 * |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
13 * accompanied this code). |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
14 * |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
18 * |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
21 * questions. |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
22 */ |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
23 |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
24 /* |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
25 * @test |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
26 * @bug 8000968 |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
27 * @key regression |
12226
7944aba7ba41
8015107: NPG: Use consistent naming for metaspace concepts
ehelin
parents:
11987
diff
changeset
|
28 * @summary NPG: UseCompressedClassPointers asserts with ObjectAlignmentInBytes=32 |
11987
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
29 * @library /testlibrary |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
30 */ |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
31 |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
32 import com.oracle.java.testlibrary.*; |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
33 |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
34 public class CompressedKlassPointerAndOops { |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
35 |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
36 public static void main(String[] args) throws Exception { |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
37 |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
38 if (!Platform.is64bit()) { |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
39 // Can't test this on 32 bit, just pass |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
40 System.out.println("Skipping test on 32bit"); |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
41 return; |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
42 } |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
43 |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
44 runWithAlignment(16); |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
45 runWithAlignment(32); |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
46 runWithAlignment(64); |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
47 runWithAlignment(128); |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
48 } |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
49 |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
50 private static void runWithAlignment(int alignment) throws Exception { |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
51 ProcessBuilder pb; |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
52 OutputAnalyzer output; |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
53 |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
54 pb = ProcessTools.createJavaProcessBuilder( |
12226
7944aba7ba41
8015107: NPG: Use consistent naming for metaspace concepts
ehelin
parents:
11987
diff
changeset
|
55 "-XX:+UseCompressedClassPointers", |
11987
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
56 "-XX:+UseCompressedOops", |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
57 "-XX:ObjectAlignmentInBytes=" + alignment, |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
58 "-version"); |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
59 |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
60 output = new OutputAnalyzer(pb.start()); |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
61 output.shouldHaveExitValue(0); |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
62 } |
81e0f17ade64
8009407: runtime/8000968/Test8000968.sh has incorrect check for proper config
ctornqvi
parents:
diff
changeset
|
63 } |