335 |
337 |
336 static AdapterHandlerEntry* generate_i2c2i_adapters(MacroAssembler *_masm, |
338 static AdapterHandlerEntry* generate_i2c2i_adapters(MacroAssembler *_masm, |
337 int total_args_passed, |
339 int total_args_passed, |
338 int max_arg, |
340 int max_arg, |
339 const BasicType *sig_bt, |
341 const BasicType *sig_bt, |
340 const VMRegPair *regs); |
342 const VMRegPair *regs, |
|
343 AdapterFingerPrint* fingerprint); |
341 |
344 |
342 // OSR support |
345 // OSR support |
343 |
346 |
344 // OSR_migration_begin will extract the jvm state from an interpreter |
347 // OSR_migration_begin will extract the jvm state from an interpreter |
345 // frame (locals, monitors) and store the data in a piece of C heap |
348 // frame (locals, monitors) and store the data in a piece of C heap |
526 // routine in their middles and end in a return (instead of ending in a jump). |
529 // routine in their middles and end in a return (instead of ending in a jump). |
527 // The native wrappers are stored in real nmethods instead of the BufferBlobs |
530 // The native wrappers are stored in real nmethods instead of the BufferBlobs |
528 // used by the adapters. The code generation happens here because it's very |
531 // used by the adapters. The code generation happens here because it's very |
529 // similar to what the adapters have to do. |
532 // similar to what the adapters have to do. |
530 |
533 |
531 class AdapterHandlerEntry : public CHeapObj { |
534 class AdapterHandlerEntry : public BasicHashtableEntry { |
|
535 friend class AdapterHandlerTable; |
|
536 |
532 private: |
537 private: |
|
538 AdapterFingerPrint* _fingerprint; |
533 address _i2c_entry; |
539 address _i2c_entry; |
534 address _c2i_entry; |
540 address _c2i_entry; |
535 address _c2i_unverified_entry; |
541 address _c2i_unverified_entry; |
536 |
542 |
|
543 void init(AdapterFingerPrint* fingerprint, address i2c_entry, address c2i_entry, address c2i_unverified_entry) { |
|
544 _fingerprint = fingerprint; |
|
545 _i2c_entry = i2c_entry; |
|
546 _c2i_entry = c2i_entry; |
|
547 _c2i_unverified_entry = c2i_unverified_entry; |
|
548 } |
|
549 |
|
550 // should never be used |
|
551 AdapterHandlerEntry(); |
|
552 |
537 public: |
553 public: |
538 |
|
539 // The name we give all buffer blobs |
554 // The name we give all buffer blobs |
540 static const char* name; |
555 static const char* name; |
541 |
|
542 AdapterHandlerEntry(address i2c_entry, address c2i_entry, address c2i_unverified_entry): |
|
543 _i2c_entry(i2c_entry), |
|
544 _c2i_entry(c2i_entry), |
|
545 _c2i_unverified_entry(c2i_unverified_entry) { |
|
546 } |
|
547 |
556 |
548 address get_i2c_entry() { return _i2c_entry; } |
557 address get_i2c_entry() { return _i2c_entry; } |
549 address get_c2i_entry() { return _c2i_entry; } |
558 address get_c2i_entry() { return _c2i_entry; } |
550 address get_c2i_unverified_entry() { return _c2i_unverified_entry; } |
559 address get_c2i_unverified_entry() { return _c2i_unverified_entry; } |
551 |
560 |
552 void relocate(address new_base); |
561 void relocate(address new_base); |
|
562 |
|
563 AdapterFingerPrint* fingerprint() { return _fingerprint; } |
|
564 |
|
565 AdapterHandlerEntry* next() { |
|
566 return (AdapterHandlerEntry*)BasicHashtableEntry::next(); |
|
567 } |
|
568 |
553 #ifndef PRODUCT |
569 #ifndef PRODUCT |
554 void print(); |
570 void print(); |
555 #endif /* PRODUCT */ |
571 #endif /* PRODUCT */ |
556 }; |
572 }; |
557 |
573 |
558 class AdapterHandlerLibrary: public AllStatic { |
574 class AdapterHandlerLibrary: public AllStatic { |
559 private: |
575 private: |
560 static BufferBlob* _buffer; // the temporary code buffer in CodeCache |
576 static BufferBlob* _buffer; // the temporary code buffer in CodeCache |
561 static GrowableArray<uint64_t>* _fingerprints; // the fingerprint collection |
577 static AdapterHandlerTable* _adapters; |
562 static GrowableArray<AdapterHandlerEntry*> * _handlers; // the corresponding handlers |
578 static AdapterHandlerEntry* _abstract_method_handler; |
563 enum { |
|
564 AbstractMethodHandler = 1 // special handler for abstract methods |
|
565 }; |
|
566 static BufferBlob* buffer_blob(); |
579 static BufferBlob* buffer_blob(); |
567 static void initialize(); |
580 static void initialize(); |
568 static int get_create_adapter_index(methodHandle method); |
|
569 static address get_i2c_entry( int index ) { |
|
570 return get_entry(index)->get_i2c_entry(); |
|
571 } |
|
572 static address get_c2i_entry( int index ) { |
|
573 return get_entry(index)->get_c2i_entry(); |
|
574 } |
|
575 static address get_c2i_unverified_entry( int index ) { |
|
576 return get_entry(index)->get_c2i_unverified_entry(); |
|
577 } |
|
578 |
581 |
579 public: |
582 public: |
580 static AdapterHandlerEntry* get_entry( int index ) { return _handlers->at(index); } |
583 |
|
584 static AdapterHandlerEntry* new_entry(AdapterFingerPrint* fingerprint, |
|
585 address i2c_entry, address c2i_entry, address c2i_unverified_entry); |
581 static nmethod* create_native_wrapper(methodHandle method); |
586 static nmethod* create_native_wrapper(methodHandle method); |
582 static AdapterHandlerEntry* get_adapter(methodHandle method) { |
587 static AdapterHandlerEntry* get_adapter(methodHandle method); |
583 return get_entry(get_create_adapter_index(method)); |
588 |
584 } |
|
585 #ifdef HAVE_DTRACE_H |
589 #ifdef HAVE_DTRACE_H |
586 static nmethod* create_dtrace_nmethod (methodHandle method); |
590 static nmethod* create_dtrace_nmethod (methodHandle method); |
587 #endif // HAVE_DTRACE_H |
591 #endif // HAVE_DTRACE_H |
588 |
592 |
589 #ifndef PRODUCT |
593 #ifndef PRODUCT |
590 static void print_handler(CodeBlob* b); |
594 static void print_handler(CodeBlob* b); |
591 static bool contains(CodeBlob* b); |
595 static bool contains(CodeBlob* b); |
|
596 static void print_statistics(); |
592 #endif /* PRODUCT */ |
597 #endif /* PRODUCT */ |
593 |
598 |
594 }; |
599 }; |