author | psandoz |
Thu, 24 Mar 2016 11:21:49 +0100 | |
changeset 36819 | bca375d368ed |
parent 33593 | 60764a78fa5c |
child 43458 | 61ab1daf0fc8 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
33593
60764a78fa5c
8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents:
25715
diff
changeset
|
2 |
* Copyright (c) 1997, 2015, 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" |
25715
d5a8dbdc5150
8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents:
13728
diff
changeset
|
31 |
#include "utilities/bytes.hpp" |
7397 | 32 |
|
7913 | 33 |
class ciBytecodeStream; |
34 |
||
35 |
// The base class for different kinds of bytecode abstractions. |
|
36 |
// Provides the primitive operations to manipulate code relative |
|
37 |
// to the bcp. |
|
1 | 38 |
|
7913 | 39 |
class Bytecode: public StackObj { |
40 |
protected: |
|
41 |
const address _bcp; |
|
42 |
const Bytecodes::Code _code; |
|
43 |
||
1 | 44 |
// Address computation |
7913 | 45 |
address addr_at (int offset) const { return (address)_bcp + offset; } |
46 |
u_char byte_at(int offset) const { return *addr_at(offset); } |
|
1 | 47 |
address aligned_addr_at (int offset) const { return (address)round_to((intptr_t)addr_at(offset), jintSize); } |
48 |
int aligned_offset (int offset) const { return aligned_addr_at(offset) - addr_at(0); } |
|
49 |
||
5688 | 50 |
// Word access: |
51 |
int get_Java_u2_at (int offset) const { return Bytes::get_Java_u2(addr_at(offset)); } |
|
52 |
int get_Java_u4_at (int offset) const { return Bytes::get_Java_u4(addr_at(offset)); } |
|
53 |
int get_native_u2_at (int offset) const { return Bytes::get_native_u2(addr_at(offset)); } |
|
54 |
int get_native_u4_at (int offset) const { return Bytes::get_native_u4(addr_at(offset)); } |
|
1 | 55 |
|
56 |
public: |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
57 |
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
|
58 |
assert(method != NULL, "this form requires a valid Method*"); |
7913 | 59 |
} |
60 |
// Defined in ciStreams.hpp |
|
61 |
inline Bytecode(const ciBytecodeStream* stream, address bcp = NULL); |
|
1 | 62 |
|
7913 | 63 |
// Attributes |
64 |
address bcp() const { return _bcp; } |
|
65 |
int instruction_size() const { return Bytecodes::length_for_code_at(_code, bcp()); } |
|
66 |
||
67 |
Bytecodes::Code code() const { return _code; } |
|
1 | 68 |
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
|
69 |
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
|
70 |
|
5688 | 71 |
// Static functions for parsing bytecodes in place. |
72 |
int get_index_u1(Bytecodes::Code bc) const { |
|
73 |
assert_same_format_as(bc); assert_index_size(1, bc); |
|
74 |
return *(jubyte*)addr_at(1); |
|
75 |
} |
|
76 |
int get_index_u2(Bytecodes::Code bc, bool is_wide = false) const { |
|
77 |
assert_same_format_as(bc, is_wide); assert_index_size(2, bc, is_wide); |
|
78 |
address p = addr_at(is_wide ? 2 : 1); |
|
79 |
if (can_use_native_byte_order(bc, is_wide)) |
|
7913 | 80 |
return Bytes::get_native_u2(p); |
5688 | 81 |
else return Bytes::get_Java_u2(p); |
82 |
} |
|
5882 | 83 |
int get_index_u1_cpcache(Bytecodes::Code bc) const { |
84 |
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
|
85 |
return *(jubyte*)addr_at(1) + ConstantPool::CPCACHE_INDEX_TAG; |
5882 | 86 |
} |
5688 | 87 |
int get_index_u2_cpcache(Bytecodes::Code bc) const { |
88 |
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
|
89 |
return Bytes::get_native_u2(addr_at(1)) + ConstantPool::CPCACHE_INDEX_TAG; |
5688 | 90 |
} |
91 |
int get_index_u4(Bytecodes::Code bc) const { |
|
92 |
assert_same_format_as(bc); assert_index_size(4, bc); |
|
93 |
assert(can_use_native_byte_order(bc), ""); |
|
94 |
return Bytes::get_native_u4(addr_at(1)); |
|
95 |
} |
|
96 |
bool has_index_u4(Bytecodes::Code bc) const { |
|
97 |
return bc == Bytecodes::_invokedynamic; |
|
98 |
} |
|
99 |
||
100 |
int get_offset_s2(Bytecodes::Code bc) const { |
|
101 |
assert_same_format_as(bc); assert_offset_size(2, bc); |
|
102 |
return (jshort) Bytes::get_Java_u2(addr_at(1)); |
|
103 |
} |
|
104 |
int get_offset_s4(Bytecodes::Code bc) const { |
|
105 |
assert_same_format_as(bc); assert_offset_size(4, bc); |
|
106 |
return (jint) Bytes::get_Java_u4(addr_at(1)); |
|
107 |
} |
|
108 |
||
109 |
int get_constant_u1(int offset, Bytecodes::Code bc) const { |
|
110 |
assert_same_format_as(bc); assert_constant_size(1, offset, bc); |
|
111 |
return *(jbyte*)addr_at(offset); |
|
112 |
} |
|
113 |
int get_constant_u2(int offset, Bytecodes::Code bc, bool is_wide = false) const { |
|
114 |
assert_same_format_as(bc, is_wide); assert_constant_size(2, offset, bc, is_wide); |
|
115 |
return (jshort) Bytes::get_Java_u2(addr_at(offset)); |
|
116 |
} |
|
117 |
||
118 |
// These are used locally and also from bytecode streams. |
|
119 |
void assert_same_format_as(Bytecodes::Code testbc, bool is_wide = false) const NOT_DEBUG_RETURN; |
|
120 |
static void assert_index_size(int required_size, Bytecodes::Code bc, bool is_wide = false) NOT_DEBUG_RETURN; |
|
121 |
static void assert_offset_size(int required_size, Bytecodes::Code bc, bool is_wide = false) NOT_DEBUG_RETURN; |
|
122 |
static void assert_constant_size(int required_size, int where, Bytecodes::Code bc, bool is_wide = false) NOT_DEBUG_RETURN; |
|
123 |
static void assert_native_index(Bytecodes::Code bc, bool is_wide = false) NOT_DEBUG_RETURN; |
|
124 |
static bool can_use_native_byte_order(Bytecodes::Code bc, bool is_wide = false) { |
|
125 |
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
|
126 |
} |
1 | 127 |
}; |
128 |
||
129 |
||
130 |
// Abstractions for lookupswitch bytecode |
|
7913 | 131 |
class LookupswitchPair VALUE_OBJ_CLASS_SPEC { |
1 | 132 |
private: |
7913 | 133 |
const address _bcp; |
134 |
||
135 |
address addr_at (int offset) const { return _bcp + offset; } |
|
136 |
int get_Java_u4_at (int offset) const { return Bytes::get_Java_u4(addr_at(offset)); } |
|
1 | 137 |
|
138 |
public: |
|
7913 | 139 |
LookupswitchPair(address bcp): _bcp(bcp) {} |
5688 | 140 |
int match() const { return get_Java_u4_at(0 * jintSize); } |
141 |
int offset() const { return get_Java_u4_at(1 * jintSize); } |
|
1 | 142 |
}; |
143 |
||
144 |
||
145 |
class Bytecode_lookupswitch: public Bytecode { |
|
146 |
public: |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
147 |
Bytecode_lookupswitch(Method* method, address bcp): Bytecode(method, bcp) { verify(); } |
7913 | 148 |
// Defined in ciStreams.hpp |
149 |
inline Bytecode_lookupswitch(const ciBytecodeStream* stream); |
|
1 | 150 |
void verify() const PRODUCT_RETURN; |
151 |
||
152 |
// Attributes |
|
5688 | 153 |
int default_offset() const { return get_Java_u4_at(aligned_offset(1 + 0*jintSize)); } |
154 |
int number_of_pairs() const { return get_Java_u4_at(aligned_offset(1 + 1*jintSize)); } |
|
7913 | 155 |
LookupswitchPair pair_at(int i) const { |
156 |
assert(0 <= i && i < number_of_pairs(), "pair index out of bounds"); |
|
157 |
return LookupswitchPair(aligned_addr_at(1 + (1 + i)*2*jintSize)); |
|
158 |
} |
|
1 | 159 |
}; |
160 |
||
161 |
class Bytecode_tableswitch: public Bytecode { |
|
162 |
public: |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
163 |
Bytecode_tableswitch(Method* method, address bcp): Bytecode(method, bcp) { verify(); } |
7913 | 164 |
// Defined in ciStreams.hpp |
165 |
inline Bytecode_tableswitch(const ciBytecodeStream* stream); |
|
1 | 166 |
void verify() const PRODUCT_RETURN; |
167 |
||
168 |
// Attributes |
|
5688 | 169 |
int default_offset() const { return get_Java_u4_at(aligned_offset(1 + 0*jintSize)); } |
170 |
int low_key() const { return get_Java_u4_at(aligned_offset(1 + 1*jintSize)); } |
|
171 |
int high_key() const { return get_Java_u4_at(aligned_offset(1 + 2*jintSize)); } |
|
1 | 172 |
int dest_offset_at(int i) const; |
173 |
int length() { return high_key()-low_key()+1; } |
|
174 |
}; |
|
175 |
||
5882 | 176 |
// Common code for decoding invokes and field references. |
1 | 177 |
|
7913 | 178 |
class Bytecode_member_ref: public Bytecode { |
1 | 179 |
protected: |
7913 | 180 |
const methodHandle _method; // method containing the bytecode |
1 | 181 |
|
33593
60764a78fa5c
8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents:
25715
diff
changeset
|
182 |
Bytecode_member_ref(const methodHandle& method, int bci) : Bytecode(method(), method()->bcp_from(bci)), _method(method) {} |
7913 | 183 |
|
184 |
methodHandle method() const { return _method; } |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
185 |
ConstantPool* constants() const { return _method->constants(); } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
186 |
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
|
187 |
ConstantPoolCacheEntry* cpcache_entry() const; |
5882 | 188 |
|
189 |
public: |
|
190 |
int index() const; // cache index (loaded from instruction) |
|
191 |
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
|
192 |
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
|
193 |
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
|
194 |
Symbol* signature() const; // returns the signature of the method or field |
5882 | 195 |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7913
diff
changeset
|
196 |
BasicType result_type() const; // returns the result type of the getfield or invoke |
5882 | 197 |
}; |
198 |
||
199 |
// Abstraction for invoke_{virtual, static, interface, special} |
|
200 |
||
201 |
class Bytecode_invoke: public Bytecode_member_ref { |
|
202 |
protected: |
|
7913 | 203 |
// Constructor that skips verification |
33593
60764a78fa5c
8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents:
25715
diff
changeset
|
204 |
Bytecode_invoke(const methodHandle& method, int bci, bool unused) : Bytecode_member_ref(method, bci) {} |
1 | 205 |
|
206 |
public: |
|
33593
60764a78fa5c
8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents:
25715
diff
changeset
|
207 |
Bytecode_invoke(const methodHandle& method, int bci) : Bytecode_member_ref(method, bci) { verify(); } |
1 | 208 |
void verify() const; |
209 |
||
210 |
// Attributes |
|
211 |
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
|
212 |
Handle appendix(TRAPS); // if CPCE::has_appendix (from constant pool) |
1 | 213 |
|
214 |
// Testers |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10979
diff
changeset
|
215 |
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
|
216 |
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
|
217 |
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
|
218 |
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
|
219 |
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
|
220 |
bool is_invokehandle() const { return invoke_code() == Bytecodes::_invokehandle; } |
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
221 |
|
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4564
diff
changeset
|
222 |
bool has_receiver() const { return !is_invokestatic() && !is_invokedynamic(); } |
1 | 223 |
|
224 |
bool is_valid() const { return is_invokeinterface() || |
|
225 |
is_invokevirtual() || |
|
226 |
is_invokestatic() || |
|
4564
55dfb20908d0
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
3261
diff
changeset
|
227 |
is_invokespecial() || |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10979
diff
changeset
|
228 |
is_invokedynamic() || |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10979
diff
changeset
|
229 |
is_invokehandle(); } |
1 | 230 |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10979
diff
changeset
|
231 |
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
|
232 |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10979
diff
changeset
|
233 |
private: |
7913 | 234 |
// Helper to skip verification. Used is_valid() to check if the result is really an invoke |
33593
60764a78fa5c
8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents:
25715
diff
changeset
|
235 |
inline friend Bytecode_invoke Bytecode_invoke_check(const methodHandle& method, int bci); |
1 | 236 |
}; |
237 |
||
33593
60764a78fa5c
8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents:
25715
diff
changeset
|
238 |
inline Bytecode_invoke Bytecode_invoke_check(const methodHandle& method, int bci) { |
7913 | 239 |
return Bytecode_invoke(method, bci, false); |
1 | 240 |
} |
241 |
||
242 |
||
5882 | 243 |
// Abstraction for all field accesses (put/get field/static) |
244 |
class Bytecode_field: public Bytecode_member_ref { |
|
7913 | 245 |
public: |
33593
60764a78fa5c
8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents:
25715
diff
changeset
|
246 |
Bytecode_field(const methodHandle& method, int bci) : Bytecode_member_ref(method, bci) { verify(); } |
5882 | 247 |
|
248 |
// Testers |
|
249 |
bool is_getfield() const { return java_code() == Bytecodes::_getfield; } |
|
250 |
bool is_putfield() const { return java_code() == Bytecodes::_putfield; } |
|
251 |
bool is_getstatic() const { return java_code() == Bytecodes::_getstatic; } |
|
252 |
bool is_putstatic() const { return java_code() == Bytecodes::_putstatic; } |
|
253 |
||
254 |
bool is_getter() const { return is_getfield() || is_getstatic(); } |
|
255 |
bool is_static() const { return is_getstatic() || is_putstatic(); } |
|
256 |
||
257 |
bool is_valid() const { return is_getfield() || |
|
258 |
is_putfield() || |
|
259 |
is_getstatic() || |
|
260 |
is_putstatic(); } |
|
1 | 261 |
void verify() const; |
262 |
}; |
|
263 |
||
264 |
// Abstraction for checkcast |
|
265 |
class Bytecode_checkcast: public Bytecode { |
|
266 |
public: |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
267 |
Bytecode_checkcast(Method* method, address bcp): Bytecode(method, bcp) { verify(); } |
1 | 268 |
void verify() const { assert(Bytecodes::java_code(code()) == Bytecodes::_checkcast, "check checkcast"); } |
269 |
||
270 |
// Returns index |
|
5688 | 271 |
long index() const { return get_index_u2(Bytecodes::_checkcast); }; |
1 | 272 |
}; |
273 |
||
274 |
// Abstraction for instanceof |
|
275 |
class Bytecode_instanceof: public Bytecode { |
|
276 |
public: |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
277 |
Bytecode_instanceof(Method* method, address bcp): Bytecode(method, bcp) { verify(); } |
1 | 278 |
void verify() const { assert(code() == Bytecodes::_instanceof, "check instanceof"); } |
279 |
||
280 |
// Returns index |
|
5688 | 281 |
long index() const { return get_index_u2(Bytecodes::_instanceof); }; |
1 | 282 |
}; |
283 |
||
284 |
class Bytecode_new: public Bytecode { |
|
285 |
public: |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
286 |
Bytecode_new(Method* method, address bcp): Bytecode(method, bcp) { verify(); } |
1 | 287 |
void verify() const { assert(java_code() == Bytecodes::_new, "check new"); } |
288 |
||
289 |
// Returns index |
|
5688 | 290 |
long index() const { return get_index_u2(Bytecodes::_new); }; |
1 | 291 |
}; |
292 |
||
293 |
class Bytecode_multianewarray: public Bytecode { |
|
294 |
public: |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
295 |
Bytecode_multianewarray(Method* method, address bcp): Bytecode(method, bcp) { verify(); } |
1 | 296 |
void verify() const { assert(java_code() == Bytecodes::_multianewarray, "check new"); } |
297 |
||
298 |
// Returns index |
|
5688 | 299 |
long index() const { return get_index_u2(Bytecodes::_multianewarray); }; |
1 | 300 |
}; |
301 |
||
302 |
class Bytecode_anewarray: public Bytecode { |
|
303 |
public: |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
304 |
Bytecode_anewarray(Method* method, address bcp): Bytecode(method, bcp) { verify(); } |
1 | 305 |
void verify() const { assert(java_code() == Bytecodes::_anewarray, "check anewarray"); } |
306 |
||
307 |
// Returns index |
|
5688 | 308 |
long index() const { return get_index_u2(Bytecodes::_anewarray); }; |
1 | 309 |
}; |
310 |
||
311 |
// Abstraction for ldc, ldc_w and ldc2_w |
|
7913 | 312 |
class Bytecode_loadconstant: public Bytecode { |
5882 | 313 |
private: |
7913 | 314 |
const methodHandle _method; |
5882 | 315 |
|
316 |
int raw_index() const; |
|
317 |
||
1 | 318 |
public: |
33593
60764a78fa5c
8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents:
25715
diff
changeset
|
319 |
Bytecode_loadconstant(const methodHandle& method, int bci): Bytecode(method(), method->bcp_from(bci)), _method(method) { verify(); } |
5882 | 320 |
|
1 | 321 |
void verify() const { |
5882 | 322 |
assert(_method.not_null(), "must supply method"); |
1 | 323 |
Bytecodes::Code stdc = Bytecodes::java_code(code()); |
324 |
assert(stdc == Bytecodes::_ldc || |
|
325 |
stdc == Bytecodes::_ldc_w || |
|
326 |
stdc == Bytecodes::_ldc2_w, "load constant"); |
|
327 |
} |
|
328 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
329 |
// Only non-standard bytecodes (fast_aldc) have reference cache indexes. |
5882 | 330 |
bool has_cache_index() const { return code() >= Bytecodes::number_of_java_codes; } |
1 | 331 |
|
5882 | 332 |
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
|
333 |
int cache_index() const { // index into reference cache (or -1 if none) |
5882 | 334 |
return has_cache_index() ? raw_index() : -1; |
335 |
} |
|
336 |
||
337 |
BasicType result_type() const; // returns the result type of the ldc |
|
338 |
||
339 |
oop resolve_constant(TRAPS) const; |
|
1 | 340 |
}; |
341 |
||
7397 | 342 |
#endif // SHARE_VM_INTERPRETER_BYTECODE_HPP |