author | zmajo |
Tue, 28 Jul 2015 19:20:42 +0200 | |
changeset 31962 | d05e0a4d1b43 |
parent 22214 | c551021e75b2 |
child 34155 | 8d9e0cbf93a2 |
permissions | -rw-r--r-- |
22214
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
1 |
/* |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
2 |
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
4 |
* |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
8 |
* |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
13 |
* accompanied this code). |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
14 |
* |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
18 |
* |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
21 |
* questions. |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
22 |
*/ |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
23 |
|
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
24 |
import java.lang.reflect.Executable; |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
25 |
import java.util.concurrent.Callable; |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
26 |
|
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
27 |
public class MathIntrinsic { |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
28 |
|
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
29 |
enum IntIntrinsic implements CompilerWhiteBoxTest.TestCase { |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
30 |
Add { |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
31 |
@Override |
31962
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
32 |
Executable testMethod() throws NoSuchMethodException, ClassNotFoundException { |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
33 |
return Class.forName("java.lang.Math").getDeclaredMethod("addExact", int.class, int.class); |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
34 |
} |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
35 |
|
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
36 |
@Override |
22214
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
37 |
Object execMathMethod() { |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
38 |
return intR = Math.addExact(int1, int2); |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
39 |
} |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
40 |
}, |
31962
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
41 |
Subtract { |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
42 |
@Override |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
43 |
Executable testMethod() throws NoSuchMethodException, ClassNotFoundException { |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
44 |
return Class.forName("java.lang.Math").getDeclaredMethod("subtractExact", int.class, int.class); |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
45 |
} |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
46 |
|
22214
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
47 |
@Override |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
48 |
Object execMathMethod() { |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
49 |
return intR = Math.subtractExact(int1, int2); |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
50 |
} |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
51 |
}, |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
52 |
Multiply { |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
53 |
@Override |
31962
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
54 |
Executable testMethod() throws NoSuchMethodException, ClassNotFoundException { |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
55 |
return Class.forName("java.lang.Math").getDeclaredMethod("multiplyExact", int.class, int.class); |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
56 |
} |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
57 |
|
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
58 |
@Override |
22214
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
59 |
Object execMathMethod() { |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
60 |
return intR = Math.multiplyExact(int1, int2); |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
61 |
} |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
62 |
}, |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
63 |
Increment { |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
64 |
@Override |
31962
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
65 |
Executable testMethod() throws NoSuchMethodException, ClassNotFoundException { |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
66 |
return Class.forName("java.lang.Math").getDeclaredMethod("incrementExact", int.class); |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
67 |
} |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
68 |
|
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
69 |
@Override |
22214
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
70 |
Object execMathMethod() { |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
71 |
return intR = Math.incrementExact(int1); |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
72 |
} |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
73 |
}, |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
74 |
Decrement { |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
75 |
@Override |
31962
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
76 |
Executable testMethod() throws NoSuchMethodException, ClassNotFoundException { |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
77 |
return Class.forName("java.lang.Math").getDeclaredMethod("decrementExact", int.class); |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
78 |
} |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
79 |
|
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
80 |
@Override |
22214
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
81 |
Object execMathMethod() { |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
82 |
return intR = Math.decrementExact(int1); |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
83 |
} |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
84 |
}, |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
85 |
Negate { |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
86 |
@Override |
31962
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
87 |
Executable testMethod() throws NoSuchMethodException, ClassNotFoundException { |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
88 |
return Class.forName("java.lang.Math").getDeclaredMethod("negateExact", int.class); |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
89 |
} |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
90 |
|
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
91 |
@Override |
22214
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
92 |
Object execMathMethod() { |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
93 |
return intR = Math.negateExact(int1); |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
94 |
} |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
95 |
}; |
31962
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
96 |
|
22214
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
97 |
protected int int1; |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
98 |
protected int int2; |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
99 |
protected int intR; |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
100 |
|
31962
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
101 |
abstract Executable testMethod() throws NoSuchMethodException, ClassNotFoundException; |
22214
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
102 |
abstract Object execMathMethod(); |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
103 |
|
31962
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
104 |
public Executable getTestMethod() { |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
105 |
try { |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
106 |
return testMethod(); |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
107 |
} catch (NoSuchMethodException e) { |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
108 |
throw new RuntimeException("Test bug, no such method: " + e); |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
109 |
} catch (ClassNotFoundException e) { |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
110 |
throw new RuntimeException("Test bug, no such class: " + e); |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
111 |
} |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
112 |
} |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
113 |
|
22214
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
114 |
@Override |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
115 |
public Executable getExecutable() { |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
116 |
try { |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
117 |
return getClass().getDeclaredMethod("execMathMethod"); |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
118 |
} catch (NoSuchMethodException e) { |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
119 |
throw new RuntimeException("Test bug, no such method: " + e); |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
120 |
} |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
121 |
} |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
122 |
|
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
123 |
@Override |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
124 |
public Callable<Integer> getCallable() { |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
125 |
return null; |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
126 |
} |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
127 |
|
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
128 |
@Override |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
129 |
public boolean isOsr() { |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
130 |
return false; |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
131 |
} |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
132 |
|
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
133 |
} |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
134 |
|
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
135 |
enum LongIntrinsic implements CompilerWhiteBoxTest.TestCase { |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
136 |
Add { |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
137 |
@Override |
31962
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
138 |
Executable testMethod() throws NoSuchMethodException, ClassNotFoundException { |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
139 |
return Class.forName("java.lang.Math").getDeclaredMethod("addExact", long.class, long.class); |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
140 |
} |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
141 |
|
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
142 |
@Override |
22214
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
143 |
Object execMathMethod() { |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
144 |
return longR = Math.addExact(long1, long2); |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
145 |
} |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
146 |
}, |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
147 |
Subtract { |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
148 |
@Override |
31962
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
149 |
Executable testMethod() throws NoSuchMethodException, ClassNotFoundException { |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
150 |
return Class.forName("java.lang.Math").getDeclaredMethod("subtractExact", long.class, long.class); |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
151 |
} |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
152 |
|
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
153 |
@Override |
22214
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
154 |
Object execMathMethod() { |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
155 |
return longR = Math.subtractExact(long1, long2); |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
156 |
} |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
157 |
}, |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
158 |
Multiply { |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
159 |
@Override |
31962
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
160 |
Executable testMethod() throws NoSuchMethodException, ClassNotFoundException { |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
161 |
return Class.forName("java.lang.Math").getDeclaredMethod("multiplyExact", long.class, long.class); |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
162 |
} |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
163 |
|
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
164 |
@Override |
22214
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
165 |
Object execMathMethod() { |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
166 |
return longR = Math.multiplyExact(long1, long2); |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
167 |
} |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
168 |
}, |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
169 |
Increment { |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
170 |
@Override |
31962
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
171 |
Executable testMethod() throws NoSuchMethodException, ClassNotFoundException { |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
172 |
return Class.forName("java.lang.Math").getDeclaredMethod("incrementExact", long.class); |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
173 |
} |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
174 |
|
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
175 |
@Override |
22214
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
176 |
Object execMathMethod() { |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
177 |
return longR = Math.incrementExact(long1); |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
178 |
} |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
179 |
}, |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
180 |
Decrement { |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
181 |
@Override |
31962
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
182 |
Executable testMethod() throws NoSuchMethodException, ClassNotFoundException { |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
183 |
return Class.forName("java.lang.Math").getDeclaredMethod("decrementExact", long.class); |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
184 |
} |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
185 |
|
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
186 |
@Override |
22214
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
187 |
Object execMathMethod() { |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
188 |
return longR = Math.decrementExact(long1); |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
189 |
} |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
190 |
}, |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
191 |
Negate { |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
192 |
@Override |
31962
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
193 |
Executable testMethod() throws NoSuchMethodException, ClassNotFoundException { |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
194 |
return Class.forName("java.lang.Math").getDeclaredMethod("negateExact", long.class); |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
195 |
} |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
196 |
|
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
197 |
@Override |
22214
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
198 |
Object execMathMethod() { |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
199 |
return longR = Math.negateExact(long1); |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
200 |
} |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
201 |
}; |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
202 |
protected long long1; |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
203 |
protected long long2; |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
204 |
protected long longR; |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
205 |
|
31962
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
206 |
abstract Executable testMethod() throws NoSuchMethodException, ClassNotFoundException; |
22214
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
207 |
abstract Object execMathMethod(); |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
208 |
|
31962
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
209 |
public Executable getTestMethod() { |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
210 |
try { |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
211 |
return testMethod(); |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
212 |
} catch (NoSuchMethodException e) { |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
213 |
throw new RuntimeException("Test bug, no such method: " + e); |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
214 |
} catch (ClassNotFoundException e) { |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
215 |
throw new RuntimeException("Test bug, no such class: " + e); |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
216 |
} |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
217 |
} |
d05e0a4d1b43
8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents:
22214
diff
changeset
|
218 |
|
22214
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
219 |
@Override |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
220 |
public Executable getExecutable() { |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
221 |
try { |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
222 |
return getClass().getDeclaredMethod("execMathMethod"); |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
223 |
} catch (NoSuchMethodException e) { |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
224 |
throw new RuntimeException("Test bug, no such method: " + e); |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
225 |
} |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
226 |
} |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
227 |
|
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
228 |
@Override |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
229 |
public Callable<Integer> getCallable() { |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
230 |
return null; |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
231 |
} |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
232 |
|
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
233 |
@Override |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
234 |
public boolean isOsr() { |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
235 |
return false; |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
236 |
} |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
237 |
} |
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
diff
changeset
|
238 |
} |