94 // object for the resolved_method. |
94 // object for the resolved_method. |
95 CallInfo(Method* resolved_method, Klass* resolved_klass, TRAPS); |
95 CallInfo(Method* resolved_method, Klass* resolved_klass, TRAPS); |
96 |
96 |
97 Klass* resolved_klass() const { return _resolved_klass; } |
97 Klass* resolved_klass() const { return _resolved_klass; } |
98 Klass* selected_klass() const { return _selected_klass; } |
98 Klass* selected_klass() const { return _selected_klass; } |
99 methodHandle resolved_method() const { return _resolved_method; } |
99 Method* resolved_method() const { return _resolved_method(); } |
100 methodHandle selected_method() const { return _selected_method; } |
100 Method* selected_method() const { return _selected_method(); } |
101 Handle resolved_appendix() const { return _resolved_appendix; } |
101 Handle resolved_appendix() const { return _resolved_appendix; } |
102 Handle resolved_method_name() const { return _resolved_method_name; } |
102 Handle resolved_method_name() const { return _resolved_method_name; } |
103 // Materialize a java.lang.invoke.ResolvedMethodName for this resolved_method |
103 // Materialize a java.lang.invoke.ResolvedMethodName for this resolved_method |
104 void set_resolved_method_name(TRAPS); |
104 void set_resolved_method_name(TRAPS); |
105 |
105 |
179 // accessors |
179 // accessors |
180 Symbol* name() const { return _name; } |
180 Symbol* name() const { return _name; } |
181 Symbol* signature() const { return _signature; } |
181 Symbol* signature() const { return _signature; } |
182 Klass* resolved_klass() const { return _resolved_klass; } |
182 Klass* resolved_klass() const { return _resolved_klass; } |
183 Klass* current_klass() const { return _current_klass; } |
183 Klass* current_klass() const { return _current_klass; } |
184 methodHandle current_method() const { return _current_method; } |
184 Method* current_method() const { return _current_method(); } |
185 constantTag tag() const { return _tag; } |
185 constantTag tag() const { return _tag; } |
186 bool check_access() const { return _check_access; } |
186 bool check_access() const { return _check_access; } |
187 |
187 |
188 void print() PRODUCT_RETURN; |
188 void print() PRODUCT_RETURN; |
189 }; |
189 }; |
203 static Method* lookup_method_in_klasses(const LinkInfo& link_info, |
203 static Method* lookup_method_in_klasses(const LinkInfo& link_info, |
204 bool checkpolymorphism, |
204 bool checkpolymorphism, |
205 bool in_imethod_resolve); |
205 bool in_imethod_resolve); |
206 static Method* lookup_method_in_interfaces(const LinkInfo& link_info); |
206 static Method* lookup_method_in_interfaces(const LinkInfo& link_info); |
207 |
207 |
208 static methodHandle lookup_polymorphic_method(const LinkInfo& link_info, |
208 static Method* lookup_polymorphic_method(const LinkInfo& link_info, |
209 Handle *appendix_result_or_null, TRAPS); |
209 Handle *appendix_result_or_null, TRAPS); |
210 JVMCI_ONLY(public:) // Needed for CompilerToVM.resolveMethod() |
210 JVMCI_ONLY(public:) // Needed for CompilerToVM.resolveMethod() |
211 // Not Linktime so doesn't take LinkInfo |
211 // Not Linktime so doesn't take LinkInfo |
212 static methodHandle lookup_instance_method_in_klasses (Klass* klass, Symbol* name, Symbol* signature, |
212 static Method* lookup_instance_method_in_klasses (Klass* klass, Symbol* name, Symbol* signature, |
213 Klass::PrivateLookupMode private_mode, TRAPS); |
213 Klass::PrivateLookupMode private_mode, TRAPS); |
214 JVMCI_ONLY(private:) |
214 JVMCI_ONLY(private:) |
215 |
215 |
216 // Similar loader constraint checking functions that throw |
216 // Similar loader constraint checking functions that throw |
217 // LinkageError with descriptive message. |
217 // LinkageError with descriptive message. |
218 static void check_method_loader_constraints(const LinkInfo& link_info, |
218 static void check_method_loader_constraints(const LinkInfo& link_info, |
220 const char* method_type, TRAPS); |
220 const char* method_type, TRAPS); |
221 static void check_field_loader_constraints(Symbol* field, Symbol* sig, |
221 static void check_field_loader_constraints(Symbol* field, Symbol* sig, |
222 Klass* current_klass, |
222 Klass* current_klass, |
223 Klass* sel_klass, TRAPS); |
223 Klass* sel_klass, TRAPS); |
224 |
224 |
225 static methodHandle resolve_interface_method(const LinkInfo& link_info, Bytecodes::Code code, TRAPS); |
225 static Method* resolve_interface_method(const LinkInfo& link_info, Bytecodes::Code code, TRAPS); |
226 static methodHandle resolve_method (const LinkInfo& link_info, Bytecodes::Code code, TRAPS); |
226 static Method* resolve_method (const LinkInfo& link_info, Bytecodes::Code code, TRAPS); |
227 |
227 |
228 static methodHandle linktime_resolve_static_method (const LinkInfo& link_info, TRAPS); |
228 static Method* linktime_resolve_static_method (const LinkInfo& link_info, TRAPS); |
229 static methodHandle linktime_resolve_special_method (const LinkInfo& link_info, TRAPS); |
229 static Method* linktime_resolve_special_method (const LinkInfo& link_info, TRAPS); |
230 static methodHandle linktime_resolve_virtual_method (const LinkInfo& link_info, TRAPS); |
230 static Method* linktime_resolve_virtual_method (const LinkInfo& link_info, TRAPS); |
231 static methodHandle linktime_resolve_interface_method (const LinkInfo& link_info, TRAPS); |
231 static Method* linktime_resolve_interface_method (const LinkInfo& link_info, TRAPS); |
232 |
232 |
233 static void runtime_resolve_special_method (CallInfo& result, |
233 static void runtime_resolve_special_method (CallInfo& result, |
234 const LinkInfo& link_info, |
234 const LinkInfo& link_info, |
235 const methodHandle& resolved_method, |
235 const methodHandle& resolved_method, |
236 Handle recv, TRAPS); |
236 Handle recv, TRAPS); |
283 return check_klass_accessability(ref_klass, sel_klass, false, THREAD); |
283 return check_klass_accessability(ref_klass, sel_klass, false, THREAD); |
284 } |
284 } |
285 |
285 |
286 // static resolving calls (will not run any Java code); |
286 // static resolving calls (will not run any Java code); |
287 // used only from Bytecode_invoke::static_target |
287 // used only from Bytecode_invoke::static_target |
288 static methodHandle resolve_method_statically(Bytecodes::Code code, |
288 static Method* resolve_method_statically(Bytecodes::Code code, |
289 const constantPoolHandle& pool, |
289 const constantPoolHandle& pool, |
290 int index, TRAPS); |
290 int index, TRAPS); |
291 |
291 |
292 static void resolve_field_access(fieldDescriptor& result, |
292 static void resolve_field_access(fieldDescriptor& result, |
293 const constantPoolHandle& pool, |
293 const constantPoolHandle& pool, |
294 int index, |
294 int index, |
295 const methodHandle& method, |
295 const methodHandle& method, |
316 static void resolve_dynamic_call (CallInfo& result, |
316 static void resolve_dynamic_call (CallInfo& result, |
317 BootstrapInfo& bootstrap_specifier, TRAPS); |
317 BootstrapInfo& bootstrap_specifier, TRAPS); |
318 |
318 |
319 // same as above for compile-time resolution; but returns null handle instead of throwing |
319 // same as above for compile-time resolution; but returns null handle instead of throwing |
320 // an exception on error also, does not initialize klass (i.e., no side effects) |
320 // an exception on error also, does not initialize klass (i.e., no side effects) |
321 static methodHandle resolve_virtual_call_or_null (Klass* receiver_klass, |
321 static Method* resolve_virtual_call_or_null(Klass* receiver_klass, |
322 const LinkInfo& link_info); |
322 const LinkInfo& link_info); |
323 static methodHandle resolve_interface_call_or_null(Klass* receiver_klass, |
323 static Method* resolve_interface_call_or_null(Klass* receiver_klass, |
324 const LinkInfo& link_info); |
324 const LinkInfo& link_info); |
325 static methodHandle resolve_static_call_or_null (const LinkInfo& link_info); |
325 static Method* resolve_static_call_or_null(const LinkInfo& link_info); |
326 static methodHandle resolve_special_call_or_null (const LinkInfo& link_info); |
326 static Method* resolve_special_call_or_null(const LinkInfo& link_info); |
327 |
327 |
328 static int vtable_index_of_interface_method(Klass* klass, const methodHandle& resolved_method); |
328 static int vtable_index_of_interface_method(Klass* klass, const methodHandle& resolved_method); |
329 |
329 |
330 // same as above for compile-time resolution; returns vtable_index if current_klass if linked |
330 // same as above for compile-time resolution; returns vtable_index if current_klass if linked |
331 static int resolve_virtual_vtable_index (Klass* receiver_klass, |
331 static int resolve_virtual_vtable_index (Klass* receiver_klass, |
332 const LinkInfo& link_info); |
332 const LinkInfo& link_info); |
333 |
333 |
334 // static resolving for compiler (does not throw exceptions, returns null handle if unsuccessful) |
334 // static resolving for compiler (does not throw exceptions, returns null handle if unsuccessful) |
335 static methodHandle linktime_resolve_virtual_method_or_null (const LinkInfo& link_info); |
335 static Method* linktime_resolve_virtual_method_or_null (const LinkInfo& link_info); |
336 static methodHandle linktime_resolve_interface_method_or_null(const LinkInfo& link_info); |
336 static Method* linktime_resolve_interface_method_or_null(const LinkInfo& link_info); |
337 |
337 |
338 // runtime resolving from constant pool |
338 // runtime resolving from constant pool |
339 static void resolve_invoke(CallInfo& result, Handle recv, |
339 static void resolve_invoke(CallInfo& result, Handle recv, |
340 const constantPoolHandle& pool, int index, |
340 const constantPoolHandle& pool, int index, |
341 Bytecodes::Code byte, TRAPS); |
341 Bytecodes::Code byte, TRAPS); |
346 Bytecodes::Code byte, TRAPS); |
346 Bytecodes::Code byte, TRAPS); |
347 |
347 |
348 public: |
348 public: |
349 // Only resolved method known. |
349 // Only resolved method known. |
350 static void throw_abstract_method_error(const methodHandle& resolved_method, TRAPS) { |
350 static void throw_abstract_method_error(const methodHandle& resolved_method, TRAPS) { |
351 throw_abstract_method_error(resolved_method, NULL, NULL, CHECK); |
351 throw_abstract_method_error(resolved_method, methodHandle(), NULL, CHECK); |
352 } |
352 } |
353 // Resolved method and receiver klass know. |
353 // Resolved method and receiver klass know. |
354 static void throw_abstract_method_error(const methodHandle& resolved_method, Klass *recv_klass, TRAPS) { |
354 static void throw_abstract_method_error(const methodHandle& resolved_method, Klass *recv_klass, TRAPS) { |
355 throw_abstract_method_error(resolved_method, NULL, recv_klass, CHECK); |
355 throw_abstract_method_error(resolved_method, methodHandle(), recv_klass, CHECK); |
356 } |
356 } |
357 // Selected method is abstract. |
357 // Selected method is abstract. |
358 static void throw_abstract_method_error(const methodHandle& resolved_method, |
358 static void throw_abstract_method_error(const methodHandle& resolved_method, |
359 const methodHandle& selected_method, |
359 const methodHandle& selected_method, |
360 Klass *recv_klass, TRAPS); |
360 Klass *recv_klass, TRAPS); |