1 /*
2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
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
135 volatile address _from_interpreted_entry; // Cache of _code ? _adapter->i2c_entry() : _i2i_entry
136
137 // Constructor
138 Method(ConstMethod* xconst, AccessFlags access_flags, int size);
788
789 // Helper routines for intrinsic_id() and vmIntrinsics::method().
790 void init_intrinsic_id(); // updates from _none if a match
791 void clear_jmethod_id(ClassLoaderData* loader_data);
792
793 static vmSymbols::SID klass_id_for_intrinsics(Klass* holder);
794
795 bool jfr_towrite() { return _jfr_towrite; }
796 void set_jfr_towrite(bool x) { _jfr_towrite = x; }
797 bool caller_sensitive() { return _caller_sensitive; }
798 void set_caller_sensitive(bool x) { _caller_sensitive = x; }
799 bool force_inline() { return _force_inline; }
800 void set_force_inline(bool x) { _force_inline = x; }
801 bool dont_inline() { return _dont_inline; }
802 void set_dont_inline(bool x) { _dont_inline = x; }
803 bool is_hidden() { return _hidden; }
804 void set_hidden(bool x) { _hidden = x; }
805 bool has_injected_profile() { return _has_injected_profile; }
806 void set_has_injected_profile(bool x) { _has_injected_profile = x; }
807
808 ConstMethod::MethodType method_type() const {
809 return _constMethod->method_type();
810 }
811 bool is_overpass() const { return method_type() == ConstMethod::OVERPASS; }
812
813 // On-stack replacement support
814 bool has_osr_nmethod(int level, bool match_level) {
815 return method_holder()->lookup_osr_nmethod(this, InvocationEntryBci, level, match_level) != NULL;
816 }
817
818 int mark_osr_nmethods() {
819 return method_holder()->mark_osr_nmethods(this);
820 }
821
822 nmethod* lookup_osr_nmethod_for(int bci, int level, bool match_level) {
823 return method_holder()->lookup_osr_nmethod(this, bci, level, match_level);
824 }
825
826 // Inline cache support
827 void cleanup_inline_caches();
|
1 /*
2 * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
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 TRACE_DEFINE_FLAG;
120
121 #ifndef PRODUCT
122 int _compiled_invocation_count; // Number of nmethod invocations so far (for perf. debugging)
123 #endif
124 // Entry point for calling both from and to the interpreter.
125 address _i2i_entry; // All-args-on-stack calling convention
126 // Adapter blob (i2c/c2i) for this Method*. Set once when method is linked.
127 AdapterHandlerEntry* _adapter;
128 // Entry point for calling from compiled code, to compiled code if it exists
129 // or else the interpreter.
130 volatile address _from_compiled_entry; // Cache of: _code ? _code->entry_point() : _adapter->c2i_entry()
131 // The entry point for calling both from and to compiled code is
132 // "_code->entry_point()". Because of tiered compilation and de-opt, this
133 // field can come and go. It can transition from NULL to not-null at any
134 // time (whenever a compile completes). It can transition from not-null to
135 // NULL only at safepoints (because of a de-opt).
136 nmethod* volatile _code; // Points to the corresponding piece of native code
137 volatile address _from_interpreted_entry; // Cache of _code ? _adapter->i2c_entry() : _i2i_entry
138
139 // Constructor
140 Method(ConstMethod* xconst, AccessFlags access_flags, int size);
790
791 // Helper routines for intrinsic_id() and vmIntrinsics::method().
792 void init_intrinsic_id(); // updates from _none if a match
793 void clear_jmethod_id(ClassLoaderData* loader_data);
794
795 static vmSymbols::SID klass_id_for_intrinsics(Klass* holder);
796
797 bool jfr_towrite() { return _jfr_towrite; }
798 void set_jfr_towrite(bool x) { _jfr_towrite = x; }
799 bool caller_sensitive() { return _caller_sensitive; }
800 void set_caller_sensitive(bool x) { _caller_sensitive = x; }
801 bool force_inline() { return _force_inline; }
802 void set_force_inline(bool x) { _force_inline = x; }
803 bool dont_inline() { return _dont_inline; }
804 void set_dont_inline(bool x) { _dont_inline = x; }
805 bool is_hidden() { return _hidden; }
806 void set_hidden(bool x) { _hidden = x; }
807 bool has_injected_profile() { return _has_injected_profile; }
808 void set_has_injected_profile(bool x) { _has_injected_profile = x; }
809
810 TRACE_DEFINE_FLAG_ACCESSOR;
811
812 ConstMethod::MethodType method_type() const {
813 return _constMethod->method_type();
814 }
815 bool is_overpass() const { return method_type() == ConstMethod::OVERPASS; }
816
817 // On-stack replacement support
818 bool has_osr_nmethod(int level, bool match_level) {
819 return method_holder()->lookup_osr_nmethod(this, InvocationEntryBci, level, match_level) != NULL;
820 }
821
822 int mark_osr_nmethods() {
823 return method_holder()->mark_osr_nmethods(this);
824 }
825
826 nmethod* lookup_osr_nmethod_for(int bci, int level, bool match_level) {
827 return method_holder()->lookup_osr_nmethod(this, bci, level, match_level);
828 }
829
830 // Inline cache support
831 void cleanup_inline_caches();
|