94 class MethodCounters;
95 class ConstMethod;
96 class InlineTableSizes;
97 class KlassSizeStats;
98
99 class Method : public Metadata {
100 friend class VMStructs;
101 private:
102 ConstMethod* _constMethod; // Method read-only data.
103 MethodData* _method_data;
104 MethodCounters* _method_counters;
105 AccessFlags _access_flags; // Access flags
106 int _vtable_index; // vtable index of this method (see VtableIndexFlag)
107 // note: can have vtables with >2**16 elements (because of inheritance)
108 u2 _method_size; // size of this object
109 u1 _intrinsic_id; // vmSymbols::intrinsic_id (0 == _none)
110 u1 _jfr_towrite : 1, // Flags
111 _caller_sensitive : 1,
112 _force_inline : 1,
113 _hidden : 1,
114 _dont_inline : 1,
115 _has_injected_profile : 1,
116 : 2;
117
118 #ifndef PRODUCT
119 int _compiled_invocation_count; // Number of nmethod invocations so far (for perf. debugging)
120 #endif
121 // Entry point for calling both from and to the interpreter.
122 address _i2i_entry; // All-args-on-stack calling convention
123 // Adapter blob (i2c/c2i) for this Method*. Set once when method is linked.
124 AdapterHandlerEntry* _adapter;
125 // Entry point for calling from compiled code, to compiled code if it exists
126 // or else the interpreter.
127 volatile address _from_compiled_entry; // Cache of: _code ? _code->entry_point() : _adapter->c2i_entry()
128 // The entry point for calling both from and to compiled code is
129 // "_code->entry_point()". Because of tiered compilation and de-opt, this
130 // field can come and go. It can transition from NULL to not-null at any
131 // time (whenever a compile completes). It can transition from not-null to
132 // NULL only at safepoints (because of a de-opt).
133 nmethod* volatile _code; // Points to the corresponding piece of native code
694 Symbol* signature, //anything at all
695 TRAPS);
696 static Klass* check_non_bcp_klass(Klass* klass);
697
698 // How many extra stack entries for invokedynamic when it's enabled
699 static const int extra_stack_entries_for_jsr292 = 1;
700
701 // this operates only on invoke methods:
702 // presize interpreter frames for extra interpreter stack entries, if needed
703 // Account for the extra appendix argument for invokehandle/invokedynamic
704 static int extra_stack_entries() { return EnableInvokeDynamic ? extra_stack_entries_for_jsr292 : 0; }
705 static int extra_stack_words(); // = extra_stack_entries() * Interpreter::stackElementSize
706
707 // RedefineClasses() support:
708 bool is_old() const { return access_flags().is_old(); }
709 void set_is_old() { _access_flags.set_is_old(); }
710 bool is_obsolete() const { return access_flags().is_obsolete(); }
711 void set_is_obsolete() { _access_flags.set_is_obsolete(); }
712 bool is_deleted() const { return access_flags().is_deleted(); }
713 void set_is_deleted() { _access_flags.set_is_deleted(); }
714 bool on_stack() const { return access_flags().on_stack(); }
715 void set_on_stack(const bool value);
716
717 // see the definition in Method*.cpp for the gory details
718 bool should_not_be_cached() const;
719
720 // JVMTI Native method prefixing support:
721 bool is_prefixed_native() const { return access_flags().is_prefixed_native(); }
722 void set_is_prefixed_native() { _access_flags.set_is_prefixed_native(); }
723
724 // Rewriting support
725 static methodHandle clone_with_new_data(methodHandle m, u_char* new_code, int new_code_length,
726 u_char* new_compressed_linenumber_table, int new_compressed_linenumber_size, TRAPS);
727
728 // jmethodID handling
729 // Because the useful life-span of a jmethodID cannot be determined,
730 // once created they are never reclaimed. The methods to which they refer,
731 // however, can be GC'ed away if the class is unloaded or if the method is
732 // made obsolete or deleted -- in these cases, the jmethodID
733 // refers to NULL (as is the case for any weak reference).
|
94 class MethodCounters;
95 class ConstMethod;
96 class InlineTableSizes;
97 class KlassSizeStats;
98
99 class Method : public Metadata {
100 friend class VMStructs;
101 private:
102 ConstMethod* _constMethod; // Method read-only data.
103 MethodData* _method_data;
104 MethodCounters* _method_counters;
105 AccessFlags _access_flags; // Access flags
106 int _vtable_index; // vtable index of this method (see VtableIndexFlag)
107 // note: can have vtables with >2**16 elements (because of inheritance)
108 u2 _method_size; // size of this object
109 u1 _intrinsic_id; // vmSymbols::intrinsic_id (0 == _none)
110 u1 _jfr_towrite : 1, // Flags
111 _caller_sensitive : 1,
112 _force_inline : 1,
113 _hidden : 1,
114 _running_emcp : 1,
115 _dont_inline : 1,
116 _has_injected_profile : 1,
117 : 2;
118
119 #ifndef PRODUCT
120 int _compiled_invocation_count; // Number of nmethod invocations so far (for perf. debugging)
121 #endif
122 // Entry point for calling both from and to the interpreter.
123 address _i2i_entry; // All-args-on-stack calling convention
124 // Adapter blob (i2c/c2i) for this Method*. Set once when method is linked.
125 AdapterHandlerEntry* _adapter;
126 // Entry point for calling from compiled code, to compiled code if it exists
127 // or else the interpreter.
128 volatile address _from_compiled_entry; // Cache of: _code ? _code->entry_point() : _adapter->c2i_entry()
129 // The entry point for calling both from and to compiled code is
130 // "_code->entry_point()". Because of tiered compilation and de-opt, this
131 // field can come and go. It can transition from NULL to not-null at any
132 // time (whenever a compile completes). It can transition from not-null to
133 // NULL only at safepoints (because of a de-opt).
134 nmethod* volatile _code; // Points to the corresponding piece of native code
695 Symbol* signature, //anything at all
696 TRAPS);
697 static Klass* check_non_bcp_klass(Klass* klass);
698
699 // How many extra stack entries for invokedynamic when it's enabled
700 static const int extra_stack_entries_for_jsr292 = 1;
701
702 // this operates only on invoke methods:
703 // presize interpreter frames for extra interpreter stack entries, if needed
704 // Account for the extra appendix argument for invokehandle/invokedynamic
705 static int extra_stack_entries() { return EnableInvokeDynamic ? extra_stack_entries_for_jsr292 : 0; }
706 static int extra_stack_words(); // = extra_stack_entries() * Interpreter::stackElementSize
707
708 // RedefineClasses() support:
709 bool is_old() const { return access_flags().is_old(); }
710 void set_is_old() { _access_flags.set_is_old(); }
711 bool is_obsolete() const { return access_flags().is_obsolete(); }
712 void set_is_obsolete() { _access_flags.set_is_obsolete(); }
713 bool is_deleted() const { return access_flags().is_deleted(); }
714 void set_is_deleted() { _access_flags.set_is_deleted(); }
715
716 bool is_running_emcp() const {
717 // EMCP methods are old but not obsolete or deleted. Equivalent
718 // Modulo Constant Pool means the method is equivalent except
719 // the constant pool and instructions that access the constant
720 // pool might be different.
721 // If a breakpoint is set in a redefined method, its EMCP methods that are
722 // still running must have a breakpoint also.
723 return _running_emcp;
724 }
725
726 void set_running_emcp(bool x) {
727 _running_emcp = x;
728 }
729
730 bool on_stack() const { return access_flags().on_stack(); }
731 void set_on_stack(const bool value);
732
733 // see the definition in Method*.cpp for the gory details
734 bool should_not_be_cached() const;
735
736 // JVMTI Native method prefixing support:
737 bool is_prefixed_native() const { return access_flags().is_prefixed_native(); }
738 void set_is_prefixed_native() { _access_flags.set_is_prefixed_native(); }
739
740 // Rewriting support
741 static methodHandle clone_with_new_data(methodHandle m, u_char* new_code, int new_code_length,
742 u_char* new_compressed_linenumber_table, int new_compressed_linenumber_size, TRAPS);
743
744 // jmethodID handling
745 // Because the useful life-span of a jmethodID cannot be determined,
746 // once created they are never reclaimed. The methods to which they refer,
747 // however, can be GC'ed away if the class is unloaded or if the method is
748 // made obsolete or deleted -- in these cases, the jmethodID
749 // refers to NULL (as is the case for any weak reference).
|