Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/cpu/x86/vm/bytecodeInterpreter_x86.inline.hpp
32285 views
/*1* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#ifndef CPU_X86_VM_BYTECODEINTERPRETER_X86_INLINE_HPP25#define CPU_X86_VM_BYTECODEINTERPRETER_X86_INLINE_HPP2627// Inline interpreter functions for IA322829inline jfloat BytecodeInterpreter::VMfloatAdd(jfloat op1, jfloat op2) { return op1 + op2; }30inline jfloat BytecodeInterpreter::VMfloatSub(jfloat op1, jfloat op2) { return op1 - op2; }31inline jfloat BytecodeInterpreter::VMfloatMul(jfloat op1, jfloat op2) { return op1 * op2; }32inline jfloat BytecodeInterpreter::VMfloatDiv(jfloat op1, jfloat op2) { return op1 / op2; }33inline jfloat BytecodeInterpreter::VMfloatRem(jfloat op1, jfloat op2) { return fmod(op1, op2); }3435inline jfloat BytecodeInterpreter::VMfloatNeg(jfloat op) { return -op; }3637inline int32_t BytecodeInterpreter::VMfloatCompare(jfloat op1, jfloat op2, int32_t direction) {38return ( op1 < op2 ? -1 :39op1 > op2 ? 1 :40op1 == op2 ? 0 :41(direction == -1 || direction == 1) ? direction : 0);4243}4445inline void BytecodeInterpreter::VMmemCopy64(uint32_t to[2], const uint32_t from[2]) {46// x86 can do unaligned copies but not 64bits at a time47to[0] = from[0]; to[1] = from[1];48}4950// The long operations depend on compiler support for "long long" on x865152inline jlong BytecodeInterpreter::VMlongAdd(jlong op1, jlong op2) {53return op1 + op2;54}5556inline jlong BytecodeInterpreter::VMlongAnd(jlong op1, jlong op2) {57return op1 & op2;58}5960inline jlong BytecodeInterpreter::VMlongDiv(jlong op1, jlong op2) {61// QQQ what about check and throw...62return op1 / op2;63}6465inline jlong BytecodeInterpreter::VMlongMul(jlong op1, jlong op2) {66return op1 * op2;67}6869inline jlong BytecodeInterpreter::VMlongOr(jlong op1, jlong op2) {70return op1 | op2;71}7273inline jlong BytecodeInterpreter::VMlongSub(jlong op1, jlong op2) {74return op1 - op2;75}7677inline jlong BytecodeInterpreter::VMlongXor(jlong op1, jlong op2) {78return op1 ^ op2;79}8081inline jlong BytecodeInterpreter::VMlongRem(jlong op1, jlong op2) {82return op1 % op2;83}8485inline jlong BytecodeInterpreter::VMlongUshr(jlong op1, jint op2) {86// CVM did this 0x3f mask, is the really needed??? QQQ87return ((unsigned long long) op1) >> (op2 & 0x3F);88}8990inline jlong BytecodeInterpreter::VMlongShr(jlong op1, jint op2) {91return op1 >> (op2 & 0x3F);92}9394inline jlong BytecodeInterpreter::VMlongShl(jlong op1, jint op2) {95return op1 << (op2 & 0x3F);96}9798inline jlong BytecodeInterpreter::VMlongNeg(jlong op) {99return -op;100}101102inline jlong BytecodeInterpreter::VMlongNot(jlong op) {103return ~op;104}105106inline int32_t BytecodeInterpreter::VMlongLtz(jlong op) {107return (op <= 0);108}109110inline int32_t BytecodeInterpreter::VMlongGez(jlong op) {111return (op >= 0);112}113114inline int32_t BytecodeInterpreter::VMlongEqz(jlong op) {115return (op == 0);116}117118inline int32_t BytecodeInterpreter::VMlongEq(jlong op1, jlong op2) {119return (op1 == op2);120}121122inline int32_t BytecodeInterpreter::VMlongNe(jlong op1, jlong op2) {123return (op1 != op2);124}125126inline int32_t BytecodeInterpreter::VMlongGe(jlong op1, jlong op2) {127return (op1 >= op2);128}129130inline int32_t BytecodeInterpreter::VMlongLe(jlong op1, jlong op2) {131return (op1 <= op2);132}133134inline int32_t BytecodeInterpreter::VMlongLt(jlong op1, jlong op2) {135return (op1 < op2);136}137138inline int32_t BytecodeInterpreter::VMlongGt(jlong op1, jlong op2) {139return (op1 > op2);140}141142inline int32_t BytecodeInterpreter::VMlongCompare(jlong op1, jlong op2) {143return (VMlongLt(op1, op2) ? -1 : VMlongGt(op1, op2) ? 1 : 0);144}145146// Long conversions147148inline jdouble BytecodeInterpreter::VMlong2Double(jlong val) {149return (jdouble) val;150}151152inline jfloat BytecodeInterpreter::VMlong2Float(jlong val) {153return (jfloat) val;154}155156inline jint BytecodeInterpreter::VMlong2Int(jlong val) {157return (jint) val;158}159160// Double Arithmetic161162inline jdouble BytecodeInterpreter::VMdoubleAdd(jdouble op1, jdouble op2) {163return op1 + op2;164}165166inline jdouble BytecodeInterpreter::VMdoubleDiv(jdouble op1, jdouble op2) {167// Divide by zero... QQQ168return op1 / op2;169}170171inline jdouble BytecodeInterpreter::VMdoubleMul(jdouble op1, jdouble op2) {172return op1 * op2;173}174175inline jdouble BytecodeInterpreter::VMdoubleNeg(jdouble op) {176return -op;177}178179inline jdouble BytecodeInterpreter::VMdoubleRem(jdouble op1, jdouble op2) {180return fmod(op1, op2);181}182183inline jdouble BytecodeInterpreter::VMdoubleSub(jdouble op1, jdouble op2) {184return op1 - op2;185}186187inline int32_t BytecodeInterpreter::VMdoubleCompare(jdouble op1, jdouble op2, int32_t direction) {188return ( op1 < op2 ? -1 :189op1 > op2 ? 1 :190op1 == op2 ? 0 :191(direction == -1 || direction == 1) ? direction : 0);192}193194// Double Conversions195196inline jfloat BytecodeInterpreter::VMdouble2Float(jdouble val) {197return (jfloat) val;198}199200// Float Conversions201202inline jdouble BytecodeInterpreter::VMfloat2Double(jfloat op) {203return (jdouble) op;204}205206// Integer Arithmetic207208inline jint BytecodeInterpreter::VMintAdd(jint op1, jint op2) {209return op1 + op2;210}211212inline jint BytecodeInterpreter::VMintAnd(jint op1, jint op2) {213return op1 & op2;214}215216inline jint BytecodeInterpreter::VMintDiv(jint op1, jint op2) {217/* it's possible we could catch this special case implicitly */218if ((juint)op1 == 0x80000000 && op2 == -1) return op1;219else return op1 / op2;220}221222inline jint BytecodeInterpreter::VMintMul(jint op1, jint op2) {223return op1 * op2;224}225226inline jint BytecodeInterpreter::VMintNeg(jint op) {227return -op;228}229230inline jint BytecodeInterpreter::VMintOr(jint op1, jint op2) {231return op1 | op2;232}233234inline jint BytecodeInterpreter::VMintRem(jint op1, jint op2) {235/* it's possible we could catch this special case implicitly */236if ((juint)op1 == 0x80000000 && op2 == -1) return 0;237else return op1 % op2;238}239240inline jint BytecodeInterpreter::VMintShl(jint op1, jint op2) {241return op1 << op2;242}243244inline jint BytecodeInterpreter::VMintShr(jint op1, jint op2) {245return op1 >> (op2 & 0x1f);246}247248inline jint BytecodeInterpreter::VMintSub(jint op1, jint op2) {249return op1 - op2;250}251252inline jint BytecodeInterpreter::VMintUshr(jint op1, jint op2) {253return ((juint) op1) >> (op2 & 0x1f);254}255256inline jint BytecodeInterpreter::VMintXor(jint op1, jint op2) {257return op1 ^ op2;258}259260inline jdouble BytecodeInterpreter::VMint2Double(jint val) {261return (jdouble) val;262}263264inline jfloat BytecodeInterpreter::VMint2Float(jint val) {265return (jfloat) val;266}267268inline jlong BytecodeInterpreter::VMint2Long(jint val) {269return (jlong) val;270}271272inline jchar BytecodeInterpreter::VMint2Char(jint val) {273return (jchar) val;274}275276inline jshort BytecodeInterpreter::VMint2Short(jint val) {277return (jshort) val;278}279280inline jbyte BytecodeInterpreter::VMint2Byte(jint val) {281return (jbyte) val;282}283284#endif // CPU_X86_VM_BYTECODEINTERPRETER_X86_INLINE_HPP285286287