Mercurial > hg > graal-compiler
annotate graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/utilities/PrimitiveValueProfileTest.java @ 21640:11f68b116a07
mx: added support for server-nograal and client-nograal aliases
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 01 Jun 2015 18:04:12 +0200 |
parents | 53afdc71b311 |
children |
rev | line source |
---|---|
18164
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
1 /* |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
4 * |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
8 * |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
14 * |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
18 * |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
21 * questions. |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
22 */ |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
23 package com.oracle.truffle.api.test.utilities; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
24 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
25 import static org.hamcrest.CoreMatchers.*; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
26 import static org.junit.Assert.*; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
27 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
28 import org.junit.*; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
29 import org.junit.experimental.theories.*; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
30 import org.junit.runner.*; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
31 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
32 import com.oracle.truffle.api.utilities.*; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
33 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
34 @RunWith(Theories.class) |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
35 public class PrimitiveValueProfileTest { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
36 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
37 @DataPoint public static final String O1 = new String(); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
38 @DataPoint public static final String O2 = O1; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
39 @DataPoint public static final Object O3 = new Object(); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
40 @DataPoint public static final Object O4 = null; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
41 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
42 @DataPoint public static final byte B1 = Byte.MIN_VALUE; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
43 @DataPoint public static final byte B2 = 0; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
44 @DataPoint public static final byte B3 = 14; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
45 @DataPoint public static final byte B4 = Byte.MAX_VALUE; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
46 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
47 @DataPoint public static final short S1 = Short.MIN_VALUE; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
48 @DataPoint public static final short S2 = 0; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
49 @DataPoint public static final short S3 = 14; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
50 @DataPoint public static final short S4 = Short.MAX_VALUE; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
51 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
52 @DataPoint public static final int I1 = Integer.MIN_VALUE; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
53 @DataPoint public static final int I2 = 0; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
54 @DataPoint public static final int I3 = 14; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
55 @DataPoint public static final int I4 = Integer.MAX_VALUE; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
56 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
57 @DataPoint public static final long L1 = Long.MIN_VALUE; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
58 @DataPoint public static final long L2 = 0; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
59 @DataPoint public static final long L3 = 14; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
60 @DataPoint public static final long L4 = Long.MAX_VALUE; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
61 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
62 @DataPoint public static final float F1 = Float.MIN_VALUE; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
63 @DataPoint public static final float F2 = -0.0f; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
64 @DataPoint public static final float F3 = +0.0f; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
65 @DataPoint public static final float F4 = 14.5f; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
66 @DataPoint public static final float F5 = Float.MAX_VALUE; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
67 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
68 @DataPoint public static final double D1 = Double.MIN_VALUE; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
69 @DataPoint public static final double D2 = -0.0; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
70 @DataPoint public static final double D3 = +0.0; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
71 @DataPoint public static final double D4 = 14.5; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
72 @DataPoint public static final double D5 = Double.MAX_VALUE; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
73 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
74 @DataPoint public static final boolean T1 = false; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
75 @DataPoint public static final boolean T2 = true; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
76 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
77 @DataPoint public static final char C1 = Character.MIN_VALUE; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
78 @DataPoint public static final char C2 = 0; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
79 @DataPoint public static final char C3 = 14; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
80 @DataPoint public static final char C4 = Character.MAX_VALUE; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
81 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
82 private static final float FLOAT_DELTA = 0.00001f; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
83 private static final double DOUBLE_DELTA = 0.00001; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
84 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
85 private PrimitiveValueProfile profile; |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
86 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
87 @Before |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
88 public void create() { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
89 profile = ValueProfile.createPrimitiveProfile(); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
90 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
91 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
92 @Test |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
93 public void testInitial() { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
94 assertThat(profile.isGeneric(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
95 assertThat(profile.isUninitialized(), is(true)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
96 profile.toString(); // test that it is not crashing |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
97 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
98 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
99 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
100 public void testProfileOneObject(Object value) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
101 Object result = profile.profile(value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
102 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
103 assertThat(result, is(value)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
104 assertEquals(profile.getCachedValue(), value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
105 assertThat(profile.isUninitialized(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
106 profile.toString(); // test that it is not crashing |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
107 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
108 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
109 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
110 public void testProfileTwoObject(Object value0, Object value1) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
111 Object result0 = profile.profile(value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
112 Object result1 = profile.profile(value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
113 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
114 assertThat(result0, is(value0)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
115 assertThat(result1, is(value1)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
116 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
117 if (value0 == value1) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
118 assertThat(profile.getCachedValue(), is(value0)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
119 assertThat(profile.isGeneric(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
120 } else { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
121 assertThat(profile.isGeneric(), is(true)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
122 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
123 assertThat(profile.isUninitialized(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
124 profile.toString(); // test that it is not crashing |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
125 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
126 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
127 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
128 public void testProfileThreeObject(Object value0, Object value1, Object value2) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
129 Object result0 = profile.profile(value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
130 Object result1 = profile.profile(value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
131 Object result2 = profile.profile(value2); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
132 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
133 assertThat(result0, is(value0)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
134 assertThat(result1, is(value1)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
135 assertThat(result2, is(value2)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
136 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
137 if (value0 == value1 && value1 == value2) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
138 assertThat(profile.getCachedValue(), is(value0)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
139 assertThat(profile.isGeneric(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
140 } else { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
141 assertThat(profile.isGeneric(), is(true)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
142 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
143 assertThat(profile.isUninitialized(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
144 profile.toString(); // test that it is not crashing |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
145 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
146 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
147 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
148 public void testProfileOneByte(byte value) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
149 byte result = profile.profile(value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
150 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
151 assertThat(result, is(value)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
152 assertEquals(profile.getCachedValue(), value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
153 assertThat(profile.isUninitialized(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
154 profile.toString(); // test that it is not crashing |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
155 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
156 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
157 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
158 public void testProfileTwoByte(byte value0, byte value1) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
159 byte result0 = profile.profile(value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
160 byte result1 = profile.profile(value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
161 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
162 assertEquals(result0, value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
163 assertEquals(result1, value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
164 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
165 if (value0 == value1) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
166 assertTrue(profile.getCachedValue() instanceof Byte); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
167 assertEquals((byte) profile.getCachedValue(), value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
168 assertThat(profile.isGeneric(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
169 } else { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
170 assertThat(profile.isGeneric(), is(true)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
171 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
172 assertThat(profile.isUninitialized(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
173 profile.toString(); // test that it is not crashing |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
174 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
175 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
176 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
177 public void testProfileThreeByte(byte value0, byte value1, byte value2) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
178 byte result0 = profile.profile(value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
179 byte result1 = profile.profile(value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
180 byte result2 = profile.profile(value2); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
181 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
182 assertEquals(result0, value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
183 assertEquals(result1, value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
184 assertEquals(result2, value2); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
185 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
186 if (value0 == value1 && value1 == value2) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
187 assertTrue(profile.getCachedValue() instanceof Byte); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
188 assertEquals((byte) profile.getCachedValue(), value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
189 assertThat(profile.isGeneric(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
190 } else { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
191 assertThat(profile.isGeneric(), is(true)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
192 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
193 assertThat(profile.isUninitialized(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
194 profile.toString(); // test that it is not crashing |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
195 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
196 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
197 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
198 public void testProfileOneShort(short value) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
199 short result = profile.profile(value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
200 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
201 assertThat(result, is(value)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
202 assertEquals(profile.getCachedValue(), value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
203 assertThat(profile.isUninitialized(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
204 profile.toString(); // test that it is not crashing |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
205 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
206 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
207 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
208 public void testProfileTwoShort(short value0, short value1) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
209 short result0 = profile.profile(value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
210 short result1 = profile.profile(value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
211 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
212 assertEquals(result0, value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
213 assertEquals(result1, value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
214 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
215 if (value0 == value1) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
216 assertTrue(profile.getCachedValue() instanceof Short); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
217 assertEquals((short) profile.getCachedValue(), value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
218 assertThat(profile.isGeneric(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
219 } else { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
220 assertThat(profile.isGeneric(), is(true)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
221 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
222 assertThat(profile.isUninitialized(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
223 profile.toString(); // test that it is not crashing |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
224 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
225 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
226 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
227 public void testProfileThreeShort(short value0, short value1, short value2) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
228 short result0 = profile.profile(value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
229 short result1 = profile.profile(value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
230 short result2 = profile.profile(value2); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
231 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
232 assertEquals(result0, value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
233 assertEquals(result1, value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
234 assertEquals(result2, value2); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
235 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
236 if (value0 == value1 && value1 == value2) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
237 assertTrue(profile.getCachedValue() instanceof Short); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
238 assertEquals((short) profile.getCachedValue(), value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
239 assertThat(profile.isGeneric(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
240 } else { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
241 assertThat(profile.isGeneric(), is(true)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
242 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
243 assertThat(profile.isUninitialized(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
244 profile.toString(); // test that it is not crashing |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
245 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
246 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
247 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
248 public void testProfileOneInteger(int value) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
249 int result = profile.profile(value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
250 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
251 assertThat(result, is(value)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
252 assertEquals(profile.getCachedValue(), value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
253 assertThat(profile.isUninitialized(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
254 profile.toString(); // test that it is not crashing |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
255 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
256 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
257 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
258 public void testProfileTwoInteger(int value0, int value1) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
259 int result0 = profile.profile(value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
260 int result1 = profile.profile(value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
261 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
262 assertEquals(result0, value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
263 assertEquals(result1, value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
264 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
265 if (value0 == value1) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
266 assertTrue(profile.getCachedValue() instanceof Integer); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
267 assertEquals((int) profile.getCachedValue(), value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
268 assertThat(profile.isGeneric(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
269 } else { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
270 assertThat(profile.isGeneric(), is(true)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
271 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
272 assertThat(profile.isUninitialized(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
273 profile.toString(); // test that it is not crashing |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
274 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
275 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
276 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
277 public void testProfileThreeInteger(int value0, int value1, int value2) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
278 int result0 = profile.profile(value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
279 int result1 = profile.profile(value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
280 int result2 = profile.profile(value2); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
281 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
282 assertEquals(result0, value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
283 assertEquals(result1, value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
284 assertEquals(result2, value2); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
285 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
286 if (value0 == value1 && value1 == value2) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
287 assertTrue(profile.getCachedValue() instanceof Integer); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
288 assertEquals((int) profile.getCachedValue(), value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
289 assertThat(profile.isGeneric(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
290 } else { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
291 assertThat(profile.isGeneric(), is(true)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
292 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
293 assertThat(profile.isUninitialized(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
294 profile.toString(); // test that it is not crashing |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
295 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
296 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
297 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
298 public void testProfileOneLong(long value) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
299 long result = profile.profile(value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
300 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
301 assertThat(result, is(value)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
302 assertEquals(profile.getCachedValue(), value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
303 assertThat(profile.isUninitialized(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
304 profile.toString(); // test that it is not crashing |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
305 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
306 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
307 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
308 public void testProfileTwoLong(long value0, long value1) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
309 long result0 = profile.profile(value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
310 long result1 = profile.profile(value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
311 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
312 assertEquals(result0, value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
313 assertEquals(result1, value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
314 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
315 if (value0 == value1) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
316 assertTrue(profile.getCachedValue() instanceof Long); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
317 assertEquals((long) profile.getCachedValue(), value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
318 assertThat(profile.isGeneric(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
319 } else { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
320 assertThat(profile.isGeneric(), is(true)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
321 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
322 assertThat(profile.isUninitialized(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
323 profile.toString(); // test that it is not crashing |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
324 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
325 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
326 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
327 public void testProfileThreeLong(long value0, long value1, long value2) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
328 long result0 = profile.profile(value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
329 long result1 = profile.profile(value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
330 long result2 = profile.profile(value2); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
331 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
332 assertEquals(result0, value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
333 assertEquals(result1, value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
334 assertEquals(result2, value2); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
335 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
336 if (value0 == value1 && value1 == value2) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
337 assertTrue(profile.getCachedValue() instanceof Long); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
338 assertEquals((long) profile.getCachedValue(), value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
339 assertThat(profile.isGeneric(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
340 } else { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
341 assertThat(profile.isGeneric(), is(true)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
342 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
343 assertThat(profile.isUninitialized(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
344 profile.toString(); // test that it is not crashing |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
345 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
346 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
347 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
348 public void testProfileOneFloat(float value) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
349 float result = profile.profile(value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
350 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
351 assertThat(result, is(value)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
352 assertEquals(profile.getCachedValue(), value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
353 assertThat(profile.isUninitialized(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
354 profile.toString(); // test that it is not crashing |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
355 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
356 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
357 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
358 public void testProfileTwoFloat(float value0, float value1) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
359 float result0 = profile.profile(value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
360 float result1 = profile.profile(value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
361 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
362 assertEquals(result0, value0, FLOAT_DELTA); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
363 assertEquals(result1, value1, FLOAT_DELTA); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
364 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
365 if (PrimitiveValueProfile.exactCompare(value0, value1)) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
366 assertTrue(profile.getCachedValue() instanceof Float); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
367 assertEquals((float) profile.getCachedValue(), value0, FLOAT_DELTA); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
368 assertThat(profile.isGeneric(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
369 } else { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
370 assertThat(profile.isGeneric(), is(true)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
371 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
372 assertThat(profile.isUninitialized(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
373 profile.toString(); // test that it is not crashing |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
374 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
375 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
376 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
377 public void testProfileThreeFloat(float value0, float value1, float value2) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
378 float result0 = profile.profile(value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
379 float result1 = profile.profile(value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
380 float result2 = profile.profile(value2); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
381 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
382 assertEquals(result0, value0, FLOAT_DELTA); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
383 assertEquals(result1, value1, FLOAT_DELTA); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
384 assertEquals(result2, value2, FLOAT_DELTA); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
385 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
386 if (PrimitiveValueProfile.exactCompare(value0, value1) && PrimitiveValueProfile.exactCompare(value1, value2)) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
387 assertTrue(profile.getCachedValue() instanceof Float); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
388 assertEquals((float) profile.getCachedValue(), value0, FLOAT_DELTA); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
389 assertThat(profile.isGeneric(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
390 } else { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
391 assertThat(profile.isGeneric(), is(true)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
392 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
393 assertThat(profile.isUninitialized(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
394 profile.toString(); // test that it is not crashing |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
395 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
396 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
397 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
398 public void testProfileOneDouble(double value) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
399 double result = profile.profile(value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
400 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
401 assertThat(result, is(value)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
402 assertEquals(profile.getCachedValue(), value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
403 assertThat(profile.isUninitialized(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
404 profile.toString(); // test that it is not crashing |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
405 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
406 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
407 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
408 public void testProfileTwoDouble(double value0, double value1) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
409 double result0 = profile.profile(value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
410 double result1 = profile.profile(value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
411 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
412 assertEquals(result0, value0, DOUBLE_DELTA); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
413 assertEquals(result1, value1, DOUBLE_DELTA); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
414 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
415 if (PrimitiveValueProfile.exactCompare(value0, value1)) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
416 assertTrue(profile.getCachedValue() instanceof Double); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
417 assertEquals((double) profile.getCachedValue(), value0, DOUBLE_DELTA); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
418 assertThat(profile.isGeneric(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
419 } else { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
420 assertThat(profile.isGeneric(), is(true)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
421 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
422 assertThat(profile.isUninitialized(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
423 profile.toString(); // test that it is not crashing |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
424 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
425 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
426 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
427 public void testProfileThreeDouble(double value0, double value1, double value2) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
428 double result0 = profile.profile(value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
429 double result1 = profile.profile(value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
430 double result2 = profile.profile(value2); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
431 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
432 assertEquals(result0, value0, DOUBLE_DELTA); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
433 assertEquals(result1, value1, DOUBLE_DELTA); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
434 assertEquals(result2, value2, DOUBLE_DELTA); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
435 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
436 if (PrimitiveValueProfile.exactCompare(value0, value1) && PrimitiveValueProfile.exactCompare(value1, value2)) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
437 assertTrue(profile.getCachedValue() instanceof Double); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
438 assertEquals((double) profile.getCachedValue(), value0, DOUBLE_DELTA); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
439 assertThat(profile.isGeneric(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
440 } else { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
441 assertThat(profile.isGeneric(), is(true)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
442 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
443 assertThat(profile.isUninitialized(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
444 profile.toString(); // test that it is not crashing |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
445 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
446 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
447 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
448 public void testProfileOneBoolean(boolean value) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
449 boolean result = profile.profile(value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
450 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
451 assertThat(result, is(value)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
452 assertEquals(profile.getCachedValue(), value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
453 assertThat(profile.isUninitialized(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
454 profile.toString(); // test that it is not crashing |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
455 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
456 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
457 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
458 public void testProfileTwoBoolean(boolean value0, boolean value1) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
459 boolean result0 = profile.profile(value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
460 boolean result1 = profile.profile(value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
461 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
462 assertEquals(result0, value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
463 assertEquals(result1, value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
464 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
465 if (value0 == value1) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
466 assertTrue(profile.getCachedValue() instanceof Boolean); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
467 assertEquals((boolean) profile.getCachedValue(), value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
468 assertThat(profile.isGeneric(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
469 } else { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
470 assertThat(profile.isGeneric(), is(true)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
471 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
472 assertThat(profile.isUninitialized(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
473 profile.toString(); // test that it is not crashing |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
474 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
475 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
476 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
477 public void testProfileThreeBoolean(boolean value0, boolean value1, boolean value2) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
478 boolean result0 = profile.profile(value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
479 boolean result1 = profile.profile(value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
480 boolean result2 = profile.profile(value2); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
481 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
482 assertEquals(result0, value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
483 assertEquals(result1, value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
484 assertEquals(result2, value2); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
485 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
486 if (value0 == value1 && value1 == value2) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
487 assertTrue(profile.getCachedValue() instanceof Boolean); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
488 assertEquals((boolean) profile.getCachedValue(), value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
489 assertThat(profile.isGeneric(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
490 } else { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
491 assertThat(profile.isGeneric(), is(true)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
492 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
493 assertThat(profile.isUninitialized(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
494 profile.toString(); // test that it is not crashing |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
495 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
496 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
497 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
498 public void testProfileOneChar(char value) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
499 char result = profile.profile(value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
500 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
501 assertThat(result, is(value)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
502 assertEquals(profile.getCachedValue(), value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
503 assertThat(profile.isUninitialized(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
504 profile.toString(); // test that it is not crashing |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
505 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
506 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
507 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
508 public void testProfileTwoChar(char value0, char value1) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
509 char result0 = profile.profile(value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
510 char result1 = profile.profile(value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
511 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
512 assertEquals(result0, value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
513 assertEquals(result1, value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
514 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
515 if (value0 == value1) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
516 assertTrue(profile.getCachedValue() instanceof Character); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
517 assertEquals((char) profile.getCachedValue(), value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
518 assertThat(profile.isGeneric(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
519 } else { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
520 assertThat(profile.isGeneric(), is(true)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
521 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
522 assertThat(profile.isUninitialized(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
523 profile.toString(); // test that it is not crashing |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
524 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
525 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
526 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
527 public void testProfileThreeChar(char value0, char value1, char value2) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
528 char result0 = profile.profile(value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
529 char result1 = profile.profile(value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
530 char result2 = profile.profile(value2); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
531 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
532 assertEquals(result0, value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
533 assertEquals(result1, value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
534 assertEquals(result2, value2); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
535 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
536 if (value0 == value1 && value1 == value2) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
537 assertTrue(profile.getCachedValue() instanceof Character); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
538 assertEquals((char) profile.getCachedValue(), value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
539 assertThat(profile.isGeneric(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
540 } else { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
541 assertThat(profile.isGeneric(), is(true)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
542 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
543 assertThat(profile.isUninitialized(), is(false)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
544 profile.toString(); // test that it is not crashing |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
545 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
546 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
547 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
548 public void testWithBoxedBoxedByte(byte value) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
549 Object result0 = profile.profile((Object) value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
550 Object result1 = profile.profile((Object) value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
551 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
552 assertTrue(result0 instanceof Byte); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
553 assertEquals((byte) result0, value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
554 assertTrue(result1 instanceof Byte); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
555 assertEquals((byte) result1, value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
556 assertFalse(profile.isUninitialized()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
557 assertFalse(profile.isGeneric()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
558 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
559 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
560 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
561 public void testWithUnboxedBoxedByte(byte value) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
562 byte result0 = profile.profile(value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
563 Object result1 = profile.profile((Object) value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
564 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
565 assertEquals(result0, value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
566 assertTrue(result1 instanceof Byte); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
567 assertEquals((byte) result1, value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
568 assertFalse(profile.isUninitialized()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
569 assertFalse(profile.isGeneric()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
570 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
571 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
572 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
573 public void testWithBoxedUnboxedByte(byte value) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
574 Object result0 = profile.profile((Object) value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
575 byte result1 = profile.profile(value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
576 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
577 assertTrue(result0 instanceof Byte); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
578 assertEquals((byte) result0, value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
579 assertEquals(result1, value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
580 assertFalse(profile.isUninitialized()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
581 assertFalse(profile.isGeneric()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
582 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
583 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
584 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
585 public void testWithBoxedBoxedShort(short value) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
586 Object result0 = profile.profile((Object) value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
587 Object result1 = profile.profile((Object) value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
588 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
589 assertTrue(result0 instanceof Short); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
590 assertEquals((short) result0, value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
591 assertTrue(result1 instanceof Short); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
592 assertEquals((short) result1, value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
593 assertFalse(profile.isUninitialized()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
594 assertFalse(profile.isGeneric()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
595 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
596 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
597 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
598 public void testWithUnboxedBoxedShort(short value) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
599 short result0 = profile.profile(value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
600 Object result1 = profile.profile((Object) value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
601 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
602 assertEquals(result0, value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
603 assertTrue(result1 instanceof Short); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
604 assertEquals((short) result1, value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
605 assertFalse(profile.isUninitialized()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
606 assertFalse(profile.isGeneric()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
607 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
608 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
609 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
610 public void testWithBoxedUnboxedShort(short value) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
611 Object result0 = profile.profile((Object) value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
612 short result1 = profile.profile(value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
613 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
614 assertTrue(result0 instanceof Short); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
615 assertEquals((short) result0, value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
616 assertEquals(result1, value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
617 assertFalse(profile.isUninitialized()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
618 assertFalse(profile.isGeneric()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
619 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
620 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
621 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
622 public void testWithBoxedBoxedInt(int value) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
623 Object result0 = profile.profile((Object) value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
624 Object result1 = profile.profile((Object) value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
625 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
626 assertTrue(result0 instanceof Integer); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
627 assertEquals((int) result0, value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
628 assertTrue(result1 instanceof Integer); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
629 assertEquals((int) result1, value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
630 assertFalse(profile.isUninitialized()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
631 assertFalse(profile.isGeneric()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
632 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
633 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
634 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
635 public void testWithUnboxedBoxedInt(int value) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
636 int result0 = profile.profile(value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
637 Object result1 = profile.profile((Object) value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
638 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
639 assertEquals(result0, value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
640 assertTrue(result1 instanceof Integer); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
641 assertEquals((int) result1, value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
642 assertFalse(profile.isUninitialized()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
643 assertFalse(profile.isGeneric()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
644 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
645 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
646 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
647 public void testWithBoxedUnboxedInt(int value) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
648 Object result0 = profile.profile((Object) value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
649 int result1 = profile.profile(value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
650 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
651 assertTrue(result0 instanceof Integer); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
652 assertEquals((int) result0, value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
653 assertEquals(result1, value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
654 assertFalse(profile.isUninitialized()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
655 assertFalse(profile.isGeneric()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
656 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
657 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
658 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
659 public void testWithBoxedBoxedLong(long value) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
660 Object result0 = profile.profile((Object) value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
661 Object result1 = profile.profile((Object) value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
662 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
663 assertTrue(result0 instanceof Long); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
664 assertEquals((long) result0, value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
665 assertTrue(result1 instanceof Long); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
666 assertEquals((long) result1, value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
667 assertFalse(profile.isUninitialized()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
668 assertFalse(profile.isGeneric()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
669 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
670 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
671 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
672 public void testWithUnboxedBoxedLong(long value) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
673 long result0 = profile.profile(value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
674 Object result1 = profile.profile((Object) value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
675 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
676 assertEquals(result0, value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
677 assertTrue(result1 instanceof Long); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
678 assertEquals((long) result1, value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
679 assertFalse(profile.isUninitialized()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
680 assertFalse(profile.isGeneric()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
681 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
682 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
683 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
684 public void testWithBoxedUnboxedLong(long value) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
685 Object result0 = profile.profile((Object) value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
686 long result1 = profile.profile(value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
687 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
688 assertTrue(result0 instanceof Long); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
689 assertEquals((long) result0, value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
690 assertEquals(result1, value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
691 assertFalse(profile.isUninitialized()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
692 assertFalse(profile.isGeneric()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
693 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
694 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
695 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
696 public void testWithBoxedBoxedFloat(float value) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
697 Object result0 = profile.profile((Object) value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
698 Object result1 = profile.profile((Object) value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
699 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
700 assertTrue(result0 instanceof Float); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
701 assertTrue(PrimitiveValueProfile.exactCompare((float) result0, value)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
702 assertTrue(result1 instanceof Float); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
703 assertTrue(PrimitiveValueProfile.exactCompare((float) result1, value)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
704 assertFalse(profile.isUninitialized()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
705 assertFalse(profile.isGeneric()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
706 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
707 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
708 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
709 public void testWithUnboxedBoxedFloat(float value) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
710 float result0 = profile.profile(value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
711 Object result1 = profile.profile((Object) value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
712 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
713 assertTrue(PrimitiveValueProfile.exactCompare(result0, value)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
714 assertTrue(result1 instanceof Float); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
715 assertTrue(PrimitiveValueProfile.exactCompare((float) result1, value)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
716 assertFalse(profile.isUninitialized()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
717 assertFalse(profile.isGeneric()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
718 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
719 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
720 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
721 public void testWithBoxedUnboxedFloat(float value) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
722 Object result0 = profile.profile((Object) value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
723 float result1 = profile.profile(value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
724 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
725 assertTrue(result0 instanceof Float); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
726 assertTrue(PrimitiveValueProfile.exactCompare((float) result0, value)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
727 assertTrue(PrimitiveValueProfile.exactCompare(result1, value)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
728 assertFalse(profile.isUninitialized()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
729 assertFalse(profile.isGeneric()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
730 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
731 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
732 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
733 public void testWithBoxedBoxedDouble(double value) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
734 Object result0 = profile.profile((Object) value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
735 Object result1 = profile.profile((Object) value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
736 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
737 assertTrue(result0 instanceof Double); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
738 assertTrue(PrimitiveValueProfile.exactCompare((double) result0, value)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
739 assertTrue(result1 instanceof Double); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
740 assertTrue(PrimitiveValueProfile.exactCompare((double) result1, value)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
741 assertFalse(profile.isUninitialized()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
742 assertFalse(profile.isGeneric()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
743 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
744 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
745 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
746 public void testWithUnboxedBoxedDouble(double value) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
747 double result0 = profile.profile(value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
748 Object result1 = profile.profile((Object) value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
749 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
750 assertTrue(PrimitiveValueProfile.exactCompare(result0, value)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
751 assertTrue(result1 instanceof Double); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
752 assertTrue(PrimitiveValueProfile.exactCompare((double) result1, value)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
753 assertFalse(profile.isUninitialized()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
754 assertFalse(profile.isGeneric()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
755 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
756 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
757 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
758 public void testWithBoxedUnboxedDouble(double value) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
759 Object result0 = profile.profile((Object) value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
760 double result1 = profile.profile(value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
761 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
762 assertTrue(result0 instanceof Double); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
763 assertTrue(PrimitiveValueProfile.exactCompare((double) result0, value)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
764 assertTrue(PrimitiveValueProfile.exactCompare(result1, value)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
765 assertFalse(profile.isUninitialized()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
766 assertFalse(profile.isGeneric()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
767 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
768 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
769 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
770 public void testWithBoxedBoxedBoolean(boolean value) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
771 Object result0 = profile.profile((Object) value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
772 Object result1 = profile.profile((Object) value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
773 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
774 assertTrue(result0 instanceof Boolean); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
775 assertEquals((boolean) result0, value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
776 assertTrue(result1 instanceof Boolean); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
777 assertEquals((boolean) result1, value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
778 assertFalse(profile.isUninitialized()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
779 assertFalse(profile.isGeneric()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
780 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
781 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
782 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
783 public void testWithUnboxedBoxedBoolean(boolean value) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
784 boolean result0 = profile.profile(value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
785 Object result1 = profile.profile((Object) value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
786 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
787 assertEquals(result0, value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
788 assertTrue(result1 instanceof Boolean); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
789 assertEquals((boolean) result1, value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
790 assertFalse(profile.isUninitialized()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
791 assertFalse(profile.isGeneric()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
792 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
793 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
794 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
795 public void testWithBoxedUnboxedBoolean(boolean value) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
796 Object result0 = profile.profile((Object) value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
797 boolean result1 = profile.profile(value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
798 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
799 assertTrue(result0 instanceof Boolean); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
800 assertEquals((boolean) result0, value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
801 assertEquals(result1, value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
802 assertFalse(profile.isUninitialized()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
803 assertFalse(profile.isGeneric()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
804 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
805 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
806 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
807 public void testWithBoxedBoxedChar(char value) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
808 Object result0 = profile.profile((Object) value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
809 Object result1 = profile.profile((Object) value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
810 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
811 assertTrue(result0 instanceof Character); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
812 assertEquals((char) result0, value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
813 assertTrue(result1 instanceof Character); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
814 assertEquals((char) result1, value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
815 assertFalse(profile.isUninitialized()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
816 assertFalse(profile.isGeneric()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
817 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
818 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
819 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
820 public void testWithUnboxedBoxedChar(char value) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
821 char result0 = profile.profile(value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
822 Object result1 = profile.profile((Object) value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
823 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
824 assertEquals(result0, value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
825 assertTrue(result1 instanceof Character); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
826 assertEquals((char) result1, value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
827 assertFalse(profile.isUninitialized()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
828 assertFalse(profile.isGeneric()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
829 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
830 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
831 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
832 public void testWithBoxedUnboxedCharacter(char value) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
833 Object result0 = profile.profile((Object) value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
834 char result1 = profile.profile(value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
835 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
836 assertTrue(result0 instanceof Character); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
837 assertEquals((char) result0, value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
838 assertEquals(result1, value); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
839 assertFalse(profile.isUninitialized()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
840 assertFalse(profile.isGeneric()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
841 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
842 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
843 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
844 public void testWithByteThenObject(byte value0, Object value1) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
845 byte result0 = profile.profile(value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
846 Object result1 = profile.profile(value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
847 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
848 assertEquals(result0, value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
849 assertSame(result1, value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
850 assertFalse(profile.isUninitialized()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
851 assertTrue(profile.isGeneric()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
852 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
853 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
854 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
855 public void testWithShortThenObject(short value0, Object value1) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
856 short result0 = profile.profile(value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
857 Object result1 = profile.profile(value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
858 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
859 assertEquals(result0, value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
860 assertSame(result1, value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
861 assertFalse(profile.isUninitialized()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
862 assertTrue(profile.isGeneric()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
863 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
864 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
865 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
866 public void testWithIntThenObject(int value0, Object value1) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
867 int result0 = profile.profile(value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
868 Object result1 = profile.profile(value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
869 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
870 assertEquals(result0, value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
871 assertSame(result1, value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
872 assertFalse(profile.isUninitialized()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
873 assertTrue(profile.isGeneric()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
874 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
875 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
876 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
877 public void testWithLongThenObject(long value0, Object value1) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
878 long result0 = profile.profile(value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
879 Object result1 = profile.profile(value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
880 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
881 assertEquals(result0, value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
882 assertSame(result1, value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
883 assertFalse(profile.isUninitialized()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
884 assertTrue(profile.isGeneric()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
885 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
886 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
887 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
888 public void testWithFloatThenObject(float value0, Object value1) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
889 float result0 = profile.profile(value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
890 Object result1 = profile.profile(value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
891 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
892 assertTrue(PrimitiveValueProfile.exactCompare(result0, value0)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
893 assertSame(result1, value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
894 assertFalse(profile.isUninitialized()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
895 assertTrue(profile.isGeneric()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
896 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
897 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
898 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
899 public void testWithDoubleThenObject(double value0, Object value1) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
900 double result0 = profile.profile(value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
901 Object result1 = profile.profile(value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
902 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
903 assertTrue(PrimitiveValueProfile.exactCompare(result0, value0)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
904 assertSame(result1, value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
905 assertFalse(profile.isUninitialized()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
906 assertTrue(profile.isGeneric()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
907 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
908 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
909 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
910 public void testWithBooleanThenObject(boolean value0, Object value1) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
911 boolean result0 = profile.profile(value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
912 Object result1 = profile.profile(value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
913 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
914 assertEquals(result0, value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
915 assertSame(result1, value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
916 assertFalse(profile.isUninitialized()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
917 assertTrue(profile.isGeneric()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
918 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
919 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
920 @Theory |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
921 public void testWithCharThenObject(char value0, Object value1) { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
922 char result0 = profile.profile(value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
923 Object result1 = profile.profile(value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
924 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
925 assertEquals(result0, value0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
926 assertSame(result1, value1); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
927 assertFalse(profile.isUninitialized()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
928 assertTrue(profile.isGeneric()); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
929 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
930 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
931 @Test |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
932 public void testNegativeZeroFloat() { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
933 profile.profile(-0.0f); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
934 profile.profile(+0.0f); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
935 assertThat(profile.isGeneric(), is(true)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
936 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
937 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
938 @Test |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
939 public void testNegativeZeroDouble() { |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
940 profile.profile(-0.0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
941 profile.profile(+0.0); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
942 assertThat(profile.isGeneric(), is(true)); |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
943 } |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
944 |
53afdc71b311
Truffle: added PrimitiveValueProfile.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
945 } |