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