Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/cpu/ppc/vm/bytecodeInterpreter_ppc.inline.hpp
32285 views
/*1* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.2* Copyright 2012, 2013 SAP AG. 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 it6* under the terms of the GNU General Public License version 2 only, as7* published by the Free Software Foundation.8*9* This code is distributed in the hope that it will be useful, but WITHOUT10* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12* version 2 for more details (a copy is included in the LICENSE file that13* accompanied this code).14*15* You should have received a copy of the GNU General Public License version16* 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 USA20* or visit www.oracle.com if you need additional information or have any21* questions.22*23*/2425#ifndef CPU_PPC_VM_BYTECODEINTERPRETER_PPC_INLINE_HPP26#define CPU_PPC_VM_BYTECODEINTERPRETER_PPC_INLINE_HPP2728#ifdef CC_INTERP2930// Inline interpreter functions for ppc.3132#include <math.h>3334inline jfloat BytecodeInterpreter::VMfloatAdd(jfloat op1, jfloat op2) { return op1 + op2; }35inline jfloat BytecodeInterpreter::VMfloatSub(jfloat op1, jfloat op2) { return op1 - op2; }36inline jfloat BytecodeInterpreter::VMfloatMul(jfloat op1, jfloat op2) { return op1 * op2; }37inline jfloat BytecodeInterpreter::VMfloatDiv(jfloat op1, jfloat op2) { return op1 / op2; }38inline jfloat BytecodeInterpreter::VMfloatRem(jfloat op1, jfloat op2) { return (jfloat)fmod((double)op1, (double)op2); }3940inline jfloat BytecodeInterpreter::VMfloatNeg(jfloat op) { return -op; }4142inline int32_t BytecodeInterpreter::VMfloatCompare(jfloat op1, jfloat op2, int32_t direction) {43return ( op1 < op2 ? -1 :44op1 > op2 ? 1 :45op1 == op2 ? 0 :46(direction == -1 || direction == 1) ? direction : 0);4748}4950inline void BytecodeInterpreter::VMmemCopy64(uint32_t to[2], const uint32_t from[2]) {51to[0] = from[0]; to[1] = from[1];52}5354// The long operations depend on compiler support for "long long" on ppc.5556inline jlong BytecodeInterpreter::VMlongAdd(jlong op1, jlong op2) {57return op1 + op2;58}5960inline jlong BytecodeInterpreter::VMlongAnd(jlong op1, jlong op2) {61return op1 & op2;62}6364inline jlong BytecodeInterpreter::VMlongDiv(jlong op1, jlong op2) {65if (op1 == min_jlong && op2 == -1) return op1;66return op1 / op2;67}6869inline jlong BytecodeInterpreter::VMlongMul(jlong op1, jlong op2) {70return op1 * op2;71}7273inline jlong BytecodeInterpreter::VMlongOr(jlong op1, jlong op2) {74return op1 | op2;75}7677inline jlong BytecodeInterpreter::VMlongSub(jlong op1, jlong op2) {78return op1 - op2;79}8081inline jlong BytecodeInterpreter::VMlongXor(jlong op1, jlong op2) {82return op1 ^ op2;83}8485inline jlong BytecodeInterpreter::VMlongRem(jlong op1, jlong op2) {86if (op1 == min_jlong && op2 == -1) return 0;87return op1 % op2;88}8990inline jlong BytecodeInterpreter::VMlongUshr(jlong op1, jint op2) {91return ((uint64_t) op1) >> (op2 & 0x3F);92}9394inline jlong BytecodeInterpreter::VMlongShr(jlong op1, jint op2) {95return op1 >> (op2 & 0x3F);96}9798inline jlong BytecodeInterpreter::VMlongShl(jlong op1, jint op2) {99return op1 << (op2 & 0x3F);100}101102inline jlong BytecodeInterpreter::VMlongNeg(jlong op) {103return -op;104}105106inline jlong BytecodeInterpreter::VMlongNot(jlong op) {107return ~op;108}109110inline int32_t BytecodeInterpreter::VMlongLtz(jlong op) {111return (op <= 0);112}113114inline int32_t BytecodeInterpreter::VMlongGez(jlong op) {115return (op >= 0);116}117118inline int32_t BytecodeInterpreter::VMlongEqz(jlong op) {119return (op == 0);120}121122inline int32_t BytecodeInterpreter::VMlongEq(jlong op1, jlong op2) {123return (op1 == op2);124}125126inline int32_t BytecodeInterpreter::VMlongNe(jlong op1, jlong op2) {127return (op1 != op2);128}129130inline int32_t BytecodeInterpreter::VMlongGe(jlong op1, jlong op2) {131return (op1 >= op2);132}133134inline int32_t BytecodeInterpreter::VMlongLe(jlong op1, jlong op2) {135return (op1 <= op2);136}137138inline int32_t BytecodeInterpreter::VMlongLt(jlong op1, jlong op2) {139return (op1 < op2);140}141142inline int32_t BytecodeInterpreter::VMlongGt(jlong op1, jlong op2) {143return (op1 > op2);144}145146inline int32_t BytecodeInterpreter::VMlongCompare(jlong op1, jlong op2) {147return (VMlongLt(op1, op2) ? -1 : VMlongGt(op1, op2) ? 1 : 0);148}149150// Long conversions151152inline jdouble BytecodeInterpreter::VMlong2Double(jlong val) {153return (jdouble) val;154}155156inline jfloat BytecodeInterpreter::VMlong2Float(jlong val) {157return (jfloat) val;158}159160inline jint BytecodeInterpreter::VMlong2Int(jlong val) {161return (jint) val;162}163164// Double Arithmetic165166inline jdouble BytecodeInterpreter::VMdoubleAdd(jdouble op1, jdouble op2) {167return op1 + op2;168}169170inline jdouble BytecodeInterpreter::VMdoubleDiv(jdouble op1, jdouble op2) {171return op1 / op2;172}173174inline jdouble BytecodeInterpreter::VMdoubleMul(jdouble op1, jdouble op2) {175return op1 * op2;176}177178inline jdouble BytecodeInterpreter::VMdoubleNeg(jdouble op) {179return -op;180}181182inline jdouble BytecodeInterpreter::VMdoubleRem(jdouble op1, jdouble op2) {183return fmod(op1, op2);184}185186inline jdouble BytecodeInterpreter::VMdoubleSub(jdouble op1, jdouble op2) {187return op1 - op2;188}189190inline int32_t BytecodeInterpreter::VMdoubleCompare(jdouble op1, jdouble op2, int32_t direction) {191return ( op1 < op2 ? -1 :192op1 > op2 ? 1 :193op1 == op2 ? 0 :194(direction == -1 || direction == 1) ? direction : 0);195}196197// Double Conversions198199inline jfloat BytecodeInterpreter::VMdouble2Float(jdouble val) {200return (jfloat) val;201}202203// Float Conversions204205inline jdouble BytecodeInterpreter::VMfloat2Double(jfloat op) {206return (jdouble) op;207}208209// Integer Arithmetic210211inline jint BytecodeInterpreter::VMintAdd(jint op1, jint op2) {212return op1 + op2;213}214215inline jint BytecodeInterpreter::VMintAnd(jint op1, jint op2) {216return op1 & op2;217}218219inline jint BytecodeInterpreter::VMintDiv(jint op1, jint op2) {220/* it's possible we could catch this special case implicitly */221if ((juint)op1 == 0x80000000 && op2 == -1) return op1;222else return op1 / op2;223}224225inline jint BytecodeInterpreter::VMintMul(jint op1, jint op2) {226return op1 * op2;227}228229inline jint BytecodeInterpreter::VMintNeg(jint op) {230return -op;231}232233inline jint BytecodeInterpreter::VMintOr(jint op1, jint op2) {234return op1 | op2;235}236237inline jint BytecodeInterpreter::VMintRem(jint op1, jint op2) {238/* it's possible we could catch this special case implicitly */239if ((juint)op1 == 0x80000000 && op2 == -1) return 0;240else return op1 % op2;241}242243inline jint BytecodeInterpreter::VMintShl(jint op1, jint op2) {244return op1 << (op2 & 0x1f);245}246247inline jint BytecodeInterpreter::VMintShr(jint op1, jint op2) {248return op1 >> (op2 & 0x1f);249}250251inline jint BytecodeInterpreter::VMintSub(jint op1, jint op2) {252return op1 - op2;253}254255inline juint BytecodeInterpreter::VMintUshr(jint op1, jint op2) {256return ((juint) op1) >> (op2 & 0x1f);257}258259inline jint BytecodeInterpreter::VMintXor(jint op1, jint op2) {260return op1 ^ op2;261}262263inline jdouble BytecodeInterpreter::VMint2Double(jint val) {264return (jdouble) val;265}266267inline jfloat BytecodeInterpreter::VMint2Float(jint val) {268return (jfloat) val;269}270271inline jlong BytecodeInterpreter::VMint2Long(jint val) {272return (jlong) val;273}274275inline jchar BytecodeInterpreter::VMint2Char(jint val) {276return (jchar) val;277}278279inline jshort BytecodeInterpreter::VMint2Short(jint val) {280return (jshort) val;281}282283inline jbyte BytecodeInterpreter::VMint2Byte(jint val) {284return (jbyte) val;285}286287#endif // CC_INTERP288289#endif // CPU_PPC_VM_BYTECODEINTERPRETER_PPC_INLINE_HPP290291292