Tue, 18 Jun 2013 12:31:07 -0700
8015237: Parallelize string table scanning during strong root processing
Summary: Parallelize the scanning of the intern string table by having each GC worker claim a given number of buckets. Changes were also reviewed by Per Liden <per.liden@oracle.com>.
Reviewed-by: tschatzl, stefank, twisti
duke@435 | 1 | /* |
coleenp@4643 | 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 | #include "precompiled.hpp" |
stefank@2314 | 26 | #include "ci/ciConstant.hpp" |
stefank@2314 | 27 | #include "ci/ciEnv.hpp" |
stefank@2314 | 28 | #include "ci/ciField.hpp" |
stefank@2314 | 29 | #include "ci/ciInstance.hpp" |
stefank@2314 | 30 | #include "ci/ciInstanceKlass.hpp" |
stefank@2314 | 31 | #include "ci/ciMethod.hpp" |
stefank@2314 | 32 | #include "ci/ciNullObject.hpp" |
minqi@4267 | 33 | #include "ci/ciReplay.hpp" |
stefank@2314 | 34 | #include "ci/ciUtilities.hpp" |
stefank@2314 | 35 | #include "classfile/systemDictionary.hpp" |
stefank@2314 | 36 | #include "classfile/vmSymbols.hpp" |
stefank@2314 | 37 | #include "code/scopeDesc.hpp" |
stefank@2314 | 38 | #include "compiler/compileBroker.hpp" |
stefank@2314 | 39 | #include "compiler/compileLog.hpp" |
stefank@2314 | 40 | #include "compiler/compilerOracle.hpp" |
stefank@2314 | 41 | #include "gc_interface/collectedHeap.inline.hpp" |
stefank@2314 | 42 | #include "interpreter/linkResolver.hpp" |
stefank@2314 | 43 | #include "memory/allocation.inline.hpp" |
stefank@2314 | 44 | #include "memory/oopFactory.hpp" |
stefank@2314 | 45 | #include "memory/universe.inline.hpp" |
coleenp@4037 | 46 | #include "oops/methodData.hpp" |
stefank@2314 | 47 | #include "oops/objArrayKlass.hpp" |
stefank@2314 | 48 | #include "oops/oop.inline.hpp" |
stefank@2314 | 49 | #include "oops/oop.inline2.hpp" |
stefank@2314 | 50 | #include "prims/jvmtiExport.hpp" |
stefank@2314 | 51 | #include "runtime/init.hpp" |
stefank@2314 | 52 | #include "runtime/reflection.hpp" |
stefank@2314 | 53 | #include "runtime/sharedRuntime.hpp" |
stefank@2314 | 54 | #include "utilities/dtrace.hpp" |
jprovino@4542 | 55 | #include "utilities/macros.hpp" |
stefank@2314 | 56 | #ifdef COMPILER1 |
stefank@2314 | 57 | #include "c1/c1_Runtime1.hpp" |
stefank@2314 | 58 | #endif |
stefank@2314 | 59 | #ifdef COMPILER2 |
stefank@2314 | 60 | #include "opto/runtime.hpp" |
stefank@2314 | 61 | #endif |
duke@435 | 62 | |
duke@435 | 63 | // ciEnv |
duke@435 | 64 | // |
duke@435 | 65 | // This class is the top level broker for requests from the compiler |
duke@435 | 66 | // to the VM. |
duke@435 | 67 | |
duke@435 | 68 | ciObject* ciEnv::_null_object_instance; |
duke@435 | 69 | |
never@1577 | 70 | #define WK_KLASS_DEFN(name, ignore_s, ignore_o) ciInstanceKlass* ciEnv::_##name = NULL; |
never@1577 | 71 | WK_KLASSES_DO(WK_KLASS_DEFN) |
never@1577 | 72 | #undef WK_KLASS_DEFN |
duke@435 | 73 | |
duke@435 | 74 | ciSymbol* ciEnv::_unloaded_cisymbol = NULL; |
duke@435 | 75 | ciInstanceKlass* ciEnv::_unloaded_ciinstance_klass = NULL; |
duke@435 | 76 | ciObjArrayKlass* ciEnv::_unloaded_ciobjarrayklass = NULL; |
duke@435 | 77 | |
duke@435 | 78 | jobject ciEnv::_ArrayIndexOutOfBoundsException_handle = NULL; |
duke@435 | 79 | jobject ciEnv::_ArrayStoreException_handle = NULL; |
duke@435 | 80 | jobject ciEnv::_ClassCastException_handle = NULL; |
duke@435 | 81 | |
duke@435 | 82 | #ifndef PRODUCT |
duke@435 | 83 | static bool firstEnv = true; |
duke@435 | 84 | #endif /* PRODUCT */ |
duke@435 | 85 | |
duke@435 | 86 | // ------------------------------------------------------------------ |
duke@435 | 87 | // ciEnv::ciEnv |
duke@435 | 88 | ciEnv::ciEnv(CompileTask* task, int system_dictionary_modification_counter) { |
duke@435 | 89 | VM_ENTRY_MARK; |
duke@435 | 90 | |
duke@435 | 91 | // Set up ciEnv::current immediately, for the sake of ciObjectFactory, etc. |
duke@435 | 92 | thread->set_env(this); |
duke@435 | 93 | assert(ciEnv::current() == this, "sanity"); |
duke@435 | 94 | |
duke@435 | 95 | _oop_recorder = NULL; |
duke@435 | 96 | _debug_info = NULL; |
duke@435 | 97 | _dependencies = NULL; |
duke@435 | 98 | _failure_reason = NULL; |
duke@435 | 99 | _compilable = MethodCompilable; |
duke@435 | 100 | _break_at_compile = false; |
duke@435 | 101 | _compiler_data = NULL; |
duke@435 | 102 | #ifndef PRODUCT |
duke@435 | 103 | assert(!firstEnv, "not initialized properly"); |
duke@435 | 104 | #endif /* !PRODUCT */ |
duke@435 | 105 | |
duke@435 | 106 | _system_dictionary_modification_counter = system_dictionary_modification_counter; |
duke@435 | 107 | _num_inlined_bytecodes = 0; |
duke@435 | 108 | assert(task == NULL || thread->task() == task, "sanity"); |
duke@435 | 109 | _task = task; |
duke@435 | 110 | _log = NULL; |
duke@435 | 111 | |
duke@435 | 112 | // Temporary buffer for creating symbols and such. |
duke@435 | 113 | _name_buffer = NULL; |
duke@435 | 114 | _name_buffer_len = 0; |
duke@435 | 115 | |
duke@435 | 116 | _arena = &_ciEnv_arena; |
duke@435 | 117 | _factory = new (_arena) ciObjectFactory(_arena, 128); |
duke@435 | 118 | |
duke@435 | 119 | // Preload commonly referenced system ciObjects. |
duke@435 | 120 | |
duke@435 | 121 | // During VM initialization, these instances have not yet been created. |
duke@435 | 122 | // Assertions ensure that these instances are not accessed before |
duke@435 | 123 | // their initialization. |
duke@435 | 124 | |
duke@435 | 125 | assert(Universe::is_fully_initialized(), "should be complete"); |
duke@435 | 126 | |
duke@435 | 127 | oop o = Universe::null_ptr_exception_instance(); |
duke@435 | 128 | assert(o != NULL, "should have been initialized"); |
duke@435 | 129 | _NullPointerException_instance = get_object(o)->as_instance(); |
duke@435 | 130 | o = Universe::arithmetic_exception_instance(); |
duke@435 | 131 | assert(o != NULL, "should have been initialized"); |
duke@435 | 132 | _ArithmeticException_instance = get_object(o)->as_instance(); |
duke@435 | 133 | |
duke@435 | 134 | _ArrayIndexOutOfBoundsException_instance = NULL; |
duke@435 | 135 | _ArrayStoreException_instance = NULL; |
duke@435 | 136 | _ClassCastException_instance = NULL; |
never@1515 | 137 | _the_null_string = NULL; |
never@1515 | 138 | _the_min_jint_string = NULL; |
duke@435 | 139 | } |
duke@435 | 140 | |
duke@435 | 141 | ciEnv::ciEnv(Arena* arena) { |
duke@435 | 142 | ASSERT_IN_VM; |
duke@435 | 143 | |
duke@435 | 144 | // Set up ciEnv::current immediately, for the sake of ciObjectFactory, etc. |
duke@435 | 145 | CompilerThread* current_thread = CompilerThread::current(); |
duke@435 | 146 | assert(current_thread->env() == NULL, "must be"); |
duke@435 | 147 | current_thread->set_env(this); |
duke@435 | 148 | assert(ciEnv::current() == this, "sanity"); |
duke@435 | 149 | |
duke@435 | 150 | _oop_recorder = NULL; |
duke@435 | 151 | _debug_info = NULL; |
duke@435 | 152 | _dependencies = NULL; |
duke@435 | 153 | _failure_reason = NULL; |
duke@435 | 154 | _compilable = MethodCompilable_never; |
duke@435 | 155 | _break_at_compile = false; |
duke@435 | 156 | _compiler_data = NULL; |
duke@435 | 157 | #ifndef PRODUCT |
duke@435 | 158 | assert(firstEnv, "must be first"); |
duke@435 | 159 | firstEnv = false; |
duke@435 | 160 | #endif /* !PRODUCT */ |
duke@435 | 161 | |
duke@435 | 162 | _system_dictionary_modification_counter = 0; |
duke@435 | 163 | _num_inlined_bytecodes = 0; |
duke@435 | 164 | _task = NULL; |
duke@435 | 165 | _log = NULL; |
duke@435 | 166 | |
duke@435 | 167 | // Temporary buffer for creating symbols and such. |
duke@435 | 168 | _name_buffer = NULL; |
duke@435 | 169 | _name_buffer_len = 0; |
duke@435 | 170 | |
duke@435 | 171 | _arena = arena; |
duke@435 | 172 | _factory = new (_arena) ciObjectFactory(_arena, 128); |
duke@435 | 173 | |
duke@435 | 174 | // Preload commonly referenced system ciObjects. |
duke@435 | 175 | |
duke@435 | 176 | // During VM initialization, these instances have not yet been created. |
duke@435 | 177 | // Assertions ensure that these instances are not accessed before |
duke@435 | 178 | // their initialization. |
duke@435 | 179 | |
duke@435 | 180 | assert(Universe::is_fully_initialized(), "must be"); |
duke@435 | 181 | |
coleenp@4037 | 182 | _NullPointerException_instance = NULL; |
coleenp@4037 | 183 | _ArithmeticException_instance = NULL; |
duke@435 | 184 | _ArrayIndexOutOfBoundsException_instance = NULL; |
duke@435 | 185 | _ArrayStoreException_instance = NULL; |
duke@435 | 186 | _ClassCastException_instance = NULL; |
never@1515 | 187 | _the_null_string = NULL; |
never@1515 | 188 | _the_min_jint_string = NULL; |
duke@435 | 189 | } |
duke@435 | 190 | |
duke@435 | 191 | ciEnv::~ciEnv() { |
duke@435 | 192 | CompilerThread* current_thread = CompilerThread::current(); |
coleenp@2497 | 193 | _factory->remove_symbols(); |
coleenp@4037 | 194 | // Need safepoint to clear the env on the thread. RedefineClasses might |
coleenp@4037 | 195 | // be reading it. |
coleenp@4037 | 196 | GUARDED_VM_ENTRY(current_thread->set_env(NULL);) |
duke@435 | 197 | } |
duke@435 | 198 | |
duke@435 | 199 | // ------------------------------------------------------------------ |
kvn@1215 | 200 | // Cache Jvmti state |
kvn@1215 | 201 | void ciEnv::cache_jvmti_state() { |
kvn@1215 | 202 | VM_ENTRY_MARK; |
kvn@1215 | 203 | // Get Jvmti capabilities under lock to get consistant values. |
kvn@1215 | 204 | MutexLocker mu(JvmtiThreadState_lock); |
kvn@1215 | 205 | _jvmti_can_hotswap_or_post_breakpoint = JvmtiExport::can_hotswap_or_post_breakpoint(); |
kvn@1215 | 206 | _jvmti_can_access_local_variables = JvmtiExport::can_access_local_variables(); |
dcubed@1648 | 207 | _jvmti_can_post_on_exceptions = JvmtiExport::can_post_on_exceptions(); |
kvn@1215 | 208 | } |
kvn@1215 | 209 | |
kvn@1215 | 210 | // ------------------------------------------------------------------ |
kvn@1215 | 211 | // Cache DTrace flags |
kvn@1215 | 212 | void ciEnv::cache_dtrace_flags() { |
kvn@1215 | 213 | // Need lock? |
kvn@1215 | 214 | _dtrace_extended_probes = ExtendedDTraceProbes; |
kvn@1215 | 215 | if (_dtrace_extended_probes) { |
kvn@1215 | 216 | _dtrace_monitor_probes = true; |
kvn@1215 | 217 | _dtrace_method_probes = true; |
kvn@1215 | 218 | _dtrace_alloc_probes = true; |
kvn@1215 | 219 | } else { |
kvn@1215 | 220 | _dtrace_monitor_probes = DTraceMonitorProbes; |
kvn@1215 | 221 | _dtrace_method_probes = DTraceMethodProbes; |
kvn@1215 | 222 | _dtrace_alloc_probes = DTraceAllocProbes; |
kvn@1215 | 223 | } |
kvn@1215 | 224 | } |
kvn@1215 | 225 | |
kvn@1215 | 226 | // ------------------------------------------------------------------ |
duke@435 | 227 | // helper for lazy exception creation |
coleenp@2497 | 228 | ciInstance* ciEnv::get_or_create_exception(jobject& handle, Symbol* name) { |
duke@435 | 229 | VM_ENTRY_MARK; |
duke@435 | 230 | if (handle == NULL) { |
duke@435 | 231 | // Cf. universe.cpp, creation of Universe::_null_ptr_exception_instance. |
coleenp@4037 | 232 | Klass* k = SystemDictionary::find(name, Handle(), Handle(), THREAD); |
duke@435 | 233 | jobject objh = NULL; |
duke@435 | 234 | if (!HAS_PENDING_EXCEPTION && k != NULL) { |
coleenp@4037 | 235 | oop obj = InstanceKlass::cast(k)->allocate_instance(THREAD); |
duke@435 | 236 | if (!HAS_PENDING_EXCEPTION) |
duke@435 | 237 | objh = JNIHandles::make_global(obj); |
duke@435 | 238 | } |
duke@435 | 239 | if (HAS_PENDING_EXCEPTION) { |
duke@435 | 240 | CLEAR_PENDING_EXCEPTION; |
duke@435 | 241 | } else { |
duke@435 | 242 | handle = objh; |
duke@435 | 243 | } |
duke@435 | 244 | } |
duke@435 | 245 | oop obj = JNIHandles::resolve(handle); |
duke@435 | 246 | return obj == NULL? NULL: get_object(obj)->as_instance(); |
duke@435 | 247 | } |
duke@435 | 248 | |
duke@435 | 249 | ciInstance* ciEnv::ArrayIndexOutOfBoundsException_instance() { |
duke@435 | 250 | if (_ArrayIndexOutOfBoundsException_instance == NULL) { |
duke@435 | 251 | _ArrayIndexOutOfBoundsException_instance |
duke@435 | 252 | = get_or_create_exception(_ArrayIndexOutOfBoundsException_handle, |
coleenp@2497 | 253 | vmSymbols::java_lang_ArrayIndexOutOfBoundsException()); |
duke@435 | 254 | } |
duke@435 | 255 | return _ArrayIndexOutOfBoundsException_instance; |
duke@435 | 256 | } |
duke@435 | 257 | ciInstance* ciEnv::ArrayStoreException_instance() { |
duke@435 | 258 | if (_ArrayStoreException_instance == NULL) { |
duke@435 | 259 | _ArrayStoreException_instance |
duke@435 | 260 | = get_or_create_exception(_ArrayStoreException_handle, |
coleenp@2497 | 261 | vmSymbols::java_lang_ArrayStoreException()); |
duke@435 | 262 | } |
duke@435 | 263 | return _ArrayStoreException_instance; |
duke@435 | 264 | } |
duke@435 | 265 | ciInstance* ciEnv::ClassCastException_instance() { |
duke@435 | 266 | if (_ClassCastException_instance == NULL) { |
duke@435 | 267 | _ClassCastException_instance |
duke@435 | 268 | = get_or_create_exception(_ClassCastException_handle, |
coleenp@2497 | 269 | vmSymbols::java_lang_ClassCastException()); |
duke@435 | 270 | } |
duke@435 | 271 | return _ClassCastException_instance; |
duke@435 | 272 | } |
duke@435 | 273 | |
never@1515 | 274 | ciInstance* ciEnv::the_null_string() { |
never@1515 | 275 | if (_the_null_string == NULL) { |
never@1515 | 276 | VM_ENTRY_MARK; |
never@1515 | 277 | _the_null_string = get_object(Universe::the_null_string())->as_instance(); |
never@1515 | 278 | } |
never@1515 | 279 | return _the_null_string; |
never@1515 | 280 | } |
never@1515 | 281 | |
never@1515 | 282 | ciInstance* ciEnv::the_min_jint_string() { |
never@1515 | 283 | if (_the_min_jint_string == NULL) { |
never@1515 | 284 | VM_ENTRY_MARK; |
never@1515 | 285 | _the_min_jint_string = get_object(Universe::the_min_jint_string())->as_instance(); |
never@1515 | 286 | } |
never@1515 | 287 | return _the_min_jint_string; |
never@1515 | 288 | } |
never@1515 | 289 | |
duke@435 | 290 | // ------------------------------------------------------------------ |
duke@435 | 291 | // ciEnv::get_method_from_handle |
coleenp@4037 | 292 | ciMethod* ciEnv::get_method_from_handle(Method* method) { |
duke@435 | 293 | VM_ENTRY_MARK; |
coleenp@4037 | 294 | return get_metadata(method)->as_method(); |
duke@435 | 295 | } |
duke@435 | 296 | |
duke@435 | 297 | // ------------------------------------------------------------------ |
duke@435 | 298 | // ciEnv::array_element_offset_in_bytes |
duke@435 | 299 | int ciEnv::array_element_offset_in_bytes(ciArray* a_h, ciObject* o_h) { |
duke@435 | 300 | VM_ENTRY_MARK; |
duke@435 | 301 | objArrayOop a = (objArrayOop)a_h->get_oop(); |
duke@435 | 302 | assert(a->is_objArray(), ""); |
duke@435 | 303 | int length = a->length(); |
duke@435 | 304 | oop o = o_h->get_oop(); |
duke@435 | 305 | for (int i = 0; i < length; i++) { |
duke@435 | 306 | if (a->obj_at(i) == o) return i; |
duke@435 | 307 | } |
duke@435 | 308 | return -1; |
duke@435 | 309 | } |
duke@435 | 310 | |
duke@435 | 311 | |
duke@435 | 312 | // ------------------------------------------------------------------ |
duke@435 | 313 | // ciEnv::check_klass_accessiblity |
duke@435 | 314 | // |
duke@435 | 315 | // Note: the logic of this method should mirror the logic of |
coleenp@4037 | 316 | // ConstantPool::verify_constant_pool_resolve. |
duke@435 | 317 | bool ciEnv::check_klass_accessibility(ciKlass* accessing_klass, |
coleenp@4037 | 318 | Klass* resolved_klass) { |
duke@435 | 319 | if (accessing_klass == NULL || !accessing_klass->is_loaded()) { |
duke@435 | 320 | return true; |
duke@435 | 321 | } |
coleenp@4037 | 322 | if (accessing_klass->is_obj_array_klass()) { |
duke@435 | 323 | accessing_klass = accessing_klass->as_obj_array_klass()->base_element_klass(); |
duke@435 | 324 | } |
duke@435 | 325 | if (!accessing_klass->is_instance_klass()) { |
duke@435 | 326 | return true; |
duke@435 | 327 | } |
duke@435 | 328 | |
coleenp@4037 | 329 | if (resolved_klass->oop_is_objArray()) { |
duke@435 | 330 | // Find the element klass, if this is an array. |
coleenp@4142 | 331 | resolved_klass = ObjArrayKlass::cast(resolved_klass)->bottom_klass(); |
duke@435 | 332 | } |
coleenp@4037 | 333 | if (resolved_klass->oop_is_instance()) { |
coleenp@4037 | 334 | return Reflection::verify_class_access(accessing_klass->get_Klass(), |
duke@435 | 335 | resolved_klass, |
duke@435 | 336 | true); |
duke@435 | 337 | } |
duke@435 | 338 | return true; |
duke@435 | 339 | } |
duke@435 | 340 | |
duke@435 | 341 | // ------------------------------------------------------------------ |
duke@435 | 342 | // ciEnv::get_klass_by_name_impl |
duke@435 | 343 | ciKlass* ciEnv::get_klass_by_name_impl(ciKlass* accessing_klass, |
jrose@2982 | 344 | constantPoolHandle cpool, |
duke@435 | 345 | ciSymbol* name, |
duke@435 | 346 | bool require_local) { |
duke@435 | 347 | ASSERT_IN_VM; |
duke@435 | 348 | EXCEPTION_CONTEXT; |
duke@435 | 349 | |
duke@435 | 350 | // Now we need to check the SystemDictionary |
coleenp@2497 | 351 | Symbol* sym = name->get_symbol(); |
duke@435 | 352 | if (sym->byte_at(0) == 'L' && |
duke@435 | 353 | sym->byte_at(sym->utf8_length()-1) == ';') { |
duke@435 | 354 | // This is a name from a signature. Strip off the trimmings. |
coleenp@2497 | 355 | // Call recursive to keep scope of strippedsym. |
coleenp@2497 | 356 | TempNewSymbol strippedsym = SymbolTable::new_symbol(sym->as_utf8()+1, |
coleenp@2497 | 357 | sym->utf8_length()-2, |
coleenp@2497 | 358 | KILL_COMPILE_ON_FATAL_(_unloaded_ciinstance_klass)); |
coleenp@2497 | 359 | ciSymbol* strippedname = get_symbol(strippedsym); |
jrose@2982 | 360 | return get_klass_by_name_impl(accessing_klass, cpool, strippedname, require_local); |
duke@435 | 361 | } |
duke@435 | 362 | |
duke@435 | 363 | // Check for prior unloaded klass. The SystemDictionary's answers |
duke@435 | 364 | // can vary over time but the compiler needs consistency. |
duke@435 | 365 | ciKlass* unloaded_klass = check_get_unloaded_klass(accessing_klass, name); |
duke@435 | 366 | if (unloaded_klass != NULL) { |
duke@435 | 367 | if (require_local) return NULL; |
duke@435 | 368 | return unloaded_klass; |
duke@435 | 369 | } |
duke@435 | 370 | |
duke@435 | 371 | Handle loader(THREAD, (oop)NULL); |
duke@435 | 372 | Handle domain(THREAD, (oop)NULL); |
duke@435 | 373 | if (accessing_klass != NULL) { |
duke@435 | 374 | loader = Handle(THREAD, accessing_klass->loader()); |
duke@435 | 375 | domain = Handle(THREAD, accessing_klass->protection_domain()); |
duke@435 | 376 | } |
duke@435 | 377 | |
duke@435 | 378 | // setup up the proper type to return on OOM |
duke@435 | 379 | ciKlass* fail_type; |
duke@435 | 380 | if (sym->byte_at(0) == '[') { |
duke@435 | 381 | fail_type = _unloaded_ciobjarrayklass; |
duke@435 | 382 | } else { |
duke@435 | 383 | fail_type = _unloaded_ciinstance_klass; |
duke@435 | 384 | } |
kamg@2467 | 385 | KlassHandle found_klass; |
never@2551 | 386 | { |
never@2570 | 387 | ttyUnlocker ttyul; // release tty lock to avoid ordering problems |
never@2551 | 388 | MutexLocker ml(Compile_lock); |
coleenp@4037 | 389 | Klass* kls; |
never@2551 | 390 | if (!require_local) { |
never@2551 | 391 | kls = SystemDictionary::find_constrained_instance_or_array_klass(sym, loader, |
never@2551 | 392 | KILL_COMPILE_ON_FATAL_(fail_type)); |
never@2551 | 393 | } else { |
never@2551 | 394 | kls = SystemDictionary::find_instance_or_array_klass(sym, loader, domain, |
never@2551 | 395 | KILL_COMPILE_ON_FATAL_(fail_type)); |
never@2551 | 396 | } |
kamg@2467 | 397 | found_klass = KlassHandle(THREAD, kls); |
duke@435 | 398 | } |
duke@435 | 399 | |
duke@435 | 400 | // If we fail to find an array klass, look again for its element type. |
duke@435 | 401 | // The element type may be available either locally or via constraints. |
duke@435 | 402 | // In either case, if we can find the element type in the system dictionary, |
duke@435 | 403 | // we must build an array type around it. The CI requires array klasses |
duke@435 | 404 | // to be loaded if their element klasses are loaded, except when memory |
duke@435 | 405 | // is exhausted. |
duke@435 | 406 | if (sym->byte_at(0) == '[' && |
duke@435 | 407 | (sym->byte_at(1) == '[' || sym->byte_at(1) == 'L')) { |
duke@435 | 408 | // We have an unloaded array. |
duke@435 | 409 | // Build it on the fly if the element class exists. |
coleenp@2497 | 410 | TempNewSymbol elem_sym = SymbolTable::new_symbol(sym->as_utf8()+1, |
coleenp@2497 | 411 | sym->utf8_length()-1, |
coleenp@2497 | 412 | KILL_COMPILE_ON_FATAL_(fail_type)); |
coleenp@2497 | 413 | |
duke@435 | 414 | // Get element ciKlass recursively. |
duke@435 | 415 | ciKlass* elem_klass = |
duke@435 | 416 | get_klass_by_name_impl(accessing_klass, |
jrose@2982 | 417 | cpool, |
coleenp@2497 | 418 | get_symbol(elem_sym), |
duke@435 | 419 | require_local); |
duke@435 | 420 | if (elem_klass != NULL && elem_klass->is_loaded()) { |
duke@435 | 421 | // Now make an array for it |
duke@435 | 422 | return ciObjArrayKlass::make_impl(elem_klass); |
duke@435 | 423 | } |
duke@435 | 424 | } |
duke@435 | 425 | |
jrose@2982 | 426 | if (found_klass() == NULL && !cpool.is_null() && cpool->has_preresolution()) { |
jrose@2982 | 427 | // Look inside the constant pool for pre-resolved class entries. |
jrose@2982 | 428 | for (int i = cpool->length() - 1; i >= 1; i--) { |
jrose@2982 | 429 | if (cpool->tag_at(i).is_klass()) { |
coleenp@4037 | 430 | Klass* kls = cpool->resolved_klass_at(i); |
hseigel@4278 | 431 | if (kls->name() == sym) { |
jrose@2982 | 432 | found_klass = KlassHandle(THREAD, kls); |
jrose@2982 | 433 | break; |
jrose@2982 | 434 | } |
jrose@2982 | 435 | } |
jrose@2982 | 436 | } |
jrose@2982 | 437 | } |
jrose@2982 | 438 | |
kamg@2467 | 439 | if (found_klass() != NULL) { |
jrose@1424 | 440 | // Found it. Build a CI handle. |
coleenp@4037 | 441 | return get_klass(found_klass()); |
jrose@1424 | 442 | } |
jrose@1424 | 443 | |
duke@435 | 444 | if (require_local) return NULL; |
twisti@3197 | 445 | |
duke@435 | 446 | // Not yet loaded into the VM, or not governed by loader constraints. |
duke@435 | 447 | // Make a CI representative for it. |
duke@435 | 448 | return get_unloaded_klass(accessing_klass, name); |
duke@435 | 449 | } |
duke@435 | 450 | |
duke@435 | 451 | // ------------------------------------------------------------------ |
duke@435 | 452 | // ciEnv::get_klass_by_name |
duke@435 | 453 | ciKlass* ciEnv::get_klass_by_name(ciKlass* accessing_klass, |
duke@435 | 454 | ciSymbol* klass_name, |
duke@435 | 455 | bool require_local) { |
duke@435 | 456 | GUARDED_VM_ENTRY(return get_klass_by_name_impl(accessing_klass, |
jrose@2982 | 457 | constantPoolHandle(), |
duke@435 | 458 | klass_name, |
duke@435 | 459 | require_local);) |
duke@435 | 460 | } |
duke@435 | 461 | |
duke@435 | 462 | // ------------------------------------------------------------------ |
duke@435 | 463 | // ciEnv::get_klass_by_index_impl |
duke@435 | 464 | // |
duke@435 | 465 | // Implementation of get_klass_by_index. |
twisti@1573 | 466 | ciKlass* ciEnv::get_klass_by_index_impl(constantPoolHandle cpool, |
duke@435 | 467 | int index, |
twisti@1573 | 468 | bool& is_accessible, |
twisti@1573 | 469 | ciInstanceKlass* accessor) { |
duke@435 | 470 | EXCEPTION_CONTEXT; |
coleenp@4037 | 471 | KlassHandle klass; // = NULL; |
coleenp@2497 | 472 | Symbol* klass_name = NULL; |
coleenp@4037 | 473 | |
coleenp@4037 | 474 | if (cpool->tag_at(index).is_symbol()) { |
coleenp@4037 | 475 | klass_name = cpool->symbol_at(index); |
coleenp@4037 | 476 | } else { |
coleenp@4037 | 477 | // Check if it's resolved if it's not a symbol constant pool entry. |
coleenp@4037 | 478 | klass = KlassHandle(THREAD, ConstantPool::klass_at_if_loaded(cpool, index)); |
coleenp@4037 | 479 | |
duke@435 | 480 | if (klass.is_null()) { |
duke@435 | 481 | // The klass has not been inserted into the constant pool. |
duke@435 | 482 | // Try to look it up by name. |
duke@435 | 483 | { |
duke@435 | 484 | // We have to lock the cpool to keep the oop from being resolved |
duke@435 | 485 | // while we are accessing it. |
iklam@4984 | 486 | oop cplock = cpool->lock(); |
iklam@4984 | 487 | ObjectLocker ol(cplock, THREAD, cplock != NULL); |
duke@435 | 488 | constantTag tag = cpool->tag_at(index); |
duke@435 | 489 | if (tag.is_klass()) { |
duke@435 | 490 | // The klass has been inserted into the constant pool |
duke@435 | 491 | // very recently. |
duke@435 | 492 | klass = KlassHandle(THREAD, cpool->resolved_klass_at(index)); |
duke@435 | 493 | } else { |
duke@435 | 494 | assert(cpool->tag_at(index).is_unresolved_klass(), "wrong tag"); |
coleenp@2497 | 495 | klass_name = cpool->unresolved_klass_at(index); |
duke@435 | 496 | } |
duke@435 | 497 | } |
duke@435 | 498 | } |
coleenp@4037 | 499 | } |
duke@435 | 500 | |
duke@435 | 501 | if (klass.is_null()) { |
duke@435 | 502 | // Not found in constant pool. Use the name to do the lookup. |
duke@435 | 503 | ciKlass* k = get_klass_by_name_impl(accessor, |
jrose@2982 | 504 | cpool, |
coleenp@2497 | 505 | get_symbol(klass_name), |
duke@435 | 506 | false); |
duke@435 | 507 | // Calculate accessibility the hard way. |
duke@435 | 508 | if (!k->is_loaded()) { |
duke@435 | 509 | is_accessible = false; |
duke@435 | 510 | } else if (k->loader() != accessor->loader() && |
jrose@2982 | 511 | get_klass_by_name_impl(accessor, cpool, k->name(), true) == NULL) { |
duke@435 | 512 | // Loaded only remotely. Not linked yet. |
duke@435 | 513 | is_accessible = false; |
duke@435 | 514 | } else { |
duke@435 | 515 | // Linked locally, and we must also check public/private, etc. |
coleenp@4037 | 516 | is_accessible = check_klass_accessibility(accessor, k->get_Klass()); |
duke@435 | 517 | } |
duke@435 | 518 | return k; |
duke@435 | 519 | } |
duke@435 | 520 | |
duke@435 | 521 | // Check for prior unloaded klass. The SystemDictionary's answers |
duke@435 | 522 | // can vary over time but the compiler needs consistency. |
coleenp@4037 | 523 | ciSymbol* name = get_symbol(klass()->name()); |
duke@435 | 524 | ciKlass* unloaded_klass = check_get_unloaded_klass(accessor, name); |
duke@435 | 525 | if (unloaded_klass != NULL) { |
duke@435 | 526 | is_accessible = false; |
duke@435 | 527 | return unloaded_klass; |
duke@435 | 528 | } |
duke@435 | 529 | |
duke@435 | 530 | // It is known to be accessible, since it was found in the constant pool. |
duke@435 | 531 | is_accessible = true; |
coleenp@4037 | 532 | return get_klass(klass()); |
duke@435 | 533 | } |
duke@435 | 534 | |
duke@435 | 535 | // ------------------------------------------------------------------ |
duke@435 | 536 | // ciEnv::get_klass_by_index |
duke@435 | 537 | // |
duke@435 | 538 | // Get a klass from the constant pool. |
twisti@1573 | 539 | ciKlass* ciEnv::get_klass_by_index(constantPoolHandle cpool, |
duke@435 | 540 | int index, |
twisti@1573 | 541 | bool& is_accessible, |
twisti@1573 | 542 | ciInstanceKlass* accessor) { |
twisti@1573 | 543 | GUARDED_VM_ENTRY(return get_klass_by_index_impl(cpool, index, is_accessible, accessor);) |
duke@435 | 544 | } |
duke@435 | 545 | |
duke@435 | 546 | // ------------------------------------------------------------------ |
duke@435 | 547 | // ciEnv::get_constant_by_index_impl |
duke@435 | 548 | // |
duke@435 | 549 | // Implementation of get_constant_by_index(). |
twisti@1573 | 550 | ciConstant ciEnv::get_constant_by_index_impl(constantPoolHandle cpool, |
jrose@1957 | 551 | int pool_index, int cache_index, |
twisti@1573 | 552 | ciInstanceKlass* accessor) { |
jrose@1957 | 553 | bool ignore_will_link; |
duke@435 | 554 | EXCEPTION_CONTEXT; |
jrose@1957 | 555 | int index = pool_index; |
jrose@1957 | 556 | if (cache_index >= 0) { |
jrose@1957 | 557 | assert(index < 0, "only one kind of index at a time"); |
coleenp@4037 | 558 | oop obj = cpool->resolved_references()->obj_at(cache_index); |
jrose@1957 | 559 | if (obj != NULL) { |
jrose@1957 | 560 | ciObject* ciobj = get_object(obj); |
jrose@1957 | 561 | return ciConstant(T_OBJECT, ciobj); |
jrose@1957 | 562 | } |
coleenp@4037 | 563 | index = cpool->object_to_cp_index(cache_index); |
jrose@1957 | 564 | } |
duke@435 | 565 | constantTag tag = cpool->tag_at(index); |
duke@435 | 566 | if (tag.is_int()) { |
duke@435 | 567 | return ciConstant(T_INT, (jint)cpool->int_at(index)); |
duke@435 | 568 | } else if (tag.is_long()) { |
duke@435 | 569 | return ciConstant((jlong)cpool->long_at(index)); |
duke@435 | 570 | } else if (tag.is_float()) { |
duke@435 | 571 | return ciConstant((jfloat)cpool->float_at(index)); |
duke@435 | 572 | } else if (tag.is_double()) { |
duke@435 | 573 | return ciConstant((jdouble)cpool->double_at(index)); |
coleenp@4037 | 574 | } else if (tag.is_string()) { |
jrose@866 | 575 | oop string = NULL; |
coleenp@4037 | 576 | assert(cache_index >= 0, "should have a cache index"); |
jrose@866 | 577 | if (cpool->is_pseudo_string_at(index)) { |
coleenp@4037 | 578 | string = cpool->pseudo_string_at(index, cache_index); |
jrose@866 | 579 | } else { |
coleenp@4037 | 580 | string = cpool->string_at(index, cache_index, THREAD); |
jrose@866 | 581 | if (HAS_PENDING_EXCEPTION) { |
jrose@866 | 582 | CLEAR_PENDING_EXCEPTION; |
jrose@866 | 583 | record_out_of_memory_failure(); |
jrose@866 | 584 | return ciConstant(); |
jrose@866 | 585 | } |
duke@435 | 586 | } |
duke@435 | 587 | ciObject* constant = get_object(string); |
duke@435 | 588 | assert (constant->is_instance(), "must be an instance, or not? "); |
duke@435 | 589 | return ciConstant(T_OBJECT, constant); |
duke@435 | 590 | } else if (tag.is_klass() || tag.is_unresolved_klass()) { |
duke@435 | 591 | // 4881222: allow ldc to take a class type |
jrose@1957 | 592 | ciKlass* klass = get_klass_by_index_impl(cpool, index, ignore_will_link, accessor); |
duke@435 | 593 | if (HAS_PENDING_EXCEPTION) { |
duke@435 | 594 | CLEAR_PENDING_EXCEPTION; |
duke@435 | 595 | record_out_of_memory_failure(); |
duke@435 | 596 | return ciConstant(); |
duke@435 | 597 | } |
duke@435 | 598 | assert (klass->is_instance_klass() || klass->is_array_klass(), |
duke@435 | 599 | "must be an instance or array klass "); |
jrose@1957 | 600 | return ciConstant(T_OBJECT, klass->java_mirror()); |
jrose@1957 | 601 | } else if (tag.is_method_type()) { |
jrose@1957 | 602 | // must execute Java code to link this CP entry into cache[i].f1 |
coleenp@2497 | 603 | ciSymbol* signature = get_symbol(cpool->method_type_signature_at(index)); |
jrose@1957 | 604 | ciObject* ciobj = get_unloaded_method_type_constant(signature); |
jrose@1957 | 605 | return ciConstant(T_OBJECT, ciobj); |
jrose@1957 | 606 | } else if (tag.is_method_handle()) { |
jrose@1957 | 607 | // must execute Java code to link this CP entry into cache[i].f1 |
jrose@1957 | 608 | int ref_kind = cpool->method_handle_ref_kind_at(index); |
jrose@1957 | 609 | int callee_index = cpool->method_handle_klass_index_at(index); |
jrose@1957 | 610 | ciKlass* callee = get_klass_by_index_impl(cpool, callee_index, ignore_will_link, accessor); |
coleenp@2497 | 611 | ciSymbol* name = get_symbol(cpool->method_handle_name_ref_at(index)); |
coleenp@2497 | 612 | ciSymbol* signature = get_symbol(cpool->method_handle_signature_ref_at(index)); |
jrose@1957 | 613 | ciObject* ciobj = get_unloaded_method_handle_constant(callee, name, signature, ref_kind); |
jrose@1957 | 614 | return ciConstant(T_OBJECT, ciobj); |
duke@435 | 615 | } else { |
duke@435 | 616 | ShouldNotReachHere(); |
duke@435 | 617 | return ciConstant(); |
duke@435 | 618 | } |
duke@435 | 619 | } |
duke@435 | 620 | |
duke@435 | 621 | // ------------------------------------------------------------------ |
duke@435 | 622 | // ciEnv::get_constant_by_index |
duke@435 | 623 | // |
duke@435 | 624 | // Pull a constant out of the constant pool. How appropriate. |
duke@435 | 625 | // |
duke@435 | 626 | // Implementation note: this query is currently in no way cached. |
twisti@1573 | 627 | ciConstant ciEnv::get_constant_by_index(constantPoolHandle cpool, |
jrose@1957 | 628 | int pool_index, int cache_index, |
twisti@1573 | 629 | ciInstanceKlass* accessor) { |
jrose@1957 | 630 | GUARDED_VM_ENTRY(return get_constant_by_index_impl(cpool, pool_index, cache_index, accessor);) |
duke@435 | 631 | } |
duke@435 | 632 | |
duke@435 | 633 | // ------------------------------------------------------------------ |
duke@435 | 634 | // ciEnv::get_field_by_index_impl |
duke@435 | 635 | // |
duke@435 | 636 | // Implementation of get_field_by_index. |
duke@435 | 637 | // |
duke@435 | 638 | // Implementation note: the results of field lookups are cached |
duke@435 | 639 | // in the accessor klass. |
duke@435 | 640 | ciField* ciEnv::get_field_by_index_impl(ciInstanceKlass* accessor, |
duke@435 | 641 | int index) { |
duke@435 | 642 | ciConstantPoolCache* cache = accessor->field_cache(); |
duke@435 | 643 | if (cache == NULL) { |
duke@435 | 644 | ciField* field = new (arena()) ciField(accessor, index); |
duke@435 | 645 | return field; |
duke@435 | 646 | } else { |
duke@435 | 647 | ciField* field = (ciField*)cache->get(index); |
duke@435 | 648 | if (field == NULL) { |
duke@435 | 649 | field = new (arena()) ciField(accessor, index); |
duke@435 | 650 | cache->insert(index, field); |
duke@435 | 651 | } |
duke@435 | 652 | return field; |
duke@435 | 653 | } |
duke@435 | 654 | } |
duke@435 | 655 | |
duke@435 | 656 | // ------------------------------------------------------------------ |
duke@435 | 657 | // ciEnv::get_field_by_index |
duke@435 | 658 | // |
duke@435 | 659 | // Get a field by index from a klass's constant pool. |
duke@435 | 660 | ciField* ciEnv::get_field_by_index(ciInstanceKlass* accessor, |
duke@435 | 661 | int index) { |
duke@435 | 662 | GUARDED_VM_ENTRY(return get_field_by_index_impl(accessor, index);) |
duke@435 | 663 | } |
duke@435 | 664 | |
duke@435 | 665 | // ------------------------------------------------------------------ |
duke@435 | 666 | // ciEnv::lookup_method |
duke@435 | 667 | // |
duke@435 | 668 | // Perform an appropriate method lookup based on accessor, holder, |
duke@435 | 669 | // name, signature, and bytecode. |
coleenp@4037 | 670 | Method* ciEnv::lookup_method(InstanceKlass* accessor, |
coleenp@4037 | 671 | InstanceKlass* holder, |
coleenp@2497 | 672 | Symbol* name, |
coleenp@2497 | 673 | Symbol* sig, |
duke@435 | 674 | Bytecodes::Code bc) { |
duke@435 | 675 | EXCEPTION_CONTEXT; |
duke@435 | 676 | KlassHandle h_accessor(THREAD, accessor); |
duke@435 | 677 | KlassHandle h_holder(THREAD, holder); |
duke@435 | 678 | LinkResolver::check_klass_accessability(h_accessor, h_holder, KILL_COMPILE_ON_FATAL_(NULL)); |
duke@435 | 679 | methodHandle dest_method; |
duke@435 | 680 | switch (bc) { |
duke@435 | 681 | case Bytecodes::_invokestatic: |
duke@435 | 682 | dest_method = |
coleenp@2497 | 683 | LinkResolver::resolve_static_call_or_null(h_holder, name, sig, h_accessor); |
duke@435 | 684 | break; |
duke@435 | 685 | case Bytecodes::_invokespecial: |
duke@435 | 686 | dest_method = |
coleenp@2497 | 687 | LinkResolver::resolve_special_call_or_null(h_holder, name, sig, h_accessor); |
duke@435 | 688 | break; |
duke@435 | 689 | case Bytecodes::_invokeinterface: |
duke@435 | 690 | dest_method = |
coleenp@2497 | 691 | LinkResolver::linktime_resolve_interface_method_or_null(h_holder, name, sig, |
duke@435 | 692 | h_accessor, true); |
duke@435 | 693 | break; |
duke@435 | 694 | case Bytecodes::_invokevirtual: |
duke@435 | 695 | dest_method = |
coleenp@2497 | 696 | LinkResolver::linktime_resolve_virtual_method_or_null(h_holder, name, sig, |
duke@435 | 697 | h_accessor, true); |
duke@435 | 698 | break; |
duke@435 | 699 | default: ShouldNotReachHere(); |
duke@435 | 700 | } |
duke@435 | 701 | |
duke@435 | 702 | return dest_method(); |
duke@435 | 703 | } |
duke@435 | 704 | |
duke@435 | 705 | |
duke@435 | 706 | // ------------------------------------------------------------------ |
duke@435 | 707 | // ciEnv::get_method_by_index_impl |
twisti@1573 | 708 | ciMethod* ciEnv::get_method_by_index_impl(constantPoolHandle cpool, |
twisti@1573 | 709 | int index, Bytecodes::Code bc, |
twisti@1573 | 710 | ciInstanceKlass* accessor) { |
twisti@4021 | 711 | if (bc == Bytecodes::_invokedynamic) { |
coleenp@4037 | 712 | ConstantPoolCacheEntry* cpce = cpool->invokedynamic_cp_cache_entry_at(index); |
coleenp@4037 | 713 | bool is_resolved = !cpce->is_f1_null(); |
twisti@4021 | 714 | // FIXME: code generation could allow for null (unlinked) call site |
twisti@4021 | 715 | // The call site could be made patchable as follows: |
twisti@4021 | 716 | // Load the appendix argument from the constant pool. |
twisti@4021 | 717 | // Test the appendix argument and jump to a known deopt routine if it is null. |
twisti@4021 | 718 | // Jump through a patchable call site, which is initially a deopt routine. |
twisti@4021 | 719 | // Patch the call site to the nmethod entry point of the static compiled lambda form. |
twisti@4021 | 720 | // As with other two-component call sites, both values must be independently verified. |
duke@435 | 721 | |
twisti@4021 | 722 | if (is_resolved) { |
coleenp@4037 | 723 | // Get the invoker Method* from the constant pool. |
coleenp@4037 | 724 | // (The appendix argument, if any, will be noted in the method's signature.) |
coleenp@4037 | 725 | Method* adapter = cpce->f1_as_method(); |
coleenp@4037 | 726 | return get_method(adapter); |
twisti@4021 | 727 | } |
duke@435 | 728 | |
twisti@4021 | 729 | // Fake a method that is equivalent to a declared method. |
coleenp@4037 | 730 | ciInstanceKlass* holder = get_instance_klass(SystemDictionary::MethodHandle_klass()); |
twisti@3969 | 731 | ciSymbol* name = ciSymbol::invokeBasic_name(); |
twisti@3197 | 732 | ciSymbol* signature = get_symbol(cpool->signature_ref_at(index)); |
twisti@3197 | 733 | return get_unloaded_method(holder, name, signature, accessor); |
twisti@4021 | 734 | } else { |
twisti@4021 | 735 | const int holder_index = cpool->klass_ref_index_at(index); |
twisti@4021 | 736 | bool holder_is_accessible; |
twisti@4021 | 737 | ciKlass* holder = get_klass_by_index_impl(cpool, holder_index, holder_is_accessible, accessor); |
twisti@4021 | 738 | ciInstanceKlass* declared_holder = get_instance_klass_for_declared_method_holder(holder); |
twisti@4021 | 739 | |
twisti@4021 | 740 | // Get the method's name and signature. |
twisti@4021 | 741 | Symbol* name_sym = cpool->name_ref_at(index); |
twisti@4021 | 742 | Symbol* sig_sym = cpool->signature_ref_at(index); |
twisti@4021 | 743 | |
twisti@4021 | 744 | if (cpool->has_preresolution() |
twisti@4021 | 745 | || (holder == ciEnv::MethodHandle_klass() && |
coleenp@4037 | 746 | MethodHandles::is_signature_polymorphic_name(holder->get_Klass(), name_sym))) { |
twisti@4021 | 747 | // Short-circuit lookups for JSR 292-related call sites. |
twisti@4021 | 748 | // That is, do not rely only on name-based lookups, because they may fail |
twisti@4021 | 749 | // if the names are not resolvable in the boot class loader (7056328). |
twisti@4021 | 750 | switch (bc) { |
twisti@4021 | 751 | case Bytecodes::_invokevirtual: |
twisti@4021 | 752 | case Bytecodes::_invokeinterface: |
twisti@4021 | 753 | case Bytecodes::_invokespecial: |
twisti@4021 | 754 | case Bytecodes::_invokestatic: |
twisti@4021 | 755 | { |
coleenp@4037 | 756 | Method* m = ConstantPool::method_at_if_loaded(cpool, index); |
twisti@4021 | 757 | if (m != NULL) { |
coleenp@4037 | 758 | return get_method(m); |
twisti@4021 | 759 | } |
twisti@4021 | 760 | } |
twisti@4021 | 761 | break; |
twisti@4021 | 762 | } |
twisti@4021 | 763 | } |
twisti@4021 | 764 | |
twisti@4021 | 765 | if (holder_is_accessible) { // Our declared holder is loaded. |
coleenp@4037 | 766 | InstanceKlass* lookup = declared_holder->get_instanceKlass(); |
coleenp@4037 | 767 | Method* m = lookup_method(accessor->get_instanceKlass(), lookup, name_sym, sig_sym, bc); |
twisti@4021 | 768 | if (m != NULL && |
twisti@4021 | 769 | (bc == Bytecodes::_invokestatic |
coleenp@4251 | 770 | ? m->method_holder()->is_not_initialized() |
coleenp@4251 | 771 | : !m->method_holder()->is_loaded())) { |
twisti@4021 | 772 | m = NULL; |
twisti@4021 | 773 | } |
minqi@4267 | 774 | #ifdef ASSERT |
minqi@4267 | 775 | if (m != NULL && ReplayCompiles && !ciReplay::is_loaded(m)) { |
minqi@4267 | 776 | m = NULL; |
minqi@4267 | 777 | } |
minqi@4267 | 778 | #endif |
twisti@4021 | 779 | if (m != NULL) { |
twisti@4021 | 780 | // We found the method. |
coleenp@4037 | 781 | return get_method(m); |
twisti@4021 | 782 | } |
twisti@4021 | 783 | } |
twisti@4021 | 784 | |
twisti@4021 | 785 | // Either the declared holder was not loaded, or the method could |
twisti@4021 | 786 | // not be found. Create a dummy ciMethod to represent the failed |
twisti@4021 | 787 | // lookup. |
twisti@4021 | 788 | ciSymbol* name = get_symbol(name_sym); |
twisti@4021 | 789 | ciSymbol* signature = get_symbol(sig_sym); |
twisti@4021 | 790 | return get_unloaded_method(declared_holder, name, signature, accessor); |
twisti@1572 | 791 | } |
twisti@1572 | 792 | } |
twisti@1572 | 793 | |
twisti@1572 | 794 | |
twisti@1572 | 795 | // ------------------------------------------------------------------ |
duke@435 | 796 | // ciEnv::get_instance_klass_for_declared_method_holder |
duke@435 | 797 | ciInstanceKlass* ciEnv::get_instance_klass_for_declared_method_holder(ciKlass* method_holder) { |
duke@435 | 798 | // For the case of <array>.clone(), the method holder can be a ciArrayKlass |
duke@435 | 799 | // instead of a ciInstanceKlass. For that case simply pretend that the |
duke@435 | 800 | // declared holder is Object.clone since that's where the call will bottom out. |
duke@435 | 801 | // A more correct fix would trickle out through many interfaces in CI, |
duke@435 | 802 | // requiring ciInstanceKlass* to become ciKlass* and many more places would |
duke@435 | 803 | // require checks to make sure the expected type was found. Given that this |
duke@435 | 804 | // only occurs for clone() the more extensive fix seems like overkill so |
duke@435 | 805 | // instead we simply smear the array type into Object. |
morris@4777 | 806 | guarantee(method_holder != NULL, "no method holder"); |
duke@435 | 807 | if (method_holder->is_instance_klass()) { |
duke@435 | 808 | return method_holder->as_instance_klass(); |
duke@435 | 809 | } else if (method_holder->is_array_klass()) { |
duke@435 | 810 | return current()->Object_klass(); |
duke@435 | 811 | } else { |
duke@435 | 812 | ShouldNotReachHere(); |
duke@435 | 813 | } |
duke@435 | 814 | return NULL; |
duke@435 | 815 | } |
duke@435 | 816 | |
duke@435 | 817 | |
duke@435 | 818 | // ------------------------------------------------------------------ |
duke@435 | 819 | // ciEnv::get_method_by_index |
twisti@1573 | 820 | ciMethod* ciEnv::get_method_by_index(constantPoolHandle cpool, |
twisti@1573 | 821 | int index, Bytecodes::Code bc, |
twisti@1573 | 822 | ciInstanceKlass* accessor) { |
twisti@4021 | 823 | GUARDED_VM_ENTRY(return get_method_by_index_impl(cpool, index, bc, accessor);) |
duke@435 | 824 | } |
duke@435 | 825 | |
twisti@1572 | 826 | |
duke@435 | 827 | // ------------------------------------------------------------------ |
duke@435 | 828 | // ciEnv::name_buffer |
duke@435 | 829 | char *ciEnv::name_buffer(int req_len) { |
duke@435 | 830 | if (_name_buffer_len < req_len) { |
duke@435 | 831 | if (_name_buffer == NULL) { |
duke@435 | 832 | _name_buffer = (char*)arena()->Amalloc(sizeof(char)*req_len); |
duke@435 | 833 | _name_buffer_len = req_len; |
duke@435 | 834 | } else { |
duke@435 | 835 | _name_buffer = |
duke@435 | 836 | (char*)arena()->Arealloc(_name_buffer, _name_buffer_len, req_len); |
duke@435 | 837 | _name_buffer_len = req_len; |
duke@435 | 838 | } |
duke@435 | 839 | } |
duke@435 | 840 | return _name_buffer; |
duke@435 | 841 | } |
duke@435 | 842 | |
duke@435 | 843 | // ------------------------------------------------------------------ |
duke@435 | 844 | // ciEnv::is_in_vm |
duke@435 | 845 | bool ciEnv::is_in_vm() { |
duke@435 | 846 | return JavaThread::current()->thread_state() == _thread_in_vm; |
duke@435 | 847 | } |
duke@435 | 848 | |
duke@435 | 849 | bool ciEnv::system_dictionary_modification_counter_changed() { |
duke@435 | 850 | return _system_dictionary_modification_counter != SystemDictionary::number_of_modifications(); |
duke@435 | 851 | } |
duke@435 | 852 | |
duke@435 | 853 | // ------------------------------------------------------------------ |
twisti@3094 | 854 | // ciEnv::validate_compile_task_dependencies |
twisti@3094 | 855 | // |
twisti@3094 | 856 | // Check for changes during compilation (e.g. class loads, evolution, |
twisti@3094 | 857 | // breakpoints, call site invalidation). |
twisti@3094 | 858 | void ciEnv::validate_compile_task_dependencies(ciMethod* target) { |
duke@435 | 859 | if (failing()) return; // no need for further checks |
duke@435 | 860 | |
twisti@3094 | 861 | // First, check non-klass dependencies as we might return early and |
twisti@3094 | 862 | // not check klass dependencies if the system dictionary |
twisti@3094 | 863 | // modification counter hasn't changed (see below). |
twisti@3094 | 864 | for (Dependencies::DepStream deps(dependencies()); deps.next(); ) { |
twisti@3094 | 865 | if (deps.is_klass_type()) continue; // skip klass dependencies |
coleenp@4037 | 866 | Klass* witness = deps.check_dependency(); |
twisti@3094 | 867 | if (witness != NULL) { |
twisti@3094 | 868 | record_failure("invalid non-klass dependency"); |
twisti@3094 | 869 | return; |
twisti@3094 | 870 | } |
twisti@3094 | 871 | } |
duke@435 | 872 | |
twisti@3094 | 873 | // Klass dependencies must be checked when the system dictionary |
twisti@3094 | 874 | // changes. If logging is enabled all violated dependences will be |
twisti@3094 | 875 | // recorded in the log. In debug mode check dependencies even if |
twisti@3094 | 876 | // the system dictionary hasn't changed to verify that no invalid |
twisti@3094 | 877 | // dependencies were inserted. Any violated dependences in this |
twisti@3094 | 878 | // case are dumped to the tty. |
duke@435 | 879 | bool counter_changed = system_dictionary_modification_counter_changed(); |
duke@435 | 880 | |
never@3155 | 881 | bool verify_deps = trueInDebug; |
never@3155 | 882 | if (!counter_changed && !verify_deps) return; |
never@3155 | 883 | |
twisti@3094 | 884 | int klass_violations = 0; |
duke@435 | 885 | for (Dependencies::DepStream deps(dependencies()); deps.next(); ) { |
twisti@3094 | 886 | if (!deps.is_klass_type()) continue; // skip non-klass dependencies |
coleenp@4037 | 887 | Klass* witness = deps.check_dependency(); |
duke@435 | 888 | if (witness != NULL) { |
twisti@3094 | 889 | klass_violations++; |
never@3155 | 890 | if (!counter_changed) { |
never@3155 | 891 | // Dependence failed but counter didn't change. Log a message |
never@3155 | 892 | // describing what failed and allow the assert at the end to |
never@3155 | 893 | // trigger. |
never@3155 | 894 | deps.print_dependency(witness); |
never@3155 | 895 | } else if (xtty == NULL) { |
never@3155 | 896 | // If we're not logging then a single violation is sufficient, |
never@3155 | 897 | // otherwise we want to log all the dependences which were |
never@3155 | 898 | // violated. |
never@3155 | 899 | break; |
never@3155 | 900 | } |
duke@435 | 901 | } |
duke@435 | 902 | } |
duke@435 | 903 | |
twisti@3094 | 904 | if (klass_violations != 0) { |
never@3155 | 905 | #ifdef ASSERT |
never@3155 | 906 | if (!counter_changed && !PrintCompilation) { |
never@3155 | 907 | // Print out the compile task that failed |
never@3155 | 908 | _task->print_line(); |
never@3155 | 909 | } |
never@3155 | 910 | #endif |
duke@435 | 911 | assert(counter_changed, "failed dependencies, but counter didn't change"); |
duke@435 | 912 | record_failure("concurrent class loading"); |
duke@435 | 913 | } |
duke@435 | 914 | } |
duke@435 | 915 | |
duke@435 | 916 | // ------------------------------------------------------------------ |
duke@435 | 917 | // ciEnv::register_method |
duke@435 | 918 | void ciEnv::register_method(ciMethod* target, |
duke@435 | 919 | int entry_bci, |
duke@435 | 920 | CodeOffsets* offsets, |
duke@435 | 921 | int orig_pc_offset, |
duke@435 | 922 | CodeBuffer* code_buffer, |
duke@435 | 923 | int frame_words, |
duke@435 | 924 | OopMapSet* oop_map_set, |
duke@435 | 925 | ExceptionHandlerTable* handler_table, |
duke@435 | 926 | ImplicitExceptionTable* inc_table, |
duke@435 | 927 | AbstractCompiler* compiler, |
duke@435 | 928 | int comp_level, |
kvn@4103 | 929 | bool has_unsafe_access, |
kvn@4103 | 930 | bool has_wide_vectors) { |
duke@435 | 931 | VM_ENTRY_MARK; |
duke@435 | 932 | nmethod* nm = NULL; |
duke@435 | 933 | { |
duke@435 | 934 | // To prevent compile queue updates. |
duke@435 | 935 | MutexLocker locker(MethodCompileQueue_lock, THREAD); |
duke@435 | 936 | |
duke@435 | 937 | // Prevent SystemDictionary::add_to_hierarchy from running |
duke@435 | 938 | // and invalidating our dependencies until we install this method. |
duke@435 | 939 | MutexLocker ml(Compile_lock); |
duke@435 | 940 | |
kvn@1215 | 941 | // Change in Jvmti state may invalidate compilation. |
kvn@1215 | 942 | if (!failing() && |
kvn@1215 | 943 | ( (!jvmti_can_hotswap_or_post_breakpoint() && |
kvn@1215 | 944 | JvmtiExport::can_hotswap_or_post_breakpoint()) || |
kvn@1215 | 945 | (!jvmti_can_access_local_variables() && |
kvn@1215 | 946 | JvmtiExport::can_access_local_variables()) || |
dcubed@1648 | 947 | (!jvmti_can_post_on_exceptions() && |
dcubed@1648 | 948 | JvmtiExport::can_post_on_exceptions()) )) { |
kvn@1215 | 949 | record_failure("Jvmti state change invalidated dependencies"); |
duke@435 | 950 | } |
duke@435 | 951 | |
kvn@1215 | 952 | // Change in DTrace flags may invalidate compilation. |
kvn@1215 | 953 | if (!failing() && |
kvn@1215 | 954 | ( (!dtrace_extended_probes() && ExtendedDTraceProbes) || |
kvn@1215 | 955 | (!dtrace_method_probes() && DTraceMethodProbes) || |
kvn@1215 | 956 | (!dtrace_alloc_probes() && DTraceAllocProbes) )) { |
kvn@1215 | 957 | record_failure("DTrace flags change invalidated dependencies"); |
kvn@1215 | 958 | } |
duke@435 | 959 | |
kvn@1215 | 960 | if (!failing()) { |
kvn@1215 | 961 | if (log() != NULL) { |
kvn@1215 | 962 | // Log the dependencies which this compilation declares. |
kvn@1215 | 963 | dependencies()->log_all_dependencies(); |
kvn@1215 | 964 | } |
kvn@1215 | 965 | |
kvn@1215 | 966 | // Encode the dependencies now, so we can check them right away. |
kvn@1215 | 967 | dependencies()->encode_content_bytes(); |
kvn@1215 | 968 | |
twisti@3094 | 969 | // Check for {class loads, evolution, breakpoints, ...} during compilation |
twisti@3094 | 970 | validate_compile_task_dependencies(target); |
kvn@1215 | 971 | } |
duke@435 | 972 | |
coleenp@4037 | 973 | methodHandle method(THREAD, target->get_Method()); |
duke@435 | 974 | |
duke@435 | 975 | if (failing()) { |
duke@435 | 976 | // While not a true deoptimization, it is a preemptive decompile. |
coleenp@4037 | 977 | MethodData* mdo = method()->method_data(); |
duke@435 | 978 | if (mdo != NULL) { |
duke@435 | 979 | mdo->inc_decompile_count(); |
duke@435 | 980 | } |
duke@435 | 981 | |
duke@435 | 982 | // All buffers in the CodeBuffer are allocated in the CodeCache. |
duke@435 | 983 | // If the code buffer is created on each compile attempt |
duke@435 | 984 | // as in C2, then it must be freed. |
duke@435 | 985 | code_buffer->free_blob(); |
duke@435 | 986 | return; |
duke@435 | 987 | } |
duke@435 | 988 | |
duke@435 | 989 | assert(offsets->value(CodeOffsets::Deopt) != -1, "must have deopt entry"); |
duke@435 | 990 | assert(offsets->value(CodeOffsets::Exceptions) != -1, "must have exception entry"); |
duke@435 | 991 | |
duke@435 | 992 | nm = nmethod::new_nmethod(method, |
duke@435 | 993 | compile_id(), |
duke@435 | 994 | entry_bci, |
duke@435 | 995 | offsets, |
duke@435 | 996 | orig_pc_offset, |
duke@435 | 997 | debug_info(), dependencies(), code_buffer, |
duke@435 | 998 | frame_words, oop_map_set, |
duke@435 | 999 | handler_table, inc_table, |
duke@435 | 1000 | compiler, comp_level); |
duke@435 | 1001 | |
duke@435 | 1002 | // Free codeBlobs |
duke@435 | 1003 | code_buffer->free_blob(); |
duke@435 | 1004 | |
duke@435 | 1005 | // stress test 6243940 by immediately making the method |
duke@435 | 1006 | // non-entrant behind the system's back. This has serious |
duke@435 | 1007 | // side effects on the code cache and is not meant for |
duke@435 | 1008 | // general stress testing |
duke@435 | 1009 | if (nm != NULL && StressNonEntrant) { |
duke@435 | 1010 | MutexLockerEx pl(Patching_lock, Mutex::_no_safepoint_check_flag); |
duke@435 | 1011 | NativeJump::patch_verified_entry(nm->entry_point(), nm->verified_entry_point(), |
duke@435 | 1012 | SharedRuntime::get_handle_wrong_method_stub()); |
duke@435 | 1013 | } |
duke@435 | 1014 | |
duke@435 | 1015 | if (nm == NULL) { |
duke@435 | 1016 | // The CodeCache is full. Print out warning and disable compilation. |
duke@435 | 1017 | record_failure("code cache is full"); |
kvn@1637 | 1018 | { |
kvn@1637 | 1019 | MutexUnlocker ml(Compile_lock); |
kvn@1637 | 1020 | MutexUnlocker locker(MethodCompileQueue_lock); |
kvn@1637 | 1021 | CompileBroker::handle_full_code_cache(); |
duke@435 | 1022 | } |
duke@435 | 1023 | } else { |
duke@435 | 1024 | nm->set_has_unsafe_access(has_unsafe_access); |
kvn@4103 | 1025 | nm->set_has_wide_vectors(has_wide_vectors); |
duke@435 | 1026 | |
duke@435 | 1027 | // Record successful registration. |
duke@435 | 1028 | // (Put nm into the task handle *before* publishing to the Java heap.) |
duke@435 | 1029 | if (task() != NULL) task()->set_code(nm); |
duke@435 | 1030 | |
duke@435 | 1031 | if (entry_bci == InvocationEntryBci) { |
iveresov@2138 | 1032 | if (TieredCompilation) { |
iveresov@2138 | 1033 | // If there is an old version we're done with it |
iveresov@2138 | 1034 | nmethod* old = method->code(); |
iveresov@2138 | 1035 | if (TraceMethodReplacement && old != NULL) { |
iveresov@2138 | 1036 | ResourceMark rm; |
iveresov@2138 | 1037 | char *method_name = method->name_and_sig_as_C_string(); |
iveresov@2138 | 1038 | tty->print_cr("Replacing method %s", method_name); |
iveresov@2138 | 1039 | } |
iveresov@2138 | 1040 | if (old != NULL ) { |
iveresov@2138 | 1041 | old->make_not_entrant(); |
iveresov@2138 | 1042 | } |
duke@435 | 1043 | } |
duke@435 | 1044 | if (TraceNMethodInstalls ) { |
duke@435 | 1045 | ResourceMark rm; |
duke@435 | 1046 | char *method_name = method->name_and_sig_as_C_string(); |
duke@435 | 1047 | ttyLocker ttyl; |
duke@435 | 1048 | tty->print_cr("Installing method (%d) %s ", |
duke@435 | 1049 | comp_level, |
duke@435 | 1050 | method_name); |
duke@435 | 1051 | } |
duke@435 | 1052 | // Allow the code to be executed |
duke@435 | 1053 | method->set_code(method, nm); |
duke@435 | 1054 | } else { |
duke@435 | 1055 | if (TraceNMethodInstalls ) { |
duke@435 | 1056 | ResourceMark rm; |
duke@435 | 1057 | char *method_name = method->name_and_sig_as_C_string(); |
duke@435 | 1058 | ttyLocker ttyl; |
duke@435 | 1059 | tty->print_cr("Installing osr method (%d) %s @ %d", |
duke@435 | 1060 | comp_level, |
duke@435 | 1061 | method_name, |
duke@435 | 1062 | entry_bci); |
duke@435 | 1063 | } |
coleenp@4251 | 1064 | method->method_holder()->add_osr_nmethod(nm); |
duke@435 | 1065 | |
duke@435 | 1066 | } |
duke@435 | 1067 | } |
duke@435 | 1068 | } |
duke@435 | 1069 | // JVMTI -- compiled method notification (must be done outside lock) |
duke@435 | 1070 | if (nm != NULL) { |
duke@435 | 1071 | nm->post_compiled_method_load_event(); |
duke@435 | 1072 | } |
duke@435 | 1073 | |
duke@435 | 1074 | } |
duke@435 | 1075 | |
duke@435 | 1076 | |
duke@435 | 1077 | // ------------------------------------------------------------------ |
duke@435 | 1078 | // ciEnv::find_system_klass |
duke@435 | 1079 | ciKlass* ciEnv::find_system_klass(ciSymbol* klass_name) { |
duke@435 | 1080 | VM_ENTRY_MARK; |
jrose@2982 | 1081 | return get_klass_by_name_impl(NULL, constantPoolHandle(), klass_name, false); |
duke@435 | 1082 | } |
duke@435 | 1083 | |
duke@435 | 1084 | // ------------------------------------------------------------------ |
duke@435 | 1085 | // ciEnv::comp_level |
duke@435 | 1086 | int ciEnv::comp_level() { |
iveresov@2138 | 1087 | if (task() == NULL) return CompLevel_highest_tier; |
duke@435 | 1088 | return task()->comp_level(); |
duke@435 | 1089 | } |
duke@435 | 1090 | |
duke@435 | 1091 | // ------------------------------------------------------------------ |
duke@435 | 1092 | // ciEnv::compile_id |
duke@435 | 1093 | uint ciEnv::compile_id() { |
duke@435 | 1094 | if (task() == NULL) return 0; |
duke@435 | 1095 | return task()->compile_id(); |
duke@435 | 1096 | } |
duke@435 | 1097 | |
duke@435 | 1098 | // ------------------------------------------------------------------ |
duke@435 | 1099 | // ciEnv::notice_inlined_method() |
duke@435 | 1100 | void ciEnv::notice_inlined_method(ciMethod* method) { |
twisti@3969 | 1101 | _num_inlined_bytecodes += method->code_size_for_inlining(); |
duke@435 | 1102 | } |
duke@435 | 1103 | |
duke@435 | 1104 | // ------------------------------------------------------------------ |
duke@435 | 1105 | // ciEnv::num_inlined_bytecodes() |
duke@435 | 1106 | int ciEnv::num_inlined_bytecodes() const { |
duke@435 | 1107 | return _num_inlined_bytecodes; |
duke@435 | 1108 | } |
duke@435 | 1109 | |
duke@435 | 1110 | // ------------------------------------------------------------------ |
duke@435 | 1111 | // ciEnv::record_failure() |
duke@435 | 1112 | void ciEnv::record_failure(const char* reason) { |
duke@435 | 1113 | if (log() != NULL) { |
duke@435 | 1114 | log()->elem("failure reason='%s'", reason); |
duke@435 | 1115 | } |
duke@435 | 1116 | if (_failure_reason == NULL) { |
duke@435 | 1117 | // Record the first failure reason. |
duke@435 | 1118 | _failure_reason = reason; |
duke@435 | 1119 | } |
duke@435 | 1120 | } |
duke@435 | 1121 | |
duke@435 | 1122 | // ------------------------------------------------------------------ |
duke@435 | 1123 | // ciEnv::record_method_not_compilable() |
duke@435 | 1124 | void ciEnv::record_method_not_compilable(const char* reason, bool all_tiers) { |
duke@435 | 1125 | int new_compilable = |
duke@435 | 1126 | all_tiers ? MethodCompilable_never : MethodCompilable_not_at_tier ; |
duke@435 | 1127 | |
duke@435 | 1128 | // Only note transitions to a worse state |
duke@435 | 1129 | if (new_compilable > _compilable) { |
duke@435 | 1130 | if (log() != NULL) { |
duke@435 | 1131 | if (all_tiers) { |
duke@435 | 1132 | log()->elem("method_not_compilable"); |
duke@435 | 1133 | } else { |
vlivanov@4154 | 1134 | log()->elem("method_not_compilable_at_tier level='%d'", |
vlivanov@4154 | 1135 | current()->task()->comp_level()); |
duke@435 | 1136 | } |
duke@435 | 1137 | } |
duke@435 | 1138 | _compilable = new_compilable; |
duke@435 | 1139 | |
duke@435 | 1140 | // Reset failure reason; this one is more important. |
duke@435 | 1141 | _failure_reason = NULL; |
duke@435 | 1142 | record_failure(reason); |
duke@435 | 1143 | } |
duke@435 | 1144 | } |
duke@435 | 1145 | |
duke@435 | 1146 | // ------------------------------------------------------------------ |
duke@435 | 1147 | // ciEnv::record_out_of_memory_failure() |
duke@435 | 1148 | void ciEnv::record_out_of_memory_failure() { |
duke@435 | 1149 | // If memory is low, we stop compiling methods. |
duke@435 | 1150 | record_method_not_compilable("out of memory"); |
duke@435 | 1151 | } |
minqi@4267 | 1152 | |
vlivanov@5027 | 1153 | void ciEnv::dump_replay_data(outputStream* out) { |
minqi@4267 | 1154 | VM_ENTRY_MARK; |
minqi@4267 | 1155 | MutexLocker ml(Compile_lock); |
vlivanov@4531 | 1156 | ResourceMark rm; |
minqi@4267 | 1157 | #if INCLUDE_JVMTI |
minqi@4267 | 1158 | out->print_cr("JvmtiExport can_access_local_variables %d", _jvmti_can_access_local_variables); |
minqi@4267 | 1159 | out->print_cr("JvmtiExport can_hotswap_or_post_breakpoint %d", _jvmti_can_hotswap_or_post_breakpoint); |
minqi@4267 | 1160 | out->print_cr("JvmtiExport can_post_on_exceptions %d", _jvmti_can_post_on_exceptions); |
minqi@4267 | 1161 | #endif // INCLUDE_JVMTI |
minqi@4267 | 1162 | |
minqi@4267 | 1163 | GrowableArray<ciMetadata*>* objects = _factory->get_ci_metadata(); |
minqi@4267 | 1164 | out->print_cr("# %d ciObject found", objects->length()); |
minqi@4267 | 1165 | for (int i = 0; i < objects->length(); i++) { |
minqi@4267 | 1166 | objects->at(i)->dump_replay_data(out); |
minqi@4267 | 1167 | } |
iignatyev@5029 | 1168 | CompileTask* task = this->task(); |
iignatyev@5029 | 1169 | Method* method = task->method(); |
iignatyev@5029 | 1170 | int entry_bci = task->osr_bci(); |
iignatyev@5029 | 1171 | int comp_level = task->comp_level(); |
minqi@4267 | 1172 | // Klass holder = method->method_holder(); |
iignatyev@5029 | 1173 | out->print_cr("compile %s %s %s %d %d", |
minqi@4267 | 1174 | method->klass_name()->as_quoted_ascii(), |
minqi@4267 | 1175 | method->name()->as_quoted_ascii(), |
minqi@4267 | 1176 | method->signature()->as_quoted_ascii(), |
iignatyev@5029 | 1177 | entry_bci, comp_level); |
minqi@4267 | 1178 | out->flush(); |
minqi@4267 | 1179 | } |