src/share/vm/runtime/sharedRuntime.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File JDK-8026478 Sdiff src/share/vm/runtime

src/share/vm/runtime/sharedRuntime.hpp

Print this page




 588 // Native wrappers, like adapters, marshal arguments.  Unlike adapters they
 589 // also perform an offical frame push & pop.  They have a call to the native
 590 // routine in their middles and end in a return (instead of ending in a jump).
 591 // The native wrappers are stored in real nmethods instead of the BufferBlobs
 592 // used by the adapters.  The code generation happens here because it's very
 593 // similar to what the adapters have to do.
 594 
 595 class AdapterHandlerEntry : public BasicHashtableEntry<mtCode> {
 596   friend class AdapterHandlerTable;
 597 
 598  private:
 599   AdapterFingerPrint* _fingerprint;
 600   address _i2c_entry;
 601   address _c2i_entry;
 602   address _c2i_unverified_entry;
 603 
 604 #ifdef ASSERT
 605   // Captures code and signature used to generate this adapter when
 606   // verifing adapter equivalence.
 607   unsigned char* _saved_code;
 608   int            _code_length;
 609   BasicType*     _saved_sig;
 610   int            _total_args_passed;
 611 #endif
 612 
 613   void init(AdapterFingerPrint* fingerprint, address i2c_entry, address c2i_entry, address c2i_unverified_entry) {
 614     _fingerprint = fingerprint;
 615     _i2c_entry = i2c_entry;
 616     _c2i_entry = c2i_entry;
 617     _c2i_unverified_entry = c2i_unverified_entry;
 618 #ifdef ASSERT
 619     _saved_code = NULL;
 620     _code_length = 0;
 621     _saved_sig = NULL;
 622     _total_args_passed = 0;
 623 #endif
 624   }
 625 
 626   void deallocate();
 627 
 628   // should never be used
 629   AdapterHandlerEntry();
 630 
 631  public:
 632   address get_i2c_entry()            const { return _i2c_entry; }
 633   address get_c2i_entry()            const { return _c2i_entry; }
 634   address get_c2i_unverified_entry() const { return _c2i_unverified_entry; }
 635 
 636   address base_address();
 637   void relocate(address new_base);
 638 
 639   AdapterFingerPrint* fingerprint() const { return _fingerprint; }
 640 
 641   AdapterHandlerEntry* next() {
 642     return (AdapterHandlerEntry*)BasicHashtableEntry<mtCode>::next();
 643   }
 644 
 645 #ifdef ASSERT
 646   // Used to verify that code generated for shared adapters is equivalent
 647   void save_code(unsigned char* code, int length, int total_args_passed, BasicType* sig_bt);
 648   bool compare_code(unsigned char* code, int length, int total_args_passed, BasicType* sig_bt);
 649 #endif
 650 
 651   //virtual void print_on(outputStream* st) const;  DO NOT USE
 652   void print_adapter_on(outputStream* st) const;
 653 };
 654 
 655 class AdapterHandlerLibrary: public AllStatic {
 656  private:
 657   static BufferBlob* _buffer; // the temporary code buffer in CodeCache
 658   static AdapterHandlerTable* _adapters;
 659   static AdapterHandlerEntry* _abstract_method_handler;
 660   static BufferBlob* buffer_blob();
 661   static void initialize();
 662 
 663  public:
 664 
 665   static AdapterHandlerEntry* new_entry(AdapterFingerPrint* fingerprint,
 666                                         address i2c_entry, address c2i_entry, address c2i_unverified_entry);
 667   static nmethod* create_native_wrapper(methodHandle method, int compile_id);
 668   static AdapterHandlerEntry* get_adapter(methodHandle method);


 588 // Native wrappers, like adapters, marshal arguments.  Unlike adapters they
 589 // also perform an offical frame push & pop.  They have a call to the native
 590 // routine in their middles and end in a return (instead of ending in a jump).
 591 // The native wrappers are stored in real nmethods instead of the BufferBlobs
 592 // used by the adapters.  The code generation happens here because it's very
 593 // similar to what the adapters have to do.
 594 
 595 class AdapterHandlerEntry : public BasicHashtableEntry<mtCode> {
 596   friend class AdapterHandlerTable;
 597 
 598  private:
 599   AdapterFingerPrint* _fingerprint;
 600   address _i2c_entry;
 601   address _c2i_entry;
 602   address _c2i_unverified_entry;
 603 
 604 #ifdef ASSERT
 605   // Captures code and signature used to generate this adapter when
 606   // verifing adapter equivalence.
 607   unsigned char* _saved_code;
 608   int            _saved_code_length;


 609 #endif
 610 
 611   void init(AdapterFingerPrint* fingerprint, address i2c_entry, address c2i_entry, address c2i_unverified_entry) {
 612     _fingerprint = fingerprint;
 613     _i2c_entry = i2c_entry;
 614     _c2i_entry = c2i_entry;
 615     _c2i_unverified_entry = c2i_unverified_entry;
 616 #ifdef ASSERT
 617     _saved_code = NULL;
 618     _saved_code_length = 0;


 619 #endif
 620   }
 621 
 622   void deallocate();
 623 
 624   // should never be used
 625   AdapterHandlerEntry();
 626 
 627  public:
 628   address get_i2c_entry()            const { return _i2c_entry; }
 629   address get_c2i_entry()            const { return _c2i_entry; }
 630   address get_c2i_unverified_entry() const { return _c2i_unverified_entry; }

 631   address base_address();
 632   void relocate(address new_base);
 633 
 634   AdapterFingerPrint* fingerprint() const { return _fingerprint; }
 635 
 636   AdapterHandlerEntry* next() {
 637     return (AdapterHandlerEntry*)BasicHashtableEntry<mtCode>::next();
 638   }
 639 
 640 #ifdef ASSERT
 641   // Used to verify that code generated for shared adapters is equivalent
 642   void save_code   (unsigned char* code, int length);
 643   bool compare_code(unsigned char* code, int length);
 644 #endif
 645 
 646   //virtual void print_on(outputStream* st) const;  DO NOT USE
 647   void print_adapter_on(outputStream* st) const;
 648 };
 649 
 650 class AdapterHandlerLibrary: public AllStatic {
 651  private:
 652   static BufferBlob* _buffer; // the temporary code buffer in CodeCache
 653   static AdapterHandlerTable* _adapters;
 654   static AdapterHandlerEntry* _abstract_method_handler;
 655   static BufferBlob* buffer_blob();
 656   static void initialize();
 657 
 658  public:
 659 
 660   static AdapterHandlerEntry* new_entry(AdapterFingerPrint* fingerprint,
 661                                         address i2c_entry, address c2i_entry, address c2i_unverified_entry);
 662   static nmethod* create_native_wrapper(methodHandle method, int compile_id);
 663   static AdapterHandlerEntry* get_adapter(methodHandle method);
src/share/vm/runtime/sharedRuntime.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File