381 // 382 // C argument in register AND stack slot. 383 // Some architectures require that an argument must be passed in a register 384 // AND in a stack slot. These architectures provide a second VMRegPair array 385 // to be filled by the c_calling_convention method. On other architectures, 386 // NULL is being passed as the second VMRegPair array, so arguments are either 387 // passed in a register OR in a stack slot. 388 static int c_calling_convention(const BasicType *sig_bt, VMRegPair *regs, VMRegPair *regs2, 389 int total_args_passed); 390 391 // Compute the new number of arguments in the signature if 32 bit ints 392 // must be converted to longs. Needed if CCallingConventionRequiresIntsAsLongs 393 // is true. 394 static int convert_ints_to_longints_argcnt(int in_args_count, BasicType* in_sig_bt); 395 // Adapt a method's signature if it contains 32 bit integers that must 396 // be converted to longs. Needed if CCallingConventionRequiresIntsAsLongs 397 // is true. 398 static void convert_ints_to_longints(int i2l_argcnt, int& in_args_count, 399 BasicType*& in_sig_bt, VMRegPair*& in_regs); 400 401 // Generate I2C and C2I adapters. These adapters are simple argument marshalling 402 // blobs. Unlike adapters in the tiger and earlier releases the code in these 403 // blobs does not create a new frame and are therefore virtually invisible 404 // to the stack walking code. In general these blobs extend the callers stack 405 // as needed for the conversion of argument locations. 406 407 // When calling a c2i blob the code will always call the interpreter even if 408 // by the time we reach the blob there is compiled code available. This allows 409 // the blob to pass the incoming stack pointer (the sender sp) in a known 410 // location for the interpreter to record. This is used by the frame code 411 // to correct the sender code to match up with the stack pointer when the 412 // thread left the compiled code. In addition it allows the interpreter 413 // to remove the space the c2i adapter allocated to do its argument conversion. 414 415 // Although a c2i blob will always run interpreted even if compiled code is 416 // present if we see that compiled code is present the compiled call site 417 // will be patched/re-resolved so that later calls will run compiled. 418 419 // Additionally a c2i blob need to have a unverified entry because it can be reached 420 // in situations where the call site is an inlined cache site and may go megamorphic. 663 address get_c2i_unverified_entry() const { return _c2i_unverified_entry; } 664 address base_address(); 665 void relocate(address new_base); 666 667 AdapterFingerPrint* fingerprint() const { return _fingerprint; } 668 669 AdapterHandlerEntry* next() { 670 return (AdapterHandlerEntry*)BasicHashtableEntry<mtCode>::next(); 671 } 672 673 #ifdef ASSERT 674 // Used to verify that code generated for shared adapters is equivalent 675 void save_code (unsigned char* code, int length); 676 bool compare_code(unsigned char* code, int length); 677 #endif 678 679 //virtual void print_on(outputStream* st) const; DO NOT USE 680 void print_adapter_on(outputStream* st) const; 681 }; 682 683 class AdapterHandlerLibrary: public AllStatic { 684 private: 685 static BufferBlob* _buffer; // the temporary code buffer in CodeCache 686 static AdapterHandlerTable* _adapters; 687 static AdapterHandlerEntry* _abstract_method_handler; 688 static BufferBlob* buffer_blob(); 689 static void initialize(); 690 691 public: 692 693 static AdapterHandlerEntry* new_entry(AdapterFingerPrint* fingerprint, 694 address i2c_entry, address c2i_entry, address c2i_unverified_entry); 695 static void create_native_wrapper(const methodHandle& method); 696 static AdapterHandlerEntry* get_adapter(const methodHandle& method); 697 698 static void print_handler(const CodeBlob* b) { print_handler_on(tty, b); } 699 static void print_handler_on(outputStream* st, const CodeBlob* b); 700 static bool contains(const CodeBlob* b); 701 #ifndef PRODUCT 702 static void print_statistics(); 703 #endif // PRODUCT 704 705 }; 706 707 #endif // SHARE_VM_RUNTIME_SHAREDRUNTIME_HPP | 381 // 382 // C argument in register AND stack slot. 383 // Some architectures require that an argument must be passed in a register 384 // AND in a stack slot. These architectures provide a second VMRegPair array 385 // to be filled by the c_calling_convention method. On other architectures, 386 // NULL is being passed as the second VMRegPair array, so arguments are either 387 // passed in a register OR in a stack slot. 388 static int c_calling_convention(const BasicType *sig_bt, VMRegPair *regs, VMRegPair *regs2, 389 int total_args_passed); 390 391 // Compute the new number of arguments in the signature if 32 bit ints 392 // must be converted to longs. Needed if CCallingConventionRequiresIntsAsLongs 393 // is true. 394 static int convert_ints_to_longints_argcnt(int in_args_count, BasicType* in_sig_bt); 395 // Adapt a method's signature if it contains 32 bit integers that must 396 // be converted to longs. Needed if CCallingConventionRequiresIntsAsLongs 397 // is true. 398 static void convert_ints_to_longints(int i2l_argcnt, int& in_args_count, 399 BasicType*& in_sig_bt, VMRegPair*& in_regs); 400 401 static size_t trampoline_size(); 402 403 static void generate_trampoline(MacroAssembler *masm, address destination); 404 405 // Generate I2C and C2I adapters. These adapters are simple argument marshalling 406 // blobs. Unlike adapters in the tiger and earlier releases the code in these 407 // blobs does not create a new frame and are therefore virtually invisible 408 // to the stack walking code. In general these blobs extend the callers stack 409 // as needed for the conversion of argument locations. 410 411 // When calling a c2i blob the code will always call the interpreter even if 412 // by the time we reach the blob there is compiled code available. This allows 413 // the blob to pass the incoming stack pointer (the sender sp) in a known 414 // location for the interpreter to record. This is used by the frame code 415 // to correct the sender code to match up with the stack pointer when the 416 // thread left the compiled code. In addition it allows the interpreter 417 // to remove the space the c2i adapter allocated to do its argument conversion. 418 419 // Although a c2i blob will always run interpreted even if compiled code is 420 // present if we see that compiled code is present the compiled call site 421 // will be patched/re-resolved so that later calls will run compiled. 422 423 // Additionally a c2i blob need to have a unverified entry because it can be reached 424 // in situations where the call site is an inlined cache site and may go megamorphic. 667 address get_c2i_unverified_entry() const { return _c2i_unverified_entry; } 668 address base_address(); 669 void relocate(address new_base); 670 671 AdapterFingerPrint* fingerprint() const { return _fingerprint; } 672 673 AdapterHandlerEntry* next() { 674 return (AdapterHandlerEntry*)BasicHashtableEntry<mtCode>::next(); 675 } 676 677 #ifdef ASSERT 678 // Used to verify that code generated for shared adapters is equivalent 679 void save_code (unsigned char* code, int length); 680 bool compare_code(unsigned char* code, int length); 681 #endif 682 683 //virtual void print_on(outputStream* st) const; DO NOT USE 684 void print_adapter_on(outputStream* st) const; 685 }; 686 687 class CDSAdapterHandlerEntry: public AdapterHandlerEntry { 688 address _c2i_entry_trampoline; // allocated from shared spaces "MC" region 689 AdapterHandlerEntry** _adapter_trampoline; // allocated from shared spaces "MD" region 690 691 public: 692 address get_c2i_entry_trampoline() const { return _c2i_entry_trampoline; } 693 AdapterHandlerEntry** get_adapter_trampoline() const { return _adapter_trampoline; } 694 void init() NOT_CDS_RETURN; 695 }; 696 697 698 class AdapterHandlerLibrary: public AllStatic { 699 private: 700 static BufferBlob* _buffer; // the temporary code buffer in CodeCache 701 static AdapterHandlerTable* _adapters; 702 static AdapterHandlerEntry* _abstract_method_handler; 703 static BufferBlob* buffer_blob(); 704 static void initialize(); 705 static AdapterHandlerEntry* get_adapter0(const methodHandle& method); 706 707 public: 708 709 static AdapterHandlerEntry* new_entry(AdapterFingerPrint* fingerprint, 710 address i2c_entry, address c2i_entry, address c2i_unverified_entry); 711 static void create_native_wrapper(const methodHandle& method); 712 static AdapterHandlerEntry* get_adapter(const methodHandle& method); 713 714 static void print_handler(const CodeBlob* b) { print_handler_on(tty, b); } 715 static void print_handler_on(outputStream* st, const CodeBlob* b); 716 static bool contains(const CodeBlob* b); 717 #ifndef PRODUCT 718 static void print_statistics(); 719 #endif // PRODUCT 720 721 }; 722 723 #endif // SHARE_VM_RUNTIME_SHAREDRUNTIME_HPP |