59 static RuntimeStub* _resolve_opt_virtual_call_blob; |
59 static RuntimeStub* _resolve_opt_virtual_call_blob; |
60 static RuntimeStub* _resolve_virtual_call_blob; |
60 static RuntimeStub* _resolve_virtual_call_blob; |
61 static RuntimeStub* _resolve_static_call_blob; |
61 static RuntimeStub* _resolve_static_call_blob; |
62 |
62 |
63 static DeoptimizationBlob* _deopt_blob; |
63 static DeoptimizationBlob* _deopt_blob; |
64 static RicochetBlob* _ricochet_blob; |
|
65 |
64 |
66 static SafepointBlob* _polling_page_safepoint_handler_blob; |
65 static SafepointBlob* _polling_page_safepoint_handler_blob; |
67 static SafepointBlob* _polling_page_return_handler_blob; |
66 static SafepointBlob* _polling_page_return_handler_blob; |
68 |
67 |
69 #ifdef COMPILER2 |
68 #ifdef COMPILER2 |
185 static void throw_IncompatibleClassChangeError(JavaThread* thread); |
184 static void throw_IncompatibleClassChangeError(JavaThread* thread); |
186 static void throw_ArithmeticException(JavaThread* thread); |
185 static void throw_ArithmeticException(JavaThread* thread); |
187 static void throw_NullPointerException(JavaThread* thread); |
186 static void throw_NullPointerException(JavaThread* thread); |
188 static void throw_NullPointerException_at_call(JavaThread* thread); |
187 static void throw_NullPointerException_at_call(JavaThread* thread); |
189 static void throw_StackOverflowError(JavaThread* thread); |
188 static void throw_StackOverflowError(JavaThread* thread); |
190 static void throw_WrongMethodTypeException(JavaThread* thread, oopDesc* required, oopDesc* actual); |
|
191 static address continuation_for_implicit_exception(JavaThread* thread, |
189 static address continuation_for_implicit_exception(JavaThread* thread, |
192 address faulting_pc, |
190 address faulting_pc, |
193 ImplicitExceptionKind exception_kind); |
191 ImplicitExceptionKind exception_kind); |
194 |
192 |
195 // Shared stub locations |
193 // Shared stub locations |
220 } |
218 } |
221 static address get_resolve_static_call_stub() { |
219 static address get_resolve_static_call_stub() { |
222 assert(_resolve_static_call_blob != NULL, "oops"); |
220 assert(_resolve_static_call_blob != NULL, "oops"); |
223 return _resolve_static_call_blob->entry_point(); |
221 return _resolve_static_call_blob->entry_point(); |
224 } |
222 } |
225 |
|
226 static RicochetBlob* ricochet_blob() { |
|
227 #ifdef X86 |
|
228 // Currently only implemented on x86 |
|
229 assert(!EnableInvokeDynamic || _ricochet_blob != NULL, "oops"); |
|
230 #endif |
|
231 return _ricochet_blob; |
|
232 } |
|
233 |
|
234 static void generate_ricochet_blob(); |
|
235 |
223 |
236 static SafepointBlob* polling_page_return_handler_blob() { return _polling_page_return_handler_blob; } |
224 static SafepointBlob* polling_page_return_handler_blob() { return _polling_page_return_handler_blob; } |
237 static SafepointBlob* polling_page_safepoint_handler_blob() { return _polling_page_safepoint_handler_blob; } |
225 static SafepointBlob* polling_page_safepoint_handler_blob() { return _polling_page_safepoint_handler_blob; } |
238 |
226 |
239 // Counters |
227 // Counters |
287 * on top of the stack. |
275 * on top of the stack. |
288 * The caller (or one of it's callers) must use a ResourceMark |
276 * The caller (or one of it's callers) must use a ResourceMark |
289 * in order to correctly free the result. |
277 * in order to correctly free the result. |
290 */ |
278 */ |
291 static char* generate_class_cast_message(JavaThread* thr, const char* name); |
279 static char* generate_class_cast_message(JavaThread* thr, const char* name); |
292 |
|
293 /** |
|
294 * Fill in the message for a WrongMethodTypeException |
|
295 * |
|
296 * @param thr the current thread |
|
297 * @param mtype (optional) expected method type (or argument class) |
|
298 * @param mhandle (optional) actual method handle (or argument) |
|
299 * @return the dynamically allocated exception message |
|
300 * |
|
301 * BCP for the frame on top of the stack must refer to an |
|
302 * 'invokevirtual' op for a method handle, or an 'invokedyamic' op. |
|
303 * The caller (or one of its callers) must use a ResourceMark |
|
304 * in order to correctly free the result. |
|
305 */ |
|
306 static char* generate_wrong_method_type_message(JavaThread* thr, |
|
307 oopDesc* mtype = NULL, |
|
308 oopDesc* mhandle = NULL); |
|
309 |
|
310 /** Return non-null if the mtype is a klass or Class, not a MethodType. */ |
|
311 static oop wrong_method_type_is_for_single_argument(JavaThread* thr, |
|
312 oopDesc* mtype); |
|
313 |
280 |
314 /** |
281 /** |
315 * Fill in the "X cannot be cast to a Y" message for ClassCastException |
282 * Fill in the "X cannot be cast to a Y" message for ClassCastException |
316 * |
283 * |
317 * @param name the name of the class of the object attempted to be cast |
284 * @param name the name of the class of the object attempted to be cast |
451 // Generate a native wrapper for a given method. The method takes arguments |
418 // Generate a native wrapper for a given method. The method takes arguments |
452 // in the Java compiled code convention, marshals them to the native |
419 // in the Java compiled code convention, marshals them to the native |
453 // convention (handlizes oops, etc), transitions to native, makes the call, |
420 // convention (handlizes oops, etc), transitions to native, makes the call, |
454 // returns to java state (possibly blocking), unhandlizes any result and |
421 // returns to java state (possibly blocking), unhandlizes any result and |
455 // returns. |
422 // returns. |
|
423 // |
|
424 // The wrapper may contain special-case code if the given method |
|
425 // is a JNI critical method, or a compiled method handle adapter, |
|
426 // such as _invokeBasic, _linkToVirtual, etc. |
456 static nmethod *generate_native_wrapper(MacroAssembler* masm, |
427 static nmethod *generate_native_wrapper(MacroAssembler* masm, |
457 methodHandle method, |
428 methodHandle method, |
458 int compile_id, |
429 int compile_id, |
459 int total_args_passed, |
430 int total_args_passed, |
460 int max_arg, |
431 int max_arg, |
645 |
616 |
646 // should never be used |
617 // should never be used |
647 AdapterHandlerEntry(); |
618 AdapterHandlerEntry(); |
648 |
619 |
649 public: |
620 public: |
650 address get_i2c_entry() { return _i2c_entry; } |
621 address get_i2c_entry() const { return _i2c_entry; } |
651 address get_c2i_entry() { return _c2i_entry; } |
622 address get_c2i_entry() const { return _c2i_entry; } |
652 address get_c2i_unverified_entry() { return _c2i_unverified_entry; } |
623 address get_c2i_unverified_entry() const { return _c2i_unverified_entry; } |
653 |
624 |
|
625 address base_address(); |
654 void relocate(address new_base); |
626 void relocate(address new_base); |
655 |
627 |
656 AdapterFingerPrint* fingerprint() { return _fingerprint; } |
628 AdapterFingerPrint* fingerprint() const { return _fingerprint; } |
657 |
629 |
658 AdapterHandlerEntry* next() { |
630 AdapterHandlerEntry* next() { |
659 return (AdapterHandlerEntry*)BasicHashtableEntry<mtCode>::next(); |
631 return (AdapterHandlerEntry*)BasicHashtableEntry<mtCode>::next(); |
660 } |
632 } |
661 |
633 |
663 // Used to verify that code generated for shared adapters is equivalent |
635 // Used to verify that code generated for shared adapters is equivalent |
664 void save_code(unsigned char* code, int length, int total_args_passed, BasicType* sig_bt); |
636 void save_code(unsigned char* code, int length, int total_args_passed, BasicType* sig_bt); |
665 bool compare_code(unsigned char* code, int length, int total_args_passed, BasicType* sig_bt); |
637 bool compare_code(unsigned char* code, int length, int total_args_passed, BasicType* sig_bt); |
666 #endif |
638 #endif |
667 |
639 |
668 void print(); |
640 //virtual void print_on(outputStream* st) const; DO NOT USE |
|
641 void print_adapter_on(outputStream* st) const; |
669 }; |
642 }; |
670 |
643 |
671 class AdapterHandlerLibrary: public AllStatic { |
644 class AdapterHandlerLibrary: public AllStatic { |
672 private: |
645 private: |
673 static BufferBlob* _buffer; // the temporary code buffer in CodeCache |
646 static BufferBlob* _buffer; // the temporary code buffer in CodeCache |