57 static RuntimeStub* _wrong_method_blob;
58 static RuntimeStub* _wrong_method_abstract_blob;
59 static RuntimeStub* _ic_miss_blob;
60 static RuntimeStub* _resolve_opt_virtual_call_blob;
61 static RuntimeStub* _resolve_virtual_call_blob;
62 static RuntimeStub* _resolve_static_call_blob;
63 static address _resolve_static_call_entry;
64
65 static DeoptimizationBlob* _deopt_blob;
66
67 static SafepointBlob* _polling_page_vectors_safepoint_handler_blob;
68 static SafepointBlob* _polling_page_safepoint_handler_blob;
69 static SafepointBlob* _polling_page_return_handler_blob;
70
71 #ifdef COMPILER2
72 static UncommonTrapBlob* _uncommon_trap_blob;
73 #endif // COMPILER2
74
75 #ifndef PRODUCT
76 // Counters
77 static int _nof_megamorphic_calls; // total # of megamorphic calls (through vtable)
78 #endif // !PRODUCT
79
80 private:
81 enum { POLL_AT_RETURN, POLL_AT_LOOP, POLL_AT_VECTOR_LOOP };
82 static SafepointBlob* generate_handler_blob(address call_ptr, int poll_type);
83 static RuntimeStub* generate_resolve_blob(address destination, const char* name);
84
85 public:
86 static void generate_stubs(void);
87
88 // max bytes for each dtrace string parameter
89 enum { max_dtrace_string_size = 256 };
90
91 // The following arithmetic routines are used on platforms that do
92 // not have machine instructions to implement their functionality.
93 // Do not remove these.
94
95 // long arithmetics
96 static jlong lmul(jlong y, jlong x);
97 static jlong ldiv(jlong y, jlong x);
551 static int _jlong_array_copy_ctr; // Slow-path long array copy
552 static int _oop_array_copy_ctr; // Slow-path oop array copy
553 static int _checkcast_array_copy_ctr; // Slow-path oop array copy, with cast
554 static int _unsafe_array_copy_ctr; // Slow-path includes alignment checks
555 static int _generic_array_copy_ctr; // Slow-path includes type decoding
556 static int _slow_array_copy_ctr; // Slow-path failed out to a method call
557
558 static int _new_instance_ctr; // 'new' object requires GC
559 static int _new_array_ctr; // 'new' array requires GC
560 static int _multi1_ctr, _multi2_ctr, _multi3_ctr, _multi4_ctr, _multi5_ctr;
561 static int _find_handler_ctr; // find exception handler
562 static int _rethrow_ctr; // rethrow exception
563 static int _mon_enter_stub_ctr; // monitor enter stub
564 static int _mon_exit_stub_ctr; // monitor exit stub
565 static int _mon_enter_ctr; // monitor enter slow
566 static int _mon_exit_ctr; // monitor exit slow
567 static int _partial_subtype_ctr; // SubRoutines::partial_subtype_check
568
569 // Statistics code
570 // stats for "normal" compiled calls (non-interface)
571 static int _nof_normal_calls; // total # of calls
572 static int _nof_optimized_calls; // total # of statically-bound calls
573 static int _nof_inlined_calls; // total # of inlined normal calls
574 static int _nof_static_calls; // total # of calls to static methods or super methods (invokespecial)
575 static int _nof_inlined_static_calls; // total # of inlined static calls
576 // stats for compiled interface calls
577 static int _nof_interface_calls; // total # of compiled calls
578 static int _nof_optimized_interface_calls; // total # of statically-bound interface calls
579 static int _nof_inlined_interface_calls; // total # of inlined interface calls
580 static int _nof_megamorphic_interface_calls;// total # of megamorphic interface calls
581 // stats for runtime exceptions
582 static int _nof_removable_exceptions; // total # of exceptions that could be replaced by branches due to inlining
583
584 public: // for compiler
585 static address nof_normal_calls_addr() { return (address)&_nof_normal_calls; }
586 static address nof_optimized_calls_addr() { return (address)&_nof_optimized_calls; }
587 static address nof_inlined_calls_addr() { return (address)&_nof_inlined_calls; }
588 static address nof_static_calls_addr() { return (address)&_nof_static_calls; }
589 static address nof_inlined_static_calls_addr() { return (address)&_nof_inlined_static_calls; }
590 static address nof_interface_calls_addr() { return (address)&_nof_interface_calls; }
591 static address nof_optimized_interface_calls_addr() { return (address)&_nof_optimized_interface_calls; }
592 static address nof_inlined_interface_calls_addr() { return (address)&_nof_inlined_interface_calls; }
593 static address nof_megamorphic_interface_calls_addr() { return (address)&_nof_megamorphic_interface_calls; }
594 static void print_call_statistics(int comp_total);
595 static void print_statistics();
596 static void print_ic_miss_histogram();
597
598 #endif // PRODUCT
599 };
600
601
602 // ---------------------------------------------------------------------------
603 // Implementation of AdapterHandlerLibrary
604 //
605 // This library manages argument marshaling adapters and native wrappers.
606 // There are 2 flavors of adapters: I2C and C2I.
607 //
608 // The I2C flavor takes a stock interpreted call setup, marshals the
609 // arguments for a Java-compiled call, and jumps to Rmethod-> code()->
610 // code_begin(). It is broken to call it without an nmethod assigned.
611 // The usual behavior is to lift any register arguments up out of the
612 // stack and possibly re-pack the extra arguments to be contiguous.
613 // I2C adapters will save what the interpreter's stack pointer will be
614 // after arguments are popped, then adjust the interpreter's frame
|
57 static RuntimeStub* _wrong_method_blob;
58 static RuntimeStub* _wrong_method_abstract_blob;
59 static RuntimeStub* _ic_miss_blob;
60 static RuntimeStub* _resolve_opt_virtual_call_blob;
61 static RuntimeStub* _resolve_virtual_call_blob;
62 static RuntimeStub* _resolve_static_call_blob;
63 static address _resolve_static_call_entry;
64
65 static DeoptimizationBlob* _deopt_blob;
66
67 static SafepointBlob* _polling_page_vectors_safepoint_handler_blob;
68 static SafepointBlob* _polling_page_safepoint_handler_blob;
69 static SafepointBlob* _polling_page_return_handler_blob;
70
71 #ifdef COMPILER2
72 static UncommonTrapBlob* _uncommon_trap_blob;
73 #endif // COMPILER2
74
75 #ifndef PRODUCT
76 // Counters
77 static int64_t _nof_megamorphic_calls; // total # of megamorphic calls (through vtable)
78 #endif // !PRODUCT
79
80 private:
81 enum { POLL_AT_RETURN, POLL_AT_LOOP, POLL_AT_VECTOR_LOOP };
82 static SafepointBlob* generate_handler_blob(address call_ptr, int poll_type);
83 static RuntimeStub* generate_resolve_blob(address destination, const char* name);
84
85 public:
86 static void generate_stubs(void);
87
88 // max bytes for each dtrace string parameter
89 enum { max_dtrace_string_size = 256 };
90
91 // The following arithmetic routines are used on platforms that do
92 // not have machine instructions to implement their functionality.
93 // Do not remove these.
94
95 // long arithmetics
96 static jlong lmul(jlong y, jlong x);
97 static jlong ldiv(jlong y, jlong x);
551 static int _jlong_array_copy_ctr; // Slow-path long array copy
552 static int _oop_array_copy_ctr; // Slow-path oop array copy
553 static int _checkcast_array_copy_ctr; // Slow-path oop array copy, with cast
554 static int _unsafe_array_copy_ctr; // Slow-path includes alignment checks
555 static int _generic_array_copy_ctr; // Slow-path includes type decoding
556 static int _slow_array_copy_ctr; // Slow-path failed out to a method call
557
558 static int _new_instance_ctr; // 'new' object requires GC
559 static int _new_array_ctr; // 'new' array requires GC
560 static int _multi1_ctr, _multi2_ctr, _multi3_ctr, _multi4_ctr, _multi5_ctr;
561 static int _find_handler_ctr; // find exception handler
562 static int _rethrow_ctr; // rethrow exception
563 static int _mon_enter_stub_ctr; // monitor enter stub
564 static int _mon_exit_stub_ctr; // monitor exit stub
565 static int _mon_enter_ctr; // monitor enter slow
566 static int _mon_exit_ctr; // monitor exit slow
567 static int _partial_subtype_ctr; // SubRoutines::partial_subtype_check
568
569 // Statistics code
570 // stats for "normal" compiled calls (non-interface)
571 static int64_t _nof_normal_calls; // total # of calls
572 static int64_t _nof_optimized_calls; // total # of statically-bound 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_optimized_interface_calls; // total # of statically-bound interface calls
579 static int64_t _nof_inlined_interface_calls; // total # of inlined interface calls
580 static int64_t _nof_megamorphic_interface_calls;// total # of megamorphic interface calls
581 // stats for runtime exceptions
582 static int _nof_removable_exceptions; // total # of exceptions that could be replaced by branches due to inlining
583
584 public: // for compiler
585 static address nof_normal_calls_addr() { return (address)&_nof_normal_calls; }
586 static address nof_optimized_calls_addr() { return (address)&_nof_optimized_calls; }
587 static address nof_inlined_calls_addr() { return (address)&_nof_inlined_calls; }
588 static address nof_static_calls_addr() { return (address)&_nof_static_calls; }
589 static address nof_inlined_static_calls_addr() { return (address)&_nof_inlined_static_calls; }
590 static address nof_interface_calls_addr() { return (address)&_nof_interface_calls; }
591 static address nof_optimized_interface_calls_addr() { return (address)&_nof_optimized_interface_calls; }
592 static address nof_inlined_interface_calls_addr() { return (address)&_nof_inlined_interface_calls; }
593 static address nof_megamorphic_interface_calls_addr() { return (address)&_nof_megamorphic_interface_calls; }
594 static void print_call_statistics(uint64_t comp_total);
595 static void print_statistics();
596 static void print_ic_miss_histogram();
597
598 #endif // PRODUCT
599 };
600
601
602 // ---------------------------------------------------------------------------
603 // Implementation of AdapterHandlerLibrary
604 //
605 // This library manages argument marshaling adapters and native wrappers.
606 // There are 2 flavors of adapters: I2C and C2I.
607 //
608 // The I2C flavor takes a stock interpreted call setup, marshals the
609 // arguments for a Java-compiled call, and jumps to Rmethod-> code()->
610 // code_begin(). It is broken to call it without an nmethod assigned.
611 // The usual behavior is to lift any register arguments up out of the
612 // stack and possibly re-pack the extra arguments to be contiguous.
613 // I2C adapters will save what the interpreter's stack pointer will be
614 // after arguments are popped, then adjust the interpreter's frame
|