1 /* 2 * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #include "precompiled.hpp" 26 #include "classfile/systemDictionary.hpp" 27 #include "classfile/vmSymbols.hpp" 28 #include "code/codeCache.hpp" 29 #include "code/compiledIC.hpp" 30 #include "code/icBuffer.hpp" 31 #include "code/nmethod.hpp" 32 #include "code/pcDesc.hpp" 33 #include "code/scopeDesc.hpp" 34 #include "code/vtableStubs.hpp" 35 #include "compiler/compileBroker.hpp" 36 #include "compiler/oopMap.hpp" 37 #include "gc/g1/g1SATBCardTableModRefBS.hpp" 38 #include "gc/g1/heapRegion.hpp" 39 #include "gc/shared/barrierSet.hpp" 40 #include "gc/shared/collectedHeap.hpp" 41 #include "gc/shared/gcLocker.inline.hpp" 42 #include "interpreter/bytecode.hpp" 43 #include "interpreter/interpreter.hpp" 44 #include "interpreter/linkResolver.hpp" 45 #include "memory/oopFactory.hpp" 46 #include "oops/objArrayKlass.hpp" 47 #include "oops/oop.inline.hpp" 48 #include "opto/ad.hpp" 49 #include "opto/addnode.hpp" 50 #include "opto/callnode.hpp" 51 #include "opto/cfgnode.hpp" 52 #include "opto/graphKit.hpp" 53 #include "opto/machnode.hpp" 54 #include "opto/matcher.hpp" 55 #include "opto/memnode.hpp" 56 #include "opto/mulnode.hpp" 57 #include "opto/runtime.hpp" 58 #include "opto/subnode.hpp" 59 #include "runtime/atomic.inline.hpp" 60 #include "runtime/fprofiler.hpp" 61 #include "runtime/handles.inline.hpp" 62 #include "runtime/interfaceSupport.hpp" 63 #include "runtime/javaCalls.hpp" 64 #include "runtime/sharedRuntime.hpp" 65 #include "runtime/signature.hpp" 66 #include "runtime/threadCritical.hpp" 67 #include "runtime/vframe.hpp" 68 #include "runtime/vframeArray.hpp" 69 #include "runtime/vframe_hp.hpp" 70 #include "utilities/copy.hpp" 71 #include "utilities/preserveException.hpp" 72 73 74 // For debugging purposes: 75 // To force FullGCALot inside a runtime function, add the following two lines 76 // 77 // Universe::release_fullgc_alot_dummy(); 78 // MarkSweep::invoke(0, "Debugging"); 79 // 80 // At command line specify the parameters: -XX:+FullGCALot -XX:FullGCALotStart=100000000 81 82 83 84 85 // Compiled code entry points 86 address OptoRuntime::_new_instance_Java = NULL; 87 address OptoRuntime::_new_array_Java = NULL; 88 address OptoRuntime::_new_array_nozero_Java = NULL; 89 address OptoRuntime::_multianewarray2_Java = NULL; 90 address OptoRuntime::_multianewarray3_Java = NULL; 91 address OptoRuntime::_multianewarray4_Java = NULL; 92 address OptoRuntime::_multianewarray5_Java = NULL; 93 address OptoRuntime::_multianewarrayN_Java = NULL; 94 address OptoRuntime::_g1_wb_pre_Java = NULL; 95 address OptoRuntime::_g1_wb_post_Java = NULL; 96 address OptoRuntime::_vtable_must_compile_Java = NULL; 97 address OptoRuntime::_complete_monitor_locking_Java = NULL; 98 address OptoRuntime::_monitor_notify_Java = NULL; 99 address OptoRuntime::_monitor_notifyAll_Java = NULL; 100 address OptoRuntime::_rethrow_Java = NULL; 101 102 address OptoRuntime::_slow_arraycopy_Java = NULL; 103 address OptoRuntime::_register_finalizer_Java = NULL; 104 105 ExceptionBlob* OptoRuntime::_exception_blob; 106 107 // This should be called in an assertion at the start of OptoRuntime routines 108 // which are entered from compiled code (all of them) 109 #ifdef ASSERT 110 static bool check_compiled_frame(JavaThread* thread) { 111 assert(thread->last_frame().is_runtime_frame(), "cannot call runtime directly from compiled code"); 112 RegisterMap map(thread, false); 113 frame caller = thread->last_frame().sender(&map); 114 assert(caller.is_compiled_frame(), "not being called from compiled like code"); 115 return true; 116 } 117 #endif // ASSERT 118 119 120 #define gen(env, var, type_func_gen, c_func, fancy_jump, pass_tls, save_arg_regs, return_pc) \ 121 var = generate_stub(env, type_func_gen, CAST_FROM_FN_PTR(address, c_func), #var, fancy_jump, pass_tls, save_arg_regs, return_pc); \ 122 if (var == NULL) { return false; } 123 124 bool OptoRuntime::generate(ciEnv* env) { 125 126 generate_exception_blob(); 127 128 // Note: tls: Means fetching the return oop out of the thread-local storage 129 // 130 // variable/name type-function-gen , runtime method ,fncy_jp, tls,save_args,retpc 131 // ------------------------------------------------------------------------------------------------------------------------------- 132 gen(env, _new_instance_Java , new_instance_Type , new_instance_C , 0 , true , false, false); 133 gen(env, _new_array_Java , new_array_Type , new_array_C , 0 , true , false, false); 134 gen(env, _new_array_nozero_Java , new_array_Type , new_array_nozero_C , 0 , true , false, false); 135 gen(env, _multianewarray2_Java , multianewarray2_Type , multianewarray2_C , 0 , true , false, false); 136 gen(env, _multianewarray3_Java , multianewarray3_Type , multianewarray3_C , 0 , true , false, false); 137 gen(env, _multianewarray4_Java , multianewarray4_Type , multianewarray4_C , 0 , true , false, false); 138 gen(env, _multianewarray5_Java , multianewarray5_Type , multianewarray5_C , 0 , true , false, false); 139 gen(env, _multianewarrayN_Java , multianewarrayN_Type , multianewarrayN_C , 0 , true , false, false); 140 gen(env, _g1_wb_pre_Java , g1_wb_pre_Type , SharedRuntime::g1_wb_pre , 0 , false, false, false); 141 gen(env, _g1_wb_post_Java , g1_wb_post_Type , SharedRuntime::g1_wb_post , 0 , false, false, false); 142 gen(env, _complete_monitor_locking_Java , complete_monitor_enter_Type , SharedRuntime::complete_monitor_locking_C, 0, false, false, false); 143 gen(env, _monitor_notify_Java , monitor_notify_Type , monitor_notify_C , 0 , false, false, false); 144 gen(env, _monitor_notifyAll_Java , monitor_notify_Type , monitor_notifyAll_C , 0 , false, false, false); 145 gen(env, _rethrow_Java , rethrow_Type , rethrow_C , 2 , true , false, true ); 146 147 gen(env, _slow_arraycopy_Java , slow_arraycopy_Type , SharedRuntime::slow_arraycopy_C , 0 , false, false, false); 148 gen(env, _register_finalizer_Java , register_finalizer_Type , register_finalizer , 0 , false, false, false); 149 150 return true; 151 } 152 153 #undef gen 154 155 156 // Helper method to do generation of RunTimeStub's 157 address OptoRuntime::generate_stub( ciEnv* env, 158 TypeFunc_generator gen, address C_function, 159 const char *name, int is_fancy_jump, 160 bool pass_tls, 161 bool save_argument_registers, 162 bool return_pc ) { 163 ResourceMark rm; 164 Compile C( env, gen, C_function, name, is_fancy_jump, pass_tls, save_argument_registers, return_pc ); 165 return C.stub_entry_point(); 166 } 167 168 const char* OptoRuntime::stub_name(address entry) { 169 #ifndef PRODUCT 170 CodeBlob* cb = CodeCache::find_blob(entry); 171 RuntimeStub* rs =(RuntimeStub *)cb; 172 assert(rs != NULL && rs->is_runtime_stub(), "not a runtime stub"); 173 return rs->name(); 174 #else 175 // Fast implementation for product mode (maybe it should be inlined too) 176 return "runtime stub"; 177 #endif 178 } 179 180 181 //============================================================================= 182 // Opto compiler runtime routines 183 //============================================================================= 184 185 186 //=============================allocation====================================== 187 // We failed the fast-path allocation. Now we need to do a scavenge or GC 188 // and try allocation again. 189 190 void OptoRuntime::new_store_pre_barrier(JavaThread* thread) { 191 // After any safepoint, just before going back to compiled code, 192 // we inform the GC that we will be doing initializing writes to 193 // this object in the future without emitting card-marks, so 194 // GC may take any compensating steps. 195 // NOTE: Keep this code consistent with GraphKit::store_barrier. 196 197 oop new_obj = thread->vm_result(); 198 if (new_obj == NULL) return; 199 200 assert(Universe::heap()->can_elide_tlab_store_barriers(), 201 "compiler must check this first"); 202 // GC may decide to give back a safer copy of new_obj. 203 new_obj = Universe::heap()->new_store_pre_barrier(thread, new_obj); 204 thread->set_vm_result(new_obj); 205 } 206 207 // object allocation 208 JRT_BLOCK_ENTRY(void, OptoRuntime::new_instance_C(Klass* klass, JavaThread* thread)) 209 JRT_BLOCK; 210 #ifndef PRODUCT 211 SharedRuntime::_new_instance_ctr++; // new instance requires GC 212 #endif 213 assert(check_compiled_frame(thread), "incorrect caller"); 214 215 // These checks are cheap to make and support reflective allocation. 216 int lh = klass->layout_helper(); 217 if (Klass::layout_helper_needs_slow_path(lh) 218 || !InstanceKlass::cast(klass)->is_initialized()) { 219 KlassHandle kh(THREAD, klass); 220 kh->check_valid_for_instantiation(false, THREAD); 221 if (!HAS_PENDING_EXCEPTION) { 222 InstanceKlass::cast(kh())->initialize(THREAD); 223 } 224 if (!HAS_PENDING_EXCEPTION) { 225 klass = kh(); 226 } else { 227 klass = NULL; 228 } 229 } 230 231 if (klass != NULL) { 232 // Scavenge and allocate an instance. 233 oop result = InstanceKlass::cast(klass)->allocate_instance(THREAD); 234 thread->set_vm_result(result); 235 236 // Pass oops back through thread local storage. Our apparent type to Java 237 // is that we return an oop, but we can block on exit from this routine and 238 // a GC can trash the oop in C's return register. The generated stub will 239 // fetch the oop from TLS after any possible GC. 240 } 241 242 deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION); 243 JRT_BLOCK_END; 244 245 if (GraphKit::use_ReduceInitialCardMarks()) { 246 // inform GC that we won't do card marks for initializing writes. 247 new_store_pre_barrier(thread); 248 } 249 JRT_END 250 251 252 // array allocation 253 JRT_BLOCK_ENTRY(void, OptoRuntime::new_array_C(Klass* array_type, int len, JavaThread *thread)) 254 JRT_BLOCK; 255 #ifndef PRODUCT 256 SharedRuntime::_new_array_ctr++; // new array requires GC 257 #endif 258 assert(check_compiled_frame(thread), "incorrect caller"); 259 260 // Scavenge and allocate an instance. 261 oop result; 262 263 if (array_type->oop_is_typeArray()) { 264 // The oopFactory likes to work with the element type. 265 // (We could bypass the oopFactory, since it doesn't add much value.) 266 BasicType elem_type = TypeArrayKlass::cast(array_type)->element_type(); 267 result = oopFactory::new_typeArray(elem_type, len, THREAD); 268 } else { 269 // Although the oopFactory likes to work with the elem_type, 270 // the compiler prefers the array_type, since it must already have 271 // that latter value in hand for the fast path. 272 Klass* elem_type = ObjArrayKlass::cast(array_type)->element_klass(); 273 result = oopFactory::new_objArray(elem_type, len, THREAD); 274 } 275 276 // Pass oops back through thread local storage. Our apparent type to Java 277 // is that we return an oop, but we can block on exit from this routine and 278 // a GC can trash the oop in C's return register. The generated stub will 279 // fetch the oop from TLS after any possible GC. 280 deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION); 281 thread->set_vm_result(result); 282 JRT_BLOCK_END; 283 284 if (GraphKit::use_ReduceInitialCardMarks()) { 285 // inform GC that we won't do card marks for initializing writes. 286 new_store_pre_barrier(thread); 287 } 288 JRT_END 289 290 // array allocation without zeroing 291 JRT_BLOCK_ENTRY(void, OptoRuntime::new_array_nozero_C(Klass* array_type, int len, JavaThread *thread)) 292 JRT_BLOCK; 293 #ifndef PRODUCT 294 SharedRuntime::_new_array_ctr++; // new array requires GC 295 #endif 296 assert(check_compiled_frame(thread), "incorrect caller"); 297 298 // Scavenge and allocate an instance. 299 oop result; 300 301 assert(array_type->oop_is_typeArray(), "should be called only for type array"); 302 // The oopFactory likes to work with the element type. 303 BasicType elem_type = TypeArrayKlass::cast(array_type)->element_type(); 304 result = oopFactory::new_typeArray_nozero(elem_type, len, THREAD); 305 306 // Pass oops back through thread local storage. Our apparent type to Java 307 // is that we return an oop, but we can block on exit from this routine and 308 // a GC can trash the oop in C's return register. The generated stub will 309 // fetch the oop from TLS after any possible GC. 310 deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION); 311 thread->set_vm_result(result); 312 JRT_BLOCK_END; 313 314 if (GraphKit::use_ReduceInitialCardMarks()) { 315 // inform GC that we won't do card marks for initializing writes. 316 new_store_pre_barrier(thread); 317 } 318 319 oop result = thread->vm_result(); 320 if ((len > 0) && (result != NULL) && 321 is_deoptimized_caller_frame(thread)) { 322 // Zero array here if the caller is deoptimized. 323 int size = ((typeArrayOop)result)->object_size(); 324 BasicType elem_type = TypeArrayKlass::cast(array_type)->element_type(); 325 const size_t hs = arrayOopDesc::header_size(elem_type); 326 // Align to next 8 bytes to avoid trashing arrays's length. 327 const size_t aligned_hs = align_object_offset(hs); 328 HeapWord* obj = (HeapWord*)result; 329 if (aligned_hs > hs) { 330 Copy::zero_to_words(obj+hs, aligned_hs-hs); 331 } 332 // Optimized zeroing. 333 Copy::fill_to_aligned_words(obj+aligned_hs, size-aligned_hs); 334 } 335 336 JRT_END 337 338 // Note: multianewarray for one dimension is handled inline by GraphKit::new_array. 339 340 // multianewarray for 2 dimensions 341 JRT_ENTRY(void, OptoRuntime::multianewarray2_C(Klass* elem_type, int len1, int len2, JavaThread *thread)) 342 #ifndef PRODUCT 343 SharedRuntime::_multi2_ctr++; // multianewarray for 1 dimension 344 #endif 345 assert(check_compiled_frame(thread), "incorrect caller"); 346 assert(elem_type->is_klass(), "not a class"); 347 jint dims[2]; 348 dims[0] = len1; 349 dims[1] = len2; 350 oop obj = ArrayKlass::cast(elem_type)->multi_allocate(2, dims, THREAD); 351 deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION); 352 thread->set_vm_result(obj); 353 JRT_END 354 355 // multianewarray for 3 dimensions 356 JRT_ENTRY(void, OptoRuntime::multianewarray3_C(Klass* elem_type, int len1, int len2, int len3, JavaThread *thread)) 357 #ifndef PRODUCT 358 SharedRuntime::_multi3_ctr++; // multianewarray for 1 dimension 359 #endif 360 assert(check_compiled_frame(thread), "incorrect caller"); 361 assert(elem_type->is_klass(), "not a class"); 362 jint dims[3]; 363 dims[0] = len1; 364 dims[1] = len2; 365 dims[2] = len3; 366 oop obj = ArrayKlass::cast(elem_type)->multi_allocate(3, dims, THREAD); 367 deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION); 368 thread->set_vm_result(obj); 369 JRT_END 370 371 // multianewarray for 4 dimensions 372 JRT_ENTRY(void, OptoRuntime::multianewarray4_C(Klass* elem_type, int len1, int len2, int len3, int len4, JavaThread *thread)) 373 #ifndef PRODUCT 374 SharedRuntime::_multi4_ctr++; // multianewarray for 1 dimension 375 #endif 376 assert(check_compiled_frame(thread), "incorrect caller"); 377 assert(elem_type->is_klass(), "not a class"); 378 jint dims[4]; 379 dims[0] = len1; 380 dims[1] = len2; 381 dims[2] = len3; 382 dims[3] = len4; 383 oop obj = ArrayKlass::cast(elem_type)->multi_allocate(4, dims, THREAD); 384 deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION); 385 thread->set_vm_result(obj); 386 JRT_END 387 388 // multianewarray for 5 dimensions 389 JRT_ENTRY(void, OptoRuntime::multianewarray5_C(Klass* elem_type, int len1, int len2, int len3, int len4, int len5, JavaThread *thread)) 390 #ifndef PRODUCT 391 SharedRuntime::_multi5_ctr++; // multianewarray for 1 dimension 392 #endif 393 assert(check_compiled_frame(thread), "incorrect caller"); 394 assert(elem_type->is_klass(), "not a class"); 395 jint dims[5]; 396 dims[0] = len1; 397 dims[1] = len2; 398 dims[2] = len3; 399 dims[3] = len4; 400 dims[4] = len5; 401 oop obj = ArrayKlass::cast(elem_type)->multi_allocate(5, dims, THREAD); 402 deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION); 403 thread->set_vm_result(obj); 404 JRT_END 405 406 JRT_ENTRY(void, OptoRuntime::multianewarrayN_C(Klass* elem_type, arrayOopDesc* dims, JavaThread *thread)) 407 assert(check_compiled_frame(thread), "incorrect caller"); 408 assert(elem_type->is_klass(), "not a class"); 409 assert(oop(dims)->is_typeArray(), "not an array"); 410 411 ResourceMark rm; 412 jint len = dims->length(); 413 assert(len > 0, "Dimensions array should contain data"); 414 jint *j_dims = typeArrayOop(dims)->int_at_addr(0); 415 jint *c_dims = NEW_RESOURCE_ARRAY(jint, len); 416 Copy::conjoint_jints_atomic(j_dims, c_dims, len); 417 418 oop obj = ArrayKlass::cast(elem_type)->multi_allocate(len, c_dims, THREAD); 419 deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION); 420 thread->set_vm_result(obj); 421 JRT_END 422 423 JRT_BLOCK_ENTRY(void, OptoRuntime::monitor_notify_C(oopDesc* obj, JavaThread *thread)) 424 425 // Very few notify/notifyAll operations find any threads on the waitset, so 426 // the dominant fast-path is to simply return. 427 // Relatedly, it's critical that notify/notifyAll be fast in order to 428 // reduce lock hold times. 429 if (!SafepointSynchronize::is_synchronizing()) { 430 if (ObjectSynchronizer::quick_notify(obj, thread, false)) { 431 return; 432 } 433 } 434 435 // This is the case the fast-path above isn't provisioned to handle. 436 // The fast-path is designed to handle frequently arising cases in an efficient manner. 437 // (The fast-path is just a degenerate variant of the slow-path). 438 // Perform the dreaded state transition and pass control into the slow-path. 439 JRT_BLOCK; 440 Handle h_obj(THREAD, obj); 441 ObjectSynchronizer::notify(h_obj, CHECK); 442 JRT_BLOCK_END; 443 JRT_END 444 445 JRT_BLOCK_ENTRY(void, OptoRuntime::monitor_notifyAll_C(oopDesc* obj, JavaThread *thread)) 446 447 if (!SafepointSynchronize::is_synchronizing() ) { 448 if (ObjectSynchronizer::quick_notify(obj, thread, true)) { 449 return; 450 } 451 } 452 453 // This is the case the fast-path above isn't provisioned to handle. 454 // The fast-path is designed to handle frequently arising cases in an efficient manner. 455 // (The fast-path is just a degenerate variant of the slow-path). 456 // Perform the dreaded state transition and pass control into the slow-path. 457 JRT_BLOCK; 458 Handle h_obj(THREAD, obj); 459 ObjectSynchronizer::notifyall(h_obj, CHECK); 460 JRT_BLOCK_END; 461 JRT_END 462 463 const TypeFunc *OptoRuntime::new_instance_Type() { 464 // create input type (domain) 465 const Type **fields = TypeTuple::fields(1); 466 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // Klass to be allocated 467 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+1, fields); 468 469 // create result type (range) 470 fields = TypeTuple::fields(1); 471 fields[TypeFunc::Parms+0] = TypeRawPtr::NOTNULL; // Returned oop 472 473 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+1, fields); 474 475 return TypeFunc::make(domain, range); 476 } 477 478 479 const TypeFunc *OptoRuntime::athrow_Type() { 480 // create input type (domain) 481 const Type **fields = TypeTuple::fields(1); 482 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // Klass to be allocated 483 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+1, fields); 484 485 // create result type (range) 486 fields = TypeTuple::fields(0); 487 488 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields); 489 490 return TypeFunc::make(domain, range); 491 } 492 493 494 const TypeFunc *OptoRuntime::new_array_Type() { 495 // create input type (domain) 496 const Type **fields = TypeTuple::fields(2); 497 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // element klass 498 fields[TypeFunc::Parms+1] = TypeInt::INT; // array size 499 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2, fields); 500 501 // create result type (range) 502 fields = TypeTuple::fields(1); 503 fields[TypeFunc::Parms+0] = TypeRawPtr::NOTNULL; // Returned oop 504 505 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+1, fields); 506 507 return TypeFunc::make(domain, range); 508 } 509 510 const TypeFunc *OptoRuntime::multianewarray_Type(int ndim) { 511 // create input type (domain) 512 const int nargs = ndim + 1; 513 const Type **fields = TypeTuple::fields(nargs); 514 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // element klass 515 for( int i = 1; i < nargs; i++ ) 516 fields[TypeFunc::Parms + i] = TypeInt::INT; // array size 517 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+nargs, fields); 518 519 // create result type (range) 520 fields = TypeTuple::fields(1); 521 fields[TypeFunc::Parms+0] = TypeRawPtr::NOTNULL; // Returned oop 522 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+1, fields); 523 524 return TypeFunc::make(domain, range); 525 } 526 527 const TypeFunc *OptoRuntime::multianewarray2_Type() { 528 return multianewarray_Type(2); 529 } 530 531 const TypeFunc *OptoRuntime::multianewarray3_Type() { 532 return multianewarray_Type(3); 533 } 534 535 const TypeFunc *OptoRuntime::multianewarray4_Type() { 536 return multianewarray_Type(4); 537 } 538 539 const TypeFunc *OptoRuntime::multianewarray5_Type() { 540 return multianewarray_Type(5); 541 } 542 543 const TypeFunc *OptoRuntime::multianewarrayN_Type() { 544 // create input type (domain) 545 const Type **fields = TypeTuple::fields(2); 546 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // element klass 547 fields[TypeFunc::Parms+1] = TypeInstPtr::NOTNULL; // array of dim sizes 548 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2, fields); 549 550 // create result type (range) 551 fields = TypeTuple::fields(1); 552 fields[TypeFunc::Parms+0] = TypeRawPtr::NOTNULL; // Returned oop 553 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+1, fields); 554 555 return TypeFunc::make(domain, range); 556 } 557 558 const TypeFunc *OptoRuntime::g1_wb_pre_Type() { 559 const Type **fields = TypeTuple::fields(2); 560 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // original field value 561 fields[TypeFunc::Parms+1] = TypeRawPtr::NOTNULL; // thread 562 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2, fields); 563 564 // create result type (range) 565 fields = TypeTuple::fields(0); 566 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields); 567 568 return TypeFunc::make(domain, range); 569 } 570 571 const TypeFunc *OptoRuntime::g1_wb_post_Type() { 572 573 const Type **fields = TypeTuple::fields(2); 574 fields[TypeFunc::Parms+0] = TypeRawPtr::NOTNULL; // Card addr 575 fields[TypeFunc::Parms+1] = TypeRawPtr::NOTNULL; // thread 576 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2, fields); 577 578 // create result type (range) 579 fields = TypeTuple::fields(0); 580 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms, fields); 581 582 return TypeFunc::make(domain, range); 583 } 584 585 const TypeFunc *OptoRuntime::uncommon_trap_Type() { 586 // create input type (domain) 587 const Type **fields = TypeTuple::fields(1); 588 fields[TypeFunc::Parms+0] = TypeInt::INT; // trap_reason (deopt reason and action) 589 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+1, fields); 590 591 // create result type (range) 592 fields = TypeTuple::fields(0); 593 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields); 594 595 return TypeFunc::make(domain, range); 596 } 597 598 //----------------------------------------------------------------------------- 599 // Monitor Handling 600 const TypeFunc *OptoRuntime::complete_monitor_enter_Type() { 601 // create input type (domain) 602 const Type **fields = TypeTuple::fields(2); 603 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // Object to be Locked 604 fields[TypeFunc::Parms+1] = TypeRawPtr::BOTTOM; // Address of stack location for lock 605 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2,fields); 606 607 // create result type (range) 608 fields = TypeTuple::fields(0); 609 610 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0,fields); 611 612 return TypeFunc::make(domain,range); 613 } 614 615 616 //----------------------------------------------------------------------------- 617 const TypeFunc *OptoRuntime::complete_monitor_exit_Type() { 618 // create input type (domain) 619 const Type **fields = TypeTuple::fields(3); 620 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // Object to be Locked 621 fields[TypeFunc::Parms+1] = TypeRawPtr::BOTTOM; // Address of stack location for lock - BasicLock 622 fields[TypeFunc::Parms+2] = TypeRawPtr::BOTTOM; // Thread pointer (Self) 623 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+3, fields); 624 625 // create result type (range) 626 fields = TypeTuple::fields(0); 627 628 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields); 629 630 return TypeFunc::make(domain, range); 631 } 632 633 const TypeFunc *OptoRuntime::monitor_notify_Type() { 634 // create input type (domain) 635 const Type **fields = TypeTuple::fields(1); 636 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // Object to be Locked 637 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+1, fields); 638 639 // create result type (range) 640 fields = TypeTuple::fields(0); 641 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields); 642 return TypeFunc::make(domain, range); 643 } 644 645 const TypeFunc* OptoRuntime::flush_windows_Type() { 646 // create input type (domain) 647 const Type** fields = TypeTuple::fields(1); 648 fields[TypeFunc::Parms+0] = NULL; // void 649 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms, fields); 650 651 // create result type 652 fields = TypeTuple::fields(1); 653 fields[TypeFunc::Parms+0] = NULL; // void 654 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms, fields); 655 656 return TypeFunc::make(domain, range); 657 } 658 659 const TypeFunc* OptoRuntime::l2f_Type() { 660 // create input type (domain) 661 const Type **fields = TypeTuple::fields(2); 662 fields[TypeFunc::Parms+0] = TypeLong::LONG; 663 fields[TypeFunc::Parms+1] = Type::HALF; 664 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2, fields); 665 666 // create result type (range) 667 fields = TypeTuple::fields(1); 668 fields[TypeFunc::Parms+0] = Type::FLOAT; 669 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+1, fields); 670 671 return TypeFunc::make(domain, range); 672 } 673 674 const TypeFunc* OptoRuntime::modf_Type() { 675 const Type **fields = TypeTuple::fields(2); 676 fields[TypeFunc::Parms+0] = Type::FLOAT; 677 fields[TypeFunc::Parms+1] = Type::FLOAT; 678 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2, fields); 679 680 // create result type (range) 681 fields = TypeTuple::fields(1); 682 fields[TypeFunc::Parms+0] = Type::FLOAT; 683 684 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+1, fields); 685 686 return TypeFunc::make(domain, range); 687 } 688 689 const TypeFunc *OptoRuntime::Math_D_D_Type() { 690 // create input type (domain) 691 const Type **fields = TypeTuple::fields(2); 692 // Symbol* name of class to be loaded 693 fields[TypeFunc::Parms+0] = Type::DOUBLE; 694 fields[TypeFunc::Parms+1] = Type::HALF; 695 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2, fields); 696 697 // create result type (range) 698 fields = TypeTuple::fields(2); 699 fields[TypeFunc::Parms+0] = Type::DOUBLE; 700 fields[TypeFunc::Parms+1] = Type::HALF; 701 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+2, fields); 702 703 return TypeFunc::make(domain, range); 704 } 705 706 const TypeFunc* OptoRuntime::Math_DD_D_Type() { 707 const Type **fields = TypeTuple::fields(4); 708 fields[TypeFunc::Parms+0] = Type::DOUBLE; 709 fields[TypeFunc::Parms+1] = Type::HALF; 710 fields[TypeFunc::Parms+2] = Type::DOUBLE; 711 fields[TypeFunc::Parms+3] = Type::HALF; 712 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+4, fields); 713 714 // create result type (range) 715 fields = TypeTuple::fields(2); 716 fields[TypeFunc::Parms+0] = Type::DOUBLE; 717 fields[TypeFunc::Parms+1] = Type::HALF; 718 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+2, fields); 719 720 return TypeFunc::make(domain, range); 721 } 722 723 //-------------- currentTimeMillis, currentTimeNanos, etc 724 725 const TypeFunc* OptoRuntime::void_long_Type() { 726 // create input type (domain) 727 const Type **fields = TypeTuple::fields(0); 728 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+0, fields); 729 730 // create result type (range) 731 fields = TypeTuple::fields(2); 732 fields[TypeFunc::Parms+0] = TypeLong::LONG; 733 fields[TypeFunc::Parms+1] = Type::HALF; 734 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+2, fields); 735 736 return TypeFunc::make(domain, range); 737 } 738 739 // arraycopy stub variations: 740 enum ArrayCopyType { 741 ac_fast, // void(ptr, ptr, size_t) 742 ac_checkcast, // int(ptr, ptr, size_t, size_t, ptr) 743 ac_slow, // void(ptr, int, ptr, int, int) 744 ac_generic // int(ptr, int, ptr, int, int) 745 }; 746 747 static const TypeFunc* make_arraycopy_Type(ArrayCopyType act) { 748 // create input type (domain) 749 int num_args = (act == ac_fast ? 3 : 5); 750 int num_size_args = (act == ac_fast ? 1 : act == ac_checkcast ? 2 : 0); 751 int argcnt = num_args; 752 LP64_ONLY(argcnt += num_size_args); // halfwords for lengths 753 const Type** fields = TypeTuple::fields(argcnt); 754 int argp = TypeFunc::Parms; 755 fields[argp++] = TypePtr::NOTNULL; // src 756 if (num_size_args == 0) { 757 fields[argp++] = TypeInt::INT; // src_pos 758 } 759 fields[argp++] = TypePtr::NOTNULL; // dest 760 if (num_size_args == 0) { 761 fields[argp++] = TypeInt::INT; // dest_pos 762 fields[argp++] = TypeInt::INT; // length 763 } 764 while (num_size_args-- > 0) { 765 fields[argp++] = TypeX_X; // size in whatevers (size_t) 766 LP64_ONLY(fields[argp++] = Type::HALF); // other half of long length 767 } 768 if (act == ac_checkcast) { 769 fields[argp++] = TypePtr::NOTNULL; // super_klass 770 } 771 assert(argp == TypeFunc::Parms+argcnt, "correct decoding of act"); 772 const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); 773 774 // create result type if needed 775 int retcnt = (act == ac_checkcast || act == ac_generic ? 1 : 0); 776 fields = TypeTuple::fields(1); 777 if (retcnt == 0) 778 fields[TypeFunc::Parms+0] = NULL; // void 779 else 780 fields[TypeFunc::Parms+0] = TypeInt::INT; // status result, if needed 781 const TypeTuple* range = TypeTuple::make(TypeFunc::Parms+retcnt, fields); 782 return TypeFunc::make(domain, range); 783 } 784 785 const TypeFunc* OptoRuntime::fast_arraycopy_Type() { 786 // This signature is simple: Two base pointers and a size_t. 787 return make_arraycopy_Type(ac_fast); 788 } 789 790 const TypeFunc* OptoRuntime::checkcast_arraycopy_Type() { 791 // An extension of fast_arraycopy_Type which adds type checking. 792 return make_arraycopy_Type(ac_checkcast); 793 } 794 795 const TypeFunc* OptoRuntime::slow_arraycopy_Type() { 796 // This signature is exactly the same as System.arraycopy. 797 // There are no intptr_t (int/long) arguments. 798 return make_arraycopy_Type(ac_slow); 799 } 800 801 const TypeFunc* OptoRuntime::generic_arraycopy_Type() { 802 // This signature is like System.arraycopy, except that it returns status. 803 return make_arraycopy_Type(ac_generic); 804 } 805 806 807 const TypeFunc* OptoRuntime::array_fill_Type() { 808 const Type** fields; 809 int argp = TypeFunc::Parms; 810 // create input type (domain): pointer, int, size_t 811 fields = TypeTuple::fields(3 LP64_ONLY( + 1)); 812 fields[argp++] = TypePtr::NOTNULL; 813 fields[argp++] = TypeInt::INT; 814 fields[argp++] = TypeX_X; // size in whatevers (size_t) 815 LP64_ONLY(fields[argp++] = Type::HALF); // other half of long length 816 const TypeTuple *domain = TypeTuple::make(argp, fields); 817 818 // create result type 819 fields = TypeTuple::fields(1); 820 fields[TypeFunc::Parms+0] = NULL; // void 821 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms, fields); 822 823 return TypeFunc::make(domain, range); 824 } 825 826 // for aescrypt encrypt/decrypt operations, just three pointers returning void (length is constant) 827 const TypeFunc* OptoRuntime::aescrypt_block_Type() { 828 // create input type (domain) 829 int num_args = 3; 830 if (Matcher::pass_original_key_for_aes()) { 831 num_args = 4; 832 } 833 int argcnt = num_args; 834 const Type** fields = TypeTuple::fields(argcnt); 835 int argp = TypeFunc::Parms; 836 fields[argp++] = TypePtr::NOTNULL; // src 837 fields[argp++] = TypePtr::NOTNULL; // dest 838 fields[argp++] = TypePtr::NOTNULL; // k array 839 if (Matcher::pass_original_key_for_aes()) { 840 fields[argp++] = TypePtr::NOTNULL; // original k array 841 } 842 assert(argp == TypeFunc::Parms+argcnt, "correct decoding"); 843 const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); 844 845 // no result type needed 846 fields = TypeTuple::fields(1); 847 fields[TypeFunc::Parms+0] = NULL; // void 848 const TypeTuple* range = TypeTuple::make(TypeFunc::Parms, fields); 849 return TypeFunc::make(domain, range); 850 } 851 852 /** 853 * int updateBytesCRC32(int crc, byte* b, int len) 854 */ 855 const TypeFunc* OptoRuntime::updateBytesCRC32_Type() { 856 // create input type (domain) 857 int num_args = 3; 858 int argcnt = num_args; 859 const Type** fields = TypeTuple::fields(argcnt); 860 int argp = TypeFunc::Parms; 861 fields[argp++] = TypeInt::INT; // crc 862 fields[argp++] = TypePtr::NOTNULL; // src 863 fields[argp++] = TypeInt::INT; // len 864 assert(argp == TypeFunc::Parms+argcnt, "correct decoding"); 865 const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); 866 867 // result type needed 868 fields = TypeTuple::fields(1); 869 fields[TypeFunc::Parms+0] = TypeInt::INT; // crc result 870 const TypeTuple* range = TypeTuple::make(TypeFunc::Parms+1, fields); 871 return TypeFunc::make(domain, range); 872 } 873 874 /** 875 * int updateBytesCRC32C(int crc, byte* buf, int len, int* table) 876 */ 877 const TypeFunc* OptoRuntime::updateBytesCRC32C_Type() { 878 // create input type (domain) 879 int num_args = 4; 880 int argcnt = num_args; 881 const Type** fields = TypeTuple::fields(argcnt); 882 int argp = TypeFunc::Parms; 883 fields[argp++] = TypeInt::INT; // crc 884 fields[argp++] = TypePtr::NOTNULL; // buf 885 fields[argp++] = TypeInt::INT; // len 886 fields[argp++] = TypePtr::NOTNULL; // table 887 assert(argp == TypeFunc::Parms+argcnt, "correct decoding"); 888 const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); 889 890 // result type needed 891 fields = TypeTuple::fields(1); 892 fields[TypeFunc::Parms+0] = TypeInt::INT; // crc result 893 const TypeTuple* range = TypeTuple::make(TypeFunc::Parms+1, fields); 894 return TypeFunc::make(domain, range); 895 } 896 897 /** 898 * int updateBytesAdler32(int adler, bytes* b, int off, int len) 899 */ 900 const TypeFunc* OptoRuntime::updateBytesAdler32_Type() { 901 // create input type (domain) 902 int num_args = 3; 903 int argcnt = num_args; 904 const Type** fields = TypeTuple::fields(argcnt); 905 int argp = TypeFunc::Parms; 906 fields[argp++] = TypeInt::INT; // crc 907 fields[argp++] = TypePtr::NOTNULL; // src + offset 908 fields[argp++] = TypeInt::INT; // len 909 assert(argp == TypeFunc::Parms+argcnt, "correct decoding"); 910 const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); 911 912 // result type needed 913 fields = TypeTuple::fields(1); 914 fields[TypeFunc::Parms+0] = TypeInt::INT; // crc result 915 const TypeTuple* range = TypeTuple::make(TypeFunc::Parms+1, fields); 916 return TypeFunc::make(domain, range); 917 } 918 919 // for cipherBlockChaining calls of aescrypt encrypt/decrypt, four pointers and a length, returning int 920 const TypeFunc* OptoRuntime::cipherBlockChaining_aescrypt_Type() { 921 // create input type (domain) 922 int num_args = 5; 923 if (Matcher::pass_original_key_for_aes()) { 924 num_args = 6; 925 } 926 int argcnt = num_args; 927 const Type** fields = TypeTuple::fields(argcnt); 928 int argp = TypeFunc::Parms; 929 fields[argp++] = TypePtr::NOTNULL; // src 930 fields[argp++] = TypePtr::NOTNULL; // dest 931 fields[argp++] = TypePtr::NOTNULL; // k array 932 fields[argp++] = TypePtr::NOTNULL; // r array 933 fields[argp++] = TypeInt::INT; // src len 934 if (Matcher::pass_original_key_for_aes()) { 935 fields[argp++] = TypePtr::NOTNULL; // original k array 936 } 937 assert(argp == TypeFunc::Parms+argcnt, "correct decoding"); 938 const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); 939 940 // returning cipher len (int) 941 fields = TypeTuple::fields(1); 942 fields[TypeFunc::Parms+0] = TypeInt::INT; 943 const TypeTuple* range = TypeTuple::make(TypeFunc::Parms+1, fields); 944 return TypeFunc::make(domain, range); 945 } 946 947 /* 948 * void implCompress(byte[] buf, int ofs) 949 */ 950 const TypeFunc* OptoRuntime::sha_implCompress_Type() { 951 // create input type (domain) 952 int num_args = 2; 953 int argcnt = num_args; 954 const Type** fields = TypeTuple::fields(argcnt); 955 int argp = TypeFunc::Parms; 956 fields[argp++] = TypePtr::NOTNULL; // buf 957 fields[argp++] = TypePtr::NOTNULL; // state 958 assert(argp == TypeFunc::Parms+argcnt, "correct decoding"); 959 const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); 960 961 // no result type needed 962 fields = TypeTuple::fields(1); 963 fields[TypeFunc::Parms+0] = NULL; // void 964 const TypeTuple* range = TypeTuple::make(TypeFunc::Parms, fields); 965 return TypeFunc::make(domain, range); 966 } 967 968 /* 969 * int implCompressMultiBlock(byte[] b, int ofs, int limit) 970 */ 971 const TypeFunc* OptoRuntime::digestBase_implCompressMB_Type() { 972 // create input type (domain) 973 int num_args = 4; 974 int argcnt = num_args; 975 const Type** fields = TypeTuple::fields(argcnt); 976 int argp = TypeFunc::Parms; 977 fields[argp++] = TypePtr::NOTNULL; // buf 978 fields[argp++] = TypePtr::NOTNULL; // state 979 fields[argp++] = TypeInt::INT; // ofs 980 fields[argp++] = TypeInt::INT; // limit 981 assert(argp == TypeFunc::Parms+argcnt, "correct decoding"); 982 const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); 983 984 // returning ofs (int) 985 fields = TypeTuple::fields(1); 986 fields[TypeFunc::Parms+0] = TypeInt::INT; // ofs 987 const TypeTuple* range = TypeTuple::make(TypeFunc::Parms+1, fields); 988 return TypeFunc::make(domain, range); 989 } 990 991 const TypeFunc* OptoRuntime::multiplyToLen_Type() { 992 // create input type (domain) 993 int num_args = 6; 994 int argcnt = num_args; 995 const Type** fields = TypeTuple::fields(argcnt); 996 int argp = TypeFunc::Parms; 997 fields[argp++] = TypePtr::NOTNULL; // x 998 fields[argp++] = TypeInt::INT; // xlen 999 fields[argp++] = TypePtr::NOTNULL; // y 1000 fields[argp++] = TypeInt::INT; // ylen 1001 fields[argp++] = TypePtr::NOTNULL; // z 1002 fields[argp++] = TypeInt::INT; // zlen 1003 assert(argp == TypeFunc::Parms+argcnt, "correct decoding"); 1004 const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); 1005 1006 // no result type needed 1007 fields = TypeTuple::fields(1); 1008 fields[TypeFunc::Parms+0] = NULL; 1009 const TypeTuple* range = TypeTuple::make(TypeFunc::Parms, fields); 1010 return TypeFunc::make(domain, range); 1011 } 1012 1013 const TypeFunc* OptoRuntime::squareToLen_Type() { 1014 // create input type (domain) 1015 int num_args = 4; 1016 int argcnt = num_args; 1017 const Type** fields = TypeTuple::fields(argcnt); 1018 int argp = TypeFunc::Parms; 1019 fields[argp++] = TypePtr::NOTNULL; // x 1020 fields[argp++] = TypeInt::INT; // len 1021 fields[argp++] = TypePtr::NOTNULL; // z 1022 fields[argp++] = TypeInt::INT; // zlen 1023 assert(argp == TypeFunc::Parms+argcnt, "correct decoding"); 1024 const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); 1025 1026 // no result type needed 1027 fields = TypeTuple::fields(1); 1028 fields[TypeFunc::Parms+0] = NULL; 1029 const TypeTuple* range = TypeTuple::make(TypeFunc::Parms, fields); 1030 return TypeFunc::make(domain, range); 1031 } 1032 1033 // for mulAdd calls, 2 pointers and 3 ints, returning int 1034 const TypeFunc* OptoRuntime::mulAdd_Type() { 1035 // create input type (domain) 1036 int num_args = 5; 1037 int argcnt = num_args; 1038 const Type** fields = TypeTuple::fields(argcnt); 1039 int argp = TypeFunc::Parms; 1040 fields[argp++] = TypePtr::NOTNULL; // out 1041 fields[argp++] = TypePtr::NOTNULL; // in 1042 fields[argp++] = TypeInt::INT; // offset 1043 fields[argp++] = TypeInt::INT; // len 1044 fields[argp++] = TypeInt::INT; // k 1045 assert(argp == TypeFunc::Parms+argcnt, "correct decoding"); 1046 const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); 1047 1048 // returning carry (int) 1049 fields = TypeTuple::fields(1); 1050 fields[TypeFunc::Parms+0] = TypeInt::INT; 1051 const TypeTuple* range = TypeTuple::make(TypeFunc::Parms+1, fields); 1052 return TypeFunc::make(domain, range); 1053 } 1054 1055 const TypeFunc* OptoRuntime::montgomeryMultiply_Type() { 1056 // create input type (domain) 1057 int num_args = 7; 1058 int argcnt = num_args; 1059 const Type** fields = TypeTuple::fields(argcnt); 1060 int argp = TypeFunc::Parms; 1061 fields[argp++] = TypePtr::NOTNULL; // a 1062 fields[argp++] = TypePtr::NOTNULL; // b 1063 fields[argp++] = TypePtr::NOTNULL; // n 1064 fields[argp++] = TypeInt::INT; // len 1065 fields[argp++] = TypeLong::LONG; // inv 1066 fields[argp++] = Type::HALF; 1067 fields[argp++] = TypePtr::NOTNULL; // result 1068 assert(argp == TypeFunc::Parms+argcnt, "correct decoding"); 1069 const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); 1070 1071 // result type needed 1072 fields = TypeTuple::fields(1); 1073 fields[TypeFunc::Parms+0] = TypePtr::NOTNULL; 1074 1075 const TypeTuple* range = TypeTuple::make(TypeFunc::Parms, fields); 1076 return TypeFunc::make(domain, range); 1077 } 1078 1079 const TypeFunc* OptoRuntime::montgomerySquare_Type() { 1080 // create input type (domain) 1081 int num_args = 6; 1082 int argcnt = num_args; 1083 const Type** fields = TypeTuple::fields(argcnt); 1084 int argp = TypeFunc::Parms; 1085 fields[argp++] = TypePtr::NOTNULL; // a 1086 fields[argp++] = TypePtr::NOTNULL; // n 1087 fields[argp++] = TypeInt::INT; // len 1088 fields[argp++] = TypeLong::LONG; // inv 1089 fields[argp++] = Type::HALF; 1090 fields[argp++] = TypePtr::NOTNULL; // result 1091 assert(argp == TypeFunc::Parms+argcnt, "correct decoding"); 1092 const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); 1093 1094 // result type needed 1095 fields = TypeTuple::fields(1); 1096 fields[TypeFunc::Parms+0] = TypePtr::NOTNULL; 1097 1098 const TypeTuple* range = TypeTuple::make(TypeFunc::Parms, fields); 1099 return TypeFunc::make(domain, range); 1100 } 1101 1102 // GHASH block processing 1103 const TypeFunc* OptoRuntime::ghash_processBlocks_Type() { 1104 int argcnt = 4; 1105 1106 const Type** fields = TypeTuple::fields(argcnt); 1107 int argp = TypeFunc::Parms; 1108 fields[argp++] = TypePtr::NOTNULL; // state 1109 fields[argp++] = TypePtr::NOTNULL; // subkeyH 1110 fields[argp++] = TypePtr::NOTNULL; // data 1111 fields[argp++] = TypeInt::INT; // blocks 1112 assert(argp == TypeFunc::Parms+argcnt, "correct decoding"); 1113 const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); 1114 1115 // result type needed 1116 fields = TypeTuple::fields(1); 1117 fields[TypeFunc::Parms+0] = NULL; // void 1118 const TypeTuple* range = TypeTuple::make(TypeFunc::Parms, fields); 1119 return TypeFunc::make(domain, range); 1120 } 1121 1122 //------------- Interpreter state access for on stack replacement 1123 const TypeFunc* OptoRuntime::osr_end_Type() { 1124 // create input type (domain) 1125 const Type **fields = TypeTuple::fields(1); 1126 fields[TypeFunc::Parms+0] = TypeRawPtr::BOTTOM; // OSR temp buf 1127 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+1, fields); 1128 1129 // create result type 1130 fields = TypeTuple::fields(1); 1131 // fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // locked oop 1132 fields[TypeFunc::Parms+0] = NULL; // void 1133 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms, fields); 1134 return TypeFunc::make(domain, range); 1135 } 1136 1137 //-------------- methodData update helpers 1138 1139 const TypeFunc* OptoRuntime::profile_receiver_type_Type() { 1140 // create input type (domain) 1141 const Type **fields = TypeTuple::fields(2); 1142 fields[TypeFunc::Parms+0] = TypeAryPtr::NOTNULL; // methodData pointer 1143 fields[TypeFunc::Parms+1] = TypeInstPtr::BOTTOM; // receiver oop 1144 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2, fields); 1145 1146 // create result type 1147 fields = TypeTuple::fields(1); 1148 fields[TypeFunc::Parms+0] = NULL; // void 1149 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms, fields); 1150 return TypeFunc::make(domain,range); 1151 } 1152 1153 JRT_LEAF(void, OptoRuntime::profile_receiver_type_C(DataLayout* data, oopDesc* receiver)) 1154 if (receiver == NULL) return; 1155 Klass* receiver_klass = receiver->klass(); 1156 1157 intptr_t* mdp = ((intptr_t*)(data)) + DataLayout::header_size_in_cells(); 1158 int empty_row = -1; // free row, if any is encountered 1159 1160 // ReceiverTypeData* vc = new ReceiverTypeData(mdp); 1161 for (uint row = 0; row < ReceiverTypeData::row_limit(); row++) { 1162 // if (vc->receiver(row) == receiver_klass) 1163 int receiver_off = ReceiverTypeData::receiver_cell_index(row); 1164 intptr_t row_recv = *(mdp + receiver_off); 1165 if (row_recv == (intptr_t) receiver_klass) { 1166 // vc->set_receiver_count(row, vc->receiver_count(row) + DataLayout::counter_increment); 1167 int count_off = ReceiverTypeData::receiver_count_cell_index(row); 1168 *(mdp + count_off) += DataLayout::counter_increment; 1169 return; 1170 } else if (row_recv == 0) { 1171 // else if (vc->receiver(row) == NULL) 1172 empty_row = (int) row; 1173 } 1174 } 1175 1176 if (empty_row != -1) { 1177 int receiver_off = ReceiverTypeData::receiver_cell_index(empty_row); 1178 // vc->set_receiver(empty_row, receiver_klass); 1179 *(mdp + receiver_off) = (intptr_t) receiver_klass; 1180 // vc->set_receiver_count(empty_row, DataLayout::counter_increment); 1181 int count_off = ReceiverTypeData::receiver_count_cell_index(empty_row); 1182 *(mdp + count_off) = DataLayout::counter_increment; 1183 } else { 1184 // Receiver did not match any saved receiver and there is no empty row for it. 1185 // Increment total counter to indicate polymorphic case. 1186 intptr_t* count_p = (intptr_t*)(((uint8_t*)(data)) + in_bytes(CounterData::count_offset())); 1187 *count_p += DataLayout::counter_increment; 1188 } 1189 JRT_END 1190 1191 //------------------------------------------------------------------------------------- 1192 // register policy 1193 1194 bool OptoRuntime::is_callee_saved_register(MachRegisterNumbers reg) { 1195 assert(reg >= 0 && reg < _last_Mach_Reg, "must be a machine register"); 1196 switch (register_save_policy[reg]) { 1197 case 'C': return false; //SOC 1198 case 'E': return true ; //SOE 1199 case 'N': return false; //NS 1200 case 'A': return false; //AS 1201 } 1202 ShouldNotReachHere(); 1203 return false; 1204 } 1205 1206 //----------------------------------------------------------------------- 1207 // Exceptions 1208 // 1209 1210 static void trace_exception(oop exception_oop, address exception_pc, const char* msg) PRODUCT_RETURN; 1211 1212 // The method is an entry that is always called by a C++ method not 1213 // directly from compiled code. Compiled code will call the C++ method following. 1214 // We can't allow async exception to be installed during exception processing. 1215 JRT_ENTRY_NO_ASYNC(address, OptoRuntime::handle_exception_C_helper(JavaThread* thread, nmethod* &nm)) 1216 1217 // Do not confuse exception_oop with pending_exception. The exception_oop 1218 // is only used to pass arguments into the method. Not for general 1219 // exception handling. DO NOT CHANGE IT to use pending_exception, since 1220 // the runtime stubs checks this on exit. 1221 assert(thread->exception_oop() != NULL, "exception oop is found"); 1222 address handler_address = NULL; 1223 1224 Handle exception(thread, thread->exception_oop()); 1225 address pc = thread->exception_pc(); 1226 1227 // Clear out the exception oop and pc since looking up an 1228 // exception handler can cause class loading, which might throw an 1229 // exception and those fields are expected to be clear during 1230 // normal bytecode execution. 1231 thread->clear_exception_oop_and_pc(); 1232 1233 if (TraceExceptions) { 1234 trace_exception(exception(), pc, ""); 1235 } 1236 1237 // for AbortVMOnException flag 1238 NOT_PRODUCT(Exceptions::debug_check_abort(exception)); 1239 1240 #ifdef ASSERT 1241 if (!(exception->is_a(SystemDictionary::Throwable_klass()))) { 1242 // should throw an exception here 1243 ShouldNotReachHere(); 1244 } 1245 #endif 1246 1247 // new exception handling: this method is entered only from adapters 1248 // exceptions from compiled java methods are handled in compiled code 1249 // using rethrow node 1250 1251 nm = CodeCache::find_nmethod(pc); 1252 assert(nm != NULL, "No NMethod found"); 1253 if (nm->is_native_method()) { 1254 fatal("Native method should not have path to exception handling"); 1255 } else { 1256 // we are switching to old paradigm: search for exception handler in caller_frame 1257 // instead in exception handler of caller_frame.sender() 1258 1259 if (JvmtiExport::can_post_on_exceptions()) { 1260 // "Full-speed catching" is not necessary here, 1261 // since we're notifying the VM on every catch. 1262 // Force deoptimization and the rest of the lookup 1263 // will be fine. 1264 deoptimize_caller_frame(thread); 1265 } 1266 1267 // Check the stack guard pages. If enabled, look for handler in this frame; 1268 // otherwise, forcibly unwind the frame. 1269 // 1270 // 4826555: use default current sp for reguard_stack instead of &nm: it's more accurate. 1271 bool force_unwind = !thread->reguard_stack(); 1272 bool deopting = false; 1273 if (nm->is_deopt_pc(pc)) { 1274 deopting = true; 1275 RegisterMap map(thread, false); 1276 frame deoptee = thread->last_frame().sender(&map); 1277 assert(deoptee.is_deoptimized_frame(), "must be deopted"); 1278 // Adjust the pc back to the original throwing pc 1279 pc = deoptee.pc(); 1280 } 1281 1282 // If we are forcing an unwind because of stack overflow then deopt is 1283 // irrelevant since we are throwing the frame away anyway. 1284 1285 if (deopting && !force_unwind) { 1286 handler_address = SharedRuntime::deopt_blob()->unpack_with_exception(); 1287 } else { 1288 1289 handler_address = 1290 force_unwind ? NULL : nm->handler_for_exception_and_pc(exception, pc); 1291 1292 if (handler_address == NULL) { 1293 Handle original_exception(thread, exception()); 1294 handler_address = SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, force_unwind, true); 1295 assert (handler_address != NULL, "must have compiled handler"); 1296 // Update the exception cache only when the unwind was not forced 1297 // and there didn't happen another exception during the computation of the 1298 // compiled exception handler. 1299 if (!force_unwind && original_exception() == exception()) { 1300 nm->add_handler_for_exception_and_pc(exception,pc,handler_address); 1301 } 1302 } else { 1303 assert(handler_address == SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, force_unwind, true), "Must be the same"); 1304 } 1305 } 1306 1307 thread->set_exception_pc(pc); 1308 thread->set_exception_handler_pc(handler_address); 1309 1310 // Check if the exception PC is a MethodHandle call site. 1311 thread->set_is_method_handle_return(nm->is_method_handle_return(pc)); 1312 } 1313 1314 // Restore correct return pc. Was saved above. 1315 thread->set_exception_oop(exception()); 1316 return handler_address; 1317 1318 JRT_END 1319 1320 // We are entering here from exception_blob 1321 // If there is a compiled exception handler in this method, we will continue there; 1322 // otherwise we will unwind the stack and continue at the caller of top frame method 1323 // Note we enter without the usual JRT wrapper. We will call a helper routine that 1324 // will do the normal VM entry. We do it this way so that we can see if the nmethod 1325 // we looked up the handler for has been deoptimized in the meantime. If it has been 1326 // we must not use the handler and instead return the deopt blob. 1327 address OptoRuntime::handle_exception_C(JavaThread* thread) { 1328 // 1329 // We are in Java not VM and in debug mode we have a NoHandleMark 1330 // 1331 #ifndef PRODUCT 1332 SharedRuntime::_find_handler_ctr++; // find exception handler 1333 #endif 1334 debug_only(NoHandleMark __hm;) 1335 nmethod* nm = NULL; 1336 address handler_address = NULL; 1337 { 1338 // Enter the VM 1339 1340 ResetNoHandleMark rnhm; 1341 handler_address = handle_exception_C_helper(thread, nm); 1342 } 1343 1344 // Back in java: Use no oops, DON'T safepoint 1345 1346 // Now check to see if the handler we are returning is in a now 1347 // deoptimized frame 1348 1349 if (nm != NULL) { 1350 RegisterMap map(thread, false); 1351 frame caller = thread->last_frame().sender(&map); 1352 #ifdef ASSERT 1353 assert(caller.is_compiled_frame(), "must be"); 1354 #endif // ASSERT 1355 if (caller.is_deoptimized_frame()) { 1356 handler_address = SharedRuntime::deopt_blob()->unpack_with_exception(); 1357 } 1358 } 1359 return handler_address; 1360 } 1361 1362 //------------------------------rethrow---------------------------------------- 1363 // We get here after compiled code has executed a 'RethrowNode'. The callee 1364 // is either throwing or rethrowing an exception. The callee-save registers 1365 // have been restored, synchronized objects have been unlocked and the callee 1366 // stack frame has been removed. The return address was passed in. 1367 // Exception oop is passed as the 1st argument. This routine is then called 1368 // from the stub. On exit, we know where to jump in the caller's code. 1369 // After this C code exits, the stub will pop his frame and end in a jump 1370 // (instead of a return). We enter the caller's default handler. 1371 // 1372 // This must be JRT_LEAF: 1373 // - caller will not change its state as we cannot block on exit, 1374 // therefore raw_exception_handler_for_return_address is all it takes 1375 // to handle deoptimized blobs 1376 // 1377 // However, there needs to be a safepoint check in the middle! So compiled 1378 // safepoints are completely watertight. 1379 // 1380 // Thus, it cannot be a leaf since it contains the No_GC_Verifier. 1381 // 1382 // *THIS IS NOT RECOMMENDED PROGRAMMING STYLE* 1383 // 1384 address OptoRuntime::rethrow_C(oopDesc* exception, JavaThread* thread, address ret_pc) { 1385 #ifndef PRODUCT 1386 SharedRuntime::_rethrow_ctr++; // count rethrows 1387 #endif 1388 assert (exception != NULL, "should have thrown a NULLPointerException"); 1389 #ifdef ASSERT 1390 if (!(exception->is_a(SystemDictionary::Throwable_klass()))) { 1391 // should throw an exception here 1392 ShouldNotReachHere(); 1393 } 1394 #endif 1395 1396 thread->set_vm_result(exception); 1397 // Frame not compiled (handles deoptimization blob) 1398 return SharedRuntime::raw_exception_handler_for_return_address(thread, ret_pc); 1399 } 1400 1401 1402 const TypeFunc *OptoRuntime::rethrow_Type() { 1403 // create input type (domain) 1404 const Type **fields = TypeTuple::fields(1); 1405 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // Exception oop 1406 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+1,fields); 1407 1408 // create result type (range) 1409 fields = TypeTuple::fields(1); 1410 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // Exception oop 1411 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+1, fields); 1412 1413 return TypeFunc::make(domain, range); 1414 } 1415 1416 1417 void OptoRuntime::deoptimize_caller_frame(JavaThread *thread, bool doit) { 1418 // Deoptimize the caller before continuing, as the compiled 1419 // exception handler table may not be valid. 1420 if (!StressCompiledExceptionHandlers && doit) { 1421 deoptimize_caller_frame(thread); 1422 } 1423 } 1424 1425 void OptoRuntime::deoptimize_caller_frame(JavaThread *thread) { 1426 // Called from within the owner thread, so no need for safepoint 1427 RegisterMap reg_map(thread); 1428 frame stub_frame = thread->last_frame(); 1429 assert(stub_frame.is_runtime_frame() || exception_blob()->contains(stub_frame.pc()), "sanity check"); 1430 frame caller_frame = stub_frame.sender(®_map); 1431 1432 // Deoptimize the caller frame. 1433 Deoptimization::deoptimize_frame(thread, caller_frame.id()); 1434 } 1435 1436 1437 bool OptoRuntime::is_deoptimized_caller_frame(JavaThread *thread) { 1438 // Called from within the owner thread, so no need for safepoint 1439 RegisterMap reg_map(thread); 1440 frame stub_frame = thread->last_frame(); 1441 assert(stub_frame.is_runtime_frame() || exception_blob()->contains(stub_frame.pc()), "sanity check"); 1442 frame caller_frame = stub_frame.sender(®_map); 1443 return caller_frame.is_deoptimized_frame(); 1444 } 1445 1446 1447 const TypeFunc *OptoRuntime::register_finalizer_Type() { 1448 // create input type (domain) 1449 const Type **fields = TypeTuple::fields(1); 1450 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // oop; Receiver 1451 // // The JavaThread* is passed to each routine as the last argument 1452 // fields[TypeFunc::Parms+1] = TypeRawPtr::NOTNULL; // JavaThread *; Executing thread 1453 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+1,fields); 1454 1455 // create result type (range) 1456 fields = TypeTuple::fields(0); 1457 1458 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0,fields); 1459 1460 return TypeFunc::make(domain,range); 1461 } 1462 1463 1464 //----------------------------------------------------------------------------- 1465 // Dtrace support. entry and exit probes have the same signature 1466 const TypeFunc *OptoRuntime::dtrace_method_entry_exit_Type() { 1467 // create input type (domain) 1468 const Type **fields = TypeTuple::fields(2); 1469 fields[TypeFunc::Parms+0] = TypeRawPtr::BOTTOM; // Thread-local storage 1470 fields[TypeFunc::Parms+1] = TypeMetadataPtr::BOTTOM; // Method*; Method we are entering 1471 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2,fields); 1472 1473 // create result type (range) 1474 fields = TypeTuple::fields(0); 1475 1476 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0,fields); 1477 1478 return TypeFunc::make(domain,range); 1479 } 1480 1481 const TypeFunc *OptoRuntime::dtrace_object_alloc_Type() { 1482 // create input type (domain) 1483 const Type **fields = TypeTuple::fields(2); 1484 fields[TypeFunc::Parms+0] = TypeRawPtr::BOTTOM; // Thread-local storage 1485 fields[TypeFunc::Parms+1] = TypeInstPtr::NOTNULL; // oop; newly allocated object 1486 1487 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2,fields); 1488 1489 // create result type (range) 1490 fields = TypeTuple::fields(0); 1491 1492 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0,fields); 1493 1494 return TypeFunc::make(domain,range); 1495 } 1496 1497 1498 JRT_ENTRY_NO_ASYNC(void, OptoRuntime::register_finalizer(oopDesc* obj, JavaThread* thread)) 1499 assert(obj->is_oop(), "must be a valid oop"); 1500 assert(obj->klass()->has_finalizer(), "shouldn't be here otherwise"); 1501 InstanceKlass::register_finalizer(instanceOop(obj), CHECK); 1502 JRT_END 1503 1504 //----------------------------------------------------------------------------- 1505 1506 NamedCounter * volatile OptoRuntime::_named_counters = NULL; 1507 1508 // 1509 // dump the collected NamedCounters. 1510 // 1511 void OptoRuntime::print_named_counters() { 1512 int total_lock_count = 0; 1513 int eliminated_lock_count = 0; 1514 1515 NamedCounter* c = _named_counters; 1516 while (c) { 1517 if (c->tag() == NamedCounter::LockCounter || c->tag() == NamedCounter::EliminatedLockCounter) { 1518 int count = c->count(); 1519 if (count > 0) { 1520 bool eliminated = c->tag() == NamedCounter::EliminatedLockCounter; 1521 if (Verbose) { 1522 tty->print_cr("%d %s%s", count, c->name(), eliminated ? " (eliminated)" : ""); 1523 } 1524 total_lock_count += count; 1525 if (eliminated) { 1526 eliminated_lock_count += count; 1527 } 1528 } 1529 } else if (c->tag() == NamedCounter::BiasedLockingCounter) { 1530 BiasedLockingCounters* blc = ((BiasedLockingNamedCounter*)c)->counters(); 1531 if (blc->nonzero()) { 1532 tty->print_cr("%s", c->name()); 1533 blc->print_on(tty); 1534 } 1535 #if INCLUDE_RTM_OPT 1536 } else if (c->tag() == NamedCounter::RTMLockingCounter) { 1537 RTMLockingCounters* rlc = ((RTMLockingNamedCounter*)c)->counters(); 1538 if (rlc->nonzero()) { 1539 tty->print_cr("%s", c->name()); 1540 rlc->print_on(tty); 1541 } 1542 #endif 1543 } 1544 c = c->next(); 1545 } 1546 if (total_lock_count > 0) { 1547 tty->print_cr("dynamic locks: %d", total_lock_count); 1548 if (eliminated_lock_count) { 1549 tty->print_cr("eliminated locks: %d (%d%%)", eliminated_lock_count, 1550 (int)(eliminated_lock_count * 100.0 / total_lock_count)); 1551 } 1552 } 1553 } 1554 1555 // 1556 // Allocate a new NamedCounter. The JVMState is used to generate the 1557 // name which consists of method@line for the inlining tree. 1558 // 1559 1560 NamedCounter* OptoRuntime::new_named_counter(JVMState* youngest_jvms, NamedCounter::CounterTag tag) { 1561 int max_depth = youngest_jvms->depth(); 1562 1563 // Visit scopes from youngest to oldest. 1564 bool first = true; 1565 stringStream st; 1566 for (int depth = max_depth; depth >= 1; depth--) { 1567 JVMState* jvms = youngest_jvms->of_depth(depth); 1568 ciMethod* m = jvms->has_method() ? jvms->method() : NULL; 1569 if (!first) { 1570 st.print(" "); 1571 } else { 1572 first = false; 1573 } 1574 int bci = jvms->bci(); 1575 if (bci < 0) bci = 0; 1576 st.print("%s.%s@%d", m->holder()->name()->as_utf8(), m->name()->as_utf8(), bci); 1577 // To print linenumbers instead of bci use: m->line_number_from_bci(bci) 1578 } 1579 NamedCounter* c; 1580 if (tag == NamedCounter::BiasedLockingCounter) { 1581 c = new BiasedLockingNamedCounter(st.as_string()); 1582 } else if (tag == NamedCounter::RTMLockingCounter) { 1583 c = new RTMLockingNamedCounter(st.as_string()); 1584 } else { 1585 c = new NamedCounter(st.as_string(), tag); 1586 } 1587 1588 // atomically add the new counter to the head of the list. We only 1589 // add counters so this is safe. 1590 NamedCounter* head; 1591 do { 1592 c->set_next(NULL); 1593 head = _named_counters; 1594 c->set_next(head); 1595 } while (Atomic::cmpxchg_ptr(c, &_named_counters, head) != head); 1596 return c; 1597 } 1598 1599 //----------------------------------------------------------------------------- 1600 // Non-product code 1601 #ifndef PRODUCT 1602 1603 int trace_exception_counter = 0; 1604 static void trace_exception(oop exception_oop, address exception_pc, const char* msg) { 1605 ttyLocker ttyl; 1606 trace_exception_counter++; 1607 tty->print("%d [Exception (%s): ", trace_exception_counter, msg); 1608 exception_oop->print_value(); 1609 tty->print(" in "); 1610 CodeBlob* blob = CodeCache::find_blob(exception_pc); 1611 if (blob->is_nmethod()) { 1612 nmethod* nm = blob->as_nmethod_or_null(); 1613 nm->method()->print_value(); 1614 } else if (blob->is_runtime_stub()) { 1615 tty->print("<runtime-stub>"); 1616 } else { 1617 tty->print("<unknown>"); 1618 } 1619 tty->print(" at " INTPTR_FORMAT, p2i(exception_pc)); 1620 tty->print_cr("]"); 1621 } 1622 1623 #endif // PRODUCT 1624