1 /*
2 * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 // Inline interpreter functions for sparc
26
27 inline jfloat BytecodeInterpreter::VMfloatAdd(jfloat op1, jfloat op2) { return op1 + op2; }
28 inline jfloat BytecodeInterpreter::VMfloatSub(jfloat op1, jfloat op2) { return op1 - op2; }
29 inline jfloat BytecodeInterpreter::VMfloatMul(jfloat op1, jfloat op2) { return op1 * op2; }
30 inline jfloat BytecodeInterpreter::VMfloatDiv(jfloat op1, jfloat op2) { return op1 / op2; }
31 inline jfloat BytecodeInterpreter::VMfloatRem(jfloat op1, jfloat op2) { return fmod(op1, op2); }
32
33 inline jfloat BytecodeInterpreter::VMfloatNeg(jfloat op) { return -op; }
34
35 inline int32_t BytecodeInterpreter::VMfloatCompare(jfloat op1, jfloat op2, int32_t direction) {
36 return ( op1 < op2 ? -1 :
37 op1 > op2 ? 1 :
38 op1 == op2 ? 0 :
39 (direction == -1 || direction == 1) ? direction : 0);
40
41 }
42
43 inline void BytecodeInterpreter::VMmemCopy64(uint32_t to[2], const uint32_t from[2]) {
44 // x86 can do unaligned copies but not 64bits at a time
314 tmp.d = d;
315 ((uint32_t*)p)[0] = tmp.v[0];
316 ((uint32_t*)p)[1] = tmp.v[1];
317 }
318
319 static jlong get_jlong(address p) {
320 VMJavaVal64 tmp;
321 tmp.v[0] = ((uint32_t*)p)[0];
322 tmp.v[1] = ((uint32_t*)p)[1];
323 return tmp.l;
324 }
325
326 static void put_jlong(address p, jlong l) {
327 VMJavaVal64 tmp;
328 tmp.l = l;
329 ((uint32_t*)p)[0] = tmp.v[0];
330 ((uint32_t*)p)[1] = tmp.v[1];
331 }
332 };
333 #endif /* ALIGN_CONVERTER */
|
1 /*
2 * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef CPU_SPARC_VM_BYTECODEINTERPRETER_SPARC_INLINE_HPP
26 #define CPU_SPARC_VM_BYTECODEINTERPRETER_SPARC_INLINE_HPP
27
28 // Inline interpreter functions for sparc
29
30 inline jfloat BytecodeInterpreter::VMfloatAdd(jfloat op1, jfloat op2) { return op1 + op2; }
31 inline jfloat BytecodeInterpreter::VMfloatSub(jfloat op1, jfloat op2) { return op1 - op2; }
32 inline jfloat BytecodeInterpreter::VMfloatMul(jfloat op1, jfloat op2) { return op1 * op2; }
33 inline jfloat BytecodeInterpreter::VMfloatDiv(jfloat op1, jfloat op2) { return op1 / op2; }
34 inline jfloat BytecodeInterpreter::VMfloatRem(jfloat op1, jfloat op2) { return fmod(op1, op2); }
35
36 inline jfloat BytecodeInterpreter::VMfloatNeg(jfloat op) { return -op; }
37
38 inline int32_t BytecodeInterpreter::VMfloatCompare(jfloat op1, jfloat op2, int32_t direction) {
39 return ( op1 < op2 ? -1 :
40 op1 > op2 ? 1 :
41 op1 == op2 ? 0 :
42 (direction == -1 || direction == 1) ? direction : 0);
43
44 }
45
46 inline void BytecodeInterpreter::VMmemCopy64(uint32_t to[2], const uint32_t from[2]) {
47 // x86 can do unaligned copies but not 64bits at a time
317 tmp.d = d;
318 ((uint32_t*)p)[0] = tmp.v[0];
319 ((uint32_t*)p)[1] = tmp.v[1];
320 }
321
322 static jlong get_jlong(address p) {
323 VMJavaVal64 tmp;
324 tmp.v[0] = ((uint32_t*)p)[0];
325 tmp.v[1] = ((uint32_t*)p)[1];
326 return tmp.l;
327 }
328
329 static void put_jlong(address p, jlong l) {
330 VMJavaVal64 tmp;
331 tmp.l = l;
332 ((uint32_t*)p)[0] = tmp.v[0];
333 ((uint32_t*)p)[1] = tmp.v[1];
334 }
335 };
336 #endif /* ALIGN_CONVERTER */
337
338 #endif // CPU_SPARC_VM_BYTECODEINTERPRETER_SPARC_INLINE_HPP
|