498
499 // Resolving of calls
500 static address get_resolved_entry (JavaThread* current, methodHandle callee_method);
501 static address resolve_static_call_C (JavaThread* current);
502 static address resolve_virtual_call_C (JavaThread* current);
503 static address resolve_opt_virtual_call_C(JavaThread* current);
504
505 // arraycopy, the non-leaf version. (See StubRoutines for all the leaf calls.)
506 static void slow_arraycopy_C(oopDesc* src, jint src_pos,
507 oopDesc* dest, jint dest_pos,
508 jint length, JavaThread* thread);
509
510 // handle ic miss with caller being compiled code
511 // wrong method handling (inline cache misses)
512 static address handle_wrong_method(JavaThread* current);
513 static address handle_wrong_method_abstract(JavaThread* current);
514 static address handle_wrong_method_ic_miss(JavaThread* current);
515
516 static address handle_unsafe_access(JavaThread* thread, address next_pc);
517
518 #ifndef PRODUCT
519
520 // Collect and print inline cache miss statistics
521 private:
522 enum { maxICmiss_count = 100 };
523 static int _ICmiss_index; // length of IC miss histogram
524 static int _ICmiss_count[maxICmiss_count]; // miss counts
525 static address _ICmiss_at[maxICmiss_count]; // miss addresses
526 static void trace_ic_miss(address at);
527
528 public:
529 static uint _ic_miss_ctr; // total # of IC misses
530 static uint _wrong_method_ctr;
531 static uint _resolve_static_ctr;
532 static uint _resolve_virtual_ctr;
533 static uint _resolve_opt_virtual_ctr;
534 static uint _implicit_null_throws;
535 static uint _implicit_div0_throws;
536
537 static uint _jbyte_array_copy_ctr; // Slow-path byte array copy
538 static uint _jshort_array_copy_ctr; // Slow-path short array copy
539 static uint _jint_array_copy_ctr; // Slow-path int array copy
540 static uint _jlong_array_copy_ctr; // Slow-path long array copy
541 static uint _oop_array_copy_ctr; // Slow-path oop array copy
542 static uint _checkcast_array_copy_ctr; // Slow-path oop array copy, with cast
543 static uint _unsafe_array_copy_ctr; // Slow-path includes alignment checks
544 static uint _generic_array_copy_ctr; // Slow-path includes type decoding
545 static uint _slow_array_copy_ctr; // Slow-path failed out to a method call
546
547 static uint _unsafe_set_memory_ctr; // Slow-path includes alignment checks
548
549 static uint _new_instance_ctr; // 'new' object requires GC
550 static uint _new_array_ctr; // 'new' array requires GC
551 static uint _multi2_ctr, _multi3_ctr, _multi4_ctr, _multi5_ctr;
552 static uint _find_handler_ctr; // find exception handler
553 static uint _rethrow_ctr; // rethrow exception
557 static uint _mon_exit_ctr; // monitor exit slow
558 static uint _partial_subtype_ctr; // SubRoutines::partial_subtype_check
559
560 // Statistics code
561 // stats for "normal" compiled calls (non-interface)
562 static int64_t _nof_normal_calls; // total # of calls
563 static int64_t _nof_inlined_calls; // total # of inlined normal calls
564 static int64_t _nof_static_calls; // total # of calls to static methods or super methods (invokespecial)
565 static int64_t _nof_inlined_static_calls; // total # of inlined static calls
566 // stats for compiled interface calls
567 static int64_t _nof_interface_calls; // total # of compiled calls
568 static int64_t _nof_inlined_interface_calls; // total # of inlined interface calls
569
570 public: // for compiler
571 static address nof_normal_calls_addr() { return (address)&_nof_normal_calls; }
572 static address nof_inlined_calls_addr() { return (address)&_nof_inlined_calls; }
573 static address nof_static_calls_addr() { return (address)&_nof_static_calls; }
574 static address nof_inlined_static_calls_addr() { return (address)&_nof_inlined_static_calls; }
575 static address nof_interface_calls_addr() { return (address)&_nof_interface_calls; }
576 static address nof_inlined_interface_calls_addr() { return (address)&_nof_inlined_interface_calls; }
577 static void print_call_statistics(uint64_t comp_total);
578 static void print_ic_miss_histogram();
579
580 #endif // PRODUCT
581
582 static void print_statistics() PRODUCT_RETURN;
583 };
584
585
586 // ---------------------------------------------------------------------------
587 // Implementation of AdapterHandlerLibrary
588 //
589 // This library manages argument marshaling adapters and native wrappers.
590 // There are 2 flavors of adapters: I2C and C2I.
591 //
592 // The I2C flavor takes a stock interpreted call setup, marshals the
593 // arguments for a Java-compiled call, and jumps to Rmethod-> code()->
594 // code_begin(). It is broken to call it without an nmethod assigned.
595 // The usual behavior is to lift any register arguments up out of the
596 // stack and possibly re-pack the extra arguments to be contiguous.
597 // I2C adapters will save what the interpreter's stack pointer will be
598 // after arguments are popped, then adjust the interpreter's frame
599 // size to force alignment and possibly to repack the arguments.
684 static void initialize();
685 static AdapterHandlerEntry* create_adapter(AdapterBlob*& new_adapter,
686 int total_args_passed,
687 BasicType* sig_bt,
688 bool allocate_code_blob);
689 static AdapterHandlerEntry* get_simple_adapter(const methodHandle& method);
690 public:
691
692 static AdapterHandlerEntry* new_entry(AdapterFingerPrint* fingerprint,
693 address i2c_entry,
694 address c2i_entry,
695 address c2i_unverified_entry,
696 address c2i_no_clinit_check_entry = nullptr);
697 static void create_native_wrapper(const methodHandle& method);
698 static AdapterHandlerEntry* get_adapter(const methodHandle& method);
699
700 static void print_handler(const CodeBlob* b) { print_handler_on(tty, b); }
701 static void print_handler_on(outputStream* st, const CodeBlob* b);
702 static bool contains(const CodeBlob* b);
703 #ifndef PRODUCT
704 static void print_statistics();
705 #endif // PRODUCT
706
707 };
708
709 #endif // SHARE_RUNTIME_SHAREDRUNTIME_HPP
|
498
499 // Resolving of calls
500 static address get_resolved_entry (JavaThread* current, methodHandle callee_method);
501 static address resolve_static_call_C (JavaThread* current);
502 static address resolve_virtual_call_C (JavaThread* current);
503 static address resolve_opt_virtual_call_C(JavaThread* current);
504
505 // arraycopy, the non-leaf version. (See StubRoutines for all the leaf calls.)
506 static void slow_arraycopy_C(oopDesc* src, jint src_pos,
507 oopDesc* dest, jint dest_pos,
508 jint length, JavaThread* thread);
509
510 // handle ic miss with caller being compiled code
511 // wrong method handling (inline cache misses)
512 static address handle_wrong_method(JavaThread* current);
513 static address handle_wrong_method_abstract(JavaThread* current);
514 static address handle_wrong_method_ic_miss(JavaThread* current);
515
516 static address handle_unsafe_access(JavaThread* thread, address next_pc);
517
518 private:
519 static PerfTickCounters* _perf_resolve_opt_virtual_total_time;
520 static PerfTickCounters* _perf_resolve_virtual_total_time;
521 static PerfTickCounters* _perf_resolve_static_total_time;
522 static PerfTickCounters* _perf_handle_wrong_method_total_time;
523 static PerfTickCounters* _perf_ic_miss_total_time;
524 public:
525 static uint _ic_miss_ctr; // total # of IC misses
526 static uint _wrong_method_ctr;
527 static uint _resolve_static_ctr;
528 static uint _resolve_virtual_ctr;
529 static uint _resolve_opt_virtual_ctr;
530
531 static void print_counters_on(outputStream* st);
532
533 #ifndef PRODUCT
534
535 // Collect and print inline cache miss statistics
536 private:
537 enum { maxICmiss_count = 100 };
538 static int _ICmiss_index; // length of IC miss histogram
539 static int _ICmiss_count[maxICmiss_count]; // miss counts
540 static address _ICmiss_at[maxICmiss_count]; // miss addresses
541 static void trace_ic_miss(address at);
542
543 public:
544 static uint _implicit_null_throws;
545 static uint _implicit_div0_throws;
546
547 static uint _jbyte_array_copy_ctr; // Slow-path byte array copy
548 static uint _jshort_array_copy_ctr; // Slow-path short array copy
549 static uint _jint_array_copy_ctr; // Slow-path int array copy
550 static uint _jlong_array_copy_ctr; // Slow-path long array copy
551 static uint _oop_array_copy_ctr; // Slow-path oop array copy
552 static uint _checkcast_array_copy_ctr; // Slow-path oop array copy, with cast
553 static uint _unsafe_array_copy_ctr; // Slow-path includes alignment checks
554 static uint _generic_array_copy_ctr; // Slow-path includes type decoding
555 static uint _slow_array_copy_ctr; // Slow-path failed out to a method call
556
557 static uint _unsafe_set_memory_ctr; // Slow-path includes alignment checks
558
559 static uint _new_instance_ctr; // 'new' object requires GC
560 static uint _new_array_ctr; // 'new' array requires GC
561 static uint _multi2_ctr, _multi3_ctr, _multi4_ctr, _multi5_ctr;
562 static uint _find_handler_ctr; // find exception handler
563 static uint _rethrow_ctr; // rethrow exception
567 static uint _mon_exit_ctr; // monitor exit slow
568 static uint _partial_subtype_ctr; // SubRoutines::partial_subtype_check
569
570 // Statistics code
571 // stats for "normal" compiled calls (non-interface)
572 static int64_t _nof_normal_calls; // total # of calls
573 static int64_t _nof_inlined_calls; // total # of inlined normal calls
574 static int64_t _nof_static_calls; // total # of calls to static methods or super methods (invokespecial)
575 static int64_t _nof_inlined_static_calls; // total # of inlined static calls
576 // stats for compiled interface calls
577 static int64_t _nof_interface_calls; // total # of compiled calls
578 static int64_t _nof_inlined_interface_calls; // total # of inlined interface calls
579
580 public: // for compiler
581 static address nof_normal_calls_addr() { return (address)&_nof_normal_calls; }
582 static address nof_inlined_calls_addr() { return (address)&_nof_inlined_calls; }
583 static address nof_static_calls_addr() { return (address)&_nof_static_calls; }
584 static address nof_inlined_static_calls_addr() { return (address)&_nof_inlined_static_calls; }
585 static address nof_interface_calls_addr() { return (address)&_nof_interface_calls; }
586 static address nof_inlined_interface_calls_addr() { return (address)&_nof_inlined_interface_calls; }
587
588 static void print_call_statistics_on(outputStream* st);
589 static void print_ic_miss_histogram_on(outputStream* st);
590 #endif // PRODUCT
591
592 static void print_statistics() PRODUCT_RETURN;
593 };
594
595
596 // ---------------------------------------------------------------------------
597 // Implementation of AdapterHandlerLibrary
598 //
599 // This library manages argument marshaling adapters and native wrappers.
600 // There are 2 flavors of adapters: I2C and C2I.
601 //
602 // The I2C flavor takes a stock interpreted call setup, marshals the
603 // arguments for a Java-compiled call, and jumps to Rmethod-> code()->
604 // code_begin(). It is broken to call it without an nmethod assigned.
605 // The usual behavior is to lift any register arguments up out of the
606 // stack and possibly re-pack the extra arguments to be contiguous.
607 // I2C adapters will save what the interpreter's stack pointer will be
608 // after arguments are popped, then adjust the interpreter's frame
609 // size to force alignment and possibly to repack the arguments.
694 static void initialize();
695 static AdapterHandlerEntry* create_adapter(AdapterBlob*& new_adapter,
696 int total_args_passed,
697 BasicType* sig_bt,
698 bool allocate_code_blob);
699 static AdapterHandlerEntry* get_simple_adapter(const methodHandle& method);
700 public:
701
702 static AdapterHandlerEntry* new_entry(AdapterFingerPrint* fingerprint,
703 address i2c_entry,
704 address c2i_entry,
705 address c2i_unverified_entry,
706 address c2i_no_clinit_check_entry = nullptr);
707 static void create_native_wrapper(const methodHandle& method);
708 static AdapterHandlerEntry* get_adapter(const methodHandle& method);
709
710 static void print_handler(const CodeBlob* b) { print_handler_on(tty, b); }
711 static void print_handler_on(outputStream* st, const CodeBlob* b);
712 static bool contains(const CodeBlob* b);
713 #ifndef PRODUCT
714 static void print_statistics_on(outputStream* st);
715 #endif // PRODUCT
716
717 };
718
719 #endif // SHARE_RUNTIME_SHAREDRUNTIME_HPP
|