Mercurial > hg > truffle
annotate src/cpu/zero/vm/bytecodeInterpreter_zero.inline.hpp @ 18138:4c49f062d136
Truffle: corrected references to @SlowPath (now @TruffleBoundary).
author | Danilo Ansaloni <danilo.ansaloni@oracle.com> |
---|---|
date | Tue, 21 Oct 2014 11:23:37 +0200 |
parents | f95d63e2154a |
children |
rev | line source |
---|---|
1010 | 1 /* |
1972 | 2 * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. |
1729 | 3 * Copyright 2007, 2010 Red Hat, Inc. |
1010 | 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5 * | |
6 * This code is free software; you can redistribute it and/or modify it | |
7 * under the terms of the GNU General Public License version 2 only, as | |
8 * published by the Free Software Foundation. | |
9 * | |
10 * This code is distributed in the hope that it will be useful, but WITHOUT | |
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
13 * version 2 for more details (a copy is included in the LICENSE file that | |
14 * accompanied this code). | |
15 * | |
16 * You should have received a copy of the GNU General Public License version | |
17 * 2 along with this work; if not, write to the Free Software Foundation, | |
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
19 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1010
diff
changeset
|
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1010
diff
changeset
|
21 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1010
diff
changeset
|
22 * questions. |
1010 | 23 * |
24 */ | |
25 | |
1972 | 26 #ifndef CPU_ZERO_VM_BYTECODEINTERPRETER_ZERO_INLINE_HPP |
27 #define CPU_ZERO_VM_BYTECODEINTERPRETER_ZERO_INLINE_HPP | |
28 | |
1010 | 29 // Inline interpreter functions for zero |
30 | |
31 inline jfloat BytecodeInterpreter::VMfloatAdd(jfloat op1, jfloat op2) { | |
32 return op1 + op2; | |
33 } | |
34 | |
35 inline jfloat BytecodeInterpreter::VMfloatSub(jfloat op1, jfloat op2) { | |
36 return op1 - op2; | |
37 } | |
38 | |
39 inline jfloat BytecodeInterpreter::VMfloatMul(jfloat op1, jfloat op2) { | |
40 return op1 * op2; | |
41 } | |
42 | |
43 inline jfloat BytecodeInterpreter::VMfloatDiv(jfloat op1, jfloat op2) { | |
44 return op1 / op2; | |
45 } | |
46 | |
47 inline jfloat BytecodeInterpreter::VMfloatRem(jfloat op1, jfloat op2) { | |
48 return fmod(op1, op2); | |
49 } | |
50 | |
51 inline jfloat BytecodeInterpreter::VMfloatNeg(jfloat op) { | |
52 return -op; | |
53 } | |
54 | |
55 inline int32_t BytecodeInterpreter::VMfloatCompare(jfloat op1, | |
56 jfloat op2, | |
57 int32_t direction) { | |
58 return ( op1 < op2 ? -1 : | |
59 op1 > op2 ? 1 : | |
60 op1 == op2 ? 0 : | |
61 (direction == -1 || direction == 1) ? direction : 0); | |
62 | |
63 } | |
64 | |
65 inline void BytecodeInterpreter::VMmemCopy64(uint32_t to[2], | |
66 const uint32_t from[2]) { | |
67 *(uint64_t *) to = *(uint64_t *) from; | |
68 } | |
69 | |
70 inline jlong BytecodeInterpreter::VMlongAdd(jlong op1, jlong op2) { | |
71 return op1 + op2; | |
72 } | |
73 | |
74 inline jlong BytecodeInterpreter::VMlongAnd(jlong op1, jlong op2) { | |
75 return op1 & op2; | |
76 } | |
77 | |
78 inline jlong BytecodeInterpreter::VMlongDiv(jlong op1, jlong op2) { | |
79 /* it's possible we could catch this special case implicitly */ | |
80 if (op1 == (jlong) 0x8000000000000000LL && op2 == -1) return op1; | |
81 else return op1 / op2; | |
82 } | |
83 | |
84 inline jlong BytecodeInterpreter::VMlongMul(jlong op1, jlong op2) { | |
85 return op1 * op2; | |
86 } | |
87 | |
88 inline jlong BytecodeInterpreter::VMlongOr(jlong op1, jlong op2) { | |
89 return op1 | op2; | |
90 } | |
91 | |
92 inline jlong BytecodeInterpreter::VMlongSub(jlong op1, jlong op2) { | |
93 return op1 - op2; | |
94 } | |
95 | |
96 inline jlong BytecodeInterpreter::VMlongXor(jlong op1, jlong op2) { | |
97 return op1 ^ op2; | |
98 } | |
99 | |
100 inline jlong BytecodeInterpreter::VMlongRem(jlong op1, jlong op2) { | |
101 /* it's possible we could catch this special case implicitly */ | |
102 if (op1 == (jlong) 0x8000000000000000LL && op2 == -1) return 0; | |
103 else return op1 % op2; | |
104 } | |
105 | |
106 inline jlong BytecodeInterpreter::VMlongUshr(jlong op1, jint op2) { | |
107 return ((unsigned long long) op1) >> (op2 & 0x3F); | |
108 } | |
109 | |
110 inline jlong BytecodeInterpreter::VMlongShr(jlong op1, jint op2) { | |
111 return op1 >> (op2 & 0x3F); | |
112 } | |
113 | |
114 inline jlong BytecodeInterpreter::VMlongShl(jlong op1, jint op2) { | |
115 return op1 << (op2 & 0x3F); | |
116 } | |
117 | |
118 inline jlong BytecodeInterpreter::VMlongNeg(jlong op) { | |
119 return -op; | |
120 } | |
121 | |
122 inline jlong BytecodeInterpreter::VMlongNot(jlong op) { | |
123 return ~op; | |
124 } | |
125 | |
126 inline int32_t BytecodeInterpreter::VMlongLtz(jlong op) { | |
127 return (op <= 0); | |
128 } | |
129 | |
130 inline int32_t BytecodeInterpreter::VMlongGez(jlong op) { | |
131 return (op >= 0); | |
132 } | |
133 | |
134 inline int32_t BytecodeInterpreter::VMlongEqz(jlong op) { | |
135 return (op == 0); | |
136 } | |
137 | |
138 inline int32_t BytecodeInterpreter::VMlongEq(jlong op1, jlong op2) { | |
139 return (op1 == op2); | |
140 } | |
141 | |
142 inline int32_t BytecodeInterpreter::VMlongNe(jlong op1, jlong op2) { | |
143 return (op1 != op2); | |
144 } | |
145 | |
146 inline int32_t BytecodeInterpreter::VMlongGe(jlong op1, jlong op2) { | |
147 return (op1 >= op2); | |
148 } | |
149 | |
150 inline int32_t BytecodeInterpreter::VMlongLe(jlong op1, jlong op2) { | |
151 return (op1 <= op2); | |
152 } | |
153 | |
154 inline int32_t BytecodeInterpreter::VMlongLt(jlong op1, jlong op2) { | |
155 return (op1 < op2); | |
156 } | |
157 | |
158 inline int32_t BytecodeInterpreter::VMlongGt(jlong op1, jlong op2) { | |
159 return (op1 > op2); | |
160 } | |
161 | |
162 inline int32_t BytecodeInterpreter::VMlongCompare(jlong op1, jlong op2) { | |
163 return (VMlongLt(op1, op2) ? -1 : VMlongGt(op1, op2) ? 1 : 0); | |
164 } | |
165 | |
166 // Long conversions | |
167 | |
168 inline jdouble BytecodeInterpreter::VMlong2Double(jlong val) { | |
169 return (jdouble) val; | |
170 } | |
171 | |
172 inline jfloat BytecodeInterpreter::VMlong2Float(jlong val) { | |
173 return (jfloat) val; | |
174 } | |
175 | |
176 inline jint BytecodeInterpreter::VMlong2Int(jlong val) { | |
177 return (jint) val; | |
178 } | |
179 | |
180 // Double Arithmetic | |
181 | |
182 inline jdouble BytecodeInterpreter::VMdoubleAdd(jdouble op1, jdouble op2) { | |
183 return op1 + op2; | |
184 } | |
185 | |
186 inline jdouble BytecodeInterpreter::VMdoubleDiv(jdouble op1, jdouble op2) { | |
187 // Divide by zero... QQQ | |
188 return op1 / op2; | |
189 } | |
190 | |
191 inline jdouble BytecodeInterpreter::VMdoubleMul(jdouble op1, jdouble op2) { | |
192 return op1 * op2; | |
193 } | |
194 | |
195 inline jdouble BytecodeInterpreter::VMdoubleNeg(jdouble op) { | |
196 return -op; | |
197 } | |
198 | |
199 inline jdouble BytecodeInterpreter::VMdoubleRem(jdouble op1, jdouble op2) { | |
200 return fmod(op1, op2); | |
201 } | |
202 | |
203 inline jdouble BytecodeInterpreter::VMdoubleSub(jdouble op1, jdouble op2) { | |
204 return op1 - op2; | |
205 } | |
206 | |
207 inline int32_t BytecodeInterpreter::VMdoubleCompare(jdouble op1, | |
208 jdouble op2, | |
209 int32_t direction) { | |
210 return ( op1 < op2 ? -1 : | |
211 op1 > op2 ? 1 : | |
212 op1 == op2 ? 0 : | |
213 (direction == -1 || direction == 1) ? direction : 0); | |
214 } | |
215 | |
216 // Double Conversions | |
217 | |
218 inline jfloat BytecodeInterpreter::VMdouble2Float(jdouble val) { | |
219 return (jfloat) val; | |
220 } | |
221 | |
222 // Float Conversions | |
223 | |
224 inline jdouble BytecodeInterpreter::VMfloat2Double(jfloat op) { | |
225 return (jdouble) op; | |
226 } | |
227 | |
228 // Integer Arithmetic | |
229 | |
230 inline jint BytecodeInterpreter::VMintAdd(jint op1, jint op2) { | |
231 return op1 + op2; | |
232 } | |
233 | |
234 inline jint BytecodeInterpreter::VMintAnd(jint op1, jint op2) { | |
235 return op1 & op2; | |
236 } | |
237 | |
238 inline jint BytecodeInterpreter::VMintDiv(jint op1, jint op2) { | |
239 /* it's possible we could catch this special case implicitly */ | |
240 if (op1 == (jint) 0x80000000 && op2 == -1) return op1; | |
241 else return op1 / op2; | |
242 } | |
243 | |
244 inline jint BytecodeInterpreter::VMintMul(jint op1, jint op2) { | |
245 return op1 * op2; | |
246 } | |
247 | |
248 inline jint BytecodeInterpreter::VMintNeg(jint op) { | |
249 return -op; | |
250 } | |
251 | |
252 inline jint BytecodeInterpreter::VMintOr(jint op1, jint op2) { | |
253 return op1 | op2; | |
254 } | |
255 | |
256 inline jint BytecodeInterpreter::VMintRem(jint op1, jint op2) { | |
257 /* it's possible we could catch this special case implicitly */ | |
258 if (op1 == (jint) 0x80000000 && op2 == -1) return 0; | |
259 else return op1 % op2; | |
260 } | |
261 | |
262 inline jint BytecodeInterpreter::VMintShl(jint op1, jint op2) { | |
263 return op1 << (op2 & 0x1F); | |
264 } | |
265 | |
266 inline jint BytecodeInterpreter::VMintShr(jint op1, jint op2) { | |
267 return op1 >> (op2 & 0x1F); | |
268 } | |
269 | |
270 inline jint BytecodeInterpreter::VMintSub(jint op1, jint op2) { | |
271 return op1 - op2; | |
272 } | |
273 | |
1729 | 274 inline juint BytecodeInterpreter::VMintUshr(jint op1, jint op2) { |
1010 | 275 return ((juint) op1) >> (op2 & 0x1F); |
276 } | |
277 | |
278 inline jint BytecodeInterpreter::VMintXor(jint op1, jint op2) { | |
279 return op1 ^ op2; | |
280 } | |
281 | |
282 inline jdouble BytecodeInterpreter::VMint2Double(jint val) { | |
283 return (jdouble) val; | |
284 } | |
285 | |
286 inline jfloat BytecodeInterpreter::VMint2Float(jint val) { | |
287 return (jfloat) val; | |
288 } | |
289 | |
290 inline jlong BytecodeInterpreter::VMint2Long(jint val) { | |
291 return (jlong) val; | |
292 } | |
293 | |
294 inline jchar BytecodeInterpreter::VMint2Char(jint val) { | |
295 return (jchar) val; | |
296 } | |
297 | |
298 inline jshort BytecodeInterpreter::VMint2Short(jint val) { | |
299 return (jshort) val; | |
300 } | |
301 | |
302 inline jbyte BytecodeInterpreter::VMint2Byte(jint val) { | |
303 return (jbyte) val; | |
304 } | |
1972 | 305 |
306 #endif // CPU_ZERO_VM_BYTECODEINTERPRETER_ZERO_INLINE_HPP |