Mercurial > hg > graal-compiler
annotate test/gc/TestObjectAlignment.java @ 15835:187634c8099c
Remove overly restrictive assertion
author | Christian Wimmer <christian.wimmer@oracle.com> |
---|---|
date | Tue, 20 May 2014 18:58:42 -0700 |
parents | ff218fdb30ba |
children |
rev | line source |
---|---|
12229
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
1 /* |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
4 * |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
8 * |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
13 * accompanied this code). |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
14 * |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
18 * |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
21 * questions. |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
22 */ |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
23 |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
24 /** |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
25 * @test TestObjectAlignment |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
26 * @key gc |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
27 * @bug 8021823 |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
28 * @summary G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
29 * @library /testlibrary |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
30 * @run main/othervm TestObjectAlignment -Xmx20M -XX:+ExplicitGCInvokesConcurrent -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=8 |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
31 * @run main/othervm TestObjectAlignment -Xmx20M -XX:+ExplicitGCInvokesConcurrent -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=16 |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
32 * @run main/othervm TestObjectAlignment -Xmx20M -XX:+ExplicitGCInvokesConcurrent -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=32 |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
33 * @run main/othervm TestObjectAlignment -Xmx20M -XX:+ExplicitGCInvokesConcurrent -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=64 |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
34 * @run main/othervm TestObjectAlignment -Xmx20M -XX:+ExplicitGCInvokesConcurrent -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=128 |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
35 * @run main/othervm TestObjectAlignment -Xmx20M -XX:+ExplicitGCInvokesConcurrent -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=256 |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
36 * @run main/othervm TestObjectAlignment -Xmx20M -XX:-ExplicitGCInvokesConcurrent -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=8 |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
37 * @run main/othervm TestObjectAlignment -Xmx20M -XX:-ExplicitGCInvokesConcurrent -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=16 |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
38 * @run main/othervm TestObjectAlignment -Xmx20M -XX:-ExplicitGCInvokesConcurrent -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=32 |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
39 * @run main/othervm TestObjectAlignment -Xmx20M -XX:-ExplicitGCInvokesConcurrent -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=64 |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
40 * @run main/othervm TestObjectAlignment -Xmx20M -XX:-ExplicitGCInvokesConcurrent -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=128 |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
41 * @run main/othervm TestObjectAlignment -Xmx20M -XX:-ExplicitGCInvokesConcurrent -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=256 |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
42 */ |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
43 |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
44 import com.oracle.java.testlibrary.ProcessTools; |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
45 import com.oracle.java.testlibrary.OutputAnalyzer; |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
46 |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
47 public class TestObjectAlignment { |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
48 |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
49 public static byte[] garbage; |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
50 |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
51 private static boolean runsOn32bit() { |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
52 return System.getProperty("sun.arch.data.model").equals("32"); |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
53 } |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
54 |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
55 public static void main(String[] args) throws Exception { |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
56 if (runsOn32bit()) { |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
57 // 32 bit VMs do not allow setting ObjectAlignmentInBytes, so there is nothing to test. We still get called. |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
58 return; |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
59 } |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
60 for (int i = 0; i < 10; i++) { |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
61 garbage = new byte[1000]; |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
62 System.gc(); |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
63 } |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
64 } |
ff218fdb30ba
8021823: G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
tschatzl
parents:
diff
changeset
|
65 } |