annotate src/cpu/sparc/vm/bytecodeInterpreter_sparc.inline.hpp @ 9790:6b515c453646

CompilationTask: print exception of compilation also when we don't exit the VM for example, this is useful for CTW, in order to see on which methods the compiler bails out
author Bernhard Urban <bernhard.urban@jku.at>
date Wed, 22 May 2013 16:28:12 +0200
parents f95d63e2154a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1681
diff changeset
2 * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1681
diff changeset
25 #ifndef CPU_SPARC_VM_BYTECODEINTERPRETER_SPARC_INLINE_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1681
diff changeset
26 #define CPU_SPARC_VM_BYTECODEINTERPRETER_SPARC_INLINE_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1681
diff changeset
27
0
a61af66fc99e Initial load
duke
parents:
diff changeset
28 // Inline interpreter functions for sparc
a61af66fc99e Initial load
duke
parents:
diff changeset
29
a61af66fc99e Initial load
duke
parents:
diff changeset
30 inline jfloat BytecodeInterpreter::VMfloatAdd(jfloat op1, jfloat op2) { return op1 + op2; }
a61af66fc99e Initial load
duke
parents:
diff changeset
31 inline jfloat BytecodeInterpreter::VMfloatSub(jfloat op1, jfloat op2) { return op1 - op2; }
a61af66fc99e Initial load
duke
parents:
diff changeset
32 inline jfloat BytecodeInterpreter::VMfloatMul(jfloat op1, jfloat op2) { return op1 * op2; }
a61af66fc99e Initial load
duke
parents:
diff changeset
33 inline jfloat BytecodeInterpreter::VMfloatDiv(jfloat op1, jfloat op2) { return op1 / op2; }
a61af66fc99e Initial load
duke
parents:
diff changeset
34 inline jfloat BytecodeInterpreter::VMfloatRem(jfloat op1, jfloat op2) { return fmod(op1, op2); }
a61af66fc99e Initial load
duke
parents:
diff changeset
35
a61af66fc99e Initial load
duke
parents:
diff changeset
36 inline jfloat BytecodeInterpreter::VMfloatNeg(jfloat op) { return -op; }
a61af66fc99e Initial load
duke
parents:
diff changeset
37
a61af66fc99e Initial load
duke
parents:
diff changeset
38 inline int32_t BytecodeInterpreter::VMfloatCompare(jfloat op1, jfloat op2, int32_t direction) {
a61af66fc99e Initial load
duke
parents:
diff changeset
39 return ( op1 < op2 ? -1 :
a61af66fc99e Initial load
duke
parents:
diff changeset
40 op1 > op2 ? 1 :
a61af66fc99e Initial load
duke
parents:
diff changeset
41 op1 == op2 ? 0 :
a61af66fc99e Initial load
duke
parents:
diff changeset
42 (direction == -1 || direction == 1) ? direction : 0);
a61af66fc99e Initial load
duke
parents:
diff changeset
43
a61af66fc99e Initial load
duke
parents:
diff changeset
44 }
a61af66fc99e Initial load
duke
parents:
diff changeset
45
a61af66fc99e Initial load
duke
parents:
diff changeset
46 inline void BytecodeInterpreter::VMmemCopy64(uint32_t to[2], const uint32_t from[2]) {
a61af66fc99e Initial load
duke
parents:
diff changeset
47 // x86 can do unaligned copies but not 64bits at a time
a61af66fc99e Initial load
duke
parents:
diff changeset
48 to[0] = from[0]; to[1] = from[1];
a61af66fc99e Initial load
duke
parents:
diff changeset
49 }
a61af66fc99e Initial load
duke
parents:
diff changeset
50
a61af66fc99e Initial load
duke
parents:
diff changeset
51 // The long operations depend on compiler support for "long long" on x86
a61af66fc99e Initial load
duke
parents:
diff changeset
52
a61af66fc99e Initial load
duke
parents:
diff changeset
53 inline jlong BytecodeInterpreter::VMlongAdd(jlong op1, jlong op2) {
a61af66fc99e Initial load
duke
parents:
diff changeset
54 return op1 + op2;
a61af66fc99e Initial load
duke
parents:
diff changeset
55 }
a61af66fc99e Initial load
duke
parents:
diff changeset
56
a61af66fc99e Initial load
duke
parents:
diff changeset
57 inline jlong BytecodeInterpreter::VMlongAnd(jlong op1, jlong op2) {
a61af66fc99e Initial load
duke
parents:
diff changeset
58 return op1 & op2;
a61af66fc99e Initial load
duke
parents:
diff changeset
59 }
a61af66fc99e Initial load
duke
parents:
diff changeset
60
a61af66fc99e Initial load
duke
parents:
diff changeset
61 inline jlong BytecodeInterpreter::VMlongDiv(jlong op1, jlong op2) {
a61af66fc99e Initial load
duke
parents:
diff changeset
62 // QQQ what about check and throw...
a61af66fc99e Initial load
duke
parents:
diff changeset
63 return op1 / op2;
a61af66fc99e Initial load
duke
parents:
diff changeset
64 }
a61af66fc99e Initial load
duke
parents:
diff changeset
65
a61af66fc99e Initial load
duke
parents:
diff changeset
66 inline jlong BytecodeInterpreter::VMlongMul(jlong op1, jlong op2) {
a61af66fc99e Initial load
duke
parents:
diff changeset
67 return op1 * op2;
a61af66fc99e Initial load
duke
parents:
diff changeset
68 }
a61af66fc99e Initial load
duke
parents:
diff changeset
69
a61af66fc99e Initial load
duke
parents:
diff changeset
70 inline jlong BytecodeInterpreter::VMlongOr(jlong op1, jlong op2) {
a61af66fc99e Initial load
duke
parents:
diff changeset
71 return op1 | op2;
a61af66fc99e Initial load
duke
parents:
diff changeset
72 }
a61af66fc99e Initial load
duke
parents:
diff changeset
73
a61af66fc99e Initial load
duke
parents:
diff changeset
74 inline jlong BytecodeInterpreter::VMlongSub(jlong op1, jlong op2) {
a61af66fc99e Initial load
duke
parents:
diff changeset
75 return op1 - op2;
a61af66fc99e Initial load
duke
parents:
diff changeset
76 }
a61af66fc99e Initial load
duke
parents:
diff changeset
77
a61af66fc99e Initial load
duke
parents:
diff changeset
78 inline jlong BytecodeInterpreter::VMlongXor(jlong op1, jlong op2) {
a61af66fc99e Initial load
duke
parents:
diff changeset
79 return op1 ^ op2;
a61af66fc99e Initial load
duke
parents:
diff changeset
80 }
a61af66fc99e Initial load
duke
parents:
diff changeset
81
a61af66fc99e Initial load
duke
parents:
diff changeset
82 inline jlong BytecodeInterpreter::VMlongRem(jlong op1, jlong op2) {
a61af66fc99e Initial load
duke
parents:
diff changeset
83 return op1 % op2;
a61af66fc99e Initial load
duke
parents:
diff changeset
84 }
a61af66fc99e Initial load
duke
parents:
diff changeset
85
a61af66fc99e Initial load
duke
parents:
diff changeset
86 inline jlong BytecodeInterpreter::VMlongUshr(jlong op1, jint op2) {
a61af66fc99e Initial load
duke
parents:
diff changeset
87 // CVM did this 0x3f mask, is the really needed??? QQQ
a61af66fc99e Initial load
duke
parents:
diff changeset
88 return ((unsigned long long) op1) >> (op2 & 0x3F);
a61af66fc99e Initial load
duke
parents:
diff changeset
89 }
a61af66fc99e Initial load
duke
parents:
diff changeset
90
a61af66fc99e Initial load
duke
parents:
diff changeset
91 inline jlong BytecodeInterpreter::VMlongShr(jlong op1, jint op2) {
a61af66fc99e Initial load
duke
parents:
diff changeset
92 return op1 >> (op2 & 0x3F);
a61af66fc99e Initial load
duke
parents:
diff changeset
93 }
a61af66fc99e Initial load
duke
parents:
diff changeset
94
a61af66fc99e Initial load
duke
parents:
diff changeset
95 inline jlong BytecodeInterpreter::VMlongShl(jlong op1, jint op2) {
a61af66fc99e Initial load
duke
parents:
diff changeset
96 return op1 << (op2 & 0x3F);
a61af66fc99e Initial load
duke
parents:
diff changeset
97 }
a61af66fc99e Initial load
duke
parents:
diff changeset
98
a61af66fc99e Initial load
duke
parents:
diff changeset
99 inline jlong BytecodeInterpreter::VMlongNeg(jlong op) {
a61af66fc99e Initial load
duke
parents:
diff changeset
100 return -op;
a61af66fc99e Initial load
duke
parents:
diff changeset
101 }
a61af66fc99e Initial load
duke
parents:
diff changeset
102
a61af66fc99e Initial load
duke
parents:
diff changeset
103 inline jlong BytecodeInterpreter::VMlongNot(jlong op) {
a61af66fc99e Initial load
duke
parents:
diff changeset
104 return ~op;
a61af66fc99e Initial load
duke
parents:
diff changeset
105 }
a61af66fc99e Initial load
duke
parents:
diff changeset
106
a61af66fc99e Initial load
duke
parents:
diff changeset
107 inline int32_t BytecodeInterpreter::VMlongLtz(jlong op) {
a61af66fc99e Initial load
duke
parents:
diff changeset
108 return (op <= 0);
a61af66fc99e Initial load
duke
parents:
diff changeset
109 }
a61af66fc99e Initial load
duke
parents:
diff changeset
110
a61af66fc99e Initial load
duke
parents:
diff changeset
111 inline int32_t BytecodeInterpreter::VMlongGez(jlong op) {
a61af66fc99e Initial load
duke
parents:
diff changeset
112 return (op >= 0);
a61af66fc99e Initial load
duke
parents:
diff changeset
113 }
a61af66fc99e Initial load
duke
parents:
diff changeset
114
a61af66fc99e Initial load
duke
parents:
diff changeset
115 inline int32_t BytecodeInterpreter::VMlongEqz(jlong op) {
a61af66fc99e Initial load
duke
parents:
diff changeset
116 return (op == 0);
a61af66fc99e Initial load
duke
parents:
diff changeset
117 }
a61af66fc99e Initial load
duke
parents:
diff changeset
118
a61af66fc99e Initial load
duke
parents:
diff changeset
119 inline int32_t BytecodeInterpreter::VMlongEq(jlong op1, jlong op2) {
a61af66fc99e Initial load
duke
parents:
diff changeset
120 return (op1 == op2);
a61af66fc99e Initial load
duke
parents:
diff changeset
121 }
a61af66fc99e Initial load
duke
parents:
diff changeset
122
a61af66fc99e Initial load
duke
parents:
diff changeset
123 inline int32_t BytecodeInterpreter::VMlongNe(jlong op1, jlong op2) {
a61af66fc99e Initial load
duke
parents:
diff changeset
124 return (op1 != op2);
a61af66fc99e Initial load
duke
parents:
diff changeset
125 }
a61af66fc99e Initial load
duke
parents:
diff changeset
126
a61af66fc99e Initial load
duke
parents:
diff changeset
127 inline int32_t BytecodeInterpreter::VMlongGe(jlong op1, jlong op2) {
a61af66fc99e Initial load
duke
parents:
diff changeset
128 return (op1 >= op2);
a61af66fc99e Initial load
duke
parents:
diff changeset
129 }
a61af66fc99e Initial load
duke
parents:
diff changeset
130
a61af66fc99e Initial load
duke
parents:
diff changeset
131 inline int32_t BytecodeInterpreter::VMlongLe(jlong op1, jlong op2) {
a61af66fc99e Initial load
duke
parents:
diff changeset
132 return (op1 <= op2);
a61af66fc99e Initial load
duke
parents:
diff changeset
133 }
a61af66fc99e Initial load
duke
parents:
diff changeset
134
a61af66fc99e Initial load
duke
parents:
diff changeset
135 inline int32_t BytecodeInterpreter::VMlongLt(jlong op1, jlong op2) {
a61af66fc99e Initial load
duke
parents:
diff changeset
136 return (op1 < op2);
a61af66fc99e Initial load
duke
parents:
diff changeset
137 }
a61af66fc99e Initial load
duke
parents:
diff changeset
138
a61af66fc99e Initial load
duke
parents:
diff changeset
139 inline int32_t BytecodeInterpreter::VMlongGt(jlong op1, jlong op2) {
a61af66fc99e Initial load
duke
parents:
diff changeset
140 return (op1 > op2);
a61af66fc99e Initial load
duke
parents:
diff changeset
141 }
a61af66fc99e Initial load
duke
parents:
diff changeset
142
a61af66fc99e Initial load
duke
parents:
diff changeset
143 inline int32_t BytecodeInterpreter::VMlongCompare(jlong op1, jlong op2) {
a61af66fc99e Initial load
duke
parents:
diff changeset
144 return (VMlongLt(op1, op2) ? -1 : VMlongGt(op1, op2) ? 1 : 0);
a61af66fc99e Initial load
duke
parents:
diff changeset
145 }
a61af66fc99e Initial load
duke
parents:
diff changeset
146
a61af66fc99e Initial load
duke
parents:
diff changeset
147 // Long conversions
a61af66fc99e Initial load
duke
parents:
diff changeset
148
a61af66fc99e Initial load
duke
parents:
diff changeset
149 inline jdouble BytecodeInterpreter::VMlong2Double(jlong val) {
a61af66fc99e Initial load
duke
parents:
diff changeset
150 return (jdouble) val;
a61af66fc99e Initial load
duke
parents:
diff changeset
151 }
a61af66fc99e Initial load
duke
parents:
diff changeset
152
a61af66fc99e Initial load
duke
parents:
diff changeset
153 inline jfloat BytecodeInterpreter::VMlong2Float(jlong val) {
a61af66fc99e Initial load
duke
parents:
diff changeset
154 return (jfloat) val;
a61af66fc99e Initial load
duke
parents:
diff changeset
155 }
a61af66fc99e Initial load
duke
parents:
diff changeset
156
a61af66fc99e Initial load
duke
parents:
diff changeset
157 inline jint BytecodeInterpreter::VMlong2Int(jlong val) {
a61af66fc99e Initial load
duke
parents:
diff changeset
158 return (jint) val;
a61af66fc99e Initial load
duke
parents:
diff changeset
159 }
a61af66fc99e Initial load
duke
parents:
diff changeset
160
a61af66fc99e Initial load
duke
parents:
diff changeset
161 // Double Arithmetic
a61af66fc99e Initial load
duke
parents:
diff changeset
162
a61af66fc99e Initial load
duke
parents:
diff changeset
163 inline jdouble BytecodeInterpreter::VMdoubleAdd(jdouble op1, jdouble op2) {
a61af66fc99e Initial load
duke
parents:
diff changeset
164 return op1 + op2;
a61af66fc99e Initial load
duke
parents:
diff changeset
165 }
a61af66fc99e Initial load
duke
parents:
diff changeset
166
a61af66fc99e Initial load
duke
parents:
diff changeset
167 inline jdouble BytecodeInterpreter::VMdoubleDiv(jdouble op1, jdouble op2) {
a61af66fc99e Initial load
duke
parents:
diff changeset
168 // Divide by zero... QQQ
a61af66fc99e Initial load
duke
parents:
diff changeset
169 return op1 / op2;
a61af66fc99e Initial load
duke
parents:
diff changeset
170 }
a61af66fc99e Initial load
duke
parents:
diff changeset
171
a61af66fc99e Initial load
duke
parents:
diff changeset
172 inline jdouble BytecodeInterpreter::VMdoubleMul(jdouble op1, jdouble op2) {
a61af66fc99e Initial load
duke
parents:
diff changeset
173 return op1 * op2;
a61af66fc99e Initial load
duke
parents:
diff changeset
174 }
a61af66fc99e Initial load
duke
parents:
diff changeset
175
a61af66fc99e Initial load
duke
parents:
diff changeset
176 inline jdouble BytecodeInterpreter::VMdoubleNeg(jdouble op) {
a61af66fc99e Initial load
duke
parents:
diff changeset
177 return -op;
a61af66fc99e Initial load
duke
parents:
diff changeset
178 }
a61af66fc99e Initial load
duke
parents:
diff changeset
179
a61af66fc99e Initial load
duke
parents:
diff changeset
180 inline jdouble BytecodeInterpreter::VMdoubleRem(jdouble op1, jdouble op2) {
a61af66fc99e Initial load
duke
parents:
diff changeset
181 return fmod(op1, op2);
a61af66fc99e Initial load
duke
parents:
diff changeset
182 }
a61af66fc99e Initial load
duke
parents:
diff changeset
183
a61af66fc99e Initial load
duke
parents:
diff changeset
184 inline jdouble BytecodeInterpreter::VMdoubleSub(jdouble op1, jdouble op2) {
a61af66fc99e Initial load
duke
parents:
diff changeset
185 return op1 - op2;
a61af66fc99e Initial load
duke
parents:
diff changeset
186 }
a61af66fc99e Initial load
duke
parents:
diff changeset
187
a61af66fc99e Initial load
duke
parents:
diff changeset
188 inline int32_t BytecodeInterpreter::VMdoubleCompare(jdouble op1, jdouble op2, int32_t direction) {
a61af66fc99e Initial load
duke
parents:
diff changeset
189 return ( op1 < op2 ? -1 :
a61af66fc99e Initial load
duke
parents:
diff changeset
190 op1 > op2 ? 1 :
a61af66fc99e Initial load
duke
parents:
diff changeset
191 op1 == op2 ? 0 :
a61af66fc99e Initial load
duke
parents:
diff changeset
192 (direction == -1 || direction == 1) ? direction : 0);
a61af66fc99e Initial load
duke
parents:
diff changeset
193 }
a61af66fc99e Initial load
duke
parents:
diff changeset
194
a61af66fc99e Initial load
duke
parents:
diff changeset
195 // Double Conversions
a61af66fc99e Initial load
duke
parents:
diff changeset
196
a61af66fc99e Initial load
duke
parents:
diff changeset
197 inline jfloat BytecodeInterpreter::VMdouble2Float(jdouble val) {
a61af66fc99e Initial load
duke
parents:
diff changeset
198 return (jfloat) val;
a61af66fc99e Initial load
duke
parents:
diff changeset
199 }
a61af66fc99e Initial load
duke
parents:
diff changeset
200
a61af66fc99e Initial load
duke
parents:
diff changeset
201 // Float Conversions
a61af66fc99e Initial load
duke
parents:
diff changeset
202
a61af66fc99e Initial load
duke
parents:
diff changeset
203 inline jdouble BytecodeInterpreter::VMfloat2Double(jfloat op) {
a61af66fc99e Initial load
duke
parents:
diff changeset
204 return (jdouble) op;
a61af66fc99e Initial load
duke
parents:
diff changeset
205 }
a61af66fc99e Initial load
duke
parents:
diff changeset
206
a61af66fc99e Initial load
duke
parents:
diff changeset
207 // Integer Arithmetic
a61af66fc99e Initial load
duke
parents:
diff changeset
208
a61af66fc99e Initial load
duke
parents:
diff changeset
209 inline jint BytecodeInterpreter::VMintAdd(jint op1, jint op2) {
a61af66fc99e Initial load
duke
parents:
diff changeset
210 return op1 + op2;
a61af66fc99e Initial load
duke
parents:
diff changeset
211 }
a61af66fc99e Initial load
duke
parents:
diff changeset
212
a61af66fc99e Initial load
duke
parents:
diff changeset
213 inline jint BytecodeInterpreter::VMintAnd(jint op1, jint op2) {
a61af66fc99e Initial load
duke
parents:
diff changeset
214 return op1 & op2;
a61af66fc99e Initial load
duke
parents:
diff changeset
215 }
a61af66fc99e Initial load
duke
parents:
diff changeset
216
a61af66fc99e Initial load
duke
parents:
diff changeset
217 inline jint BytecodeInterpreter::VMintDiv(jint op1, jint op2) {
a61af66fc99e Initial load
duke
parents:
diff changeset
218 /* it's possible we could catch this special case implicitly */
a61af66fc99e Initial load
duke
parents:
diff changeset
219 if (op1 == 0x80000000 && op2 == -1) return op1;
a61af66fc99e Initial load
duke
parents:
diff changeset
220 else return op1 / op2;
a61af66fc99e Initial load
duke
parents:
diff changeset
221 }
a61af66fc99e Initial load
duke
parents:
diff changeset
222
a61af66fc99e Initial load
duke
parents:
diff changeset
223 inline jint BytecodeInterpreter::VMintMul(jint op1, jint op2) {
a61af66fc99e Initial load
duke
parents:
diff changeset
224 return op1 * op2;
a61af66fc99e Initial load
duke
parents:
diff changeset
225 }
a61af66fc99e Initial load
duke
parents:
diff changeset
226
a61af66fc99e Initial load
duke
parents:
diff changeset
227 inline jint BytecodeInterpreter::VMintNeg(jint op) {
a61af66fc99e Initial load
duke
parents:
diff changeset
228 return -op;
a61af66fc99e Initial load
duke
parents:
diff changeset
229 }
a61af66fc99e Initial load
duke
parents:
diff changeset
230
a61af66fc99e Initial load
duke
parents:
diff changeset
231 inline jint BytecodeInterpreter::VMintOr(jint op1, jint op2) {
a61af66fc99e Initial load
duke
parents:
diff changeset
232 return op1 | op2;
a61af66fc99e Initial load
duke
parents:
diff changeset
233 }
a61af66fc99e Initial load
duke
parents:
diff changeset
234
a61af66fc99e Initial load
duke
parents:
diff changeset
235 inline jint BytecodeInterpreter::VMintRem(jint op1, jint op2) {
a61af66fc99e Initial load
duke
parents:
diff changeset
236 /* it's possible we could catch this special case implicitly */
a61af66fc99e Initial load
duke
parents:
diff changeset
237 if (op1 == 0x80000000 && op2 == -1) return 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
238 else return op1 % op2;
a61af66fc99e Initial load
duke
parents:
diff changeset
239 }
a61af66fc99e Initial load
duke
parents:
diff changeset
240
a61af66fc99e Initial load
duke
parents:
diff changeset
241 inline jint BytecodeInterpreter::VMintShl(jint op1, jint op2) {
1681
126ea7725993 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 1552
diff changeset
242 return op1 << (op2 & 0x1f);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
243 }
a61af66fc99e Initial load
duke
parents:
diff changeset
244
a61af66fc99e Initial load
duke
parents:
diff changeset
245 inline jint BytecodeInterpreter::VMintShr(jint op1, jint op2) {
1681
126ea7725993 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 1552
diff changeset
246 return op1 >> (op2 & 0x1f);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
247 }
a61af66fc99e Initial load
duke
parents:
diff changeset
248
a61af66fc99e Initial load
duke
parents:
diff changeset
249 inline jint BytecodeInterpreter::VMintSub(jint op1, jint op2) {
a61af66fc99e Initial load
duke
parents:
diff changeset
250 return op1 - op2;
a61af66fc99e Initial load
duke
parents:
diff changeset
251 }
a61af66fc99e Initial load
duke
parents:
diff changeset
252
1681
126ea7725993 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 1552
diff changeset
253 inline juint BytecodeInterpreter::VMintUshr(jint op1, jint op2) {
126ea7725993 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 1552
diff changeset
254 return ((juint) op1) >> (op2 & 0x1f);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
255 }
a61af66fc99e Initial load
duke
parents:
diff changeset
256
a61af66fc99e Initial load
duke
parents:
diff changeset
257 inline jint BytecodeInterpreter::VMintXor(jint op1, jint op2) {
a61af66fc99e Initial load
duke
parents:
diff changeset
258 return op1 ^ op2;
a61af66fc99e Initial load
duke
parents:
diff changeset
259 }
a61af66fc99e Initial load
duke
parents:
diff changeset
260
a61af66fc99e Initial load
duke
parents:
diff changeset
261 inline jdouble BytecodeInterpreter::VMint2Double(jint val) {
a61af66fc99e Initial load
duke
parents:
diff changeset
262 return (jdouble) val;
a61af66fc99e Initial load
duke
parents:
diff changeset
263 }
a61af66fc99e Initial load
duke
parents:
diff changeset
264
a61af66fc99e Initial load
duke
parents:
diff changeset
265 inline jfloat BytecodeInterpreter::VMint2Float(jint val) {
a61af66fc99e Initial load
duke
parents:
diff changeset
266 return (jfloat) val;
a61af66fc99e Initial load
duke
parents:
diff changeset
267 }
a61af66fc99e Initial load
duke
parents:
diff changeset
268
a61af66fc99e Initial load
duke
parents:
diff changeset
269 inline jlong BytecodeInterpreter::VMint2Long(jint val) {
a61af66fc99e Initial load
duke
parents:
diff changeset
270 return (jlong) val;
a61af66fc99e Initial load
duke
parents:
diff changeset
271 }
a61af66fc99e Initial load
duke
parents:
diff changeset
272
a61af66fc99e Initial load
duke
parents:
diff changeset
273 inline jchar BytecodeInterpreter::VMint2Char(jint val) {
a61af66fc99e Initial load
duke
parents:
diff changeset
274 return (jchar) val;
a61af66fc99e Initial load
duke
parents:
diff changeset
275 }
a61af66fc99e Initial load
duke
parents:
diff changeset
276
a61af66fc99e Initial load
duke
parents:
diff changeset
277 inline jshort BytecodeInterpreter::VMint2Short(jint val) {
a61af66fc99e Initial load
duke
parents:
diff changeset
278 return (jshort) val;
a61af66fc99e Initial load
duke
parents:
diff changeset
279 }
a61af66fc99e Initial load
duke
parents:
diff changeset
280
a61af66fc99e Initial load
duke
parents:
diff changeset
281 inline jbyte BytecodeInterpreter::VMint2Byte(jint val) {
a61af66fc99e Initial load
duke
parents:
diff changeset
282 return (jbyte) val;
a61af66fc99e Initial load
duke
parents:
diff changeset
283 }
a61af66fc99e Initial load
duke
parents:
diff changeset
284
a61af66fc99e Initial load
duke
parents:
diff changeset
285 // The implementations are platform dependent. We have to worry about alignment
a61af66fc99e Initial load
duke
parents:
diff changeset
286 // issues on some machines which can change on the same platform depending on
a61af66fc99e Initial load
duke
parents:
diff changeset
287 // whether it is an LP64 machine also.
a61af66fc99e Initial load
duke
parents:
diff changeset
288
a61af66fc99e Initial load
duke
parents:
diff changeset
289 // We know that on LP32 mode that longs/doubles are the only thing that gives
a61af66fc99e Initial load
duke
parents:
diff changeset
290 // us alignment headaches. We also know that the worst we have is 32bit alignment
a61af66fc99e Initial load
duke
parents:
diff changeset
291 // so thing are not really too bad.
a61af66fc99e Initial load
duke
parents:
diff changeset
292 // (Also sparcworks compiler does the right thing for free if we don't use -arch..
a61af66fc99e Initial load
duke
parents:
diff changeset
293 // switches. Only gcc gives us a hard time. In LP64 mode I think we have no issue
a61af66fc99e Initial load
duke
parents:
diff changeset
294 // with alignment.
a61af66fc99e Initial load
duke
parents:
diff changeset
295
a61af66fc99e Initial load
duke
parents:
diff changeset
296 #ifdef _GNU_SOURCE
a61af66fc99e Initial load
duke
parents:
diff changeset
297 #define ALIGN_CONVERTER /* Needs alignment converter */
a61af66fc99e Initial load
duke
parents:
diff changeset
298 #else
a61af66fc99e Initial load
duke
parents:
diff changeset
299 #undef ALIGN_CONVERTER /* No alignment converter */
a61af66fc99e Initial load
duke
parents:
diff changeset
300 #endif /* _GNU_SOURCE */
a61af66fc99e Initial load
duke
parents:
diff changeset
301
a61af66fc99e Initial load
duke
parents:
diff changeset
302 #ifdef ALIGN_CONVERTER
a61af66fc99e Initial load
duke
parents:
diff changeset
303 class u8_converter {
a61af66fc99e Initial load
duke
parents:
diff changeset
304
a61af66fc99e Initial load
duke
parents:
diff changeset
305 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
306
a61af66fc99e Initial load
duke
parents:
diff changeset
307 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
308 static jdouble get_jdouble(address p) {
a61af66fc99e Initial load
duke
parents:
diff changeset
309 VMJavaVal64 tmp;
a61af66fc99e Initial load
duke
parents:
diff changeset
310 tmp.v[0] = ((uint32_t*)p)[0];
a61af66fc99e Initial load
duke
parents:
diff changeset
311 tmp.v[1] = ((uint32_t*)p)[1];
a61af66fc99e Initial load
duke
parents:
diff changeset
312 return tmp.d;
a61af66fc99e Initial load
duke
parents:
diff changeset
313 }
a61af66fc99e Initial load
duke
parents:
diff changeset
314
a61af66fc99e Initial load
duke
parents:
diff changeset
315 static void put_jdouble(address p, jdouble d) {
a61af66fc99e Initial load
duke
parents:
diff changeset
316 VMJavaVal64 tmp;
a61af66fc99e Initial load
duke
parents:
diff changeset
317 tmp.d = d;
a61af66fc99e Initial load
duke
parents:
diff changeset
318 ((uint32_t*)p)[0] = tmp.v[0];
a61af66fc99e Initial load
duke
parents:
diff changeset
319 ((uint32_t*)p)[1] = tmp.v[1];
a61af66fc99e Initial load
duke
parents:
diff changeset
320 }
a61af66fc99e Initial load
duke
parents:
diff changeset
321
a61af66fc99e Initial load
duke
parents:
diff changeset
322 static jlong get_jlong(address p) {
a61af66fc99e Initial load
duke
parents:
diff changeset
323 VMJavaVal64 tmp;
a61af66fc99e Initial load
duke
parents:
diff changeset
324 tmp.v[0] = ((uint32_t*)p)[0];
a61af66fc99e Initial load
duke
parents:
diff changeset
325 tmp.v[1] = ((uint32_t*)p)[1];
a61af66fc99e Initial load
duke
parents:
diff changeset
326 return tmp.l;
a61af66fc99e Initial load
duke
parents:
diff changeset
327 }
a61af66fc99e Initial load
duke
parents:
diff changeset
328
a61af66fc99e Initial load
duke
parents:
diff changeset
329 static void put_jlong(address p, jlong l) {
a61af66fc99e Initial load
duke
parents:
diff changeset
330 VMJavaVal64 tmp;
a61af66fc99e Initial load
duke
parents:
diff changeset
331 tmp.l = l;
a61af66fc99e Initial load
duke
parents:
diff changeset
332 ((uint32_t*)p)[0] = tmp.v[0];
a61af66fc99e Initial load
duke
parents:
diff changeset
333 ((uint32_t*)p)[1] = tmp.v[1];
a61af66fc99e Initial load
duke
parents:
diff changeset
334 }
a61af66fc99e Initial load
duke
parents:
diff changeset
335 };
a61af66fc99e Initial load
duke
parents:
diff changeset
336 #endif /* ALIGN_CONVERTER */
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1681
diff changeset
337
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1681
diff changeset
338 #endif // CPU_SPARC_VM_BYTECODEINTERPRETER_SPARC_INLINE_HPP