author | lana |
Thu, 23 Feb 2017 17:30:12 +0000 | |
changeset 44011 | 5eea3031ae7b |
parent 41705 | 332239c052cc |
permissions | -rw-r--r-- |
39263
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
1 |
/* |
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
2 |
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. |
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
4 |
* |
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
8 |
* |
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
13 |
* accompanied this code). |
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
14 |
* |
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
18 |
* |
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
21 |
* questions. |
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
22 |
*/ |
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
23 |
|
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
24 |
/* |
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
25 |
* @test TestStableMismatched |
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
26 |
* @bug 8158228 |
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
27 |
* @summary Tests if mismatched char load from stable byte[] returns correct result |
40059 | 28 |
* |
39263
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
29 |
* @run main/othervm -XX:-CompactStrings -XX:TieredStopAtLevel=1 -Xcomp |
40059 | 30 |
* -XX:CompileOnly=compiler.stable.TestStableMismatched::test,::charAt |
31 |
* compiler.stable.TestStableMismatched |
|
39263
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
32 |
* @run main/othervm -XX:-CompactStrings -XX:-TieredCompilation -Xcomp |
40059 | 33 |
* -XX:CompileOnly=compiler.stable.TestStableMismatched::test,::charAt |
34 |
* compiler.stable.TestStableMismatched |
|
39263
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
35 |
*/ |
40059 | 36 |
|
37 |
package compiler.stable; |
|
38 |
||
39263
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
39 |
public class TestStableMismatched { |
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
40 |
public static void main(String args[]) { |
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
41 |
test(); |
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
42 |
} |
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
43 |
|
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
44 |
public static void test() { |
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
45 |
String text = "abcdefg"; |
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
46 |
// Mismatched char load from @Stable byte[] String.value field |
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
47 |
char returned = text.charAt(6); |
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
48 |
if (returned != 'g') { |
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
49 |
throw new RuntimeException("failed: charAt(6) returned '" + returned + "' instead of 'g'"); |
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
50 |
} |
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
51 |
} |
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
52 |
} |
d139a133ba27
8158228: C1 incorrectly folds mismatched loads from stable arrays
thartmann
parents:
diff
changeset
|
53 |