src/share/vm/interpreter/bytecodeInterpreter.hpp

Fri, 29 Apr 2016 00:06:10 +0800

author
aoqi
date
Fri, 29 Apr 2016 00:06:10 +0800
changeset 1
2d8a650513c2
parent 0
f90c822e73f8
child 6876
710a3c8b516e
permissions
-rw-r--r--

Added MIPS 64-bit port.

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 *
aoqi@0 5 * This code is free software; you can redistribute it and/or modify it
aoqi@0 6 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 * published by the Free Software Foundation.
aoqi@0 8 *
aoqi@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 12 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 13 * accompanied this code).
aoqi@0 14 *
aoqi@0 15 * You should have received a copy of the GNU General Public License version
aoqi@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 18 *
aoqi@0 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 20 * or visit www.oracle.com if you need additional information or have any
aoqi@0 21 * questions.
aoqi@0 22 *
aoqi@0 23 */
aoqi@0 24
aoqi@1 25 /*
aoqi@1 26 * This file has been modified by Loongson Technology in 2015. These
aoqi@1 27 * modifications are Copyright (c) 2015 Loongson Technology, and are made
aoqi@1 28 * available on the same license terms set forth above.
aoqi@1 29 */
aoqi@1 30
aoqi@0 31 #ifndef SHARE_VM_INTERPRETER_BYTECODEINTERPRETER_HPP
aoqi@0 32 #define SHARE_VM_INTERPRETER_BYTECODEINTERPRETER_HPP
aoqi@0 33
aoqi@0 34 #include "memory/allocation.hpp"
aoqi@0 35 #include "oops/methodData.hpp"
aoqi@0 36 #include "oops/method.hpp"
aoqi@0 37 #include "runtime/basicLock.hpp"
aoqi@0 38 #include "runtime/frame.hpp"
aoqi@0 39 #include "runtime/globals.hpp"
aoqi@0 40 #include "utilities/globalDefinitions.hpp"
aoqi@0 41 #ifdef TARGET_ARCH_x86
aoqi@0 42 # include "bytes_x86.hpp"
aoqi@0 43 #endif
aoqi@1 44 #ifdef TARGET_ARCH_mips
aoqi@1 45 # include "bytes_mips.hpp"
aoqi@1 46 #endif
aoqi@0 47 #ifdef TARGET_ARCH_sparc
aoqi@0 48 # include "bytes_sparc.hpp"
aoqi@0 49 #endif
aoqi@0 50 #ifdef TARGET_ARCH_zero
aoqi@0 51 # include "bytes_zero.hpp"
aoqi@0 52 #endif
aoqi@0 53 #ifdef TARGET_ARCH_arm
aoqi@0 54 # include "bytes_arm.hpp"
aoqi@0 55 #endif
aoqi@0 56 #ifdef TARGET_ARCH_ppc
aoqi@0 57 # include "bytes_ppc.hpp"
aoqi@0 58 #endif
aoqi@0 59
aoqi@0 60 #ifdef CC_INTERP
aoqi@0 61
aoqi@0 62 // JavaStack Implementation
aoqi@0 63 #define MORE_STACK(count) \
aoqi@0 64 (topOfStack -= ((count) * Interpreter::stackElementWords))
aoqi@0 65
aoqi@0 66 // CVM definitions find hotspot equivalents...
aoqi@0 67
aoqi@0 68 union VMJavaVal64 {
aoqi@0 69 jlong l;
aoqi@0 70 jdouble d;
aoqi@0 71 uint32_t v[2];
aoqi@0 72 };
aoqi@0 73
aoqi@0 74
aoqi@0 75 typedef class BytecodeInterpreter* interpreterState;
aoqi@0 76
aoqi@0 77 struct call_message {
aoqi@0 78 class Method* _callee; // method to call during call_method request
aoqi@0 79 address _callee_entry_point; // address to jump to for call_method request
aoqi@0 80 int _bcp_advance; // size of the invoke bytecode operation
aoqi@0 81 };
aoqi@0 82
aoqi@0 83 struct osr_message {
aoqi@0 84 address _osr_buf; // the osr buffer
aoqi@0 85 address _osr_entry; // the entry to the osr method
aoqi@0 86 };
aoqi@0 87
aoqi@0 88 struct osr_result {
aoqi@0 89 nmethod* nm; // osr nmethod
aoqi@0 90 address return_addr; // osr blob return address
aoqi@0 91 };
aoqi@0 92
aoqi@0 93 // Result returned to frame manager
aoqi@0 94 union frame_manager_message {
aoqi@0 95 call_message _to_call; // describes callee
aoqi@0 96 osr_message _osr; // describes the osr
aoqi@0 97 osr_result _osr_result; // result of OSR request
aoqi@0 98 };
aoqi@0 99
aoqi@0 100 class BytecodeInterpreter : StackObj {
aoqi@0 101 friend class SharedRuntime;
aoqi@0 102 friend class AbstractInterpreterGenerator;
aoqi@0 103 friend class CppInterpreterGenerator;
aoqi@0 104 friend class InterpreterGenerator;
aoqi@0 105 friend class InterpreterMacroAssembler;
aoqi@0 106 friend class frame;
aoqi@0 107 friend class VMStructs;
aoqi@0 108
aoqi@0 109 public:
aoqi@0 110 enum messages {
aoqi@0 111 no_request = 0, // unused
aoqi@0 112 initialize, // Perform one time interpreter initializations (assumes all switches set)
aoqi@0 113 // status message to C++ interpreter
aoqi@0 114 method_entry, // initial method entry to interpreter
aoqi@0 115 method_resume, // frame manager response to return_from_method request (assuming a frame to resume)
aoqi@0 116 deopt_resume, // returning from a native call into a deopted frame
aoqi@0 117 deopt_resume2, // deopt resume as a result of a PopFrame
aoqi@0 118 got_monitors, // frame manager response to more_monitors request
aoqi@0 119 rethrow_exception, // unwinding and throwing exception
aoqi@0 120 // requests to frame manager from C++ interpreter
aoqi@0 121 call_method, // request for new frame from interpreter, manager responds with method_entry
aoqi@0 122 return_from_method, // request from interpreter to unwind, manager responds with method_continue
aoqi@0 123 more_monitors, // need a new monitor
aoqi@0 124 throwing_exception, // unwind stack and rethrow
aoqi@0 125 popping_frame, // unwind call and retry call
aoqi@0 126 do_osr, // request this invocation be OSR's
aoqi@0 127 early_return // early return as commanded by jvmti
aoqi@0 128 };
aoqi@0 129
aoqi@0 130 private:
aoqi@0 131 JavaThread* _thread; // the vm's java thread pointer
aoqi@0 132 address _bcp; // instruction pointer
aoqi@0 133 intptr_t* _locals; // local variable pointer
aoqi@0 134 ConstantPoolCache* _constants; // constant pool cache
aoqi@0 135 Method* _method; // method being executed
aoqi@0 136 DataLayout* _mdx; // compiler profiling data for current bytecode
aoqi@0 137 intptr_t* _stack; // expression stack
aoqi@0 138 messages _msg; // frame manager <-> interpreter message
aoqi@0 139 frame_manager_message _result; // result to frame manager
aoqi@0 140 interpreterState _prev_link; // previous interpreter state
aoqi@0 141 oop _oop_temp; // mirror for interpreted native, null otherwise
aoqi@0 142 intptr_t* _stack_base; // base of expression stack
aoqi@0 143 intptr_t* _stack_limit; // limit of expression stack
aoqi@0 144 BasicObjectLock* _monitor_base; // base of monitors on the native stack
aoqi@0 145
aoqi@0 146
aoqi@0 147 public:
aoqi@0 148 // Constructor is only used by the initialization step. All other instances are created
aoqi@0 149 // by the frame manager.
aoqi@0 150 BytecodeInterpreter(messages msg);
aoqi@0 151
aoqi@0 152 //
aoqi@0 153 // Deoptimization support
aoqi@0 154 //
aoqi@0 155 static void layout_interpreterState(interpreterState to_fill,
aoqi@0 156 frame* caller,
aoqi@0 157 frame* interpreter_frame,
aoqi@0 158 Method* method,
aoqi@0 159 intptr_t* locals,
aoqi@0 160 intptr_t* stack,
aoqi@0 161 intptr_t* stack_base,
aoqi@0 162 intptr_t* monitor_base,
aoqi@0 163 intptr_t* frame_bottom,
aoqi@0 164 bool top_frame);
aoqi@0 165
aoqi@0 166 /*
aoqi@0 167 * Generic 32-bit wide "Java slot" definition. This type occurs
aoqi@0 168 * in operand stacks, Java locals, object fields, constant pools.
aoqi@0 169 */
aoqi@0 170 union VMJavaVal32 {
aoqi@0 171 jint i;
aoqi@0 172 jfloat f;
aoqi@0 173 class oopDesc* r;
aoqi@0 174 uint32_t raw;
aoqi@0 175 };
aoqi@0 176
aoqi@0 177 /*
aoqi@0 178 * Generic 64-bit Java value definition
aoqi@0 179 */
aoqi@0 180 union VMJavaVal64 {
aoqi@0 181 jlong l;
aoqi@0 182 jdouble d;
aoqi@0 183 uint32_t v[2];
aoqi@0 184 };
aoqi@0 185
aoqi@0 186 /*
aoqi@0 187 * Generic 32-bit wide "Java slot" definition. This type occurs
aoqi@0 188 * in Java locals, object fields, constant pools, and
aoqi@0 189 * operand stacks (as a CVMStackVal32).
aoqi@0 190 */
aoqi@0 191 typedef union VMSlotVal32 {
aoqi@0 192 VMJavaVal32 j; /* For "Java" values */
aoqi@0 193 address a; /* a return created by jsr or jsr_w */
aoqi@0 194 } VMSlotVal32;
aoqi@0 195
aoqi@0 196
aoqi@0 197 /*
aoqi@0 198 * Generic 32-bit wide stack slot definition.
aoqi@0 199 */
aoqi@0 200 union VMStackVal32 {
aoqi@0 201 VMJavaVal32 j; /* For "Java" values */
aoqi@0 202 VMSlotVal32 s; /* any value from a "slot" or locals[] */
aoqi@0 203 };
aoqi@0 204
aoqi@0 205 inline JavaThread* thread() { return _thread; }
aoqi@0 206
aoqi@0 207 inline address bcp() { return _bcp; }
aoqi@0 208 inline void set_bcp(address new_bcp) { _bcp = new_bcp; }
aoqi@0 209
aoqi@0 210 inline intptr_t* locals() { return _locals; }
aoqi@0 211
aoqi@0 212 inline ConstantPoolCache* constants() { return _constants; }
aoqi@0 213 inline Method* method() { return _method; }
aoqi@0 214 inline DataLayout* mdx() { return _mdx; }
aoqi@0 215 inline void set_mdx(DataLayout *new_mdx) { _mdx = new_mdx; }
aoqi@0 216
aoqi@0 217 inline messages msg() { return _msg; }
aoqi@0 218 inline void set_msg(messages new_msg) { _msg = new_msg; }
aoqi@0 219
aoqi@0 220 inline Method* callee() { return _result._to_call._callee; }
aoqi@0 221 inline void set_callee(Method* new_callee) { _result._to_call._callee = new_callee; }
aoqi@0 222 inline void set_callee_entry_point(address entry) { _result._to_call._callee_entry_point = entry; }
aoqi@0 223 inline void set_osr_buf(address buf) { _result._osr._osr_buf = buf; }
aoqi@0 224 inline void set_osr_entry(address entry) { _result._osr._osr_entry = entry; }
aoqi@0 225 inline int bcp_advance() { return _result._to_call._bcp_advance; }
aoqi@0 226 inline void set_bcp_advance(int count) { _result._to_call._bcp_advance = count; }
aoqi@0 227
aoqi@0 228 inline interpreterState prev() { return _prev_link; }
aoqi@0 229
aoqi@0 230 inline intptr_t* stack() { return _stack; }
aoqi@0 231 inline void set_stack(intptr_t* new_stack) { _stack = new_stack; }
aoqi@0 232
aoqi@0 233
aoqi@0 234 inline intptr_t* stack_base() { return _stack_base; }
aoqi@0 235 inline intptr_t* stack_limit() { return _stack_limit; }
aoqi@0 236
aoqi@0 237 inline BasicObjectLock* monitor_base() { return _monitor_base; }
aoqi@0 238
aoqi@0 239 /*
aoqi@0 240 * 64-bit Arithmetic:
aoqi@0 241 *
aoqi@0 242 * The functions below follow the semantics of the
aoqi@0 243 * ladd, land, ldiv, lmul, lor, lxor, and lrem bytecodes,
aoqi@0 244 * respectively.
aoqi@0 245 */
aoqi@0 246
aoqi@0 247 static jlong VMlongAdd(jlong op1, jlong op2);
aoqi@0 248 static jlong VMlongAnd(jlong op1, jlong op2);
aoqi@0 249 static jlong VMlongDiv(jlong op1, jlong op2);
aoqi@0 250 static jlong VMlongMul(jlong op1, jlong op2);
aoqi@0 251 static jlong VMlongOr (jlong op1, jlong op2);
aoqi@0 252 static jlong VMlongSub(jlong op1, jlong op2);
aoqi@0 253 static jlong VMlongXor(jlong op1, jlong op2);
aoqi@0 254 static jlong VMlongRem(jlong op1, jlong op2);
aoqi@0 255
aoqi@0 256 /*
aoqi@0 257 * Shift:
aoqi@0 258 *
aoqi@0 259 * The functions below follow the semantics of the
aoqi@0 260 * lushr, lshl, and lshr bytecodes, respectively.
aoqi@0 261 */
aoqi@0 262
aoqi@0 263 static jlong VMlongUshr(jlong op1, jint op2);
aoqi@0 264 static jlong VMlongShl (jlong op1, jint op2);
aoqi@0 265 static jlong VMlongShr (jlong op1, jint op2);
aoqi@0 266
aoqi@0 267 /*
aoqi@0 268 * Unary:
aoqi@0 269 *
aoqi@0 270 * Return the negation of "op" (-op), according to
aoqi@0 271 * the semantics of the lneg bytecode.
aoqi@0 272 */
aoqi@0 273
aoqi@0 274 static jlong VMlongNeg(jlong op);
aoqi@0 275
aoqi@0 276 /*
aoqi@0 277 * Return the complement of "op" (~op)
aoqi@0 278 */
aoqi@0 279
aoqi@0 280 static jlong VMlongNot(jlong op);
aoqi@0 281
aoqi@0 282
aoqi@0 283 /*
aoqi@0 284 * Comparisons to 0:
aoqi@0 285 */
aoqi@0 286
aoqi@0 287 static int32_t VMlongLtz(jlong op); /* op <= 0 */
aoqi@0 288 static int32_t VMlongGez(jlong op); /* op >= 0 */
aoqi@0 289 static int32_t VMlongEqz(jlong op); /* op == 0 */
aoqi@0 290
aoqi@0 291 /*
aoqi@0 292 * Between operands:
aoqi@0 293 */
aoqi@0 294
aoqi@0 295 static int32_t VMlongEq(jlong op1, jlong op2); /* op1 == op2 */
aoqi@0 296 static int32_t VMlongNe(jlong op1, jlong op2); /* op1 != op2 */
aoqi@0 297 static int32_t VMlongGe(jlong op1, jlong op2); /* op1 >= op2 */
aoqi@0 298 static int32_t VMlongLe(jlong op1, jlong op2); /* op1 <= op2 */
aoqi@0 299 static int32_t VMlongLt(jlong op1, jlong op2); /* op1 < op2 */
aoqi@0 300 static int32_t VMlongGt(jlong op1, jlong op2); /* op1 > op2 */
aoqi@0 301
aoqi@0 302 /*
aoqi@0 303 * Comparisons (returning an jint value: 0, 1, or -1)
aoqi@0 304 *
aoqi@0 305 * Between operands:
aoqi@0 306 *
aoqi@0 307 * Compare "op1" and "op2" according to the semantics of the
aoqi@0 308 * "lcmp" bytecode.
aoqi@0 309 */
aoqi@0 310
aoqi@0 311 static int32_t VMlongCompare(jlong op1, jlong op2);
aoqi@0 312
aoqi@0 313 /*
aoqi@0 314 * Convert int to long, according to "i2l" bytecode semantics
aoqi@0 315 */
aoqi@0 316 static jlong VMint2Long(jint val);
aoqi@0 317
aoqi@0 318 /*
aoqi@0 319 * Convert long to int, according to "l2i" bytecode semantics
aoqi@0 320 */
aoqi@0 321 static jint VMlong2Int(jlong val);
aoqi@0 322
aoqi@0 323 /*
aoqi@0 324 * Convert long to float, according to "l2f" bytecode semantics
aoqi@0 325 */
aoqi@0 326 static jfloat VMlong2Float(jlong val);
aoqi@0 327
aoqi@0 328 /*
aoqi@0 329 * Convert long to double, according to "l2d" bytecode semantics
aoqi@0 330 */
aoqi@0 331 static jdouble VMlong2Double(jlong val);
aoqi@0 332
aoqi@0 333 /*
aoqi@0 334 * Java floating-point float value manipulation.
aoqi@0 335 *
aoqi@0 336 * The result argument is, once again, an lvalue.
aoqi@0 337 *
aoqi@0 338 * Arithmetic:
aoqi@0 339 *
aoqi@0 340 * The functions below follow the semantics of the
aoqi@0 341 * fadd, fsub, fmul, fdiv, and frem bytecodes,
aoqi@0 342 * respectively.
aoqi@0 343 */
aoqi@0 344
aoqi@0 345 static jfloat VMfloatAdd(jfloat op1, jfloat op2);
aoqi@0 346 static jfloat VMfloatSub(jfloat op1, jfloat op2);
aoqi@0 347 static jfloat VMfloatMul(jfloat op1, jfloat op2);
aoqi@0 348 static jfloat VMfloatDiv(jfloat op1, jfloat op2);
aoqi@0 349 static jfloat VMfloatRem(jfloat op1, jfloat op2);
aoqi@0 350
aoqi@0 351 /*
aoqi@0 352 * Unary:
aoqi@0 353 *
aoqi@0 354 * Return the negation of "op" (-op), according to
aoqi@0 355 * the semantics of the fneg bytecode.
aoqi@0 356 */
aoqi@0 357
aoqi@0 358 static jfloat VMfloatNeg(jfloat op);
aoqi@0 359
aoqi@0 360 /*
aoqi@0 361 * Comparisons (returning an int value: 0, 1, or -1)
aoqi@0 362 *
aoqi@0 363 * Between operands:
aoqi@0 364 *
aoqi@0 365 * Compare "op1" and "op2" according to the semantics of the
aoqi@0 366 * "fcmpl" (direction is -1) or "fcmpg" (direction is 1) bytecodes.
aoqi@0 367 */
aoqi@0 368
aoqi@0 369 static int32_t VMfloatCompare(jfloat op1, jfloat op2,
aoqi@0 370 int32_t direction);
aoqi@0 371 /*
aoqi@0 372 * Conversion:
aoqi@0 373 */
aoqi@0 374
aoqi@0 375 /*
aoqi@0 376 * Convert float to double, according to "f2d" bytecode semantics
aoqi@0 377 */
aoqi@0 378
aoqi@0 379 static jdouble VMfloat2Double(jfloat op);
aoqi@0 380
aoqi@0 381 /*
aoqi@0 382 ******************************************
aoqi@0 383 * Java double floating-point manipulation.
aoqi@0 384 ******************************************
aoqi@0 385 *
aoqi@0 386 * The result argument is, once again, an lvalue.
aoqi@0 387 *
aoqi@0 388 * Conversions:
aoqi@0 389 */
aoqi@0 390
aoqi@0 391 /*
aoqi@0 392 * Convert double to int, according to "d2i" bytecode semantics
aoqi@0 393 */
aoqi@0 394
aoqi@0 395 static jint VMdouble2Int(jdouble val);
aoqi@0 396
aoqi@0 397 /*
aoqi@0 398 * Convert double to float, according to "d2f" bytecode semantics
aoqi@0 399 */
aoqi@0 400
aoqi@0 401 static jfloat VMdouble2Float(jdouble val);
aoqi@0 402
aoqi@0 403 /*
aoqi@0 404 * Convert int to double, according to "i2d" bytecode semantics
aoqi@0 405 */
aoqi@0 406
aoqi@0 407 static jdouble VMint2Double(jint val);
aoqi@0 408
aoqi@0 409 /*
aoqi@0 410 * Arithmetic:
aoqi@0 411 *
aoqi@0 412 * The functions below follow the semantics of the
aoqi@0 413 * dadd, dsub, ddiv, dmul, and drem bytecodes, respectively.
aoqi@0 414 */
aoqi@0 415
aoqi@0 416 static jdouble VMdoubleAdd(jdouble op1, jdouble op2);
aoqi@0 417 static jdouble VMdoubleSub(jdouble op1, jdouble op2);
aoqi@0 418 static jdouble VMdoubleDiv(jdouble op1, jdouble op2);
aoqi@0 419 static jdouble VMdoubleMul(jdouble op1, jdouble op2);
aoqi@0 420 static jdouble VMdoubleRem(jdouble op1, jdouble op2);
aoqi@0 421
aoqi@0 422 /*
aoqi@0 423 * Unary:
aoqi@0 424 *
aoqi@0 425 * Return the negation of "op" (-op), according to
aoqi@0 426 * the semantics of the dneg bytecode.
aoqi@0 427 */
aoqi@0 428
aoqi@0 429 static jdouble VMdoubleNeg(jdouble op);
aoqi@0 430
aoqi@0 431 /*
aoqi@0 432 * Comparisons (returning an int32_t value: 0, 1, or -1)
aoqi@0 433 *
aoqi@0 434 * Between operands:
aoqi@0 435 *
aoqi@0 436 * Compare "op1" and "op2" according to the semantics of the
aoqi@0 437 * "dcmpl" (direction is -1) or "dcmpg" (direction is 1) bytecodes.
aoqi@0 438 */
aoqi@0 439
aoqi@0 440 static int32_t VMdoubleCompare(jdouble op1, jdouble op2, int32_t direction);
aoqi@0 441
aoqi@0 442 /*
aoqi@0 443 * Copy two typeless 32-bit words from one location to another.
aoqi@0 444 * This is semantically equivalent to:
aoqi@0 445 *
aoqi@0 446 * to[0] = from[0];
aoqi@0 447 * to[1] = from[1];
aoqi@0 448 *
aoqi@0 449 * but this interface is provided for those platforms that could
aoqi@0 450 * optimize this into a single 64-bit transfer.
aoqi@0 451 */
aoqi@0 452
aoqi@0 453 static void VMmemCopy64(uint32_t to[2], const uint32_t from[2]);
aoqi@0 454
aoqi@0 455
aoqi@0 456 // Arithmetic operations
aoqi@0 457
aoqi@0 458 /*
aoqi@0 459 * Java arithmetic methods.
aoqi@0 460 * The functions below follow the semantics of the
aoqi@0 461 * iadd, isub, imul, idiv, irem, iand, ior, ixor,
aoqi@0 462 * and ineg bytecodes, respectively.
aoqi@0 463 */
aoqi@0 464
aoqi@0 465 static jint VMintAdd(jint op1, jint op2);
aoqi@0 466 static jint VMintSub(jint op1, jint op2);
aoqi@0 467 static jint VMintMul(jint op1, jint op2);
aoqi@0 468 static jint VMintDiv(jint op1, jint op2);
aoqi@0 469 static jint VMintRem(jint op1, jint op2);
aoqi@0 470 static jint VMintAnd(jint op1, jint op2);
aoqi@0 471 static jint VMintOr (jint op1, jint op2);
aoqi@0 472 static jint VMintXor(jint op1, jint op2);
aoqi@0 473
aoqi@0 474 /*
aoqi@0 475 * Shift Operation:
aoqi@0 476 * The functions below follow the semantics of the
aoqi@0 477 * iushr, ishl, and ishr bytecodes, respectively.
aoqi@0 478 */
aoqi@0 479
aoqi@0 480 static juint VMintUshr(jint op, jint num);
aoqi@0 481 static jint VMintShl (jint op, jint num);
aoqi@0 482 static jint VMintShr (jint op, jint num);
aoqi@0 483
aoqi@0 484 /*
aoqi@0 485 * Unary Operation:
aoqi@0 486 *
aoqi@0 487 * Return the negation of "op" (-op), according to
aoqi@0 488 * the semantics of the ineg bytecode.
aoqi@0 489 */
aoqi@0 490
aoqi@0 491 static jint VMintNeg(jint op);
aoqi@0 492
aoqi@0 493 /*
aoqi@0 494 * Int Conversions:
aoqi@0 495 */
aoqi@0 496
aoqi@0 497 /*
aoqi@0 498 * Convert int to float, according to "i2f" bytecode semantics
aoqi@0 499 */
aoqi@0 500
aoqi@0 501 static jfloat VMint2Float(jint val);
aoqi@0 502
aoqi@0 503 /*
aoqi@0 504 * Convert int to byte, according to "i2b" bytecode semantics
aoqi@0 505 */
aoqi@0 506
aoqi@0 507 static jbyte VMint2Byte(jint val);
aoqi@0 508
aoqi@0 509 /*
aoqi@0 510 * Convert int to char, according to "i2c" bytecode semantics
aoqi@0 511 */
aoqi@0 512
aoqi@0 513 static jchar VMint2Char(jint val);
aoqi@0 514
aoqi@0 515 /*
aoqi@0 516 * Convert int to short, according to "i2s" bytecode semantics
aoqi@0 517 */
aoqi@0 518
aoqi@0 519 static jshort VMint2Short(jint val);
aoqi@0 520
aoqi@0 521 /*=========================================================================
aoqi@0 522 * Bytecode interpreter operations
aoqi@0 523 *=======================================================================*/
aoqi@0 524
aoqi@0 525 static void dup(intptr_t *tos);
aoqi@0 526 static void dup2(intptr_t *tos);
aoqi@0 527 static void dup_x1(intptr_t *tos); /* insert top word two down */
aoqi@0 528 static void dup_x2(intptr_t *tos); /* insert top word three down */
aoqi@0 529 static void dup2_x1(intptr_t *tos); /* insert top 2 slots three down */
aoqi@0 530 static void dup2_x2(intptr_t *tos); /* insert top 2 slots four down */
aoqi@0 531 static void swap(intptr_t *tos); /* swap top two elements */
aoqi@0 532
aoqi@0 533 // umm don't like this method modifies its object
aoqi@0 534
aoqi@0 535 // The Interpreter used when
aoqi@0 536 static void run(interpreterState istate);
aoqi@0 537 // The interpreter used if JVMTI needs interpreter events
aoqi@0 538 static void runWithChecks(interpreterState istate);
aoqi@0 539 static void End_Of_Interpreter(void);
aoqi@0 540
aoqi@0 541 // Inline static functions for Java Stack and Local manipulation
aoqi@0 542
aoqi@0 543 static address stack_slot(intptr_t *tos, int offset);
aoqi@0 544 static jint stack_int(intptr_t *tos, int offset);
aoqi@0 545 static jfloat stack_float(intptr_t *tos, int offset);
aoqi@0 546 static oop stack_object(intptr_t *tos, int offset);
aoqi@0 547 static jdouble stack_double(intptr_t *tos, int offset);
aoqi@0 548 static jlong stack_long(intptr_t *tos, int offset);
aoqi@0 549
aoqi@0 550 // only used for value types
aoqi@0 551 static void set_stack_slot(intptr_t *tos, address value, int offset);
aoqi@0 552 static void set_stack_int(intptr_t *tos, int value, int offset);
aoqi@0 553 static void set_stack_float(intptr_t *tos, jfloat value, int offset);
aoqi@0 554 static void set_stack_object(intptr_t *tos, oop value, int offset);
aoqi@0 555
aoqi@0 556 // needs to be platform dep for the 32 bit platforms.
aoqi@0 557 static void set_stack_double(intptr_t *tos, jdouble value, int offset);
aoqi@0 558 static void set_stack_long(intptr_t *tos, jlong value, int offset);
aoqi@0 559
aoqi@0 560 static void set_stack_double_from_addr(intptr_t *tos, address addr, int offset);
aoqi@0 561 static void set_stack_long_from_addr(intptr_t *tos, address addr, int offset);
aoqi@0 562
aoqi@0 563 // Locals
aoqi@0 564
aoqi@0 565 static address locals_slot(intptr_t* locals, int offset);
aoqi@0 566 static jint locals_int(intptr_t* locals, int offset);
aoqi@0 567 static jfloat locals_float(intptr_t* locals, int offset);
aoqi@0 568 static oop locals_object(intptr_t* locals, int offset);
aoqi@0 569 static jdouble locals_double(intptr_t* locals, int offset);
aoqi@0 570 static jlong locals_long(intptr_t* locals, int offset);
aoqi@0 571
aoqi@0 572 static address locals_long_at(intptr_t* locals, int offset);
aoqi@0 573 static address locals_double_at(intptr_t* locals, int offset);
aoqi@0 574
aoqi@0 575 static void set_locals_slot(intptr_t *locals, address value, int offset);
aoqi@0 576 static void set_locals_int(intptr_t *locals, jint value, int offset);
aoqi@0 577 static void set_locals_float(intptr_t *locals, jfloat value, int offset);
aoqi@0 578 static void set_locals_object(intptr_t *locals, oop value, int offset);
aoqi@0 579 static void set_locals_double(intptr_t *locals, jdouble value, int offset);
aoqi@0 580 static void set_locals_long(intptr_t *locals, jlong value, int offset);
aoqi@0 581 static void set_locals_double_from_addr(intptr_t *locals,
aoqi@0 582 address addr, int offset);
aoqi@0 583 static void set_locals_long_from_addr(intptr_t *locals,
aoqi@0 584 address addr, int offset);
aoqi@0 585
aoqi@0 586 static void astore(intptr_t* topOfStack, int stack_offset,
aoqi@0 587 intptr_t* locals, int locals_offset);
aoqi@0 588
aoqi@0 589 // Support for dup and swap
aoqi@0 590 static void copy_stack_slot(intptr_t *tos, int from_offset, int to_offset);
aoqi@0 591
aoqi@0 592 #ifndef PRODUCT
aoqi@0 593 static const char* C_msg(BytecodeInterpreter::messages msg);
aoqi@0 594 void print();
aoqi@0 595 #endif // PRODUCT
aoqi@0 596
aoqi@0 597 // Platform fields/methods
aoqi@0 598 #ifdef TARGET_ARCH_x86
aoqi@0 599 # include "bytecodeInterpreter_x86.hpp"
aoqi@0 600 #endif
aoqi@1 601 #ifdef TARGET_ARCH_mips
aoqi@1 602 # include "bytecodeInterpreter_mips.hpp"
aoqi@1 603 #endif
aoqi@0 604 #ifdef TARGET_ARCH_sparc
aoqi@0 605 # include "bytecodeInterpreter_sparc.hpp"
aoqi@0 606 #endif
aoqi@0 607 #ifdef TARGET_ARCH_zero
aoqi@0 608 # include "bytecodeInterpreter_zero.hpp"
aoqi@0 609 #endif
aoqi@0 610 #ifdef TARGET_ARCH_arm
aoqi@0 611 # include "bytecodeInterpreter_arm.hpp"
aoqi@0 612 #endif
aoqi@0 613 #ifdef TARGET_ARCH_ppc
aoqi@0 614 # include "bytecodeInterpreter_ppc.hpp"
aoqi@0 615 #endif
aoqi@0 616
aoqi@0 617
aoqi@0 618 }; // BytecodeInterpreter
aoqi@0 619
aoqi@0 620 #endif // CC_INTERP
aoqi@0 621
aoqi@0 622 #endif // SHARE_VM_INTERPRETER_BYTECODEINTERPRETER_HPP

mercurial