37 #include "code/codeCache.hpp"
38 #include "code/scopeDesc.hpp"
39 #include "compiler/compileBroker.hpp"
40 #include "compiler/compileLog.hpp"
41 #include "compiler/disassembler.hpp"
42 #include "gc/shared/collectedHeap.inline.hpp"
43 #include "interpreter/linkResolver.hpp"
44 #include "memory/allocation.inline.hpp"
45 #include "memory/oopFactory.hpp"
46 #include "memory/resourceArea.hpp"
47 #include "memory/universe.inline.hpp"
48 #include "oops/methodData.hpp"
49 #include "oops/objArrayKlass.hpp"
50 #include "oops/objArrayOop.inline.hpp"
51 #include "oops/oop.inline.hpp"
52 #include "prims/jvmtiExport.hpp"
53 #include "runtime/init.hpp"
54 #include "runtime/reflection.hpp"
55 #include "runtime/sharedRuntime.hpp"
56 #include "runtime/thread.inline.hpp"
57 #include "trace/tracing.hpp"
58 #include "utilities/dtrace.hpp"
59 #include "utilities/macros.hpp"
60 #ifdef COMPILER1
61 #include "c1/c1_Runtime1.hpp"
62 #endif
63 #ifdef COMPILER2
64 #include "opto/runtime.hpp"
65 #endif
66
67 // ciEnv
68 //
69 // This class is the top level broker for requests from the compiler
70 // to the VM.
71
72 ciObject* ciEnv::_null_object_instance;
73
74 #define WK_KLASS_DEFN(name, ignore_s, ignore_o) ciInstanceKlass* ciEnv::_##name = NULL;
75 WK_KLASSES_DO(WK_KLASS_DEFN)
76 #undef WK_KLASS_DEFN
77
78 ciSymbol* ciEnv::_unloaded_cisymbol = NULL;
79 ciInstanceKlass* ciEnv::_unloaded_ciinstance_klass = NULL;
80 ciObjArrayKlass* ciEnv::_unloaded_ciobjarrayklass = NULL;
81
82 jobject ciEnv::_ArrayIndexOutOfBoundsException_handle = NULL;
83 jobject ciEnv::_ArrayStoreException_handle = NULL;
84 jobject ciEnv::_ClassCastException_handle = NULL;
85
1137 void ciEnv::notice_inlined_method(ciMethod* method) {
1138 _num_inlined_bytecodes += method->code_size_for_inlining();
1139 }
1140
1141 // ------------------------------------------------------------------
1142 // ciEnv::num_inlined_bytecodes()
1143 int ciEnv::num_inlined_bytecodes() const {
1144 return _num_inlined_bytecodes;
1145 }
1146
1147 // ------------------------------------------------------------------
1148 // ciEnv::record_failure()
1149 void ciEnv::record_failure(const char* reason) {
1150 if (_failure_reason == NULL) {
1151 // Record the first failure reason.
1152 _failure_reason = reason;
1153 }
1154 }
1155
1156 void ciEnv::report_failure(const char* reason) {
1157 // Create and fire JFR event
1158 EventCompilationFailure event;
1159 if (event.should_commit()) {
1160 event.set_compileId(compile_id());
1161 event.set_failureMessage(reason);
1162 event.commit();
1163 }
1164 }
1165
1166 // ------------------------------------------------------------------
1167 // ciEnv::record_method_not_compilable()
1168 void ciEnv::record_method_not_compilable(const char* reason, bool all_tiers) {
1169 int new_compilable =
1170 all_tiers ? MethodCompilable_never : MethodCompilable_not_at_tier ;
1171
1172 // Only note transitions to a worse state
1173 if (new_compilable > _compilable) {
1174 if (log() != NULL) {
1175 if (all_tiers) {
1176 log()->elem("method_not_compilable");
1177 } else {
1178 log()->elem("method_not_compilable_at_tier level='%d'",
1179 current()->task()->comp_level());
1180 }
1181 }
1182 _compilable = new_compilable;
1183
|
37 #include "code/codeCache.hpp"
38 #include "code/scopeDesc.hpp"
39 #include "compiler/compileBroker.hpp"
40 #include "compiler/compileLog.hpp"
41 #include "compiler/disassembler.hpp"
42 #include "gc/shared/collectedHeap.inline.hpp"
43 #include "interpreter/linkResolver.hpp"
44 #include "memory/allocation.inline.hpp"
45 #include "memory/oopFactory.hpp"
46 #include "memory/resourceArea.hpp"
47 #include "memory/universe.inline.hpp"
48 #include "oops/methodData.hpp"
49 #include "oops/objArrayKlass.hpp"
50 #include "oops/objArrayOop.inline.hpp"
51 #include "oops/oop.inline.hpp"
52 #include "prims/jvmtiExport.hpp"
53 #include "runtime/init.hpp"
54 #include "runtime/reflection.hpp"
55 #include "runtime/sharedRuntime.hpp"
56 #include "runtime/thread.inline.hpp"
57 #include "utilities/dtrace.hpp"
58 #include "utilities/macros.hpp"
59 #ifdef COMPILER1
60 #include "c1/c1_Runtime1.hpp"
61 #endif
62 #ifdef COMPILER2
63 #include "opto/runtime.hpp"
64 #endif
65 #if INCLUDE_TRACE
66 #include "trace/tracing.hpp"
67 #endif
68
69 // ciEnv
70 //
71 // This class is the top level broker for requests from the compiler
72 // to the VM.
73
74 ciObject* ciEnv::_null_object_instance;
75
76 #define WK_KLASS_DEFN(name, ignore_s, ignore_o) ciInstanceKlass* ciEnv::_##name = NULL;
77 WK_KLASSES_DO(WK_KLASS_DEFN)
78 #undef WK_KLASS_DEFN
79
80 ciSymbol* ciEnv::_unloaded_cisymbol = NULL;
81 ciInstanceKlass* ciEnv::_unloaded_ciinstance_klass = NULL;
82 ciObjArrayKlass* ciEnv::_unloaded_ciobjarrayklass = NULL;
83
84 jobject ciEnv::_ArrayIndexOutOfBoundsException_handle = NULL;
85 jobject ciEnv::_ArrayStoreException_handle = NULL;
86 jobject ciEnv::_ClassCastException_handle = NULL;
87
1139 void ciEnv::notice_inlined_method(ciMethod* method) {
1140 _num_inlined_bytecodes += method->code_size_for_inlining();
1141 }
1142
1143 // ------------------------------------------------------------------
1144 // ciEnv::num_inlined_bytecodes()
1145 int ciEnv::num_inlined_bytecodes() const {
1146 return _num_inlined_bytecodes;
1147 }
1148
1149 // ------------------------------------------------------------------
1150 // ciEnv::record_failure()
1151 void ciEnv::record_failure(const char* reason) {
1152 if (_failure_reason == NULL) {
1153 // Record the first failure reason.
1154 _failure_reason = reason;
1155 }
1156 }
1157
1158 void ciEnv::report_failure(const char* reason) {
1159 #if INCLUDE_TRACE
1160 EventCompilationFailure event;
1161 if (event.should_commit()) {
1162 event.set_compileId(compile_id());
1163 event.set_failureMessage(reason);
1164 event.commit();
1165 }
1166 #endif
1167 }
1168
1169 // ------------------------------------------------------------------
1170 // ciEnv::record_method_not_compilable()
1171 void ciEnv::record_method_not_compilable(const char* reason, bool all_tiers) {
1172 int new_compilable =
1173 all_tiers ? MethodCompilable_never : MethodCompilable_not_at_tier ;
1174
1175 // Only note transitions to a worse state
1176 if (new_compilable > _compilable) {
1177 if (log() != NULL) {
1178 if (all_tiers) {
1179 log()->elem("method_not_compilable");
1180 } else {
1181 log()->elem("method_not_compilable_at_tier level='%d'",
1182 current()->task()->comp_level());
1183 }
1184 }
1185 _compilable = new_compilable;
1186
|