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




 583 // setup.  Compiled frames are fixed-size and the args are likely not in the
 584 // right place.  Hence all the args will likely be copied into the
 585 // interpreter's frame, forcing that frame to grow.  The compiled frame's
 586 // outgoing stack args will be dead after the copy.
 587 //
 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);


 583 // setup.  Compiled frames are fixed-size and the args are likely not in the
 584 // right place.  Hence all the args will likely be copied into the
 585 // interpreter's frame, forcing that frame to grow.  The compiled frame's
 586 // outgoing stack args will be dead after the copy.
 587 //
 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   bool    _contains_all_checks;
 604 
 605 #ifdef ASSERT
 606   // Captures code and signature used to generate this adapter when
 607   // verifing adapter equivalence.
 608   unsigned char* _saved_code;
 609   int            _saved_code_length;


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


 621 #endif
 622   }
 623 
 624   void deallocate();
 625 
 626   // should never be used
 627   AdapterHandlerEntry();
 628 
 629  public:
 630   address get_i2c_entry()            const { return _i2c_entry; }
 631   address get_c2i_entry()            const { return _c2i_entry; }
 632   address get_c2i_unverified_entry() const { return _c2i_unverified_entry; }
 633   void    set_contains_all_checks(bool val){ _contains_all_checks = val; }
 634   bool    contains_all_checks()            { return _contains_all_checks; }
 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);
 648   bool compare_code(unsigned char* code, int length);
 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);
src/share/vm/runtime/sharedRuntime.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File