annotate src/cpu/zero/vm/bytecodeInterpreter_zero.inline.hpp @ 5819:39f4affc6564

8143245: Zero build requires disabled warnings 8022956: Clang: enable return type warnings on BSD Summary: Based on work of Severin Gehwolf <sgehwolf@redhat.com> & Christian Thalinger <cthalinger@twitter.com> with additions for 7-only cases Reviewed-by: dholmes, coleenp, sla
author andrew
date Tue, 13 Feb 2018 06:42:27 +0000
parents 13b87063b4d8
children
rev   line source
never@1010 1 /*
stefank@1879 2 * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
twisti@1649 3 * Copyright 2007, 2010 Red Hat, Inc.
never@1010 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
never@1010 5 *
never@1010 6 * This code is free software; you can redistribute it and/or modify it
never@1010 7 * under the terms of the GNU General Public License version 2 only, as
never@1010 8 * published by the Free Software Foundation.
never@1010 9 *
never@1010 10 * This code is distributed in the hope that it will be useful, but WITHOUT
never@1010 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
never@1010 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
never@1010 13 * version 2 for more details (a copy is included in the LICENSE file that
never@1010 14 * accompanied this code).
never@1010 15 *
never@1010 16 * You should have received a copy of the GNU General Public License version
never@1010 17 * 2 along with this work; if not, write to the Free Software Foundation,
never@1010 18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
never@1010 19 *
trims@1472 20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1472 21 * or visit www.oracle.com if you need additional information or have any
trims@1472 22 * questions.
never@1010 23 *
never@1010 24 */
never@1010 25
stefank@1879 26 #ifndef CPU_ZERO_VM_BYTECODEINTERPRETER_ZERO_INLINE_HPP
stefank@1879 27 #define CPU_ZERO_VM_BYTECODEINTERPRETER_ZERO_INLINE_HPP
stefank@1879 28
never@1010 29 // Inline interpreter functions for zero
never@1010 30
never@1010 31 inline jfloat BytecodeInterpreter::VMfloatAdd(jfloat op1, jfloat op2) {
never@1010 32 return op1 + op2;
never@1010 33 }
never@1010 34
never@1010 35 inline jfloat BytecodeInterpreter::VMfloatSub(jfloat op1, jfloat op2) {
never@1010 36 return op1 - op2;
never@1010 37 }
never@1010 38
never@1010 39 inline jfloat BytecodeInterpreter::VMfloatMul(jfloat op1, jfloat op2) {
never@1010 40 return op1 * op2;
never@1010 41 }
never@1010 42
never@1010 43 inline jfloat BytecodeInterpreter::VMfloatDiv(jfloat op1, jfloat op2) {
never@1010 44 return op1 / op2;
never@1010 45 }
never@1010 46
never@1010 47 inline jfloat BytecodeInterpreter::VMfloatRem(jfloat op1, jfloat op2) {
never@1010 48 return fmod(op1, op2);
never@1010 49 }
never@1010 50
never@1010 51 inline jfloat BytecodeInterpreter::VMfloatNeg(jfloat op) {
never@1010 52 return -op;
never@1010 53 }
never@1010 54
never@1010 55 inline int32_t BytecodeInterpreter::VMfloatCompare(jfloat op1,
never@1010 56 jfloat op2,
never@1010 57 int32_t direction) {
never@1010 58 return ( op1 < op2 ? -1 :
never@1010 59 op1 > op2 ? 1 :
never@1010 60 op1 == op2 ? 0 :
never@1010 61 (direction == -1 || direction == 1) ? direction : 0);
never@1010 62
never@1010 63 }
never@1010 64
never@1010 65 inline void BytecodeInterpreter::VMmemCopy64(uint32_t to[2],
never@1010 66 const uint32_t from[2]) {
never@1010 67 *(uint64_t *) to = *(uint64_t *) from;
never@1010 68 }
never@1010 69
never@1010 70 inline jlong BytecodeInterpreter::VMlongAdd(jlong op1, jlong op2) {
never@1010 71 return op1 + op2;
never@1010 72 }
never@1010 73
never@1010 74 inline jlong BytecodeInterpreter::VMlongAnd(jlong op1, jlong op2) {
never@1010 75 return op1 & op2;
never@1010 76 }
never@1010 77
never@1010 78 inline jlong BytecodeInterpreter::VMlongDiv(jlong op1, jlong op2) {
never@1010 79 /* it's possible we could catch this special case implicitly */
never@1010 80 if (op1 == (jlong) 0x8000000000000000LL && op2 == -1) return op1;
never@1010 81 else return op1 / op2;
never@1010 82 }
never@1010 83
never@1010 84 inline jlong BytecodeInterpreter::VMlongMul(jlong op1, jlong op2) {
never@1010 85 return op1 * op2;
never@1010 86 }
never@1010 87
never@1010 88 inline jlong BytecodeInterpreter::VMlongOr(jlong op1, jlong op2) {
never@1010 89 return op1 | op2;
never@1010 90 }
never@1010 91
never@1010 92 inline jlong BytecodeInterpreter::VMlongSub(jlong op1, jlong op2) {
never@1010 93 return op1 - op2;
never@1010 94 }
never@1010 95
never@1010 96 inline jlong BytecodeInterpreter::VMlongXor(jlong op1, jlong op2) {
never@1010 97 return op1 ^ op2;
never@1010 98 }
never@1010 99
never@1010 100 inline jlong BytecodeInterpreter::VMlongRem(jlong op1, jlong op2) {
never@1010 101 /* it's possible we could catch this special case implicitly */
never@1010 102 if (op1 == (jlong) 0x8000000000000000LL && op2 == -1) return 0;
never@1010 103 else return op1 % op2;
never@1010 104 }
never@1010 105
never@1010 106 inline jlong BytecodeInterpreter::VMlongUshr(jlong op1, jint op2) {
never@1010 107 return ((unsigned long long) op1) >> (op2 & 0x3F);
never@1010 108 }
never@1010 109
never@1010 110 inline jlong BytecodeInterpreter::VMlongShr(jlong op1, jint op2) {
never@1010 111 return op1 >> (op2 & 0x3F);
never@1010 112 }
never@1010 113
never@1010 114 inline jlong BytecodeInterpreter::VMlongShl(jlong op1, jint op2) {
never@1010 115 return op1 << (op2 & 0x3F);
never@1010 116 }
never@1010 117
never@1010 118 inline jlong BytecodeInterpreter::VMlongNeg(jlong op) {
never@1010 119 return -op;
never@1010 120 }
never@1010 121
never@1010 122 inline jlong BytecodeInterpreter::VMlongNot(jlong op) {
never@1010 123 return ~op;
never@1010 124 }
never@1010 125
never@1010 126 inline int32_t BytecodeInterpreter::VMlongLtz(jlong op) {
never@1010 127 return (op <= 0);
never@1010 128 }
never@1010 129
never@1010 130 inline int32_t BytecodeInterpreter::VMlongGez(jlong op) {
never@1010 131 return (op >= 0);
never@1010 132 }
never@1010 133
never@1010 134 inline int32_t BytecodeInterpreter::VMlongEqz(jlong op) {
never@1010 135 return (op == 0);
never@1010 136 }
never@1010 137
never@1010 138 inline int32_t BytecodeInterpreter::VMlongEq(jlong op1, jlong op2) {
never@1010 139 return (op1 == op2);
never@1010 140 }
never@1010 141
never@1010 142 inline int32_t BytecodeInterpreter::VMlongNe(jlong op1, jlong op2) {
never@1010 143 return (op1 != op2);
never@1010 144 }
never@1010 145
never@1010 146 inline int32_t BytecodeInterpreter::VMlongGe(jlong op1, jlong op2) {
never@1010 147 return (op1 >= op2);
never@1010 148 }
never@1010 149
never@1010 150 inline int32_t BytecodeInterpreter::VMlongLe(jlong op1, jlong op2) {
never@1010 151 return (op1 <= op2);
never@1010 152 }
never@1010 153
never@1010 154 inline int32_t BytecodeInterpreter::VMlongLt(jlong op1, jlong op2) {
never@1010 155 return (op1 < op2);
never@1010 156 }
never@1010 157
never@1010 158 inline int32_t BytecodeInterpreter::VMlongGt(jlong op1, jlong op2) {
never@1010 159 return (op1 > op2);
never@1010 160 }
never@1010 161
never@1010 162 inline int32_t BytecodeInterpreter::VMlongCompare(jlong op1, jlong op2) {
never@1010 163 return (VMlongLt(op1, op2) ? -1 : VMlongGt(op1, op2) ? 1 : 0);
never@1010 164 }
never@1010 165
never@1010 166 // Long conversions
never@1010 167
never@1010 168 inline jdouble BytecodeInterpreter::VMlong2Double(jlong val) {
never@1010 169 return (jdouble) val;
never@1010 170 }
never@1010 171
never@1010 172 inline jfloat BytecodeInterpreter::VMlong2Float(jlong val) {
never@1010 173 return (jfloat) val;
never@1010 174 }
never@1010 175
never@1010 176 inline jint BytecodeInterpreter::VMlong2Int(jlong val) {
never@1010 177 return (jint) val;
never@1010 178 }
never@1010 179
never@1010 180 // Double Arithmetic
never@1010 181
never@1010 182 inline jdouble BytecodeInterpreter::VMdoubleAdd(jdouble op1, jdouble op2) {
never@1010 183 return op1 + op2;
never@1010 184 }
never@1010 185
never@1010 186 inline jdouble BytecodeInterpreter::VMdoubleDiv(jdouble op1, jdouble op2) {
never@1010 187 // Divide by zero... QQQ
never@1010 188 return op1 / op2;
never@1010 189 }
never@1010 190
never@1010 191 inline jdouble BytecodeInterpreter::VMdoubleMul(jdouble op1, jdouble op2) {
never@1010 192 return op1 * op2;
never@1010 193 }
never@1010 194
never@1010 195 inline jdouble BytecodeInterpreter::VMdoubleNeg(jdouble op) {
never@1010 196 return -op;
never@1010 197 }
never@1010 198
never@1010 199 inline jdouble BytecodeInterpreter::VMdoubleRem(jdouble op1, jdouble op2) {
never@1010 200 return fmod(op1, op2);
never@1010 201 }
never@1010 202
never@1010 203 inline jdouble BytecodeInterpreter::VMdoubleSub(jdouble op1, jdouble op2) {
never@1010 204 return op1 - op2;
never@1010 205 }
never@1010 206
never@1010 207 inline int32_t BytecodeInterpreter::VMdoubleCompare(jdouble op1,
never@1010 208 jdouble op2,
never@1010 209 int32_t direction) {
never@1010 210 return ( op1 < op2 ? -1 :
never@1010 211 op1 > op2 ? 1 :
never@1010 212 op1 == op2 ? 0 :
never@1010 213 (direction == -1 || direction == 1) ? direction : 0);
never@1010 214 }
never@1010 215
never@1010 216 // Double Conversions
never@1010 217
never@1010 218 inline jfloat BytecodeInterpreter::VMdouble2Float(jdouble val) {
never@1010 219 return (jfloat) val;
never@1010 220 }
never@1010 221
never@1010 222 // Float Conversions
never@1010 223
never@1010 224 inline jdouble BytecodeInterpreter::VMfloat2Double(jfloat op) {
never@1010 225 return (jdouble) op;
never@1010 226 }
never@1010 227
never@1010 228 // Integer Arithmetic
never@1010 229
never@1010 230 inline jint BytecodeInterpreter::VMintAdd(jint op1, jint op2) {
never@1010 231 return op1 + op2;
never@1010 232 }
never@1010 233
never@1010 234 inline jint BytecodeInterpreter::VMintAnd(jint op1, jint op2) {
never@1010 235 return op1 & op2;
never@1010 236 }
never@1010 237
never@1010 238 inline jint BytecodeInterpreter::VMintDiv(jint op1, jint op2) {
never@1010 239 /* it's possible we could catch this special case implicitly */
never@1010 240 if (op1 == (jint) 0x80000000 && op2 == -1) return op1;
never@1010 241 else return op1 / op2;
never@1010 242 }
never@1010 243
never@1010 244 inline jint BytecodeInterpreter::VMintMul(jint op1, jint op2) {
never@1010 245 return op1 * op2;
never@1010 246 }
never@1010 247
never@1010 248 inline jint BytecodeInterpreter::VMintNeg(jint op) {
never@1010 249 return -op;
never@1010 250 }
never@1010 251
never@1010 252 inline jint BytecodeInterpreter::VMintOr(jint op1, jint op2) {
never@1010 253 return op1 | op2;
never@1010 254 }
never@1010 255
never@1010 256 inline jint BytecodeInterpreter::VMintRem(jint op1, jint op2) {
never@1010 257 /* it's possible we could catch this special case implicitly */
never@1010 258 if (op1 == (jint) 0x80000000 && op2 == -1) return 0;
never@1010 259 else return op1 % op2;
never@1010 260 }
never@1010 261
never@1010 262 inline jint BytecodeInterpreter::VMintShl(jint op1, jint op2) {
never@1010 263 return op1 << (op2 & 0x1F);
never@1010 264 }
never@1010 265
never@1010 266 inline jint BytecodeInterpreter::VMintShr(jint op1, jint op2) {
never@1010 267 return op1 >> (op2 & 0x1F);
never@1010 268 }
never@1010 269
never@1010 270 inline jint BytecodeInterpreter::VMintSub(jint op1, jint op2) {
never@1010 271 return op1 - op2;
never@1010 272 }
never@1010 273
twisti@1649 274 inline juint BytecodeInterpreter::VMintUshr(jint op1, jint op2) {
never@1010 275 return ((juint) op1) >> (op2 & 0x1F);
never@1010 276 }
never@1010 277
never@1010 278 inline jint BytecodeInterpreter::VMintXor(jint op1, jint op2) {
never@1010 279 return op1 ^ op2;
never@1010 280 }
never@1010 281
never@1010 282 inline jdouble BytecodeInterpreter::VMint2Double(jint val) {
never@1010 283 return (jdouble) val;
never@1010 284 }
never@1010 285
never@1010 286 inline jfloat BytecodeInterpreter::VMint2Float(jint val) {
never@1010 287 return (jfloat) val;
never@1010 288 }
never@1010 289
never@1010 290 inline jlong BytecodeInterpreter::VMint2Long(jint val) {
never@1010 291 return (jlong) val;
never@1010 292 }
never@1010 293
never@1010 294 inline jchar BytecodeInterpreter::VMint2Char(jint val) {
never@1010 295 return (jchar) val;
never@1010 296 }
never@1010 297
never@1010 298 inline jshort BytecodeInterpreter::VMint2Short(jint val) {
never@1010 299 return (jshort) val;
never@1010 300 }
never@1010 301
never@1010 302 inline jbyte BytecodeInterpreter::VMint2Byte(jint val) {
never@1010 303 return (jbyte) val;
never@1010 304 }
stefank@1879 305
stefank@1879 306 #endif // CPU_ZERO_VM_BYTECODEINTERPRETER_ZERO_INLINE_HPP