23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/metadataOnStackMark.hpp"
27 #include "classfile/systemDictionary.hpp"
28 #include "code/codeCache.hpp"
29 #include "code/debugInfoRec.hpp"
30 #include "gc/shared/collectedHeap.inline.hpp"
31 #include "interpreter/bytecodeStream.hpp"
32 #include "interpreter/bytecodeTracer.hpp"
33 #include "interpreter/bytecodes.hpp"
34 #include "interpreter/interpreter.hpp"
35 #include "interpreter/oopMapCache.hpp"
36 #include "memory/allocation.inline.hpp"
37 #include "memory/heapInspection.hpp"
38 #include "memory/metadataFactory.hpp"
39 #include "memory/metaspaceClosure.hpp"
40 #include "memory/metaspaceShared.hpp"
41 #include "memory/oopFactory.hpp"
42 #include "memory/resourceArea.hpp"
43 #include "memory/vtBuffer.hpp"
44 #include "oops/constMethod.hpp"
45 #include "oops/method.inline.hpp"
46 #include "oops/methodData.hpp"
47 #include "oops/objArrayOop.inline.hpp"
48 #include "oops/oop.inline.hpp"
49 #include "oops/symbol.hpp"
50 #include "oops/valueKlass.hpp"
51 #include "prims/jvmtiExport.hpp"
52 #include "prims/methodHandles.hpp"
53 #include "prims/nativeLookup.hpp"
54 #include "runtime/arguments.hpp"
55 #include "runtime/compilationPolicy.hpp"
56 #include "runtime/frame.inline.hpp"
57 #include "runtime/handles.inline.hpp"
58 #include "runtime/init.hpp"
59 #include "runtime/orderAccess.hpp"
60 #include "runtime/relocator.hpp"
61 #include "runtime/safepointVerifiers.hpp"
62 #include "runtime/sharedRuntime.hpp"
63 #include "runtime/signature.hpp"
90 set_constMethod(xconst);
91 set_access_flags(access_flags);
92 set_intrinsic_id(vmIntrinsics::_none);
93 set_force_inline(false);
94 set_hidden(false);
95 set_dont_inline(false);
96 set_has_injected_profile(false);
97 set_method_data(NULL);
98 clear_method_counters();
99 set_vtable_index(Method::garbage_vtable_index);
100
101 // Fix and bury in Method*
102 set_interpreter_entry(NULL); // sets i2i entry and from_int
103 set_adapter_entry(NULL);
104 clear_code(false /* don't need a lock */); // from_c/from_i get set to c2i/i2i
105
106 if (access_flags.is_native()) {
107 clear_native_function();
108 set_signature_handler(NULL);
109 }
110
111 initialize_max_vt_buffer();
112
113 NOT_PRODUCT(set_compiled_invocation_count(0);)
114 }
115
116 // Release Method*. The nmethod will be gone when we get here because
117 // we've walked the code cache.
118 void Method::deallocate_contents(ClassLoaderData* loader_data) {
119 MetadataFactory::free_metadata(loader_data, constMethod());
120 set_constMethod(NULL);
121 MetadataFactory::free_metadata(loader_data, method_data());
122 set_method_data(NULL);
123 MetadataFactory::free_metadata(loader_data, method_counters());
124 clear_method_counters();
125 // The nmethod will be gone when we get here.
126 if (code() != NULL) _code = NULL;
127 }
128
129 address Method::get_i2c_entry() {
130 assert(adapter() != NULL, "must have");
131 return adapter()->get_i2c_entry();
132 }
1863 return (mcs == NULL) ? 0 : mcs->invocation_counter()->count();
1864 }
1865 }
1866
1867 int Method::backedge_count() {
1868 MethodCounters *mcs = method_counters();
1869 if (TieredCompilation) {
1870 MethodData* const mdo = method_data();
1871 if (((mcs != NULL) ? mcs->backedge_counter()->carry() : false) ||
1872 ((mdo != NULL) ? mdo->backedge_counter()->carry() : false)) {
1873 return InvocationCounter::count_limit;
1874 } else {
1875 return ((mcs != NULL) ? mcs->backedge_counter()->count() : 0) +
1876 ((mdo != NULL) ? mdo->backedge_counter()->count() : 0);
1877 }
1878 } else {
1879 return (mcs == NULL) ? 0 : mcs->backedge_counter()->count();
1880 }
1881 }
1882
1883 void Method::initialize_max_vt_buffer() {
1884 long long max_entries = constMethod()->max_locals() + constMethod()->max_stack();
1885 max_entries *= 2; // Add margin for loops
1886 long long max_size = max_entries * (BigValueTypeThreshold + 8); // 8 -> header size
1887 int max_chunks = (int)(max_size / VTBufferChunk::max_alloc_size()) + 1;
1888 set_max_vt_buffer(MAX2(MinimumVTBufferChunkPerFrame, max_chunks));
1889 }
1890
1891 int Method::highest_comp_level() const {
1892 const MethodCounters* mcs = method_counters();
1893 if (mcs != NULL) {
1894 return mcs->highest_comp_level();
1895 } else {
1896 return CompLevel_none;
1897 }
1898 }
1899
1900 int Method::highest_osr_comp_level() const {
1901 const MethodCounters* mcs = method_counters();
1902 if (mcs != NULL) {
1903 return mcs->highest_osr_comp_level();
1904 } else {
1905 return CompLevel_none;
1906 }
1907 }
1908
1909 void Method::set_highest_comp_level(int level) {
1910 MethodCounters* mcs = method_counters();
|
23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/metadataOnStackMark.hpp"
27 #include "classfile/systemDictionary.hpp"
28 #include "code/codeCache.hpp"
29 #include "code/debugInfoRec.hpp"
30 #include "gc/shared/collectedHeap.inline.hpp"
31 #include "interpreter/bytecodeStream.hpp"
32 #include "interpreter/bytecodeTracer.hpp"
33 #include "interpreter/bytecodes.hpp"
34 #include "interpreter/interpreter.hpp"
35 #include "interpreter/oopMapCache.hpp"
36 #include "memory/allocation.inline.hpp"
37 #include "memory/heapInspection.hpp"
38 #include "memory/metadataFactory.hpp"
39 #include "memory/metaspaceClosure.hpp"
40 #include "memory/metaspaceShared.hpp"
41 #include "memory/oopFactory.hpp"
42 #include "memory/resourceArea.hpp"
43 #include "oops/constMethod.hpp"
44 #include "oops/method.inline.hpp"
45 #include "oops/methodData.hpp"
46 #include "oops/objArrayOop.inline.hpp"
47 #include "oops/oop.inline.hpp"
48 #include "oops/symbol.hpp"
49 #include "oops/valueKlass.hpp"
50 #include "prims/jvmtiExport.hpp"
51 #include "prims/methodHandles.hpp"
52 #include "prims/nativeLookup.hpp"
53 #include "runtime/arguments.hpp"
54 #include "runtime/compilationPolicy.hpp"
55 #include "runtime/frame.inline.hpp"
56 #include "runtime/handles.inline.hpp"
57 #include "runtime/init.hpp"
58 #include "runtime/orderAccess.hpp"
59 #include "runtime/relocator.hpp"
60 #include "runtime/safepointVerifiers.hpp"
61 #include "runtime/sharedRuntime.hpp"
62 #include "runtime/signature.hpp"
89 set_constMethod(xconst);
90 set_access_flags(access_flags);
91 set_intrinsic_id(vmIntrinsics::_none);
92 set_force_inline(false);
93 set_hidden(false);
94 set_dont_inline(false);
95 set_has_injected_profile(false);
96 set_method_data(NULL);
97 clear_method_counters();
98 set_vtable_index(Method::garbage_vtable_index);
99
100 // Fix and bury in Method*
101 set_interpreter_entry(NULL); // sets i2i entry and from_int
102 set_adapter_entry(NULL);
103 clear_code(false /* don't need a lock */); // from_c/from_i get set to c2i/i2i
104
105 if (access_flags.is_native()) {
106 clear_native_function();
107 set_signature_handler(NULL);
108 }
109 NOT_PRODUCT(set_compiled_invocation_count(0);)
110 }
111
112 // Release Method*. The nmethod will be gone when we get here because
113 // we've walked the code cache.
114 void Method::deallocate_contents(ClassLoaderData* loader_data) {
115 MetadataFactory::free_metadata(loader_data, constMethod());
116 set_constMethod(NULL);
117 MetadataFactory::free_metadata(loader_data, method_data());
118 set_method_data(NULL);
119 MetadataFactory::free_metadata(loader_data, method_counters());
120 clear_method_counters();
121 // The nmethod will be gone when we get here.
122 if (code() != NULL) _code = NULL;
123 }
124
125 address Method::get_i2c_entry() {
126 assert(adapter() != NULL, "must have");
127 return adapter()->get_i2c_entry();
128 }
1859 return (mcs == NULL) ? 0 : mcs->invocation_counter()->count();
1860 }
1861 }
1862
1863 int Method::backedge_count() {
1864 MethodCounters *mcs = method_counters();
1865 if (TieredCompilation) {
1866 MethodData* const mdo = method_data();
1867 if (((mcs != NULL) ? mcs->backedge_counter()->carry() : false) ||
1868 ((mdo != NULL) ? mdo->backedge_counter()->carry() : false)) {
1869 return InvocationCounter::count_limit;
1870 } else {
1871 return ((mcs != NULL) ? mcs->backedge_counter()->count() : 0) +
1872 ((mdo != NULL) ? mdo->backedge_counter()->count() : 0);
1873 }
1874 } else {
1875 return (mcs == NULL) ? 0 : mcs->backedge_counter()->count();
1876 }
1877 }
1878
1879 int Method::highest_comp_level() const {
1880 const MethodCounters* mcs = method_counters();
1881 if (mcs != NULL) {
1882 return mcs->highest_comp_level();
1883 } else {
1884 return CompLevel_none;
1885 }
1886 }
1887
1888 int Method::highest_osr_comp_level() const {
1889 const MethodCounters* mcs = method_counters();
1890 if (mcs != NULL) {
1891 return mcs->highest_osr_comp_level();
1892 } else {
1893 return CompLevel_none;
1894 }
1895 }
1896
1897 void Method::set_highest_comp_level(int level) {
1898 MethodCounters* mcs = method_counters();
|