547 // Slow-path Locking and Unlocking
548 static void complete_monitor_locking_C(oopDesc* obj, BasicLock* lock, JavaThread* thread);
549 static void complete_monitor_unlocking_C(oopDesc* obj, BasicLock* lock, JavaThread* thread);
550
551 // Resolving of calls
552 static address resolve_static_call_C (JavaThread *thread);
553 static address resolve_virtual_call_C (JavaThread *thread);
554 static address resolve_opt_virtual_call_C(JavaThread *thread);
555
556 // arraycopy, the non-leaf version. (See StubRoutines for all the leaf calls.)
557 static void slow_arraycopy_C(oopDesc* src, jint src_pos,
558 oopDesc* dest, jint dest_pos,
559 jint length, JavaThread* thread);
560
561 // handle ic miss with caller being compiled code
562 // wrong method handling (inline cache misses, zombie methods)
563 static address handle_wrong_method(JavaThread* thread);
564 static address handle_wrong_method_abstract(JavaThread* thread);
565 static address handle_wrong_method_ic_miss(JavaThread* thread);
566 static void allocate_value_types(JavaThread* thread, Method* callee);
567
568 #ifndef PRODUCT
569
570 // Collect and print inline cache miss statistics
571 private:
572 enum { maxICmiss_count = 100 };
573 static int _ICmiss_index; // length of IC miss histogram
574 static int _ICmiss_count[maxICmiss_count]; // miss counts
575 static address _ICmiss_at[maxICmiss_count]; // miss addresses
576 static void trace_ic_miss(address at);
577
578 public:
579 static int _throw_null_ctr; // throwing a null-pointer exception
580 static int _ic_miss_ctr; // total # of IC misses
581 static int _wrong_method_ctr;
582 static int _resolve_static_ctr;
583 static int _resolve_virtual_ctr;
584 static int _resolve_opt_virtual_ctr;
585 static int _implicit_null_throws;
586 static int _implicit_div0_throws;
663 // setup. Compiled frames are fixed-size and the args are likely not in the
664 // right place. Hence all the args will likely be copied into the
665 // interpreter's frame, forcing that frame to grow. The compiled frame's
666 // outgoing stack args will be dead after the copy.
667 //
668 // Native wrappers, like adapters, marshal arguments. Unlike adapters they
669 // also perform an official frame push & pop. They have a call to the native
670 // routine in their middles and end in a return (instead of ending in a jump).
671 // The native wrappers are stored in real nmethods instead of the BufferBlobs
672 // used by the adapters. The code generation happens here because it's very
673 // similar to what the adapters have to do.
674
675 class AdapterHandlerEntry : public BasicHashtableEntry<mtCode> {
676 friend class AdapterHandlerTable;
677
678 private:
679 AdapterFingerPrint* _fingerprint;
680 address _i2c_entry;
681 address _c2i_entry;
682 address _c2i_unverified_entry;
683
684 #ifdef ASSERT
685 // Captures code and signature used to generate this adapter when
686 // verifying adapter equivalence.
687 unsigned char* _saved_code;
688 int _saved_code_length;
689 #endif
690
691 void init(AdapterFingerPrint* fingerprint, address i2c_entry, address c2i_entry, address c2i_unverified_entry) {
692 _fingerprint = fingerprint;
693 _i2c_entry = i2c_entry;
694 _c2i_entry = c2i_entry;
695 _c2i_unverified_entry = c2i_unverified_entry;
696 #ifdef ASSERT
697 _saved_code = NULL;
698 _saved_code_length = 0;
699 #endif
700 }
701
702 void deallocate();
703
704 // should never be used
705 AdapterHandlerEntry();
706
707 public:
708 address get_i2c_entry() const { return _i2c_entry; }
709 address get_c2i_entry() const { return _c2i_entry; }
710 address get_c2i_unverified_entry() const { return _c2i_unverified_entry; }
711 address base_address();
712 void relocate(address new_base);
713
714 AdapterFingerPrint* fingerprint() const { return _fingerprint; }
715
716 AdapterHandlerEntry* next() {
717 return (AdapterHandlerEntry*)BasicHashtableEntry<mtCode>::next();
718 }
719
720 #ifdef ASSERT
721 // Used to verify that code generated for shared adapters is equivalent
722 void save_code (unsigned char* code, int length);
723 bool compare_code(unsigned char* code, int length);
724 #endif
725
726 //virtual void print_on(outputStream* st) const; DO NOT USE
727 void print_adapter_on(outputStream* st) const;
728 };
729
730 class AdapterHandlerLibrary: public AllStatic {
731 private:
732 static BufferBlob* _buffer; // the temporary code buffer in CodeCache
733 static AdapterHandlerTable* _adapters;
734 static AdapterHandlerEntry* _abstract_method_handler;
735 static BufferBlob* buffer_blob();
736 static void initialize();
737
738 public:
739
740 static AdapterHandlerEntry* new_entry(AdapterFingerPrint* fingerprint,
741 address i2c_entry, address c2i_entry, address c2i_unverified_entry);
742 static void create_native_wrapper(const methodHandle& method);
743 static AdapterHandlerEntry* get_adapter(const methodHandle& method);
744
745 static void print_handler(const CodeBlob* b) { print_handler_on(tty, b); }
746 static void print_handler_on(outputStream* st, const CodeBlob* b);
747 static bool contains(const CodeBlob* b);
748 #ifndef PRODUCT
749 static void print_statistics();
750 #endif // PRODUCT
751
752 };
753
754 #endif // SHARE_VM_RUNTIME_SHAREDRUNTIME_HPP
|
547 // Slow-path Locking and Unlocking
548 static void complete_monitor_locking_C(oopDesc* obj, BasicLock* lock, JavaThread* thread);
549 static void complete_monitor_unlocking_C(oopDesc* obj, BasicLock* lock, JavaThread* thread);
550
551 // Resolving of calls
552 static address resolve_static_call_C (JavaThread *thread);
553 static address resolve_virtual_call_C (JavaThread *thread);
554 static address resolve_opt_virtual_call_C(JavaThread *thread);
555
556 // arraycopy, the non-leaf version. (See StubRoutines for all the leaf calls.)
557 static void slow_arraycopy_C(oopDesc* src, jint src_pos,
558 oopDesc* dest, jint dest_pos,
559 jint length, JavaThread* thread);
560
561 // handle ic miss with caller being compiled code
562 // wrong method handling (inline cache misses, zombie methods)
563 static address handle_wrong_method(JavaThread* thread);
564 static address handle_wrong_method_abstract(JavaThread* thread);
565 static address handle_wrong_method_ic_miss(JavaThread* thread);
566 static void allocate_value_types(JavaThread* thread, Method* callee);
567 static void apply_post_barriers(JavaThread* thread, objArrayOopDesc* array, Method* callee_method);
568
569 #ifndef PRODUCT
570
571 // Collect and print inline cache miss statistics
572 private:
573 enum { maxICmiss_count = 100 };
574 static int _ICmiss_index; // length of IC miss histogram
575 static int _ICmiss_count[maxICmiss_count]; // miss counts
576 static address _ICmiss_at[maxICmiss_count]; // miss addresses
577 static void trace_ic_miss(address at);
578
579 public:
580 static int _throw_null_ctr; // throwing a null-pointer exception
581 static int _ic_miss_ctr; // total # of IC misses
582 static int _wrong_method_ctr;
583 static int _resolve_static_ctr;
584 static int _resolve_virtual_ctr;
585 static int _resolve_opt_virtual_ctr;
586 static int _implicit_null_throws;
587 static int _implicit_div0_throws;
664 // setup. Compiled frames are fixed-size and the args are likely not in the
665 // right place. Hence all the args will likely be copied into the
666 // interpreter's frame, forcing that frame to grow. The compiled frame's
667 // outgoing stack args will be dead after the copy.
668 //
669 // Native wrappers, like adapters, marshal arguments. Unlike adapters they
670 // also perform an official frame push & pop. They have a call to the native
671 // routine in their middles and end in a return (instead of ending in a jump).
672 // The native wrappers are stored in real nmethods instead of the BufferBlobs
673 // used by the adapters. The code generation happens here because it's very
674 // similar to what the adapters have to do.
675
676 class AdapterHandlerEntry : public BasicHashtableEntry<mtCode> {
677 friend class AdapterHandlerTable;
678
679 private:
680 AdapterFingerPrint* _fingerprint;
681 address _i2c_entry;
682 address _c2i_entry;
683 address _c2i_unverified_entry;
684 Symbol* _sig_extended;
685
686 #ifdef ASSERT
687 // Captures code and signature used to generate this adapter when
688 // verifying adapter equivalence.
689 unsigned char* _saved_code;
690 int _saved_code_length;
691 #endif
692
693 void init(AdapterFingerPrint* fingerprint, address i2c_entry, address c2i_entry, address c2i_unverified_entry, Symbol* sig_extended) {
694 _fingerprint = fingerprint;
695 _i2c_entry = i2c_entry;
696 _c2i_entry = c2i_entry;
697 _c2i_unverified_entry = c2i_unverified_entry;
698 _sig_extended = sig_extended;
699 #ifdef ASSERT
700 _saved_code = NULL;
701 _saved_code_length = 0;
702 #endif
703 }
704
705 void deallocate();
706
707 // should never be used
708 AdapterHandlerEntry();
709
710 public:
711 address get_i2c_entry() const { return _i2c_entry; }
712 address get_c2i_entry() const { return _c2i_entry; }
713 address get_c2i_unverified_entry() const { return _c2i_unverified_entry; }
714 Symbol* get_sig_extended() const { return _sig_extended; }
715 address base_address();
716 void relocate(address new_base);
717
718 AdapterFingerPrint* fingerprint() const { return _fingerprint; }
719
720 AdapterHandlerEntry* next() {
721 return (AdapterHandlerEntry*)BasicHashtableEntry<mtCode>::next();
722 }
723
724 #ifdef ASSERT
725 // Used to verify that code generated for shared adapters is equivalent
726 void save_code (unsigned char* code, int length);
727 bool compare_code(unsigned char* code, int length);
728 #endif
729
730 //virtual void print_on(outputStream* st) const; DO NOT USE
731 void print_adapter_on(outputStream* st) const;
732 };
733
734 class AdapterHandlerLibrary: public AllStatic {
735 private:
736 static BufferBlob* _buffer; // the temporary code buffer in CodeCache
737 static AdapterHandlerTable* _adapters;
738 static AdapterHandlerEntry* _abstract_method_handler;
739 static BufferBlob* buffer_blob();
740 static void initialize();
741
742 public:
743
744 static AdapterHandlerEntry* new_entry(AdapterFingerPrint* fingerprint,
745 address i2c_entry, address c2i_entry, address c2i_unverified_entry,
746 Symbol* sig_extended = NULL);
747 static void create_native_wrapper(const methodHandle& method);
748 static AdapterHandlerEntry* get_adapter(const methodHandle& method);
749
750 static void print_handler(const CodeBlob* b) { print_handler_on(tty, b); }
751 static void print_handler_on(outputStream* st, const CodeBlob* b);
752 static bool contains(const CodeBlob* b);
753 #ifndef PRODUCT
754 static void print_statistics();
755 #endif // PRODUCT
756
757 };
758
759 #endif // SHARE_VM_RUNTIME_SHAREDRUNTIME_HPP
|