Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/cpu/aarch32/vm/bytecodeInterpreter_aarch32.inline.hpp
32285 views
/*1* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.2* Copyright (c) 2014, Red Hat Inc. All rights reserved.3* Copyright (c) 2015, Linaro Ltd. All rights reserved.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 it7* under the terms of the GNU General Public License version 2 only, as8* published by the Free Software Foundation.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 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*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*24*/2526#ifndef CPU_AARCH32_VM_BYTECODEINTERPRETER_AARCH32_INLINE_HPP27#define CPU_AARCH32_VM_BYTECODEINTERPRETER_AARCH32_INLINE_HPP2829// Inline interpreter functions for IA323031inline jfloat BytecodeInterpreter::VMfloatAdd(jfloat op1, jfloat op2) { return op1 + op2; }32inline jfloat BytecodeInterpreter::VMfloatSub(jfloat op1, jfloat op2) { return op1 - op2; }33inline jfloat BytecodeInterpreter::VMfloatMul(jfloat op1, jfloat op2) { return op1 * op2; }34inline jfloat BytecodeInterpreter::VMfloatDiv(jfloat op1, jfloat op2) { return op1 / op2; }35inline jfloat BytecodeInterpreter::VMfloatRem(jfloat op1, jfloat op2) { return fmod(op1, op2); }3637inline jfloat BytecodeInterpreter::VMfloatNeg(jfloat op) { return -op; }3839inline int32_t BytecodeInterpreter::VMfloatCompare(jfloat op1, jfloat op2, int32_t direction) {40return ( op1 < op2 ? -1 :41op1 > op2 ? 1 :42op1 == op2 ? 0 :43(direction == -1 || direction == 1) ? direction : 0);4445}4647inline void BytecodeInterpreter::VMmemCopy64(uint32_t to[2], const uint32_t from[2]) {48// x86 can do unaligned copies but not 64bits at a time49to[0] = from[0]; to[1] = from[1];50}5152// The long operations depend on compiler support for "long long" on x865354inline jlong BytecodeInterpreter::VMlongAdd(jlong op1, jlong op2) {55return op1 + op2;56}5758inline jlong BytecodeInterpreter::VMlongAnd(jlong op1, jlong op2) {59return op1 & op2;60}6162inline jlong BytecodeInterpreter::VMlongDiv(jlong op1, jlong op2) {63// QQQ what about check and throw...64return op1 / op2;65}6667inline jlong BytecodeInterpreter::VMlongMul(jlong op1, jlong op2) {68return op1 * op2;69}7071inline jlong BytecodeInterpreter::VMlongOr(jlong op1, jlong op2) {72return op1 | op2;73}7475inline jlong BytecodeInterpreter::VMlongSub(jlong op1, jlong op2) {76return op1 - op2;77}7879inline jlong BytecodeInterpreter::VMlongXor(jlong op1, jlong op2) {80return op1 ^ op2;81}8283inline jlong BytecodeInterpreter::VMlongRem(jlong op1, jlong op2) {84return op1 % op2;85}8687inline jlong BytecodeInterpreter::VMlongUshr(jlong op1, jint op2) {88// CVM did this 0x3f mask, is the really needed??? QQQ89return ((unsigned long long) op1) >> (op2 & 0x3F);90}9192inline jlong BytecodeInterpreter::VMlongShr(jlong op1, jint op2) {93return op1 >> (op2 & 0x3F);94}9596inline jlong BytecodeInterpreter::VMlongShl(jlong op1, jint op2) {97return op1 << (op2 & 0x3F);98}99100inline jlong BytecodeInterpreter::VMlongNeg(jlong op) {101return -op;102}103104inline jlong BytecodeInterpreter::VMlongNot(jlong op) {105return ~op;106}107108inline int32_t BytecodeInterpreter::VMlongLtz(jlong op) {109return (op <= 0);110}111112inline int32_t BytecodeInterpreter::VMlongGez(jlong op) {113return (op >= 0);114}115116inline int32_t BytecodeInterpreter::VMlongEqz(jlong op) {117return (op == 0);118}119120inline int32_t BytecodeInterpreter::VMlongEq(jlong op1, jlong op2) {121return (op1 == op2);122}123124inline int32_t BytecodeInterpreter::VMlongNe(jlong op1, jlong op2) {125return (op1 != op2);126}127128inline int32_t BytecodeInterpreter::VMlongGe(jlong op1, jlong op2) {129return (op1 >= op2);130}131132inline int32_t BytecodeInterpreter::VMlongLe(jlong op1, jlong op2) {133return (op1 <= op2);134}135136inline int32_t BytecodeInterpreter::VMlongLt(jlong op1, jlong op2) {137return (op1 < op2);138}139140inline int32_t BytecodeInterpreter::VMlongGt(jlong op1, jlong op2) {141return (op1 > op2);142}143144inline int32_t BytecodeInterpreter::VMlongCompare(jlong op1, jlong op2) {145return (VMlongLt(op1, op2) ? -1 : VMlongGt(op1, op2) ? 1 : 0);146}147148// Long conversions149150inline jdouble BytecodeInterpreter::VMlong2Double(jlong val) {151return (jdouble) val;152}153154inline jfloat BytecodeInterpreter::VMlong2Float(jlong val) {155return (jfloat) val;156}157158inline jint BytecodeInterpreter::VMlong2Int(jlong val) {159return (jint) val;160}161162// Double Arithmetic163164inline jdouble BytecodeInterpreter::VMdoubleAdd(jdouble op1, jdouble op2) {165return op1 + op2;166}167168inline jdouble BytecodeInterpreter::VMdoubleDiv(jdouble op1, jdouble op2) {169// Divide by zero... QQQ170return op1 / op2;171}172173inline jdouble BytecodeInterpreter::VMdoubleMul(jdouble op1, jdouble op2) {174return op1 * op2;175}176177inline jdouble BytecodeInterpreter::VMdoubleNeg(jdouble op) {178return -op;179}180181inline jdouble BytecodeInterpreter::VMdoubleRem(jdouble op1, jdouble op2) {182return fmod(op1, op2);183}184185inline jdouble BytecodeInterpreter::VMdoubleSub(jdouble op1, jdouble op2) {186return op1 - op2;187}188189inline int32_t BytecodeInterpreter::VMdoubleCompare(jdouble op1, jdouble op2, int32_t direction) {190return ( op1 < op2 ? -1 :191op1 > op2 ? 1 :192op1 == op2 ? 0 :193(direction == -1 || direction == 1) ? direction : 0);194}195196// Double Conversions197198inline jfloat BytecodeInterpreter::VMdouble2Float(jdouble val) {199return (jfloat) val;200}201202// Float Conversions203204inline jdouble BytecodeInterpreter::VMfloat2Double(jfloat op) {205return (jdouble) op;206}207208// Integer Arithmetic209210inline jint BytecodeInterpreter::VMintAdd(jint op1, jint op2) {211return op1 + op2;212}213214inline jint BytecodeInterpreter::VMintAnd(jint op1, jint op2) {215return op1 & op2;216}217218inline jint BytecodeInterpreter::VMintDiv(jint op1, jint op2) {219/* it's possible we could catch this special case implicitly */220if ((juint)op1 == 0x80000000 && op2 == -1) return op1;221else return op1 / op2;222}223224inline jint BytecodeInterpreter::VMintMul(jint op1, jint op2) {225return op1 * op2;226}227228inline jint BytecodeInterpreter::VMintNeg(jint op) {229return -op;230}231232inline jint BytecodeInterpreter::VMintOr(jint op1, jint op2) {233return op1 | op2;234}235236inline jint BytecodeInterpreter::VMintRem(jint op1, jint op2) {237/* it's possible we could catch this special case implicitly */238if ((juint)op1 == 0x80000000 && op2 == -1) return 0;239else return op1 % op2;240}241242inline jint BytecodeInterpreter::VMintShl(jint op1, jint op2) {243return op1 << op2;244}245246inline jint BytecodeInterpreter::VMintShr(jint op1, jint op2) {247return op1 >> (op2 & 0x1f);248}249250inline jint BytecodeInterpreter::VMintSub(jint op1, jint op2) {251return op1 - op2;252}253254inline jint BytecodeInterpreter::VMintUshr(jint op1, jint op2) {255return ((juint) op1) >> (op2 & 0x1f);256}257258inline jint BytecodeInterpreter::VMintXor(jint op1, jint op2) {259return op1 ^ op2;260}261262inline jdouble BytecodeInterpreter::VMint2Double(jint val) {263return (jdouble) val;264}265266inline jfloat BytecodeInterpreter::VMint2Float(jint val) {267return (jfloat) val;268}269270inline jlong BytecodeInterpreter::VMint2Long(jint val) {271return (jlong) val;272}273274inline jchar BytecodeInterpreter::VMint2Char(jint val) {275return (jchar) val;276}277278inline jshort BytecodeInterpreter::VMint2Short(jint val) {279return (jshort) val;280}281282inline jbyte BytecodeInterpreter::VMint2Byte(jint val) {283return (jbyte) val;284}285286#endif // CPU_AARCH32_VM_BYTECODEINTERPRETER_AARCH32_INLINE_HPP287288289