author | hseigel |
Mon, 16 Dec 2013 08:24:33 -0500 | |
changeset 22232 | 26acfad336c0 |
parent 13728 | 882756847a04 |
child 25715 | d5a8dbdc5150 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
2 |
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
1 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4567
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4567
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:
4567
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#ifndef SHARE_VM_INTERPRETER_BYTECODE_HPP |
26 |
#define SHARE_VM_INTERPRETER_BYTECODE_HPP |
|
27 |
||
28 |
#include "interpreter/bytecodes.hpp" |
|
29 |
#include "memory/allocation.hpp" |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
30 |
#include "oops/method.hpp" |
7397 | 31 |
#ifdef TARGET_ARCH_x86 |
32 |
# include "bytes_x86.hpp" |
|
33 |
#endif |
|
34 |
#ifdef TARGET_ARCH_sparc |
|
35 |
# include "bytes_sparc.hpp" |
|
36 |
#endif |
|
37 |
#ifdef TARGET_ARCH_zero |
|
38 |
# include "bytes_zero.hpp" |
|
39 |
#endif |
|
8107
78e5bd944384
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
8076
diff
changeset
|
40 |
#ifdef TARGET_ARCH_arm |
78e5bd944384
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
8076
diff
changeset
|
41 |
# include "bytes_arm.hpp" |
78e5bd944384
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
8076
diff
changeset
|
42 |
#endif |
78e5bd944384
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
8076
diff
changeset
|
43 |
#ifdef TARGET_ARCH_ppc |
78e5bd944384
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
8076
diff
changeset
|
44 |
# include "bytes_ppc.hpp" |
78e5bd944384
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
8076
diff
changeset
|
45 |
#endif |
7397 | 46 |
|
7913 | 47 |
class ciBytecodeStream; |
48 |
||
49 |
// The base class for different kinds of bytecode abstractions. |
|
50 |
// Provides the primitive operations to manipulate code relative |
|
51 |
// to the bcp. |
|
1 | 52 |
|
7913 | 53 |
class Bytecode: public StackObj { |
54 |
protected: |
|
55 |
const address _bcp; |
|
56 |
const Bytecodes::Code _code; |
|
57 |
||
1 | 58 |
// Address computation |
7913 | 59 |
address addr_at (int offset) const { return (address)_bcp + offset; } |
60 |
u_char byte_at(int offset) const { return *addr_at(offset); } |
|
1 | 61 |
address aligned_addr_at (int offset) const { return (address)round_to((intptr_t)addr_at(offset), jintSize); } |
62 |
int aligned_offset (int offset) const { return aligned_addr_at(offset) - addr_at(0); } |
|
63 |
||
5688 | 64 |
// Word access: |
65 |
int get_Java_u2_at (int offset) const { return Bytes::get_Java_u2(addr_at(offset)); } |
|
66 |
int get_Java_u4_at (int offset) const { return Bytes::get_Java_u4(addr_at(offset)); } |
|
67 |
int get_native_u2_at (int offset) const { return Bytes::get_native_u2(addr_at(offset)); } |
|
68 |
int get_native_u4_at (int offset) const { return Bytes::get_native_u4(addr_at(offset)); } |
|
1 | 69 |
|
70 |
public: |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
71 |
Bytecode(Method* method, address bcp): _bcp(bcp), _code(Bytecodes::code_at(method, addr_at(0))) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
72 |
assert(method != NULL, "this form requires a valid Method*"); |
7913 | 73 |
} |
74 |
// Defined in ciStreams.hpp |
|
75 |
inline Bytecode(const ciBytecodeStream* stream, address bcp = NULL); |
|
1 | 76 |
|
7913 | 77 |
// Attributes |
78 |
address bcp() const { return _bcp; } |
|
79 |
int instruction_size() const { return Bytecodes::length_for_code_at(_code, bcp()); } |
|
80 |
||
81 |
Bytecodes::Code code() const { return _code; } |
|
1 | 82 |
Bytecodes::Code java_code() const { return Bytecodes::java_code(code()); } |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10979
diff
changeset
|
83 |
Bytecodes::Code invoke_code() const { return (code() == Bytecodes::_invokehandle) ? code() : java_code(); } |
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
84 |
|
5688 | 85 |
// Static functions for parsing bytecodes in place. |
86 |
int get_index_u1(Bytecodes::Code bc) const { |
|
87 |
assert_same_format_as(bc); assert_index_size(1, bc); |
|
88 |
return *(jubyte*)addr_at(1); |
|
89 |
} |
|
90 |
int get_index_u2(Bytecodes::Code bc, bool is_wide = false) const { |
|
91 |
assert_same_format_as(bc, is_wide); assert_index_size(2, bc, is_wide); |
|
92 |
address p = addr_at(is_wide ? 2 : 1); |
|
93 |
if (can_use_native_byte_order(bc, is_wide)) |
|
7913 | 94 |
return Bytes::get_native_u2(p); |
5688 | 95 |
else return Bytes::get_Java_u2(p); |
96 |
} |
|
5882 | 97 |
int get_index_u1_cpcache(Bytecodes::Code bc) const { |
98 |
assert_same_format_as(bc); assert_index_size(1, bc); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
99 |
return *(jubyte*)addr_at(1) + ConstantPool::CPCACHE_INDEX_TAG; |
5882 | 100 |
} |
5688 | 101 |
int get_index_u2_cpcache(Bytecodes::Code bc) const { |
102 |
assert_same_format_as(bc); assert_index_size(2, bc); assert_native_index(bc); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
103 |
return Bytes::get_native_u2(addr_at(1)) + ConstantPool::CPCACHE_INDEX_TAG; |
5688 | 104 |
} |
105 |
int get_index_u4(Bytecodes::Code bc) const { |
|
106 |
assert_same_format_as(bc); assert_index_size(4, bc); |
|
107 |
assert(can_use_native_byte_order(bc), ""); |
|
108 |
return Bytes::get_native_u4(addr_at(1)); |
|
109 |
} |
|
110 |
bool has_index_u4(Bytecodes::Code bc) const { |
|
111 |
return bc == Bytecodes::_invokedynamic; |
|
112 |
} |
|
113 |
||
114 |
int get_offset_s2(Bytecodes::Code bc) const { |
|
115 |
assert_same_format_as(bc); assert_offset_size(2, bc); |
|
116 |
return (jshort) Bytes::get_Java_u2(addr_at(1)); |
|
117 |
} |
|
118 |
int get_offset_s4(Bytecodes::Code bc) const { |
|
119 |
assert_same_format_as(bc); assert_offset_size(4, bc); |
|
120 |
return (jint) Bytes::get_Java_u4(addr_at(1)); |
|
121 |
} |
|
122 |
||
123 |
int get_constant_u1(int offset, Bytecodes::Code bc) const { |
|
124 |
assert_same_format_as(bc); assert_constant_size(1, offset, bc); |
|
125 |
return *(jbyte*)addr_at(offset); |
|
126 |
} |
|
127 |
int get_constant_u2(int offset, Bytecodes::Code bc, bool is_wide = false) const { |
|
128 |
assert_same_format_as(bc, is_wide); assert_constant_size(2, offset, bc, is_wide); |
|
129 |
return (jshort) Bytes::get_Java_u2(addr_at(offset)); |
|
130 |
} |
|
131 |
||
132 |
// These are used locally and also from bytecode streams. |
|
133 |
void assert_same_format_as(Bytecodes::Code testbc, bool is_wide = false) const NOT_DEBUG_RETURN; |
|
134 |
static void assert_index_size(int required_size, Bytecodes::Code bc, bool is_wide = false) NOT_DEBUG_RETURN; |
|
135 |
static void assert_offset_size(int required_size, Bytecodes::Code bc, bool is_wide = false) NOT_DEBUG_RETURN; |
|
136 |
static void assert_constant_size(int required_size, int where, Bytecodes::Code bc, bool is_wide = false) NOT_DEBUG_RETURN; |
|
137 |
static void assert_native_index(Bytecodes::Code bc, bool is_wide = false) NOT_DEBUG_RETURN; |
|
138 |
static bool can_use_native_byte_order(Bytecodes::Code bc, bool is_wide = false) { |
|
139 |
return (!Bytes::is_Java_byte_ordering_different() || Bytecodes::native_byte_order(bc /*, is_wide*/)); |
|
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
140 |
} |
1 | 141 |
}; |
142 |
||
143 |
||
144 |
// Abstractions for lookupswitch bytecode |
|
7913 | 145 |
class LookupswitchPair VALUE_OBJ_CLASS_SPEC { |
1 | 146 |
private: |
7913 | 147 |
const address _bcp; |
148 |
||
149 |
address addr_at (int offset) const { return _bcp + offset; } |
|
150 |
int get_Java_u4_at (int offset) const { return Bytes::get_Java_u4(addr_at(offset)); } |
|
1 | 151 |
|
152 |
public: |
|
7913 | 153 |
LookupswitchPair(address bcp): _bcp(bcp) {} |
5688 | 154 |
int match() const { return get_Java_u4_at(0 * jintSize); } |
155 |
int offset() const { return get_Java_u4_at(1 * jintSize); } |
|
1 | 156 |
}; |
157 |
||
158 |
||
159 |
class Bytecode_lookupswitch: public Bytecode { |
|
160 |
public: |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
161 |
Bytecode_lookupswitch(Method* method, address bcp): Bytecode(method, bcp) { verify(); } |
7913 | 162 |
// Defined in ciStreams.hpp |
163 |
inline Bytecode_lookupswitch(const ciBytecodeStream* stream); |
|
1 | 164 |
void verify() const PRODUCT_RETURN; |
165 |
||
166 |
// Attributes |
|
5688 | 167 |
int default_offset() const { return get_Java_u4_at(aligned_offset(1 + 0*jintSize)); } |
168 |
int number_of_pairs() const { return get_Java_u4_at(aligned_offset(1 + 1*jintSize)); } |
|
7913 | 169 |
LookupswitchPair pair_at(int i) const { |
170 |
assert(0 <= i && i < number_of_pairs(), "pair index out of bounds"); |
|
171 |
return LookupswitchPair(aligned_addr_at(1 + (1 + i)*2*jintSize)); |
|
172 |
} |
|
1 | 173 |
}; |
174 |
||
175 |
class Bytecode_tableswitch: public Bytecode { |
|
176 |
public: |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
177 |
Bytecode_tableswitch(Method* method, address bcp): Bytecode(method, bcp) { verify(); } |
7913 | 178 |
// Defined in ciStreams.hpp |
179 |
inline Bytecode_tableswitch(const ciBytecodeStream* stream); |
|
1 | 180 |
void verify() const PRODUCT_RETURN; |
181 |
||
182 |
// Attributes |
|
5688 | 183 |
int default_offset() const { return get_Java_u4_at(aligned_offset(1 + 0*jintSize)); } |
184 |
int low_key() const { return get_Java_u4_at(aligned_offset(1 + 1*jintSize)); } |
|
185 |
int high_key() const { return get_Java_u4_at(aligned_offset(1 + 2*jintSize)); } |
|
1 | 186 |
int dest_offset_at(int i) const; |
187 |
int length() { return high_key()-low_key()+1; } |
|
188 |
}; |
|
189 |
||
5882 | 190 |
// Common code for decoding invokes and field references. |
1 | 191 |
|
7913 | 192 |
class Bytecode_member_ref: public Bytecode { |
1 | 193 |
protected: |
7913 | 194 |
const methodHandle _method; // method containing the bytecode |
1 | 195 |
|
7913 | 196 |
Bytecode_member_ref(methodHandle method, int bci) : Bytecode(method(), method()->bcp_from(bci)), _method(method) {} |
197 |
||
198 |
methodHandle method() const { return _method; } |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
199 |
ConstantPool* constants() const { return _method->constants(); } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
200 |
ConstantPoolCache* cpcache() const { return _method->constants()->cache(); } |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10979
diff
changeset
|
201 |
ConstantPoolCacheEntry* cpcache_entry() const; |
5882 | 202 |
|
203 |
public: |
|
204 |
int index() const; // cache index (loaded from instruction) |
|
205 |
int pool_index() const; // constant pool index |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10979
diff
changeset
|
206 |
Symbol* klass() const; // returns the klass of the method or field |
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7913
diff
changeset
|
207 |
Symbol* name() const; // returns the name of the method or field |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7913
diff
changeset
|
208 |
Symbol* signature() const; // returns the signature of the method or field |
5882 | 209 |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7913
diff
changeset
|
210 |
BasicType result_type() const; // returns the result type of the getfield or invoke |
5882 | 211 |
}; |
212 |
||
213 |
// Abstraction for invoke_{virtual, static, interface, special} |
|
214 |
||
215 |
class Bytecode_invoke: public Bytecode_member_ref { |
|
216 |
protected: |
|
7913 | 217 |
// Constructor that skips verification |
218 |
Bytecode_invoke(methodHandle method, int bci, bool unused) : Bytecode_member_ref(method, bci) {} |
|
1 | 219 |
|
220 |
public: |
|
7913 | 221 |
Bytecode_invoke(methodHandle method, int bci) : Bytecode_member_ref(method, bci) { verify(); } |
1 | 222 |
void verify() const; |
223 |
||
224 |
// Attributes |
|
225 |
methodHandle static_target(TRAPS); // "specified" method (from constant pool) |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10979
diff
changeset
|
226 |
Handle appendix(TRAPS); // if CPCE::has_appendix (from constant pool) |
1 | 227 |
|
228 |
// Testers |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10979
diff
changeset
|
229 |
bool is_invokeinterface() const { return invoke_code() == Bytecodes::_invokeinterface; } |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10979
diff
changeset
|
230 |
bool is_invokevirtual() const { return invoke_code() == Bytecodes::_invokevirtual; } |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10979
diff
changeset
|
231 |
bool is_invokestatic() const { return invoke_code() == Bytecodes::_invokestatic; } |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10979
diff
changeset
|
232 |
bool is_invokespecial() const { return invoke_code() == Bytecodes::_invokespecial; } |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10979
diff
changeset
|
233 |
bool is_invokedynamic() const { return invoke_code() == Bytecodes::_invokedynamic; } |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10979
diff
changeset
|
234 |
bool is_invokehandle() const { return invoke_code() == Bytecodes::_invokehandle; } |
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
235 |
|
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4564
diff
changeset
|
236 |
bool has_receiver() const { return !is_invokestatic() && !is_invokedynamic(); } |
1 | 237 |
|
238 |
bool is_valid() const { return is_invokeinterface() || |
|
239 |
is_invokevirtual() || |
|
240 |
is_invokestatic() || |
|
4564
55dfb20908d0
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
3261
diff
changeset
|
241 |
is_invokespecial() || |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10979
diff
changeset
|
242 |
is_invokedynamic() || |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10979
diff
changeset
|
243 |
is_invokehandle(); } |
1 | 244 |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10979
diff
changeset
|
245 |
bool has_appendix() { return cpcache_entry()->has_appendix(); } |
10979
c25dd872c62f
7106774: JSR 292: nightly test inlineMHTarget fails with wrong result
twisti
parents:
8107
diff
changeset
|
246 |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10979
diff
changeset
|
247 |
private: |
7913 | 248 |
// Helper to skip verification. Used is_valid() to check if the result is really an invoke |
249 |
inline friend Bytecode_invoke Bytecode_invoke_check(methodHandle method, int bci); |
|
1 | 250 |
}; |
251 |
||
7913 | 252 |
inline Bytecode_invoke Bytecode_invoke_check(methodHandle method, int bci) { |
253 |
return Bytecode_invoke(method, bci, false); |
|
1 | 254 |
} |
255 |
||
256 |
||
5882 | 257 |
// Abstraction for all field accesses (put/get field/static) |
258 |
class Bytecode_field: public Bytecode_member_ref { |
|
7913 | 259 |
public: |
260 |
Bytecode_field(methodHandle method, int bci) : Bytecode_member_ref(method, bci) { verify(); } |
|
5882 | 261 |
|
262 |
// Testers |
|
263 |
bool is_getfield() const { return java_code() == Bytecodes::_getfield; } |
|
264 |
bool is_putfield() const { return java_code() == Bytecodes::_putfield; } |
|
265 |
bool is_getstatic() const { return java_code() == Bytecodes::_getstatic; } |
|
266 |
bool is_putstatic() const { return java_code() == Bytecodes::_putstatic; } |
|
267 |
||
268 |
bool is_getter() const { return is_getfield() || is_getstatic(); } |
|
269 |
bool is_static() const { return is_getstatic() || is_putstatic(); } |
|
270 |
||
271 |
bool is_valid() const { return is_getfield() || |
|
272 |
is_putfield() || |
|
273 |
is_getstatic() || |
|
274 |
is_putstatic(); } |
|
1 | 275 |
void verify() const; |
276 |
}; |
|
277 |
||
278 |
// Abstraction for checkcast |
|
279 |
class Bytecode_checkcast: public Bytecode { |
|
280 |
public: |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
281 |
Bytecode_checkcast(Method* method, address bcp): Bytecode(method, bcp) { verify(); } |
1 | 282 |
void verify() const { assert(Bytecodes::java_code(code()) == Bytecodes::_checkcast, "check checkcast"); } |
283 |
||
284 |
// Returns index |
|
5688 | 285 |
long index() const { return get_index_u2(Bytecodes::_checkcast); }; |
1 | 286 |
}; |
287 |
||
288 |
// Abstraction for instanceof |
|
289 |
class Bytecode_instanceof: public Bytecode { |
|
290 |
public: |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
291 |
Bytecode_instanceof(Method* method, address bcp): Bytecode(method, bcp) { verify(); } |
1 | 292 |
void verify() const { assert(code() == Bytecodes::_instanceof, "check instanceof"); } |
293 |
||
294 |
// Returns index |
|
5688 | 295 |
long index() const { return get_index_u2(Bytecodes::_instanceof); }; |
1 | 296 |
}; |
297 |
||
298 |
class Bytecode_new: public Bytecode { |
|
299 |
public: |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
300 |
Bytecode_new(Method* method, address bcp): Bytecode(method, bcp) { verify(); } |
1 | 301 |
void verify() const { assert(java_code() == Bytecodes::_new, "check new"); } |
302 |
||
303 |
// Returns index |
|
5688 | 304 |
long index() const { return get_index_u2(Bytecodes::_new); }; |
1 | 305 |
}; |
306 |
||
307 |
class Bytecode_multianewarray: public Bytecode { |
|
308 |
public: |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
309 |
Bytecode_multianewarray(Method* method, address bcp): Bytecode(method, bcp) { verify(); } |
1 | 310 |
void verify() const { assert(java_code() == Bytecodes::_multianewarray, "check new"); } |
311 |
||
312 |
// Returns index |
|
5688 | 313 |
long index() const { return get_index_u2(Bytecodes::_multianewarray); }; |
1 | 314 |
}; |
315 |
||
316 |
class Bytecode_anewarray: public Bytecode { |
|
317 |
public: |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
318 |
Bytecode_anewarray(Method* method, address bcp): Bytecode(method, bcp) { verify(); } |
1 | 319 |
void verify() const { assert(java_code() == Bytecodes::_anewarray, "check anewarray"); } |
320 |
||
321 |
// Returns index |
|
5688 | 322 |
long index() const { return get_index_u2(Bytecodes::_anewarray); }; |
1 | 323 |
}; |
324 |
||
325 |
// Abstraction for ldc, ldc_w and ldc2_w |
|
7913 | 326 |
class Bytecode_loadconstant: public Bytecode { |
5882 | 327 |
private: |
7913 | 328 |
const methodHandle _method; |
5882 | 329 |
|
330 |
int raw_index() const; |
|
331 |
||
1 | 332 |
public: |
7913 | 333 |
Bytecode_loadconstant(methodHandle method, int bci): Bytecode(method(), method->bcp_from(bci)), _method(method) { verify(); } |
5882 | 334 |
|
1 | 335 |
void verify() const { |
5882 | 336 |
assert(_method.not_null(), "must supply method"); |
1 | 337 |
Bytecodes::Code stdc = Bytecodes::java_code(code()); |
338 |
assert(stdc == Bytecodes::_ldc || |
|
339 |
stdc == Bytecodes::_ldc_w || |
|
340 |
stdc == Bytecodes::_ldc2_w, "load constant"); |
|
341 |
} |
|
342 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
343 |
// Only non-standard bytecodes (fast_aldc) have reference cache indexes. |
5882 | 344 |
bool has_cache_index() const { return code() >= Bytecodes::number_of_java_codes; } |
1 | 345 |
|
5882 | 346 |
int pool_index() const; // index into constant pool |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
347 |
int cache_index() const { // index into reference cache (or -1 if none) |
5882 | 348 |
return has_cache_index() ? raw_index() : -1; |
349 |
} |
|
350 |
||
351 |
BasicType result_type() const; // returns the result type of the ldc |
|
352 |
||
353 |
oop resolve_constant(TRAPS) const; |
|
1 | 354 |
}; |
355 |
||
7397 | 356 |
#endif // SHARE_VM_INTERPRETER_BYTECODE_HPP |