< prev index next >

src/share/vm/runtime/sharedRuntime.hpp

Print this page




 537   // Slow-path Locking and Unlocking
 538   static void complete_monitor_locking_C(oopDesc* obj, BasicLock* lock, JavaThread* thread);
 539   static void complete_monitor_unlocking_C(oopDesc* obj, BasicLock* lock, JavaThread* thread);
 540 
 541   // Resolving of calls
 542   static address resolve_static_call_C     (JavaThread *thread);
 543   static address resolve_virtual_call_C    (JavaThread *thread);
 544   static address resolve_opt_virtual_call_C(JavaThread *thread);
 545 
 546   // arraycopy, the non-leaf version.  (See StubRoutines for all the leaf calls.)
 547   static void slow_arraycopy_C(oopDesc* src,  jint src_pos,
 548                                oopDesc* dest, jint dest_pos,
 549                                jint length, JavaThread* thread);
 550 
 551   // handle ic miss with caller being compiled code
 552   // wrong method handling (inline cache misses, zombie methods)
 553   static address handle_wrong_method(JavaThread* thread);
 554   static address handle_wrong_method_abstract(JavaThread* thread);
 555   static address handle_wrong_method_ic_miss(JavaThread* thread);
 556   static void allocate_value_types(JavaThread* thread, Method* callee);

 557 
 558   static address handle_unsafe_access(JavaThread* thread, address next_pc);
 559 
 560 #ifndef PRODUCT
 561 
 562   // Collect and print inline cache miss statistics
 563  private:
 564   enum { maxICmiss_count = 100 };
 565   static int     _ICmiss_index;                  // length of IC miss histogram
 566   static int     _ICmiss_count[maxICmiss_count]; // miss counts
 567   static address _ICmiss_at[maxICmiss_count];    // miss addresses
 568   static void trace_ic_miss(address at);
 569 
 570  public:
 571   static int _throw_null_ctr;                    // throwing a null-pointer exception
 572   static int _ic_miss_ctr;                       // total # of IC misses
 573   static int _wrong_method_ctr;
 574   static int _resolve_static_ctr;
 575   static int _resolve_virtual_ctr;
 576   static int _resolve_opt_virtual_ctr;


 655 // setup.  Compiled frames are fixed-size and the args are likely not in the
 656 // right place.  Hence all the args will likely be copied into the
 657 // interpreter's frame, forcing that frame to grow.  The compiled frame's
 658 // outgoing stack args will be dead after the copy.
 659 //
 660 // Native wrappers, like adapters, marshal arguments.  Unlike adapters they
 661 // also perform an official frame push & pop.  They have a call to the native
 662 // routine in their middles and end in a return (instead of ending in a jump).
 663 // The native wrappers are stored in real nmethods instead of the BufferBlobs
 664 // used by the adapters.  The code generation happens here because it's very
 665 // similar to what the adapters have to do.
 666 
 667 class AdapterHandlerEntry : public BasicHashtableEntry<mtCode> {
 668   friend class AdapterHandlerTable;
 669 
 670  private:
 671   AdapterFingerPrint* _fingerprint;
 672   address _i2c_entry;
 673   address _c2i_entry;
 674   address _c2i_unverified_entry;

 675 
 676 #ifdef ASSERT
 677   // Captures code and signature used to generate this adapter when
 678   // verifying adapter equivalence.
 679   unsigned char* _saved_code;
 680   int            _saved_code_length;
 681 #endif
 682 
 683   void init(AdapterFingerPrint* fingerprint, address i2c_entry, address c2i_entry, address c2i_unverified_entry) {
 684     _fingerprint = fingerprint;
 685     _i2c_entry = i2c_entry;
 686     _c2i_entry = c2i_entry;
 687     _c2i_unverified_entry = c2i_unverified_entry;

 688 #ifdef ASSERT
 689     _saved_code = NULL;
 690     _saved_code_length = 0;
 691 #endif
 692   }
 693 
 694   void deallocate();
 695 
 696   // should never be used
 697   AdapterHandlerEntry();
 698 
 699  public:
 700   address get_i2c_entry()            const { return _i2c_entry; }
 701   address get_c2i_entry()            const { return _c2i_entry; }
 702   address get_c2i_unverified_entry() const { return _c2i_unverified_entry; }

 703   address base_address();
 704   void relocate(address new_base);
 705 
 706   AdapterFingerPrint* fingerprint() const { return _fingerprint; }
 707 
 708   AdapterHandlerEntry* next() {
 709     return (AdapterHandlerEntry*)BasicHashtableEntry<mtCode>::next();
 710   }
 711 
 712 #ifdef ASSERT
 713   // Used to verify that code generated for shared adapters is equivalent
 714   void save_code   (unsigned char* code, int length);
 715   bool compare_code(unsigned char* code, int length);
 716 #endif
 717 
 718   //virtual void print_on(outputStream* st) const;  DO NOT USE
 719   void print_adapter_on(outputStream* st) const;
 720 };
 721 
 722 // This class is used only with DumpSharedSpaces==true. It holds extra information


 728 
 729 public:
 730   address get_c2i_entry_trampoline()             const { return _c2i_entry_trampoline; }
 731   AdapterHandlerEntry** get_adapter_trampoline() const { return _adapter_trampoline; }
 732   void init() NOT_CDS_RETURN;
 733 };
 734 
 735 
 736 class AdapterHandlerLibrary: public AllStatic {
 737  private:
 738   static BufferBlob* _buffer; // the temporary code buffer in CodeCache
 739   static AdapterHandlerTable* _adapters;
 740   static AdapterHandlerEntry* _abstract_method_handler;
 741   static BufferBlob* buffer_blob();
 742   static void initialize();
 743   static AdapterHandlerEntry* get_adapter0(const methodHandle& method);
 744 
 745  public:
 746 
 747   static AdapterHandlerEntry* new_entry(AdapterFingerPrint* fingerprint,
 748                                         address i2c_entry, address c2i_entry, address c2i_unverified_entry);

 749   static void create_native_wrapper(const methodHandle& method);
 750   static AdapterHandlerEntry* get_adapter(const methodHandle& method);
 751 
 752   static void print_handler(const CodeBlob* b) { print_handler_on(tty, b); }
 753   static void print_handler_on(outputStream* st, const CodeBlob* b);
 754   static bool contains(const CodeBlob* b);
 755 #ifndef PRODUCT
 756   static void print_statistics();
 757 #endif // PRODUCT
 758 
 759 };
 760 
 761 #endif // SHARE_VM_RUNTIME_SHAREDRUNTIME_HPP


 537   // Slow-path Locking and Unlocking
 538   static void complete_monitor_locking_C(oopDesc* obj, BasicLock* lock, JavaThread* thread);
 539   static void complete_monitor_unlocking_C(oopDesc* obj, BasicLock* lock, JavaThread* thread);
 540 
 541   // Resolving of calls
 542   static address resolve_static_call_C     (JavaThread *thread);
 543   static address resolve_virtual_call_C    (JavaThread *thread);
 544   static address resolve_opt_virtual_call_C(JavaThread *thread);
 545 
 546   // arraycopy, the non-leaf version.  (See StubRoutines for all the leaf calls.)
 547   static void slow_arraycopy_C(oopDesc* src,  jint src_pos,
 548                                oopDesc* dest, jint dest_pos,
 549                                jint length, JavaThread* thread);
 550 
 551   // handle ic miss with caller being compiled code
 552   // wrong method handling (inline cache misses, zombie methods)
 553   static address handle_wrong_method(JavaThread* thread);
 554   static address handle_wrong_method_abstract(JavaThread* thread);
 555   static address handle_wrong_method_ic_miss(JavaThread* thread);
 556   static void allocate_value_types(JavaThread* thread, Method* callee);
 557   static void apply_post_barriers(JavaThread* thread, objArrayOopDesc* array);
 558 
 559   static address handle_unsafe_access(JavaThread* thread, address next_pc);
 560 
 561 #ifndef PRODUCT
 562 
 563   // Collect and print inline cache miss statistics
 564  private:
 565   enum { maxICmiss_count = 100 };
 566   static int     _ICmiss_index;                  // length of IC miss histogram
 567   static int     _ICmiss_count[maxICmiss_count]; // miss counts
 568   static address _ICmiss_at[maxICmiss_count];    // miss addresses
 569   static void trace_ic_miss(address at);
 570 
 571  public:
 572   static int _throw_null_ctr;                    // throwing a null-pointer exception
 573   static int _ic_miss_ctr;                       // total # of IC misses
 574   static int _wrong_method_ctr;
 575   static int _resolve_static_ctr;
 576   static int _resolve_virtual_ctr;
 577   static int _resolve_opt_virtual_ctr;


 656 // setup.  Compiled frames are fixed-size and the args are likely not in the
 657 // right place.  Hence all the args will likely be copied into the
 658 // interpreter's frame, forcing that frame to grow.  The compiled frame's
 659 // outgoing stack args will be dead after the copy.
 660 //
 661 // Native wrappers, like adapters, marshal arguments.  Unlike adapters they
 662 // also perform an official frame push & pop.  They have a call to the native
 663 // routine in their middles and end in a return (instead of ending in a jump).
 664 // The native wrappers are stored in real nmethods instead of the BufferBlobs
 665 // used by the adapters.  The code generation happens here because it's very
 666 // similar to what the adapters have to do.
 667 
 668 class AdapterHandlerEntry : public BasicHashtableEntry<mtCode> {
 669   friend class AdapterHandlerTable;
 670 
 671  private:
 672   AdapterFingerPrint* _fingerprint;
 673   address _i2c_entry;
 674   address _c2i_entry;
 675   address _c2i_unverified_entry;
 676   Symbol* _sig_extended;
 677 
 678 #ifdef ASSERT
 679   // Captures code and signature used to generate this adapter when
 680   // verifying adapter equivalence.
 681   unsigned char* _saved_code;
 682   int            _saved_code_length;
 683 #endif
 684 
 685   void init(AdapterFingerPrint* fingerprint, address i2c_entry, address c2i_entry, address c2i_unverified_entry, Symbol* sig_extended) {
 686     _fingerprint = fingerprint;
 687     _i2c_entry = i2c_entry;
 688     _c2i_entry = c2i_entry;
 689     _c2i_unverified_entry = c2i_unverified_entry;
 690     _sig_extended = sig_extended;
 691 #ifdef ASSERT
 692     _saved_code = NULL;
 693     _saved_code_length = 0;
 694 #endif
 695   }
 696 
 697   void deallocate();
 698 
 699   // should never be used
 700   AdapterHandlerEntry();
 701 
 702  public:
 703   address get_i2c_entry()            const { return _i2c_entry; }
 704   address get_c2i_entry()            const { return _c2i_entry; }
 705   address get_c2i_unverified_entry() const { return _c2i_unverified_entry; }
 706   Symbol* get_sig_extended()         const { return _sig_extended; }
 707   address base_address();
 708   void relocate(address new_base);
 709 
 710   AdapterFingerPrint* fingerprint() const { return _fingerprint; }
 711 
 712   AdapterHandlerEntry* next() {
 713     return (AdapterHandlerEntry*)BasicHashtableEntry<mtCode>::next();
 714   }
 715 
 716 #ifdef ASSERT
 717   // Used to verify that code generated for shared adapters is equivalent
 718   void save_code   (unsigned char* code, int length);
 719   bool compare_code(unsigned char* code, int length);
 720 #endif
 721 
 722   //virtual void print_on(outputStream* st) const;  DO NOT USE
 723   void print_adapter_on(outputStream* st) const;
 724 };
 725 
 726 // This class is used only with DumpSharedSpaces==true. It holds extra information


 732 
 733 public:
 734   address get_c2i_entry_trampoline()             const { return _c2i_entry_trampoline; }
 735   AdapterHandlerEntry** get_adapter_trampoline() const { return _adapter_trampoline; }
 736   void init() NOT_CDS_RETURN;
 737 };
 738 
 739 
 740 class AdapterHandlerLibrary: public AllStatic {
 741  private:
 742   static BufferBlob* _buffer; // the temporary code buffer in CodeCache
 743   static AdapterHandlerTable* _adapters;
 744   static AdapterHandlerEntry* _abstract_method_handler;
 745   static BufferBlob* buffer_blob();
 746   static void initialize();
 747   static AdapterHandlerEntry* get_adapter0(const methodHandle& method);
 748 
 749  public:
 750 
 751   static AdapterHandlerEntry* new_entry(AdapterFingerPrint* fingerprint,
 752                                         address i2c_entry, address c2i_entry, address c2i_unverified_entry,
 753                                         Symbol* sig_extended = NULL);
 754   static void create_native_wrapper(const methodHandle& method);
 755   static AdapterHandlerEntry* get_adapter(const methodHandle& method);
 756 
 757   static void print_handler(const CodeBlob* b) { print_handler_on(tty, b); }
 758   static void print_handler_on(outputStream* st, const CodeBlob* b);
 759   static bool contains(const CodeBlob* b);
 760 #ifndef PRODUCT
 761   static void print_statistics();
 762 #endif // PRODUCT
 763 
 764 };
 765 
 766 #endif // SHARE_VM_RUNTIME_SHAREDRUNTIME_HPP
< prev index next >