Mon, 12 Aug 2019 18:30:40 +0300
8223147: JFR Backport
8199712: Flight Recorder
8203346: JFR: Inconsistent signature of jfr_add_string_constant
8195817: JFR.stop should require name of recording
8195818: JFR.start should increase autogenerated name by one
8195819: Remove recording=x from jcmd JFR.check output
8203921: JFR thread sampling is missing fixes from JDK-8194552
8203929: Limit amount of data for JFR.dump
8203664: JFR start failure after AppCDS archive created with JFR StartFlightRecording
8003209: JFR events for network utilization
8207392: [PPC64] Implement JFR profiling
8202835: jfr/event/os/TestSystemProcess.java fails on missing events
Summary: Backport JFR from JDK11. Initial integration
Reviewed-by: neugens
duke@435 | 1 | /* |
mikael@6198 | 2 | * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. |
duke@435 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@435 | 4 | * |
duke@435 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@435 | 6 | * under the terms of the GNU General Public License version 2 only, as |
duke@435 | 7 | * published by the Free Software Foundation. |
duke@435 | 8 | * |
duke@435 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@435 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@435 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@435 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@435 | 13 | * accompanied this code). |
duke@435 | 14 | * |
duke@435 | 15 | * You should have received a copy of the GNU General Public License version |
duke@435 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@435 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@435 | 18 | * |
trims@1907 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
trims@1907 | 20 | * or visit www.oracle.com if you need additional information or have any |
trims@1907 | 21 | * questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
duke@435 | 24 | |
stefank@2314 | 25 | #ifndef SHARE_VM_CI_CIENV_HPP |
stefank@2314 | 26 | #define SHARE_VM_CI_CIENV_HPP |
stefank@2314 | 27 | |
stefank@2314 | 28 | #include "ci/ciClassList.hpp" |
stefank@2314 | 29 | #include "ci/ciObjectFactory.hpp" |
stefank@2314 | 30 | #include "classfile/systemDictionary.hpp" |
stefank@2314 | 31 | #include "code/debugInfoRec.hpp" |
stefank@2314 | 32 | #include "code/dependencies.hpp" |
stefank@2314 | 33 | #include "code/exceptionHandlerTable.hpp" |
stefank@2314 | 34 | #include "compiler/oopMap.hpp" |
stefank@2314 | 35 | #include "runtime/thread.hpp" |
stefank@2314 | 36 | |
duke@435 | 37 | class CompileTask; |
duke@435 | 38 | |
duke@435 | 39 | // ciEnv |
duke@435 | 40 | // |
duke@435 | 41 | // This class is the top level broker for requests from the compiler |
duke@435 | 42 | // to the VM. |
duke@435 | 43 | class ciEnv : StackObj { |
duke@435 | 44 | CI_PACKAGE_ACCESS_TO |
duke@435 | 45 | |
duke@435 | 46 | friend class CompileBroker; |
duke@435 | 47 | friend class Dependencies; // for get_object, during logging |
duke@435 | 48 | |
duke@435 | 49 | private: |
duke@435 | 50 | Arena* _arena; // Alias for _ciEnv_arena except in init_shared_objects() |
duke@435 | 51 | Arena _ciEnv_arena; |
duke@435 | 52 | int _system_dictionary_modification_counter; |
duke@435 | 53 | ciObjectFactory* _factory; |
duke@435 | 54 | OopRecorder* _oop_recorder; |
duke@435 | 55 | DebugInformationRecorder* _debug_info; |
duke@435 | 56 | Dependencies* _dependencies; |
duke@435 | 57 | const char* _failure_reason; |
duke@435 | 58 | int _compilable; |
duke@435 | 59 | bool _break_at_compile; |
duke@435 | 60 | int _num_inlined_bytecodes; |
duke@435 | 61 | CompileTask* _task; // faster access to CompilerThread::task |
duke@435 | 62 | CompileLog* _log; // faster access to CompilerThread::log |
duke@435 | 63 | void* _compiler_data; // compiler-specific stuff, if any |
duke@435 | 64 | |
duke@435 | 65 | char* _name_buffer; |
duke@435 | 66 | int _name_buffer_len; |
duke@435 | 67 | |
kvn@1215 | 68 | // Cache Jvmti state |
kvn@1215 | 69 | bool _jvmti_can_hotswap_or_post_breakpoint; |
kvn@1215 | 70 | bool _jvmti_can_access_local_variables; |
dcubed@1648 | 71 | bool _jvmti_can_post_on_exceptions; |
kvn@1215 | 72 | |
kvn@1215 | 73 | // Cache DTrace flags |
kvn@1215 | 74 | bool _dtrace_extended_probes; |
kvn@1215 | 75 | bool _dtrace_monitor_probes; |
kvn@1215 | 76 | bool _dtrace_method_probes; |
kvn@1215 | 77 | bool _dtrace_alloc_probes; |
kvn@1215 | 78 | |
duke@435 | 79 | // Distinguished instances of certain ciObjects.. |
duke@435 | 80 | static ciObject* _null_object_instance; |
duke@435 | 81 | |
never@1577 | 82 | #define WK_KLASS_DECL(name, ignore_s, ignore_o) static ciInstanceKlass* _##name; |
never@1577 | 83 | WK_KLASSES_DO(WK_KLASS_DECL) |
never@1577 | 84 | #undef WK_KLASS_DECL |
duke@435 | 85 | |
duke@435 | 86 | static ciSymbol* _unloaded_cisymbol; |
duke@435 | 87 | static ciInstanceKlass* _unloaded_ciinstance_klass; |
duke@435 | 88 | static ciObjArrayKlass* _unloaded_ciobjarrayklass; |
duke@435 | 89 | |
duke@435 | 90 | static jobject _ArrayIndexOutOfBoundsException_handle; |
duke@435 | 91 | static jobject _ArrayStoreException_handle; |
duke@435 | 92 | static jobject _ClassCastException_handle; |
duke@435 | 93 | |
duke@435 | 94 | ciInstance* _NullPointerException_instance; |
duke@435 | 95 | ciInstance* _ArithmeticException_instance; |
duke@435 | 96 | ciInstance* _ArrayIndexOutOfBoundsException_instance; |
duke@435 | 97 | ciInstance* _ArrayStoreException_instance; |
duke@435 | 98 | ciInstance* _ClassCastException_instance; |
duke@435 | 99 | |
never@1515 | 100 | ciInstance* _the_null_string; // The Java string "null" |
never@1515 | 101 | ciInstance* _the_min_jint_string; // The Java string "-2147483648" |
never@1515 | 102 | |
duke@435 | 103 | // Look up a klass by name from a particular class loader (the accessor's). |
duke@435 | 104 | // If require_local, result must be defined in that class loader, or NULL. |
duke@435 | 105 | // If !require_local, a result from remote class loader may be reported, |
duke@435 | 106 | // if sufficient class loader constraints exist such that initiating |
duke@435 | 107 | // a class loading request from the given loader is bound to return |
duke@435 | 108 | // the class defined in the remote loader (or throw an error). |
duke@435 | 109 | // |
duke@435 | 110 | // Return an unloaded klass if !require_local and no class at all is found. |
duke@435 | 111 | // |
duke@435 | 112 | // The CI treats a klass as loaded if it is consistently defined in |
duke@435 | 113 | // another loader, even if it hasn't yet been loaded in all loaders |
duke@435 | 114 | // that could potentially see it via delegation. |
duke@435 | 115 | ciKlass* get_klass_by_name(ciKlass* accessing_klass, |
duke@435 | 116 | ciSymbol* klass_name, |
duke@435 | 117 | bool require_local); |
duke@435 | 118 | |
duke@435 | 119 | // Constant pool access. |
twisti@1573 | 120 | ciKlass* get_klass_by_index(constantPoolHandle cpool, |
duke@435 | 121 | int klass_index, |
twisti@1573 | 122 | bool& is_accessible, |
twisti@1573 | 123 | ciInstanceKlass* loading_klass); |
twisti@1573 | 124 | ciConstant get_constant_by_index(constantPoolHandle cpool, |
jrose@1957 | 125 | int pool_index, int cache_index, |
twisti@1573 | 126 | ciInstanceKlass* accessor); |
duke@435 | 127 | ciField* get_field_by_index(ciInstanceKlass* loading_klass, |
duke@435 | 128 | int field_index); |
twisti@1573 | 129 | ciMethod* get_method_by_index(constantPoolHandle cpool, |
twisti@1573 | 130 | int method_index, Bytecodes::Code bc, |
twisti@1573 | 131 | ciInstanceKlass* loading_klass); |
duke@435 | 132 | |
duke@435 | 133 | // Implementation methods for loading and constant pool access. |
duke@435 | 134 | ciKlass* get_klass_by_name_impl(ciKlass* accessing_klass, |
jrose@2982 | 135 | constantPoolHandle cpool, |
duke@435 | 136 | ciSymbol* klass_name, |
duke@435 | 137 | bool require_local); |
twisti@1573 | 138 | ciKlass* get_klass_by_index_impl(constantPoolHandle cpool, |
duke@435 | 139 | int klass_index, |
twisti@1573 | 140 | bool& is_accessible, |
twisti@1573 | 141 | ciInstanceKlass* loading_klass); |
twisti@1573 | 142 | ciConstant get_constant_by_index_impl(constantPoolHandle cpool, |
jrose@1957 | 143 | int pool_index, int cache_index, |
twisti@1573 | 144 | ciInstanceKlass* loading_klass); |
duke@435 | 145 | ciField* get_field_by_index_impl(ciInstanceKlass* loading_klass, |
duke@435 | 146 | int field_index); |
twisti@1573 | 147 | ciMethod* get_method_by_index_impl(constantPoolHandle cpool, |
twisti@1573 | 148 | int method_index, Bytecodes::Code bc, |
twisti@1573 | 149 | ciInstanceKlass* loading_klass); |
duke@435 | 150 | |
duke@435 | 151 | // Helper methods |
duke@435 | 152 | bool check_klass_accessibility(ciKlass* accessing_klass, |
coleenp@4037 | 153 | Klass* resolved_klass); |
coleenp@4037 | 154 | Method* lookup_method(InstanceKlass* accessor, |
coleenp@4037 | 155 | InstanceKlass* holder, |
coleenp@2497 | 156 | Symbol* name, |
coleenp@2497 | 157 | Symbol* sig, |
duke@435 | 158 | Bytecodes::Code bc); |
duke@435 | 159 | |
duke@435 | 160 | // Get a ciObject from the object factory. Ensures uniqueness |
duke@435 | 161 | // of ciObjects. |
duke@435 | 162 | ciObject* get_object(oop o) { |
duke@435 | 163 | if (o == NULL) { |
duke@435 | 164 | return _null_object_instance; |
duke@435 | 165 | } else { |
duke@435 | 166 | return _factory->get(o); |
duke@435 | 167 | } |
duke@435 | 168 | } |
duke@435 | 169 | |
coleenp@2497 | 170 | ciSymbol* get_symbol(Symbol* o) { |
coleenp@2497 | 171 | if (o == NULL) { |
coleenp@2497 | 172 | ShouldNotReachHere(); |
coleenp@2497 | 173 | return NULL; |
coleenp@2497 | 174 | } else { |
coleenp@2497 | 175 | return _factory->get_symbol(o); |
coleenp@2497 | 176 | } |
coleenp@2497 | 177 | } |
coleenp@2497 | 178 | |
coleenp@4037 | 179 | ciMetadata* get_metadata(Metadata* o) { |
coleenp@4037 | 180 | if (o == NULL) { |
coleenp@4037 | 181 | return NULL; |
coleenp@4037 | 182 | } else { |
coleenp@4037 | 183 | return _factory->get_metadata(o); |
coleenp@4037 | 184 | } |
coleenp@4037 | 185 | } |
coleenp@4037 | 186 | |
stefank@6992 | 187 | void ensure_metadata_alive(ciMetadata* m) { |
stefank@6992 | 188 | _factory->ensure_metadata_alive(m); |
stefank@6992 | 189 | } |
stefank@6992 | 190 | |
coleenp@4037 | 191 | ciInstance* get_instance(oop o) { |
coleenp@4037 | 192 | if (o == NULL) return NULL; |
coleenp@4037 | 193 | return get_object(o)->as_instance(); |
coleenp@4037 | 194 | } |
coleenp@4037 | 195 | ciObjArrayKlass* get_obj_array_klass(Klass* o) { |
coleenp@4037 | 196 | if (o == NULL) return NULL; |
coleenp@4037 | 197 | return get_metadata(o)->as_obj_array_klass(); |
coleenp@4037 | 198 | } |
coleenp@4037 | 199 | ciTypeArrayKlass* get_type_array_klass(Klass* o) { |
coleenp@4037 | 200 | if (o == NULL) return NULL; |
coleenp@4037 | 201 | return get_metadata(o)->as_type_array_klass(); |
coleenp@4037 | 202 | } |
coleenp@4037 | 203 | ciKlass* get_klass(Klass* o) { |
coleenp@4037 | 204 | if (o == NULL) return NULL; |
coleenp@4037 | 205 | return get_metadata(o)->as_klass(); |
coleenp@4037 | 206 | } |
coleenp@4037 | 207 | ciInstanceKlass* get_instance_klass(Klass* o) { |
coleenp@4037 | 208 | if (o == NULL) return NULL; |
coleenp@4037 | 209 | return get_metadata(o)->as_instance_klass(); |
coleenp@4037 | 210 | } |
coleenp@4037 | 211 | ciMethod* get_method(Method* o) { |
coleenp@4037 | 212 | if (o == NULL) return NULL; |
coleenp@4037 | 213 | return get_metadata(o)->as_method(); |
coleenp@4037 | 214 | } |
coleenp@4037 | 215 | ciMethodData* get_method_data(MethodData* o) { |
coleenp@4037 | 216 | if (o == NULL) return NULL; |
coleenp@4037 | 217 | return get_metadata(o)->as_method_data(); |
coleenp@4037 | 218 | } |
coleenp@4037 | 219 | |
coleenp@4037 | 220 | ciMethod* get_method_from_handle(Method* method); |
duke@435 | 221 | |
coleenp@2497 | 222 | ciInstance* get_or_create_exception(jobject& handle, Symbol* name); |
duke@435 | 223 | |
duke@435 | 224 | // Get a ciMethod representing either an unfound method or |
duke@435 | 225 | // a method with an unloaded holder. Ensures uniqueness of |
duke@435 | 226 | // the result. |
duke@435 | 227 | ciMethod* get_unloaded_method(ciInstanceKlass* holder, |
duke@435 | 228 | ciSymbol* name, |
twisti@3197 | 229 | ciSymbol* signature, |
twisti@3197 | 230 | ciInstanceKlass* accessor) { |
twisti@3197 | 231 | return _factory->get_unloaded_method(holder, name, signature, accessor); |
duke@435 | 232 | } |
duke@435 | 233 | |
duke@435 | 234 | // Get a ciKlass representing an unloaded klass. |
duke@435 | 235 | // Ensures uniqueness of the result. |
twisti@3197 | 236 | ciKlass* get_unloaded_klass(ciKlass* accessing_klass, |
duke@435 | 237 | ciSymbol* name) { |
duke@435 | 238 | return _factory->get_unloaded_klass(accessing_klass, name, true); |
duke@435 | 239 | } |
duke@435 | 240 | |
jrose@1957 | 241 | // Get a ciKlass representing an unloaded klass mirror. |
jrose@1957 | 242 | // Result is not necessarily unique, but will be unloaded. |
jrose@1957 | 243 | ciInstance* get_unloaded_klass_mirror(ciKlass* type) { |
jrose@1957 | 244 | return _factory->get_unloaded_klass_mirror(type); |
jrose@1957 | 245 | } |
jrose@1957 | 246 | |
jrose@1957 | 247 | // Get a ciInstance representing an unresolved method handle constant. |
jrose@1957 | 248 | ciInstance* get_unloaded_method_handle_constant(ciKlass* holder, |
jrose@1957 | 249 | ciSymbol* name, |
jrose@1957 | 250 | ciSymbol* signature, |
jrose@1957 | 251 | int ref_kind) { |
jrose@1957 | 252 | return _factory->get_unloaded_method_handle_constant(holder, name, signature, ref_kind); |
jrose@1957 | 253 | } |
jrose@1957 | 254 | |
jrose@1957 | 255 | // Get a ciInstance representing an unresolved method type constant. |
jrose@1957 | 256 | ciInstance* get_unloaded_method_type_constant(ciSymbol* signature) { |
jrose@1957 | 257 | return _factory->get_unloaded_method_type_constant(signature); |
jrose@1957 | 258 | } |
jrose@1957 | 259 | |
duke@435 | 260 | // See if we already have an unloaded klass for the given name |
duke@435 | 261 | // or return NULL if not. |
twisti@3197 | 262 | ciKlass *check_get_unloaded_klass(ciKlass* accessing_klass, ciSymbol* name) { |
duke@435 | 263 | return _factory->get_unloaded_klass(accessing_klass, name, false); |
duke@435 | 264 | } |
duke@435 | 265 | |
duke@435 | 266 | // Get a ciReturnAddress corresponding to the given bci. |
duke@435 | 267 | // Ensures uniqueness of the result. |
duke@435 | 268 | ciReturnAddress* get_return_address(int bci) { |
duke@435 | 269 | return _factory->get_return_address(bci); |
duke@435 | 270 | } |
duke@435 | 271 | |
duke@435 | 272 | // Get a ciMethodData representing the methodData for a method |
duke@435 | 273 | // with none. |
duke@435 | 274 | ciMethodData* get_empty_methodData() { |
duke@435 | 275 | return _factory->get_empty_methodData(); |
duke@435 | 276 | } |
duke@435 | 277 | |
duke@435 | 278 | // General utility : get a buffer of some required length. |
duke@435 | 279 | // Used in symbol creation. |
duke@435 | 280 | char* name_buffer(int req_len); |
duke@435 | 281 | |
duke@435 | 282 | // Is this thread currently in the VM state? |
duke@435 | 283 | static bool is_in_vm(); |
duke@435 | 284 | |
twisti@3094 | 285 | // Helper routine for determining the validity of a compilation with |
twisti@3094 | 286 | // respect to method dependencies (e.g. concurrent class loading). |
twisti@3094 | 287 | void validate_compile_task_dependencies(ciMethod* target); |
duke@435 | 288 | |
duke@435 | 289 | public: |
duke@435 | 290 | enum { |
duke@435 | 291 | MethodCompilable, |
duke@435 | 292 | MethodCompilable_not_at_tier, |
duke@435 | 293 | MethodCompilable_never |
duke@435 | 294 | }; |
duke@435 | 295 | |
duke@435 | 296 | ciEnv(CompileTask* task, int system_dictionary_modification_counter); |
duke@435 | 297 | // Used only during initialization of the ci |
duke@435 | 298 | ciEnv(Arena* arena); |
duke@435 | 299 | ~ciEnv(); |
duke@435 | 300 | |
duke@435 | 301 | OopRecorder* oop_recorder() { return _oop_recorder; } |
duke@435 | 302 | void set_oop_recorder(OopRecorder* r) { _oop_recorder = r; } |
duke@435 | 303 | |
duke@435 | 304 | DebugInformationRecorder* debug_info() { return _debug_info; } |
duke@435 | 305 | void set_debug_info(DebugInformationRecorder* i) { _debug_info = i; } |
duke@435 | 306 | |
duke@435 | 307 | Dependencies* dependencies() { return _dependencies; } |
duke@435 | 308 | void set_dependencies(Dependencies* d) { _dependencies = d; } |
duke@435 | 309 | |
duke@435 | 310 | // This is true if the compilation is not going to produce code. |
duke@435 | 311 | // (It is reasonable to retry failed compilations.) |
duke@435 | 312 | bool failing() { return _failure_reason != NULL; } |
duke@435 | 313 | |
duke@435 | 314 | // Reason this compilation is failing, such as "too many basic blocks". |
duke@435 | 315 | const char* failure_reason() { return _failure_reason; } |
duke@435 | 316 | |
duke@435 | 317 | // Return state of appropriate compilability |
duke@435 | 318 | int compilable() { return _compilable; } |
duke@435 | 319 | |
never@3499 | 320 | const char* retry_message() const { |
never@3499 | 321 | switch (_compilable) { |
never@3499 | 322 | case ciEnv::MethodCompilable_not_at_tier: |
never@3499 | 323 | return "retry at different tier"; |
never@3499 | 324 | case ciEnv::MethodCompilable_never: |
never@3499 | 325 | return "not retryable"; |
never@3499 | 326 | case ciEnv::MethodCompilable: |
never@3499 | 327 | return NULL; |
never@3499 | 328 | default: |
never@3499 | 329 | ShouldNotReachHere(); |
never@3499 | 330 | return NULL; |
never@3499 | 331 | } |
never@3499 | 332 | } |
never@3499 | 333 | |
duke@435 | 334 | bool break_at_compile() { return _break_at_compile; } |
duke@435 | 335 | void set_break_at_compile(bool z) { _break_at_compile = z; } |
duke@435 | 336 | |
kvn@1215 | 337 | // Cache Jvmti state |
kvn@1215 | 338 | void cache_jvmti_state(); |
kvn@1215 | 339 | bool jvmti_can_hotswap_or_post_breakpoint() const { return _jvmti_can_hotswap_or_post_breakpoint; } |
kvn@1215 | 340 | bool jvmti_can_access_local_variables() const { return _jvmti_can_access_local_variables; } |
dcubed@1648 | 341 | bool jvmti_can_post_on_exceptions() const { return _jvmti_can_post_on_exceptions; } |
kvn@1215 | 342 | |
kvn@1215 | 343 | // Cache DTrace flags |
kvn@1215 | 344 | void cache_dtrace_flags(); |
kvn@1215 | 345 | bool dtrace_extended_probes() const { return _dtrace_extended_probes; } |
kvn@1215 | 346 | bool dtrace_monitor_probes() const { return _dtrace_monitor_probes; } |
kvn@1215 | 347 | bool dtrace_method_probes() const { return _dtrace_method_probes; } |
kvn@1215 | 348 | bool dtrace_alloc_probes() const { return _dtrace_alloc_probes; } |
kvn@1215 | 349 | |
duke@435 | 350 | // The compiler task which has created this env. |
duke@435 | 351 | // May be useful to find out compile_id, comp_level, etc. |
duke@435 | 352 | CompileTask* task() { return _task; } |
duke@435 | 353 | // Handy forwards to the task: |
duke@435 | 354 | int comp_level(); // task()->comp_level() |
duke@435 | 355 | uint compile_id(); // task()->compile_id() |
duke@435 | 356 | |
duke@435 | 357 | // Register the result of a compilation. |
duke@435 | 358 | void register_method(ciMethod* target, |
duke@435 | 359 | int entry_bci, |
duke@435 | 360 | CodeOffsets* offsets, |
duke@435 | 361 | int orig_pc_offset, |
duke@435 | 362 | CodeBuffer* code_buffer, |
duke@435 | 363 | int frame_words, |
duke@435 | 364 | OopMapSet* oop_map_set, |
duke@435 | 365 | ExceptionHandlerTable* handler_table, |
duke@435 | 366 | ImplicitExceptionTable* inc_table, |
duke@435 | 367 | AbstractCompiler* compiler, |
duke@435 | 368 | int comp_level, |
kvn@4103 | 369 | bool has_unsafe_access, |
kvn@6429 | 370 | bool has_wide_vectors, |
kvn@6429 | 371 | RTMState rtm_state = NoRTM); |
duke@435 | 372 | |
duke@435 | 373 | |
duke@435 | 374 | // Access to certain well known ciObjects. |
never@1577 | 375 | #define WK_KLASS_FUNC(name, ignore_s, ignore_o) \ |
never@1577 | 376 | ciInstanceKlass* name() { \ |
never@1577 | 377 | return _##name;\ |
duke@435 | 378 | } |
never@1577 | 379 | WK_KLASSES_DO(WK_KLASS_FUNC) |
never@1577 | 380 | #undef WK_KLASS_FUNC |
never@1577 | 381 | |
duke@435 | 382 | ciInstance* NullPointerException_instance() { |
duke@435 | 383 | assert(_NullPointerException_instance != NULL, "initialization problem"); |
duke@435 | 384 | return _NullPointerException_instance; |
duke@435 | 385 | } |
duke@435 | 386 | ciInstance* ArithmeticException_instance() { |
duke@435 | 387 | assert(_ArithmeticException_instance != NULL, "initialization problem"); |
duke@435 | 388 | return _ArithmeticException_instance; |
duke@435 | 389 | } |
duke@435 | 390 | |
duke@435 | 391 | // Lazy constructors: |
duke@435 | 392 | ciInstance* ArrayIndexOutOfBoundsException_instance(); |
duke@435 | 393 | ciInstance* ArrayStoreException_instance(); |
duke@435 | 394 | ciInstance* ClassCastException_instance(); |
duke@435 | 395 | |
never@1515 | 396 | ciInstance* the_null_string(); |
never@1515 | 397 | ciInstance* the_min_jint_string(); |
never@1515 | 398 | |
duke@435 | 399 | static ciSymbol* unloaded_cisymbol() { |
duke@435 | 400 | return _unloaded_cisymbol; |
duke@435 | 401 | } |
duke@435 | 402 | static ciObjArrayKlass* unloaded_ciobjarrayklass() { |
duke@435 | 403 | return _unloaded_ciobjarrayklass; |
duke@435 | 404 | } |
duke@435 | 405 | static ciInstanceKlass* unloaded_ciinstance_klass() { |
duke@435 | 406 | return _unloaded_ciinstance_klass; |
duke@435 | 407 | } |
roland@5628 | 408 | ciInstance* unloaded_ciinstance(); |
duke@435 | 409 | |
duke@435 | 410 | ciKlass* find_system_klass(ciSymbol* klass_name); |
duke@435 | 411 | // Note: To find a class from its name string, use ciSymbol::make, |
duke@435 | 412 | // but consider adding to vmSymbols.hpp instead. |
duke@435 | 413 | |
duke@435 | 414 | // converts the ciKlass* representing the holder of a method into a |
duke@435 | 415 | // ciInstanceKlass*. This is needed since the holder of a method in |
duke@435 | 416 | // the bytecodes could be an array type. Basically this converts |
duke@435 | 417 | // array types into java/lang/Object and other types stay as they are. |
duke@435 | 418 | static ciInstanceKlass* get_instance_klass_for_declared_method_holder(ciKlass* klass); |
duke@435 | 419 | |
duke@435 | 420 | // Return the machine-level offset of o, which must be an element of a. |
duke@435 | 421 | // This may be used to form constant-loading expressions in lieu of simpler encodings. |
duke@435 | 422 | int array_element_offset_in_bytes(ciArray* a, ciObject* o); |
duke@435 | 423 | |
duke@435 | 424 | // Access to the compile-lifetime allocation arena. |
duke@435 | 425 | Arena* arena() { return _arena; } |
duke@435 | 426 | |
duke@435 | 427 | // What is the current compilation environment? |
duke@435 | 428 | static ciEnv* current() { return CompilerThread::current()->env(); } |
duke@435 | 429 | |
duke@435 | 430 | // Overload with current thread argument |
duke@435 | 431 | static ciEnv* current(CompilerThread *thread) { return thread->env(); } |
duke@435 | 432 | |
duke@435 | 433 | // Per-compiler data. (Used by C2 to publish the Compile* pointer.) |
duke@435 | 434 | void* compiler_data() { return _compiler_data; } |
duke@435 | 435 | void set_compiler_data(void* x) { _compiler_data = x; } |
duke@435 | 436 | |
duke@435 | 437 | // Notice that a method has been inlined in the current compile; |
duke@435 | 438 | // used only for statistics. |
duke@435 | 439 | void notice_inlined_method(ciMethod* method); |
duke@435 | 440 | |
duke@435 | 441 | // Total number of bytecodes in inlined methods in this compile |
duke@435 | 442 | int num_inlined_bytecodes() const; |
duke@435 | 443 | |
duke@435 | 444 | // Output stream for logging compilation info. |
duke@435 | 445 | CompileLog* log() { return _log; } |
duke@435 | 446 | void set_log(CompileLog* log) { _log = log; } |
duke@435 | 447 | |
duke@435 | 448 | // Check for changes to the system dictionary during compilation |
duke@435 | 449 | bool system_dictionary_modification_counter_changed(); |
duke@435 | 450 | |
duke@435 | 451 | void record_failure(const char* reason); |
duke@435 | 452 | void record_method_not_compilable(const char* reason, bool all_tiers = true); |
duke@435 | 453 | void record_out_of_memory_failure(); |
coleenp@4037 | 454 | |
coleenp@4037 | 455 | // RedefineClasses support |
coleenp@4037 | 456 | void metadata_do(void f(Metadata*)) { _factory->metadata_do(f); } |
minqi@4267 | 457 | |
minqi@4267 | 458 | // Dump the compilation replay data for the ciEnv to the stream. |
kvn@6217 | 459 | void dump_replay_data(int compile_id); |
kvn@6217 | 460 | void dump_inline_data(int compile_id); |
minqi@4267 | 461 | void dump_replay_data(outputStream* out); |
vlivanov@5904 | 462 | void dump_replay_data_unsafe(outputStream* out); |
kvn@6217 | 463 | void dump_compile_data(outputStream* out); |
duke@435 | 464 | }; |
stefank@2314 | 465 | |
stefank@2314 | 466 | #endif // SHARE_VM_CI_CIENV_HPP |