hotspot/src/cpu/x86/vm/bytecodeInterpreter_x86.inline.hpp
author mikael
Mon, 02 Jun 2014 15:48:34 -0700
changeset 24930 1fc3041c8e78
parent 23203 76c2a23e2537
permissions -rw-r--r--
8044242: Remove dead NativeMovRegMemPatching class Reviewed-by: twisti, kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6176
diff changeset
     2
 * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 2105
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 2105
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 2105
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6176
diff changeset
    25
#ifndef CPU_X86_VM_BYTECODEINTERPRETER_X86_INLINE_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6176
diff changeset
    26
#define CPU_X86_VM_BYTECODEINTERPRETER_X86_INLINE_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6176
diff changeset
    27
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
// Inline interpreter functions for IA32
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
inline jfloat BytecodeInterpreter::VMfloatAdd(jfloat op1, jfloat op2) { return op1 + op2; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
inline jfloat BytecodeInterpreter::VMfloatSub(jfloat op1, jfloat op2) { return op1 - op2; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
inline jfloat BytecodeInterpreter::VMfloatMul(jfloat op1, jfloat op2) { return op1 * op2; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
inline jfloat BytecodeInterpreter::VMfloatDiv(jfloat op1, jfloat op2) { return op1 / op2; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
inline jfloat BytecodeInterpreter::VMfloatRem(jfloat op1, jfloat op2) { return fmod(op1, op2); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
inline jfloat BytecodeInterpreter::VMfloatNeg(jfloat op) { return -op; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
inline int32_t BytecodeInterpreter::VMfloatCompare(jfloat op1, jfloat op2, int32_t direction) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
  return ( op1 < op2 ? -1 :
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
               op1 > op2 ? 1 :
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
                   op1 == op2 ? 0 :
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
                       (direction == -1 || direction == 1) ? direction : 0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
inline void BytecodeInterpreter::VMmemCopy64(uint32_t to[2], const uint32_t from[2]) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
  // x86 can do unaligned copies but not 64bits at a time
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
  to[0] = from[0]; to[1] = from[1];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
// The long operations depend on compiler support for "long long" on x86
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
inline jlong BytecodeInterpreter::VMlongAdd(jlong op1, jlong op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  return op1 + op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
inline jlong BytecodeInterpreter::VMlongAnd(jlong op1, jlong op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  return op1 & op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
inline jlong BytecodeInterpreter::VMlongDiv(jlong op1, jlong op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  // QQQ what about check and throw...
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  return op1 / op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
inline jlong BytecodeInterpreter::VMlongMul(jlong op1, jlong op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
  return op1 * op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
inline jlong BytecodeInterpreter::VMlongOr(jlong op1, jlong op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  return op1 | op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
inline jlong BytecodeInterpreter::VMlongSub(jlong op1, jlong op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  return op1 - op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
inline jlong BytecodeInterpreter::VMlongXor(jlong op1, jlong op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  return op1 ^ op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
inline jlong BytecodeInterpreter::VMlongRem(jlong op1, jlong op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  return op1 % op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
inline jlong BytecodeInterpreter::VMlongUshr(jlong op1, jint op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  // CVM did this 0x3f mask, is the really needed??? QQQ
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
  return ((unsigned long long) op1) >> (op2 & 0x3F);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
inline jlong BytecodeInterpreter::VMlongShr(jlong op1, jint op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  return op1 >> (op2 & 0x3F);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
inline jlong BytecodeInterpreter::VMlongShl(jlong op1, jint op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  return op1 << (op2 & 0x3F);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
inline jlong BytecodeInterpreter::VMlongNeg(jlong op) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  return -op;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
inline jlong BytecodeInterpreter::VMlongNot(jlong op) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
  return ~op;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
inline int32_t BytecodeInterpreter::VMlongLtz(jlong op) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  return (op <= 0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
inline int32_t BytecodeInterpreter::VMlongGez(jlong op) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
  return (op >= 0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
inline int32_t BytecodeInterpreter::VMlongEqz(jlong op) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  return (op == 0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
inline int32_t BytecodeInterpreter::VMlongEq(jlong op1, jlong op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  return (op1 == op2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
inline int32_t BytecodeInterpreter::VMlongNe(jlong op1, jlong op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
  return (op1 != op2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
inline int32_t BytecodeInterpreter::VMlongGe(jlong op1, jlong op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  return (op1 >= op2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
inline int32_t BytecodeInterpreter::VMlongLe(jlong op1, jlong op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  return (op1 <= op2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
inline int32_t BytecodeInterpreter::VMlongLt(jlong op1, jlong op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
  return (op1 < op2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
inline int32_t BytecodeInterpreter::VMlongGt(jlong op1, jlong op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  return (op1 > op2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
inline int32_t BytecodeInterpreter::VMlongCompare(jlong op1, jlong op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
  return (VMlongLt(op1, op2) ? -1 : VMlongGt(op1, op2) ? 1 : 0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
// Long conversions
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
inline jdouble BytecodeInterpreter::VMlong2Double(jlong val) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
  return (jdouble) val;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
inline jfloat BytecodeInterpreter::VMlong2Float(jlong val) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
  return (jfloat) val;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
inline jint BytecodeInterpreter::VMlong2Int(jlong val) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
  return (jint) val;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
// Double Arithmetic
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
inline jdouble BytecodeInterpreter::VMdoubleAdd(jdouble op1, jdouble op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
  return op1 + op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
inline jdouble BytecodeInterpreter::VMdoubleDiv(jdouble op1, jdouble op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
  // Divide by zero... QQQ
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
  return op1 / op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
inline jdouble BytecodeInterpreter::VMdoubleMul(jdouble op1, jdouble op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
  return op1 * op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
inline jdouble BytecodeInterpreter::VMdoubleNeg(jdouble op) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
  return -op;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
inline jdouble BytecodeInterpreter::VMdoubleRem(jdouble op1, jdouble op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
  return fmod(op1, op2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
inline jdouble BytecodeInterpreter::VMdoubleSub(jdouble op1, jdouble op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
  return op1 - op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
inline int32_t BytecodeInterpreter::VMdoubleCompare(jdouble op1, jdouble op2, int32_t direction) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
  return ( op1 < op2 ? -1 :
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
               op1 > op2 ? 1 :
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
                   op1 == op2 ? 0 :
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
                       (direction == -1 || direction == 1) ? direction : 0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
// Double Conversions
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
inline jfloat BytecodeInterpreter::VMdouble2Float(jdouble val) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
  return (jfloat) val;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
// Float Conversions
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
inline jdouble BytecodeInterpreter::VMfloat2Double(jfloat op) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
  return (jdouble) op;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
// Integer Arithmetic
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
inline jint BytecodeInterpreter::VMintAdd(jint op1, jint op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
  return op1 + op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
inline jint BytecodeInterpreter::VMintAnd(jint op1, jint op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
  return op1 & op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
inline jint BytecodeInterpreter::VMintDiv(jint op1, jint op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
  /* it's possible we could catch this special case implicitly */
1896
cce23a9ff495 6791168: Fix invalid code in bytecodeInterpreter that can cause gcc ICE
coleenp
parents: 1
diff changeset
   219
  if ((juint)op1 == 0x80000000 && op2 == -1) return op1;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
  else return op1 / op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
inline jint BytecodeInterpreter::VMintMul(jint op1, jint op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
  return op1 * op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
inline jint BytecodeInterpreter::VMintNeg(jint op) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
  return -op;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
inline jint BytecodeInterpreter::VMintOr(jint op1, jint op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
  return op1 | op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
inline jint BytecodeInterpreter::VMintRem(jint op1, jint op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
  /* it's possible we could catch this special case implicitly */
1896
cce23a9ff495 6791168: Fix invalid code in bytecodeInterpreter that can cause gcc ICE
coleenp
parents: 1
diff changeset
   237
  if ((juint)op1 == 0x80000000 && op2 == -1) return 0;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
  else return op1 % op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
inline jint BytecodeInterpreter::VMintShl(jint op1, jint op2) {
6176
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   242
  return op1 << op2;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
inline jint BytecodeInterpreter::VMintShr(jint op1, jint op2) {
6176
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   246
  return op1 >> (op2 & 0x1f);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
inline jint BytecodeInterpreter::VMintSub(jint op1, jint op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
  return op1 - op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
23203
76c2a23e2537 8036146: make CPP interpreter build again
roland
parents: 7397
diff changeset
   253
inline juint BytecodeInterpreter::VMintUshr(jint op1, jint op2) {
6176
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   254
  return ((juint) op1) >> (op2 & 0x1f);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
inline jint BytecodeInterpreter::VMintXor(jint op1, jint op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
  return op1 ^ op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
inline jdouble BytecodeInterpreter::VMint2Double(jint val) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
  return (jdouble) val;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
inline jfloat BytecodeInterpreter::VMint2Float(jint val) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
  return (jfloat) val;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
inline jlong BytecodeInterpreter::VMint2Long(jint val) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
  return (jlong) val;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
inline jchar BytecodeInterpreter::VMint2Char(jint val) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
  return (jchar) val;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
inline jshort BytecodeInterpreter::VMint2Short(jint val) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
  return (jshort) val;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
inline jbyte BytecodeInterpreter::VMint2Byte(jint val) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
  return (jbyte) val;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
}
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6176
diff changeset
   284
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6176
diff changeset
   285
#endif // CPU_X86_VM_BYTECODEINTERPRETER_X86_INLINE_HPP