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