546
547 // Resolving of calls
548 static address get_resolved_entry (JavaThread* current, methodHandle callee_method);
549 static address resolve_static_call_C (JavaThread* current);
550 static address resolve_virtual_call_C (JavaThread* current);
551 static address resolve_opt_virtual_call_C(JavaThread* current);
552
553 // arraycopy, the non-leaf version. (See StubRoutines for all the leaf calls.)
554 static void slow_arraycopy_C(oopDesc* src, jint src_pos,
555 oopDesc* dest, jint dest_pos,
556 jint length, JavaThread* thread);
557
558 // handle ic miss with caller being compiled code
559 // wrong method handling (inline cache misses)
560 static address handle_wrong_method(JavaThread* current);
561 static address handle_wrong_method_abstract(JavaThread* current);
562 static address handle_wrong_method_ic_miss(JavaThread* current);
563
564 static address handle_unsafe_access(JavaThread* thread, address next_pc);
565
566 #ifndef PRODUCT
567
568 // Collect and print inline cache miss statistics
569 private:
570 enum { maxICmiss_count = 100 };
571 static int _ICmiss_index; // length of IC miss histogram
572 static int _ICmiss_count[maxICmiss_count]; // miss counts
573 static address _ICmiss_at[maxICmiss_count]; // miss addresses
574 static void trace_ic_miss(address at);
575
576 public:
577 static uint _ic_miss_ctr; // total # of IC misses
578 static uint _wrong_method_ctr;
579 static uint _resolve_static_ctr;
580 static uint _resolve_virtual_ctr;
581 static uint _resolve_opt_virtual_ctr;
582 static uint _implicit_null_throws;
583 static uint _implicit_div0_throws;
584
585 static uint _jbyte_array_copy_ctr; // Slow-path byte array copy
586 static uint _jshort_array_copy_ctr; // Slow-path short array copy
587 static uint _jint_array_copy_ctr; // Slow-path int array copy
588 static uint _jlong_array_copy_ctr; // Slow-path long array copy
589 static uint _oop_array_copy_ctr; // Slow-path oop array copy
590 static uint _checkcast_array_copy_ctr; // Slow-path oop array copy, with cast
591 static uint _unsafe_array_copy_ctr; // Slow-path includes alignment checks
592 static uint _generic_array_copy_ctr; // Slow-path includes type decoding
593 static uint _slow_array_copy_ctr; // Slow-path failed out to a method call
594
595 static uint _unsafe_set_memory_ctr; // Slow-path includes alignment checks
596
597 static uint _new_instance_ctr; // 'new' object requires GC
598 static uint _new_array_ctr; // 'new' array requires GC
599 static uint _multi2_ctr, _multi3_ctr, _multi4_ctr, _multi5_ctr;
600 static uint _find_handler_ctr; // find exception handler
601 static uint _rethrow_ctr; // rethrow exception
605 static uint _mon_exit_ctr; // monitor exit slow
606 static uint _partial_subtype_ctr; // SubRoutines::partial_subtype_check
607
608 // Statistics code
609 // stats for "normal" compiled calls (non-interface)
610 static int64_t _nof_normal_calls; // total # of calls
611 static int64_t _nof_inlined_calls; // total # of inlined normal calls
612 static int64_t _nof_static_calls; // total # of calls to static methods or super methods (invokespecial)
613 static int64_t _nof_inlined_static_calls; // total # of inlined static calls
614 // stats for compiled interface calls
615 static int64_t _nof_interface_calls; // total # of compiled calls
616 static int64_t _nof_inlined_interface_calls; // total # of inlined interface calls
617
618 public: // for compiler
619 static address nof_normal_calls_addr() { return (address)&_nof_normal_calls; }
620 static address nof_inlined_calls_addr() { return (address)&_nof_inlined_calls; }
621 static address nof_static_calls_addr() { return (address)&_nof_static_calls; }
622 static address nof_inlined_static_calls_addr() { return (address)&_nof_inlined_static_calls; }
623 static address nof_interface_calls_addr() { return (address)&_nof_interface_calls; }
624 static address nof_inlined_interface_calls_addr() { return (address)&_nof_inlined_interface_calls; }
625 static void print_call_statistics(uint64_t comp_total);
626 static void print_ic_miss_histogram();
627
628 #endif // PRODUCT
629
630 static void print_statistics() PRODUCT_RETURN;
631 };
632
633
634 // ---------------------------------------------------------------------------
635 // Implementation of AdapterHandlerLibrary
636 //
637 // This library manages argument marshaling adapters and native wrappers.
638 // There are 2 flavors of adapters: I2C and C2I.
639 //
640 // The I2C flavor takes a stock interpreted call setup, marshals the
641 // arguments for a Java-compiled call, and jumps to Rmethod-> code()->
642 // code_begin(). It is broken to call it without an nmethod assigned.
643 // The usual behavior is to lift any register arguments up out of the
644 // stack and possibly re-pack the extra arguments to be contiguous.
645 // I2C adapters will save what the interpreter's stack pointer will be
646 // after arguments are popped, then adjust the interpreter's frame
647 // size to force alignment and possibly to repack the arguments.
732 static void initialize();
733 static AdapterHandlerEntry* create_adapter(AdapterBlob*& new_adapter,
734 int total_args_passed,
735 BasicType* sig_bt,
736 bool allocate_code_blob);
737 static AdapterHandlerEntry* get_simple_adapter(const methodHandle& method);
738 public:
739
740 static AdapterHandlerEntry* new_entry(AdapterFingerPrint* fingerprint,
741 address i2c_entry,
742 address c2i_entry,
743 address c2i_unverified_entry,
744 address c2i_no_clinit_check_entry = nullptr);
745 static void create_native_wrapper(const methodHandle& method);
746 static AdapterHandlerEntry* get_adapter(const methodHandle& method);
747
748 static void print_handler(const CodeBlob* b) { print_handler_on(tty, b); }
749 static void print_handler_on(outputStream* st, const CodeBlob* b);
750 static bool contains(const CodeBlob* b);
751 #ifndef PRODUCT
752 static void print_statistics();
753 #endif // PRODUCT
754
755 };
756
757 #endif // SHARE_RUNTIME_SHAREDRUNTIME_HPP
|
546
547 // Resolving of calls
548 static address get_resolved_entry (JavaThread* current, methodHandle callee_method);
549 static address resolve_static_call_C (JavaThread* current);
550 static address resolve_virtual_call_C (JavaThread* current);
551 static address resolve_opt_virtual_call_C(JavaThread* current);
552
553 // arraycopy, the non-leaf version. (See StubRoutines for all the leaf calls.)
554 static void slow_arraycopy_C(oopDesc* src, jint src_pos,
555 oopDesc* dest, jint dest_pos,
556 jint length, JavaThread* thread);
557
558 // handle ic miss with caller being compiled code
559 // wrong method handling (inline cache misses)
560 static address handle_wrong_method(JavaThread* current);
561 static address handle_wrong_method_abstract(JavaThread* current);
562 static address handle_wrong_method_ic_miss(JavaThread* current);
563
564 static address handle_unsafe_access(JavaThread* thread, address next_pc);
565
566 private:
567 static PerfTickCounters* _perf_resolve_opt_virtual_total_time;
568 static PerfTickCounters* _perf_resolve_virtual_total_time;
569 static PerfTickCounters* _perf_resolve_static_total_time;
570 static PerfTickCounters* _perf_handle_wrong_method_total_time;
571 static PerfTickCounters* _perf_ic_miss_total_time;
572 public:
573 static uint _ic_miss_ctr; // total # of IC misses
574 static uint _wrong_method_ctr;
575 static uint _resolve_static_ctr;
576 static uint _resolve_virtual_ctr;
577 static uint _resolve_opt_virtual_ctr;
578
579 static void print_counters_on(outputStream* st);
580
581 #ifndef PRODUCT
582
583 // Collect and print inline cache miss statistics
584 private:
585 enum { maxICmiss_count = 100 };
586 static int _ICmiss_index; // length of IC miss histogram
587 static int _ICmiss_count[maxICmiss_count]; // miss counts
588 static address _ICmiss_at[maxICmiss_count]; // miss addresses
589 static void trace_ic_miss(address at);
590
591 public:
592 static uint _implicit_null_throws;
593 static uint _implicit_div0_throws;
594
595 static uint _jbyte_array_copy_ctr; // Slow-path byte array copy
596 static uint _jshort_array_copy_ctr; // Slow-path short array copy
597 static uint _jint_array_copy_ctr; // Slow-path int array copy
598 static uint _jlong_array_copy_ctr; // Slow-path long array copy
599 static uint _oop_array_copy_ctr; // Slow-path oop array copy
600 static uint _checkcast_array_copy_ctr; // Slow-path oop array copy, with cast
601 static uint _unsafe_array_copy_ctr; // Slow-path includes alignment checks
602 static uint _generic_array_copy_ctr; // Slow-path includes type decoding
603 static uint _slow_array_copy_ctr; // Slow-path failed out to a method call
604
605 static uint _unsafe_set_memory_ctr; // Slow-path includes alignment checks
606
607 static uint _new_instance_ctr; // 'new' object requires GC
608 static uint _new_array_ctr; // 'new' array requires GC
609 static uint _multi2_ctr, _multi3_ctr, _multi4_ctr, _multi5_ctr;
610 static uint _find_handler_ctr; // find exception handler
611 static uint _rethrow_ctr; // rethrow exception
615 static uint _mon_exit_ctr; // monitor exit slow
616 static uint _partial_subtype_ctr; // SubRoutines::partial_subtype_check
617
618 // Statistics code
619 // stats for "normal" compiled calls (non-interface)
620 static int64_t _nof_normal_calls; // total # of calls
621 static int64_t _nof_inlined_calls; // total # of inlined normal calls
622 static int64_t _nof_static_calls; // total # of calls to static methods or super methods (invokespecial)
623 static int64_t _nof_inlined_static_calls; // total # of inlined static calls
624 // stats for compiled interface calls
625 static int64_t _nof_interface_calls; // total # of compiled calls
626 static int64_t _nof_inlined_interface_calls; // total # of inlined interface calls
627
628 public: // for compiler
629 static address nof_normal_calls_addr() { return (address)&_nof_normal_calls; }
630 static address nof_inlined_calls_addr() { return (address)&_nof_inlined_calls; }
631 static address nof_static_calls_addr() { return (address)&_nof_static_calls; }
632 static address nof_inlined_static_calls_addr() { return (address)&_nof_inlined_static_calls; }
633 static address nof_interface_calls_addr() { return (address)&_nof_interface_calls; }
634 static address nof_inlined_interface_calls_addr() { return (address)&_nof_inlined_interface_calls; }
635
636 static void print_call_statistics_on(outputStream* st);
637 static void print_ic_miss_histogram_on(outputStream* st);
638 #endif // PRODUCT
639
640 static void print_statistics() PRODUCT_RETURN;
641 };
642
643
644 // ---------------------------------------------------------------------------
645 // Implementation of AdapterHandlerLibrary
646 //
647 // This library manages argument marshaling adapters and native wrappers.
648 // There are 2 flavors of adapters: I2C and C2I.
649 //
650 // The I2C flavor takes a stock interpreted call setup, marshals the
651 // arguments for a Java-compiled call, and jumps to Rmethod-> code()->
652 // code_begin(). It is broken to call it without an nmethod assigned.
653 // The usual behavior is to lift any register arguments up out of the
654 // stack and possibly re-pack the extra arguments to be contiguous.
655 // I2C adapters will save what the interpreter's stack pointer will be
656 // after arguments are popped, then adjust the interpreter's frame
657 // size to force alignment and possibly to repack the arguments.
742 static void initialize();
743 static AdapterHandlerEntry* create_adapter(AdapterBlob*& new_adapter,
744 int total_args_passed,
745 BasicType* sig_bt,
746 bool allocate_code_blob);
747 static AdapterHandlerEntry* get_simple_adapter(const methodHandle& method);
748 public:
749
750 static AdapterHandlerEntry* new_entry(AdapterFingerPrint* fingerprint,
751 address i2c_entry,
752 address c2i_entry,
753 address c2i_unverified_entry,
754 address c2i_no_clinit_check_entry = nullptr);
755 static void create_native_wrapper(const methodHandle& method);
756 static AdapterHandlerEntry* get_adapter(const methodHandle& method);
757
758 static void print_handler(const CodeBlob* b) { print_handler_on(tty, b); }
759 static void print_handler_on(outputStream* st, const CodeBlob* b);
760 static bool contains(const CodeBlob* b);
761 #ifndef PRODUCT
762 static void print_statistics_on(outputStream* st);
763 #endif // PRODUCT
764
765 };
766
767 #endif // SHARE_RUNTIME_SHAREDRUNTIME_HPP
|