comparison src/share/vm/interpreter/bytecode.hpp @ 6266:1d7922586cf6

7023639: JSR 292 method handle invocation needs a fast path for compiled code 6984705: JSR 292 method handle creation should not go through JNI Summary: remove assembly code for JDK 7 chained method handles Reviewed-by: jrose, twisti, kvn, mhaupt Contributed-by: John Rose <john.r.rose@oracle.com>, Christian Thalinger <christian.thalinger@oracle.com>, Michael Haupt <michael.haupt@oracle.com>
author twisti
date Tue, 24 Jul 2012 10:51:00 -0700
parents e342a5110bed
children da91efe96a93
comparison
equal deleted inserted replaced
6241:aba91a731143 6266:1d7922586cf6
78 address bcp() const { return _bcp; } 78 address bcp() const { return _bcp; }
79 int instruction_size() const { return Bytecodes::length_for_code_at(_code, bcp()); } 79 int instruction_size() const { return Bytecodes::length_for_code_at(_code, bcp()); }
80 80
81 Bytecodes::Code code() const { return _code; } 81 Bytecodes::Code code() const { return _code; }
82 Bytecodes::Code java_code() const { return Bytecodes::java_code(code()); } 82 Bytecodes::Code java_code() const { return Bytecodes::java_code(code()); }
83 Bytecodes::Code invoke_code() const { return (code() == Bytecodes::_invokehandle) ? code() : java_code(); }
83 84
84 // Static functions for parsing bytecodes in place. 85 // Static functions for parsing bytecodes in place.
85 int get_index_u1(Bytecodes::Code bc) const { 86 int get_index_u1(Bytecodes::Code bc) const {
86 assert_same_format_as(bc); assert_index_size(1, bc); 87 assert_same_format_as(bc); assert_index_size(1, bc);
87 return *(jubyte*)addr_at(1); 88 return *(jubyte*)addr_at(1);
193 const methodHandle _method; // method containing the bytecode 194 const methodHandle _method; // method containing the bytecode
194 195
195 Bytecode_member_ref(methodHandle method, int bci) : Bytecode(method(), method()->bcp_from(bci)), _method(method) {} 196 Bytecode_member_ref(methodHandle method, int bci) : Bytecode(method(), method()->bcp_from(bci)), _method(method) {}
196 197
197 methodHandle method() const { return _method; } 198 methodHandle method() const { return _method; }
199 constantPoolOop constants() const { return _method->constants(); }
200 constantPoolCacheOop cpcache() const { return _method->constants()->cache(); }
201 ConstantPoolCacheEntry* cpcache_entry() const;
198 202
199 public: 203 public:
200 int index() const; // cache index (loaded from instruction) 204 int index() const; // cache index (loaded from instruction)
201 int pool_index() const; // constant pool index 205 int pool_index() const; // constant pool index
206 Symbol* klass() const; // returns the klass of the method or field
202 Symbol* name() const; // returns the name of the method or field 207 Symbol* name() const; // returns the name of the method or field
203 Symbol* signature() const; // returns the signature of the method or field 208 Symbol* signature() const; // returns the signature of the method or field
204 209
205 BasicType result_type() const; // returns the result type of the getfield or invoke 210 BasicType result_type() const; // returns the result type of the getfield or invoke
206 }; 211 };
216 Bytecode_invoke(methodHandle method, int bci) : Bytecode_member_ref(method, bci) { verify(); } 221 Bytecode_invoke(methodHandle method, int bci) : Bytecode_member_ref(method, bci) { verify(); }
217 void verify() const; 222 void verify() const;
218 223
219 // Attributes 224 // Attributes
220 methodHandle static_target(TRAPS); // "specified" method (from constant pool) 225 methodHandle static_target(TRAPS); // "specified" method (from constant pool)
226 Handle appendix(TRAPS); // if CPCE::has_appendix (from constant pool)
221 227
222 // Testers 228 // Testers
223 bool is_invokeinterface() const { return java_code() == Bytecodes::_invokeinterface; } 229 bool is_invokeinterface() const { return invoke_code() == Bytecodes::_invokeinterface; }
224 bool is_invokevirtual() const { return java_code() == Bytecodes::_invokevirtual; } 230 bool is_invokevirtual() const { return invoke_code() == Bytecodes::_invokevirtual; }
225 bool is_invokestatic() const { return java_code() == Bytecodes::_invokestatic; } 231 bool is_invokestatic() const { return invoke_code() == Bytecodes::_invokestatic; }
226 bool is_invokespecial() const { return java_code() == Bytecodes::_invokespecial; } 232 bool is_invokespecial() const { return invoke_code() == Bytecodes::_invokespecial; }
227 bool is_invokedynamic() const { return java_code() == Bytecodes::_invokedynamic; } 233 bool is_invokedynamic() const { return invoke_code() == Bytecodes::_invokedynamic; }
234 bool is_invokehandle() const { return invoke_code() == Bytecodes::_invokehandle; }
228 235
229 bool has_receiver() const { return !is_invokestatic() && !is_invokedynamic(); } 236 bool has_receiver() const { return !is_invokestatic() && !is_invokedynamic(); }
230 237
231 bool is_valid() const { return is_invokeinterface() || 238 bool is_valid() const { return is_invokeinterface() ||
232 is_invokevirtual() || 239 is_invokevirtual() ||
233 is_invokestatic() || 240 is_invokestatic() ||
234 is_invokespecial() || 241 is_invokespecial() ||
235 is_invokedynamic(); } 242 is_invokedynamic() ||
236 243 is_invokehandle(); }
237 bool is_method_handle_invoke() const { 244
238 return (is_invokedynamic() || 245 bool has_appendix() { return cpcache_entry()->has_appendix(); }
239 (is_invokevirtual() && 246
240 method()->constants()->klass_ref_at_noresolve(index()) == vmSymbols::java_lang_invoke_MethodHandle() && 247 private:
241 methodOopDesc::is_method_handle_invoke_name(name())));
242 }
243
244 // Helper to skip verification. Used is_valid() to check if the result is really an invoke 248 // Helper to skip verification. Used is_valid() to check if the result is really an invoke
245 inline friend Bytecode_invoke Bytecode_invoke_check(methodHandle method, int bci); 249 inline friend Bytecode_invoke Bytecode_invoke_check(methodHandle method, int bci);
246 }; 250 };
247 251
248 inline Bytecode_invoke Bytecode_invoke_check(methodHandle method, int bci) { 252 inline Bytecode_invoke Bytecode_invoke_check(methodHandle method, int bci) {