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