63 friend class VMStructs;
64 private:
65 ConstMethod* _constMethod; // Method read-only data.
66 MethodData* _method_data;
67 MethodCounters* _method_counters;
68 AccessFlags _access_flags; // Access flags
69 int _vtable_index; // vtable index of this method (see VtableIndexFlag)
70 // note: can have vtables with >2**16 elements (because of inheritance)
71 #ifdef CC_INTERP
72 int _result_index; // C++ interpreter needs for converting results to/from stack
73 #endif
74 u2 _method_size; // size of this object
75 u1 _intrinsic_id; // vmSymbols::intrinsic_id (0 == _none)
76
77 // Flags
78 enum Flags {
79 _jfr_towrite = 1 << 0,
80 _caller_sensitive = 1 << 1,
81 _force_inline = 1 << 2,
82 _dont_inline = 1 << 3,
83 _hidden = 1 << 4
84 };
85 u1 _flags;
86
87 #ifndef PRODUCT
88 int _compiled_invocation_count; // Number of nmethod invocations so far (for perf. debugging)
89 #endif
90 // Entry point for calling both from and to the interpreter.
91 address _i2i_entry; // All-args-on-stack calling convention
92 // Adapter blob (i2c/c2i) for this Method*. Set once when method is linked.
93 AdapterHandlerEntry* _adapter;
94 // Entry point for calling from compiled code, to compiled code if it exists
95 // or else the interpreter.
96 volatile address _from_compiled_entry; // Cache of: _code ? _code->entry_point() : _adapter->c2i_entry()
97 // The entry point for calling both from and to compiled code is
98 // "_code->entry_point()". Because of tiered compilation and de-opt, this
99 // field can come and go. It can transition from NULL to not-null at any
100 // time (whenever a compile completes). It can transition from not-null to
101 // NULL only at safepoints (because of a de-opt).
102 nmethod* volatile _code; // Points to the corresponding piece of native code
103 volatile address _from_interpreted_entry; // Cache of _code ? _adapter->i2c_entry() : _i2i_entry
671 Symbol* signature, //anything at all
672 TRAPS);
673 static Klass* check_non_bcp_klass(Klass* klass);
674
675 // How many extra stack entries for invokedynamic when it's enabled
676 static const int extra_stack_entries_for_jsr292 = 1;
677
678 // this operates only on invoke methods:
679 // presize interpreter frames for extra interpreter stack entries, if needed
680 // Account for the extra appendix argument for invokehandle/invokedynamic
681 static int extra_stack_entries() { return extra_stack_entries_for_jsr292; }
682 static int extra_stack_words(); // = extra_stack_entries() * Interpreter::stackElementSize
683
684 // RedefineClasses() support:
685 bool is_old() const { return access_flags().is_old(); }
686 void set_is_old() { _access_flags.set_is_old(); }
687 bool is_obsolete() const { return access_flags().is_obsolete(); }
688 void set_is_obsolete() { _access_flags.set_is_obsolete(); }
689 bool is_deleted() const { return access_flags().is_deleted(); }
690 void set_is_deleted() { _access_flags.set_is_deleted(); }
691 bool on_stack() const { return access_flags().on_stack(); }
692 void set_on_stack(const bool value);
693
694 // see the definition in Method*.cpp for the gory details
695 bool should_not_be_cached() const;
696
697 // JVMTI Native method prefixing support:
698 bool is_prefixed_native() const { return access_flags().is_prefixed_native(); }
699 void set_is_prefixed_native() { _access_flags.set_is_prefixed_native(); }
700
701 // Rewriting support
702 static methodHandle clone_with_new_data(methodHandle m, u_char* new_code, int new_code_length,
703 u_char* new_compressed_linenumber_table, int new_compressed_linenumber_size, TRAPS);
704
705 // jmethodID handling
706 // Because the useful life-span of a jmethodID cannot be determined,
707 // once created they are never reclaimed. The methods to which they refer,
708 // however, can be GC'ed away if the class is unloaded or if the method is
709 // made obsolete or deleted -- in these cases, the jmethodID
710 // refers to NULL (as is the case for any weak reference).
|
63 friend class VMStructs;
64 private:
65 ConstMethod* _constMethod; // Method read-only data.
66 MethodData* _method_data;
67 MethodCounters* _method_counters;
68 AccessFlags _access_flags; // Access flags
69 int _vtable_index; // vtable index of this method (see VtableIndexFlag)
70 // note: can have vtables with >2**16 elements (because of inheritance)
71 #ifdef CC_INTERP
72 int _result_index; // C++ interpreter needs for converting results to/from stack
73 #endif
74 u2 _method_size; // size of this object
75 u1 _intrinsic_id; // vmSymbols::intrinsic_id (0 == _none)
76
77 // Flags
78 enum Flags {
79 _jfr_towrite = 1 << 0,
80 _caller_sensitive = 1 << 1,
81 _force_inline = 1 << 2,
82 _dont_inline = 1 << 3,
83 _hidden = 1 << 4,
84 _running_emcp = 1 << 5
85 };
86 u1 _flags;
87
88 #ifndef PRODUCT
89 int _compiled_invocation_count; // Number of nmethod invocations so far (for perf. debugging)
90 #endif
91 // Entry point for calling both from and to the interpreter.
92 address _i2i_entry; // All-args-on-stack calling convention
93 // Adapter blob (i2c/c2i) for this Method*. Set once when method is linked.
94 AdapterHandlerEntry* _adapter;
95 // Entry point for calling from compiled code, to compiled code if it exists
96 // or else the interpreter.
97 volatile address _from_compiled_entry; // Cache of: _code ? _code->entry_point() : _adapter->c2i_entry()
98 // The entry point for calling both from and to compiled code is
99 // "_code->entry_point()". Because of tiered compilation and de-opt, this
100 // field can come and go. It can transition from NULL to not-null at any
101 // time (whenever a compile completes). It can transition from not-null to
102 // NULL only at safepoints (because of a de-opt).
103 nmethod* volatile _code; // Points to the corresponding piece of native code
104 volatile address _from_interpreted_entry; // Cache of _code ? _adapter->i2c_entry() : _i2i_entry
672 Symbol* signature, //anything at all
673 TRAPS);
674 static Klass* check_non_bcp_klass(Klass* klass);
675
676 // How many extra stack entries for invokedynamic when it's enabled
677 static const int extra_stack_entries_for_jsr292 = 1;
678
679 // this operates only on invoke methods:
680 // presize interpreter frames for extra interpreter stack entries, if needed
681 // Account for the extra appendix argument for invokehandle/invokedynamic
682 static int extra_stack_entries() { return extra_stack_entries_for_jsr292; }
683 static int extra_stack_words(); // = extra_stack_entries() * Interpreter::stackElementSize
684
685 // RedefineClasses() support:
686 bool is_old() const { return access_flags().is_old(); }
687 void set_is_old() { _access_flags.set_is_old(); }
688 bool is_obsolete() const { return access_flags().is_obsolete(); }
689 void set_is_obsolete() { _access_flags.set_is_obsolete(); }
690 bool is_deleted() const { return access_flags().is_deleted(); }
691 void set_is_deleted() { _access_flags.set_is_deleted(); }
692
693 bool is_running_emcp() const {
694 // EMCP methods are old but not obsolete or deleted. Equivalent
695 // Modulo Constant Pool means the method is equivalent except
696 // the constant pool and instructions that access the constant
697 // pool might be different.
698 // If a breakpoint is set in a redefined method, its EMCP methods that are
699 // still running must have a breakpoint also.
700 return (_flags & _running_emcp) != 0;
701 }
702
703 void set_running_emcp(bool x) {
704 _flags = x ? (_flags | _running_emcp) : (_flags & ~_running_emcp);
705 }
706
707 bool on_stack() const { return access_flags().on_stack(); }
708 void set_on_stack(const bool value);
709
710 // see the definition in Method*.cpp for the gory details
711 bool should_not_be_cached() const;
712
713 // JVMTI Native method prefixing support:
714 bool is_prefixed_native() const { return access_flags().is_prefixed_native(); }
715 void set_is_prefixed_native() { _access_flags.set_is_prefixed_native(); }
716
717 // Rewriting support
718 static methodHandle clone_with_new_data(methodHandle m, u_char* new_code, int new_code_length,
719 u_char* new_compressed_linenumber_table, int new_compressed_linenumber_size, TRAPS);
720
721 // jmethodID handling
722 // Because the useful life-span of a jmethodID cannot be determined,
723 // once created they are never reclaimed. The methods to which they refer,
724 // however, can be GC'ed away if the class is unloaded or if the method is
725 // made obsolete or deleted -- in these cases, the jmethodID
726 // refers to NULL (as is the case for any weak reference).
|