Mercurial > hg > truffle
annotate test/compiler/7174363/Test7174363.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 | eeb819cf36e5 |
children |
rev | line source |
---|---|
6180
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
1 /* |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
4 * |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
8 * |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
13 * accompanied this code). |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
14 * |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
18 * |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
21 * questions. |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
22 * |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
23 */ |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
24 |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
25 /** |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
26 * @test |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
27 * @bug 7174363 |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
28 * @summary crash with Arrays.copyOfRange(original, from, to) when from > original.length |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
29 * |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
30 * @run main/othervm -XX:-BackgroundCompilation Test7174363 |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
31 */ |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
32 |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
33 import java.util.*; |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
34 |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
35 public class Test7174363 { |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
36 |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
37 static Object[] m(Object[] original, int from, int to) { |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
38 return Arrays.copyOfRange(original, from, to, Object[].class); |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
39 } |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
40 |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
41 static public void main(String[] args) { |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
42 Object[] orig = new Object[10]; |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
43 for (int i = 0; i < 20000; i++) { |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
44 try { |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
45 m(orig, 15, 20); |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
46 } catch(ArrayIndexOutOfBoundsException excp) {} |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
47 } |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
48 } |
eeb819cf36e5
7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff
changeset
|
49 } |