annotate src/share/vm/interpreter/bytecodeInterpreter.hpp @ 6862:8a5ea0a9ccc4

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