hotspot/src/cpu/x86/vm/bytecodeInterpreter_x86.inline.hpp
author xlu
Wed, 24 Dec 2008 13:06:09 -0800
changeset 1888 bbf498fb4354
parent 1 489c9b5090e2
child 1896 cce23a9ff495
permissions -rw-r--r--
6787106: Hotspot 32 bit build fails on platforms having different definitions for intptr_t & int32_t Summary: Avoid casting between int32_t and intptr_t specifically for MasmAssembler::movptr in 32 bit platforms. Reviewed-by: jrose, kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
     2
 * Copyright 2002 Sun Microsystems, Inc.  All Rights Reserved.
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
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    21
 * have any questions.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
// Inline interpreter functions for IA32
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
inline jfloat BytecodeInterpreter::VMfloatAdd(jfloat op1, jfloat op2) { return op1 + op2; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
inline jfloat BytecodeInterpreter::VMfloatSub(jfloat op1, jfloat op2) { return op1 - op2; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
inline jfloat BytecodeInterpreter::VMfloatMul(jfloat op1, jfloat op2) { return op1 * op2; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
inline jfloat BytecodeInterpreter::VMfloatDiv(jfloat op1, jfloat op2) { return op1 / op2; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
inline jfloat BytecodeInterpreter::VMfloatRem(jfloat op1, jfloat op2) { return fmod(op1, op2); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
inline jfloat BytecodeInterpreter::VMfloatNeg(jfloat op) { return -op; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
inline int32_t BytecodeInterpreter::VMfloatCompare(jfloat op1, jfloat op2, int32_t direction) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
  return ( op1 < op2 ? -1 :
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
               op1 > op2 ? 1 :
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
                   op1 == op2 ? 0 :
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
                       (direction == -1 || direction == 1) ? direction : 0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
inline void BytecodeInterpreter::VMmemCopy64(uint32_t to[2], const uint32_t from[2]) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
  // x86 can do unaligned copies but not 64bits at a time
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
  to[0] = from[0]; to[1] = from[1];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
// The long operations depend on compiler support for "long long" on x86
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
inline jlong BytecodeInterpreter::VMlongAdd(jlong op1, jlong op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
  return op1 + op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
inline jlong BytecodeInterpreter::VMlongAnd(jlong op1, jlong op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  return op1 & op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
inline jlong BytecodeInterpreter::VMlongDiv(jlong op1, jlong op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  // QQQ what about check and throw...
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  return op1 / op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
inline jlong BytecodeInterpreter::VMlongMul(jlong op1, jlong op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  return op1 * op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
inline jlong BytecodeInterpreter::VMlongOr(jlong op1, jlong op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  return op1 | op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
inline jlong BytecodeInterpreter::VMlongSub(jlong op1, jlong op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  return op1 - op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
inline jlong BytecodeInterpreter::VMlongXor(jlong op1, jlong op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  return op1 ^ op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
inline jlong BytecodeInterpreter::VMlongRem(jlong op1, jlong op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  return op1 % op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
inline jlong BytecodeInterpreter::VMlongUshr(jlong op1, jint op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
  // CVM did this 0x3f mask, is the really needed??? QQQ
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  return ((unsigned long long) op1) >> (op2 & 0x3F);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
inline jlong BytecodeInterpreter::VMlongShr(jlong op1, jint op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  return op1 >> (op2 & 0x3F);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
inline jlong BytecodeInterpreter::VMlongShl(jlong op1, jint op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  return op1 << (op2 & 0x3F);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
inline jlong BytecodeInterpreter::VMlongNeg(jlong op) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
  return -op;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
inline jlong BytecodeInterpreter::VMlongNot(jlong op) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  return ~op;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
inline int32_t BytecodeInterpreter::VMlongLtz(jlong op) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
  return (op <= 0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
inline int32_t BytecodeInterpreter::VMlongGez(jlong op) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
  return (op >= 0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
inline int32_t BytecodeInterpreter::VMlongEqz(jlong op) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  return (op == 0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
inline int32_t BytecodeInterpreter::VMlongEq(jlong op1, jlong op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  return (op1 == op2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
inline int32_t BytecodeInterpreter::VMlongNe(jlong op1, jlong op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
  return (op1 != op2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
inline int32_t BytecodeInterpreter::VMlongGe(jlong op1, jlong op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
  return (op1 >= op2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
inline int32_t BytecodeInterpreter::VMlongLe(jlong op1, jlong op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
  return (op1 <= op2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
inline int32_t BytecodeInterpreter::VMlongLt(jlong op1, jlong op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
  return (op1 < op2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
inline int32_t BytecodeInterpreter::VMlongGt(jlong op1, jlong op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
  return (op1 > op2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
inline int32_t BytecodeInterpreter::VMlongCompare(jlong op1, jlong op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
  return (VMlongLt(op1, op2) ? -1 : VMlongGt(op1, op2) ? 1 : 0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
// Long conversions
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
inline jdouble BytecodeInterpreter::VMlong2Double(jlong val) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
  return (jdouble) val;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
inline jfloat BytecodeInterpreter::VMlong2Float(jlong val) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
  return (jfloat) val;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
inline jint BytecodeInterpreter::VMlong2Int(jlong val) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
  return (jint) val;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
// Double Arithmetic
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
inline jdouble BytecodeInterpreter::VMdoubleAdd(jdouble op1, jdouble op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
  return op1 + op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
inline jdouble BytecodeInterpreter::VMdoubleDiv(jdouble op1, jdouble op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
  // Divide by zero... QQQ
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  return op1 / op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
inline jdouble BytecodeInterpreter::VMdoubleMul(jdouble op1, jdouble op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
  return op1 * op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
inline jdouble BytecodeInterpreter::VMdoubleNeg(jdouble op) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
  return -op;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
inline jdouble BytecodeInterpreter::VMdoubleRem(jdouble op1, jdouble op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
  return fmod(op1, op2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
inline jdouble BytecodeInterpreter::VMdoubleSub(jdouble op1, jdouble op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
  return op1 - op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
inline int32_t BytecodeInterpreter::VMdoubleCompare(jdouble op1, jdouble op2, int32_t direction) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
  return ( op1 < op2 ? -1 :
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
               op1 > op2 ? 1 :
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
                   op1 == op2 ? 0 :
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
                       (direction == -1 || direction == 1) ? direction : 0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
// Double Conversions
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
inline jfloat BytecodeInterpreter::VMdouble2Float(jdouble val) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
  return (jfloat) val;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
// Float Conversions
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
inline jdouble BytecodeInterpreter::VMfloat2Double(jfloat op) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
  return (jdouble) op;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
// Integer Arithmetic
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
inline jint BytecodeInterpreter::VMintAdd(jint op1, jint op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
  return op1 + op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
inline jint BytecodeInterpreter::VMintAnd(jint op1, jint op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
  return op1 & op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
inline jint BytecodeInterpreter::VMintDiv(jint op1, jint op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
  /* it's possible we could catch this special case implicitly */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
  if (op1 == 0x80000000 && op2 == -1) return op1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
  else return op1 / op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
inline jint BytecodeInterpreter::VMintMul(jint op1, jint op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
  return op1 * op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
inline jint BytecodeInterpreter::VMintNeg(jint op) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
  return -op;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
inline jint BytecodeInterpreter::VMintOr(jint op1, jint op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
  return op1 | op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
inline jint BytecodeInterpreter::VMintRem(jint op1, jint op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
  /* it's possible we could catch this special case implicitly */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
  if (op1 == 0x80000000 && op2 == -1) return 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
  else return op1 % op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
inline jint BytecodeInterpreter::VMintShl(jint op1, jint op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
  return op1 <<  op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
inline jint BytecodeInterpreter::VMintShr(jint op1, jint op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
  return op1 >>  op2; // QQ op2 & 0x1f??
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
inline jint BytecodeInterpreter::VMintSub(jint op1, jint op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
  return op1 - op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
inline jint BytecodeInterpreter::VMintUshr(jint op1, jint op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
  return ((juint) op1) >> op2; // QQ op2 & 0x1f??
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
inline jint BytecodeInterpreter::VMintXor(jint op1, jint op2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
  return op1 ^ op2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
inline jdouble BytecodeInterpreter::VMint2Double(jint val) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
  return (jdouble) val;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
inline jfloat BytecodeInterpreter::VMint2Float(jint val) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
  return (jfloat) val;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
inline jlong BytecodeInterpreter::VMint2Long(jint val) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
  return (jlong) val;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
inline jchar BytecodeInterpreter::VMint2Char(jint val) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
  return (jchar) val;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
inline jshort BytecodeInterpreter::VMint2Short(jint val) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
  return (jshort) val;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
inline jbyte BytecodeInterpreter::VMint2Byte(jint val) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
  return (jbyte) val;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
}