1 /* 2 * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. 3 * Copyright (c) 2021, Azul Systems, Inc. All rights reserved. 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5 * 6 * This code is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License version 2 only, as 8 * published by the Free Software Foundation. 9 * 10 * This code is distributed in the hope that it will be useful, but WITHOUT 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 * version 2 for more details (a copy is included in the LICENSE file that 14 * accompanied this code). 15 * 16 * You should have received a copy of the GNU General Public License version 17 * 2 along with this work; if not, write to the Free Software Foundation, 18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19 * 20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 * or visit www.oracle.com if you need additional information or have any 22 * questions. 23 * 24 */ 25 26 #include "precompiled.hpp" 27 #include "cds/cdsConfig.hpp" 28 #include "classfile/javaClasses.hpp" 29 #include "classfile/javaThreadStatus.hpp" 30 #include "gc/shared/barrierSet.hpp" 31 #include "jfr/jfrEvents.hpp" 32 #include "jvm.h" 33 #include "jvmtifiles/jvmtiEnv.hpp" 34 #include "logging/log.hpp" 35 #include "memory/allocation.inline.hpp" 36 #include "memory/iterator.hpp" 37 #include "memory/resourceArea.hpp" 38 #include "nmt/memTracker.hpp" 39 #include "oops/oop.inline.hpp" 40 #include "runtime/atomic.hpp" 41 #include "runtime/handles.inline.hpp" 42 #include "runtime/javaThread.inline.hpp" 43 #include "runtime/nonJavaThread.hpp" 44 #include "runtime/orderAccess.hpp" 45 #include "runtime/osThread.hpp" 46 #include "runtime/safepoint.hpp" 47 #include "runtime/safepointMechanism.inline.hpp" 48 #include "runtime/thread.inline.hpp" 49 #include "runtime/threadSMR.inline.hpp" 50 #include "utilities/macros.hpp" 51 #include "utilities/spinYield.hpp" 52 #if INCLUDE_JFR 53 #include "jfr/jfr.hpp" 54 #endif 55 56 #ifndef USE_LIBRARY_BASED_TLS_ONLY 57 // Current thread is maintained as a thread-local variable 58 THREAD_LOCAL Thread* Thread::_thr_current = nullptr; 59 #endif 60 61 // ======= Thread ======== 62 // Base class for all threads: VMThread, WatcherThread, ConcurrentMarkSweepThread, 63 // JavaThread 64 65 DEBUG_ONLY(Thread* Thread::_starting_thread = nullptr;) 66 67 Thread::Thread() { 68 69 DEBUG_ONLY(_run_state = PRE_CALL_RUN;) 70 71 // stack and get_thread 72 set_stack_base(nullptr); 73 set_stack_size(0); 74 set_lgrp_id(-1); 75 DEBUG_ONLY(clear_suspendible_thread();) 76 DEBUG_ONLY(clear_indirectly_suspendible_thread();) 77 DEBUG_ONLY(clear_indirectly_safepoint_thread();) 78 79 // allocated data structures 80 set_osthread(nullptr); 81 set_resource_area(new (mtThread)ResourceArea()); 82 DEBUG_ONLY(_current_resource_mark = nullptr;) 83 set_handle_area(new (mtThread) HandleArea(nullptr)); 84 set_metadata_handles(new (mtClass) GrowableArray<Metadata*>(30, mtClass)); 85 set_last_handle_mark(nullptr); 86 DEBUG_ONLY(_missed_ic_stub_refill_verifier = nullptr); 87 88 // Initial value of zero ==> never claimed. 89 _threads_do_token = 0; 90 _threads_hazard_ptr = nullptr; 91 _threads_list_ptr = nullptr; 92 _nested_threads_hazard_ptr_cnt = 0; 93 _rcu_counter = 0; 94 95 // the handle mark links itself to last_handle_mark 96 new HandleMark(this); 97 98 // plain initialization 99 debug_only(_owned_locks = nullptr;) 100 NOT_PRODUCT(_skip_gcalot = false;) 101 _jvmti_env_iteration_count = 0; 102 set_allocated_bytes(0); 103 _current_pending_raw_monitor = nullptr; 104 _vm_error_callbacks = nullptr; 105 106 // thread-specific hashCode stream generator state - Marsaglia shift-xor form 107 // If we are dumping, keep ihashes constant. Note that during dumping we only 108 // ever run one java thread, and no other thread should generate ihashes either, 109 // so using a constant seed should work fine. 110 _hashStateX = CDSConfig::is_dumping_static_archive() ? 0x12345678 : os::random(); 111 _hashStateY = 842502087; 112 _hashStateZ = 0x8767; // (int)(3579807591LL & 0xffff) ; 113 _hashStateW = 273326509; 114 115 // Many of the following fields are effectively final - immutable 116 // Note that nascent threads can't use the Native Monitor-Mutex 117 // construct until the _MutexEvent is initialized ... 118 // CONSIDER: instead of using a fixed set of purpose-dedicated ParkEvents 119 // we might instead use a stack of ParkEvents that we could provision on-demand. 120 // The stack would act as a cache to avoid calls to ParkEvent::Allocate() 121 // and ::Release() 122 _ParkEvent = ParkEvent::Allocate(this); 123 124 #ifdef CHECK_UNHANDLED_OOPS 125 if (CheckUnhandledOops) { 126 _unhandled_oops = new UnhandledOops(this); 127 } 128 #endif // CHECK_UNHANDLED_OOPS 129 130 // Notify the barrier set that a thread is being created. The initial 131 // thread is created before the barrier set is available. The call to 132 // BarrierSet::on_thread_create() for this thread is therefore deferred 133 // to BarrierSet::set_barrier_set(). 134 BarrierSet* const barrier_set = BarrierSet::barrier_set(); 135 if (barrier_set != nullptr) { 136 barrier_set->on_thread_create(this); 137 } else { 138 // Only the main thread should be created before the barrier set 139 // and that happens just before Thread::current is set. No other thread 140 // can attach as the VM is not created yet, so they can't execute this code. 141 // If the main thread creates other threads before the barrier set that is an error. 142 assert(Thread::current_or_null() == nullptr, "creating thread before barrier set"); 143 } 144 145 MACOS_AARCH64_ONLY(DEBUG_ONLY(_wx_init = false)); 146 147 _profile_vm_locks = false; 148 _profile_vm_calls = false; 149 _profile_vm_ops = false; 150 _profile_rt_calls = false; 151 _profile_upcalls = false; 152 153 _all_bc_counter_value = 0; 154 _clinit_bc_counter_value = 0; 155 156 _current_rt_call_timer = nullptr; 157 } 158 159 void Thread::initialize_tlab() { 160 if (UseTLAB) { 161 tlab().initialize(); 162 } 163 } 164 165 void Thread::initialize_thread_current() { 166 #ifndef USE_LIBRARY_BASED_TLS_ONLY 167 assert(_thr_current == nullptr, "Thread::current already initialized"); 168 _thr_current = this; 169 #endif 170 assert(ThreadLocalStorage::thread() == nullptr, "ThreadLocalStorage::thread already initialized"); 171 ThreadLocalStorage::set_thread(this); 172 assert(Thread::current() == ThreadLocalStorage::thread(), "TLS mismatch!"); 173 } 174 175 void Thread::clear_thread_current() { 176 assert(Thread::current() == ThreadLocalStorage::thread(), "TLS mismatch!"); 177 #ifndef USE_LIBRARY_BASED_TLS_ONLY 178 _thr_current = nullptr; 179 #endif 180 ThreadLocalStorage::set_thread(nullptr); 181 } 182 183 void Thread::record_stack_base_and_size() { 184 // Note: at this point, Thread object is not yet initialized. Do not rely on 185 // any members being initialized. Do not rely on Thread::current() being set. 186 // If possible, refrain from doing anything which may crash or assert since 187 // quite probably those crash dumps will be useless. 188 address base; 189 size_t size; 190 os::current_stack_base_and_size(&base, &size); 191 set_stack_base(base); 192 set_stack_size(size); 193 194 // Set stack limits after thread is initialized. 195 if (is_Java_thread()) { 196 JavaThread::cast(this)->stack_overflow_state()->initialize(stack_base(), stack_end()); 197 } 198 } 199 200 void Thread::register_thread_stack_with_NMT() { 201 MemTracker::record_thread_stack(stack_end(), stack_size()); 202 } 203 204 void Thread::unregister_thread_stack_with_NMT() { 205 MemTracker::release_thread_stack(stack_end(), stack_size()); 206 } 207 208 void Thread::call_run() { 209 DEBUG_ONLY(_run_state = CALL_RUN;) 210 211 // At this point, Thread object should be fully initialized and 212 // Thread::current() should be set. 213 214 assert(Thread::current_or_null() != nullptr, "current thread is unset"); 215 assert(Thread::current_or_null() == this, "current thread is wrong"); 216 217 // Perform common initialization actions 218 219 MACOS_AARCH64_ONLY(this->init_wx()); 220 221 register_thread_stack_with_NMT(); 222 223 JFR_ONLY(Jfr::on_thread_start(this);) 224 225 log_debug(os, thread)("Thread " UINTX_FORMAT " stack dimensions: " 226 PTR_FORMAT "-" PTR_FORMAT " (" SIZE_FORMAT "k).", 227 os::current_thread_id(), p2i(stack_end()), 228 p2i(stack_base()), stack_size()/1024); 229 230 // Perform <ChildClass> initialization actions 231 DEBUG_ONLY(_run_state = PRE_RUN;) 232 this->pre_run(); 233 234 // Invoke <ChildClass>::run() 235 DEBUG_ONLY(_run_state = RUN;) 236 this->run(); 237 // Returned from <ChildClass>::run(). Thread finished. 238 239 // Perform common tear-down actions 240 241 assert(Thread::current_or_null() != nullptr, "current thread is unset"); 242 assert(Thread::current_or_null() == this, "current thread is wrong"); 243 244 // Perform <ChildClass> tear-down actions 245 DEBUG_ONLY(_run_state = POST_RUN;) 246 this->post_run(); 247 248 // Note: at this point the thread object may already have deleted itself, 249 // so from here on do not dereference *this*. Not all thread types currently 250 // delete themselves when they terminate. But no thread should ever be deleted 251 // asynchronously with respect to its termination - that is what _run_state can 252 // be used to check. 253 254 assert(Thread::current_or_null() == nullptr, "current thread still present"); 255 } 256 257 Thread::~Thread() { 258 259 // Attached threads will remain in PRE_CALL_RUN, as will threads that don't actually 260 // get started due to errors etc. Any active thread should at least reach post_run 261 // before it is deleted (usually in post_run()). 262 assert(_run_state == PRE_CALL_RUN || 263 _run_state == POST_RUN, "Active Thread deleted before post_run(): " 264 "_run_state=%d", (int)_run_state); 265 266 // Notify the barrier set that a thread is being destroyed. Note that a barrier 267 // set might not be available if we encountered errors during bootstrapping. 268 BarrierSet* const barrier_set = BarrierSet::barrier_set(); 269 if (barrier_set != nullptr) { 270 barrier_set->on_thread_destroy(this); 271 } 272 273 // deallocate data structures 274 delete resource_area(); 275 // since the handle marks are using the handle area, we have to deallocated the root 276 // handle mark before deallocating the thread's handle area, 277 assert(last_handle_mark() != nullptr, "check we have an element"); 278 delete last_handle_mark(); 279 assert(last_handle_mark() == nullptr, "check we have reached the end"); 280 281 ParkEvent::Release(_ParkEvent); 282 // Set to null as a termination indicator for has_terminated(). 283 Atomic::store(&_ParkEvent, (ParkEvent*)nullptr); 284 285 delete handle_area(); 286 delete metadata_handles(); 287 288 // osthread() can be null, if creation of thread failed. 289 if (osthread() != nullptr) os::free_thread(osthread()); 290 291 // Clear Thread::current if thread is deleting itself and it has not 292 // already been done. This must be done before the memory is deallocated. 293 // Needed to ensure JNI correctly detects non-attached threads. 294 if (this == Thread::current_or_null()) { 295 Thread::clear_thread_current(); 296 } 297 298 CHECK_UNHANDLED_OOPS_ONLY(if (CheckUnhandledOops) delete unhandled_oops();) 299 } 300 301 #ifdef ASSERT 302 // A JavaThread is considered dangling if it not handshake-safe with respect to 303 // the current thread, it is not on a ThreadsList, or not at safepoint. 304 void Thread::check_for_dangling_thread_pointer(Thread *thread) { 305 assert(!thread->is_Java_thread() || 306 JavaThread::cast(thread)->is_handshake_safe_for(Thread::current()) || 307 !JavaThread::cast(thread)->on_thread_list() || 308 SafepointSynchronize::is_at_safepoint() || 309 ThreadsSMRSupport::is_a_protected_JavaThread_with_lock(JavaThread::cast(thread)), 310 "possibility of dangling Thread pointer"); 311 } 312 #endif 313 314 // Is the target JavaThread protected by the calling Thread or by some other 315 // mechanism? 316 // 317 bool Thread::is_JavaThread_protected(const JavaThread* target) { 318 Thread* current_thread = Thread::current(); 319 320 // Do the simplest check first: 321 if (SafepointSynchronize::is_at_safepoint()) { 322 // The target is protected since JavaThreads cannot exit 323 // while we're at a safepoint. 324 return true; 325 } 326 327 // If the target hasn't been started yet then it is trivially 328 // "protected". We assume the caller is the thread that will do 329 // the starting. 330 if (target->osthread() == nullptr || target->osthread()->get_state() <= INITIALIZED) { 331 return true; 332 } 333 334 // Now make the simple checks based on who the caller is: 335 if (current_thread == target || Threads_lock->owner() == current_thread) { 336 // Target JavaThread is self or calling thread owns the Threads_lock. 337 // Second check is the same as Threads_lock->owner_is_self(), 338 // but we already have the current thread so check directly. 339 return true; 340 } 341 342 // Check the ThreadsLists associated with the calling thread (if any) 343 // to see if one of them protects the target JavaThread: 344 if (is_JavaThread_protected_by_TLH(target)) { 345 return true; 346 } 347 348 // Use this debug code with -XX:+UseNewCode to diagnose locations that 349 // are missing a ThreadsListHandle or other protection mechanism: 350 // guarantee(!UseNewCode, "current_thread=" INTPTR_FORMAT " is not protecting target=" 351 // INTPTR_FORMAT, p2i(current_thread), p2i(target)); 352 353 // Note: Since 'target' isn't protected by a TLH, the call to 354 // target->is_handshake_safe_for() may crash, but we have debug bits so 355 // we'll be able to figure out what protection mechanism is missing. 356 assert(target->is_handshake_safe_for(current_thread), "JavaThread=" INTPTR_FORMAT 357 " is not protected and not handshake safe.", p2i(target)); 358 359 // The target JavaThread is not protected so it is not safe to query: 360 return false; 361 } 362 363 // Is the target JavaThread protected by a ThreadsListHandle (TLH) associated 364 // with the calling Thread? 365 // 366 bool Thread::is_JavaThread_protected_by_TLH(const JavaThread* target) { 367 Thread* current_thread = Thread::current(); 368 369 // Check the ThreadsLists associated with the calling thread (if any) 370 // to see if one of them protects the target JavaThread: 371 for (SafeThreadsListPtr* stlp = current_thread->_threads_list_ptr; 372 stlp != nullptr; stlp = stlp->previous()) { 373 if (stlp->list()->includes(target)) { 374 // The target JavaThread is protected by this ThreadsList: 375 return true; 376 } 377 } 378 379 // The target JavaThread is not protected by a TLH so it is not safe to query: 380 return false; 381 } 382 383 void Thread::set_priority(Thread* thread, ThreadPriority priority) { 384 debug_only(check_for_dangling_thread_pointer(thread);) 385 // Can return an error! 386 (void)os::set_priority(thread, priority); 387 } 388 389 390 void Thread::start(Thread* thread) { 391 // Start is different from resume in that its safety is guaranteed by context or 392 // being called from a Java method synchronized on the Thread object. 393 if (thread->is_Java_thread()) { 394 // Initialize the thread state to RUNNABLE before starting this thread. 395 // Can not set it after the thread started because we do not know the 396 // exact thread state at that time. It could be in MONITOR_WAIT or 397 // in SLEEPING or some other state. 398 java_lang_Thread::set_thread_status(JavaThread::cast(thread)->threadObj(), 399 JavaThreadStatus::RUNNABLE); 400 } 401 os::start_thread(thread); 402 } 403 404 // GC Support 405 bool Thread::claim_par_threads_do(uintx claim_token) { 406 uintx token = _threads_do_token; 407 if (token != claim_token) { 408 uintx res = Atomic::cmpxchg(&_threads_do_token, token, claim_token); 409 if (res == token) { 410 return true; 411 } 412 guarantee(res == claim_token, "invariant"); 413 } 414 return false; 415 } 416 417 void Thread::oops_do_no_frames(OopClosure* f, NMethodClosure* cf) { 418 // Do oop for ThreadShadow 419 f->do_oop((oop*)&_pending_exception); 420 handle_area()->oops_do(f); 421 } 422 423 // If the caller is a NamedThread, then remember, in the current scope, 424 // the given JavaThread in its _processed_thread field. 425 class RememberProcessedThread: public StackObj { 426 NamedThread* _cur_thr; 427 public: 428 RememberProcessedThread(Thread* thread) { 429 Thread* self = Thread::current(); 430 if (self->is_Named_thread()) { 431 _cur_thr = (NamedThread *)self; 432 assert(_cur_thr->processed_thread() == nullptr, "nesting not supported"); 433 _cur_thr->set_processed_thread(thread); 434 } else { 435 _cur_thr = nullptr; 436 } 437 } 438 439 ~RememberProcessedThread() { 440 if (_cur_thr) { 441 assert(_cur_thr->processed_thread() != nullptr, "nesting not supported"); 442 _cur_thr->set_processed_thread(nullptr); 443 } 444 } 445 }; 446 447 void Thread::oops_do(OopClosure* f, NMethodClosure* cf) { 448 // Record JavaThread to GC thread 449 RememberProcessedThread rpt(this); 450 oops_do_no_frames(f, cf); 451 oops_do_frames(f, cf); 452 } 453 454 void Thread::metadata_handles_do(void f(Metadata*)) { 455 // Only walk the Handles in Thread. 456 if (metadata_handles() != nullptr) { 457 for (int i = 0; i< metadata_handles()->length(); i++) { 458 f(metadata_handles()->at(i)); 459 } 460 } 461 } 462 463 void Thread::print_on(outputStream* st, bool print_extended_info) const { 464 // get_priority assumes osthread initialized 465 if (osthread() != nullptr) { 466 int os_prio; 467 if (os::get_native_priority(this, &os_prio) == OS_OK) { 468 st->print("os_prio=%d ", os_prio); 469 } 470 471 st->print("cpu=%.2fms ", 472 (double)os::thread_cpu_time(const_cast<Thread*>(this), true) / 1000000.0 473 ); 474 st->print("elapsed=%.2fs ", 475 (double)_statistical_info.getElapsedTime() / 1000.0 476 ); 477 if (is_Java_thread() && (PrintExtendedThreadInfo || print_extended_info)) { 478 size_t allocated_bytes = (size_t) const_cast<Thread*>(this)->cooked_allocated_bytes(); 479 st->print("allocated=" SIZE_FORMAT "%s ", 480 byte_size_in_proper_unit(allocated_bytes), 481 proper_unit_for_byte_size(allocated_bytes) 482 ); 483 st->print("defined_classes=" INT64_FORMAT " ", _statistical_info.getDefineClassCount()); 484 } 485 486 st->print("tid=" INTPTR_FORMAT " ", p2i(this)); 487 if (!is_Java_thread() || !JavaThread::cast(this)->is_vthread_mounted()) { 488 osthread()->print_on(st); 489 } 490 } 491 ThreadsSMRSupport::print_info_on(this, st); 492 st->print(" "); 493 debug_only(if (WizardMode) print_owned_locks_on(st);) 494 } 495 496 void Thread::print() const { print_on(tty); } 497 498 // Thread::print_on_error() is called by fatal error handler. Don't use 499 // any lock or allocate memory. 500 void Thread::print_on_error(outputStream* st, char* buf, int buflen) const { 501 assert(!(is_Compiler_thread() || is_Java_thread()), "Can't call name() here if it allocates"); 502 503 st->print("%s \"%s\"", type_name(), name()); 504 505 OSThread* os_thr = osthread(); 506 if (os_thr != nullptr) { 507 st->fill_to(67); 508 if (os_thr->get_state() != ZOMBIE) { 509 // Use raw field members for stack base/size as this could be 510 // called before a thread has run enough to initialize them. 511 st->print(" [id=%d, stack(" PTR_FORMAT "," PTR_FORMAT ") (" PROPERFMT ")]", 512 osthread()->thread_id(), p2i(_stack_base - _stack_size), p2i(_stack_base), 513 PROPERFMTARGS(_stack_size)); 514 } else { 515 st->print(" terminated"); 516 } 517 } else { 518 st->print(" unknown state (no osThread)"); 519 } 520 ThreadsSMRSupport::print_info_on(this, st); 521 } 522 523 void Thread::print_value_on(outputStream* st) const { 524 if (is_Named_thread()) { 525 st->print(" \"%s\" ", name()); 526 } 527 st->print(INTPTR_FORMAT, p2i(this)); // print address 528 } 529 530 #ifdef ASSERT 531 void Thread::print_owned_locks_on(outputStream* st) const { 532 Mutex* cur = _owned_locks; 533 if (cur == nullptr) { 534 st->print(" (no locks) "); 535 } else { 536 st->print_cr(" Locks owned:"); 537 while (cur) { 538 cur->print_on(st); 539 cur = cur->next(); 540 } 541 } 542 } 543 #endif // ASSERT 544 545 bool Thread::set_as_starting_thread() { 546 assert(_starting_thread == nullptr, "already initialized: " 547 "_starting_thread=" INTPTR_FORMAT, p2i(_starting_thread)); 548 // NOTE: this must be called inside the main thread. 549 DEBUG_ONLY(_starting_thread = this;) 550 return os::create_main_thread(JavaThread::cast(this)); 551 } 552 553 // Ad-hoc mutual exclusion primitives: SpinLock 554 // 555 // We employ SpinLocks _only for low-contention, fixed-length 556 // short-duration critical sections where we're concerned 557 // about native mutex_t or HotSpot Mutex:: latency. 558 // 559 // TODO-FIXME: ListLock should be of type SpinLock. 560 // We should make this a 1st-class type, integrated into the lock 561 // hierarchy as leaf-locks. Critically, the SpinLock structure 562 // should have sufficient padding to avoid false-sharing and excessive 563 // cache-coherency traffic. 564 565 566 typedef volatile int SpinLockT; 567 568 void Thread::SpinAcquire(volatile int * adr, const char * LockName) { 569 if (Atomic::cmpxchg(adr, 0, 1) == 0) { 570 return; // normal fast-path return 571 } 572 573 // Slow-path : We've encountered contention -- Spin/Yield/Block strategy. 574 int ctr = 0; 575 int Yields = 0; 576 for (;;) { 577 while (*adr != 0) { 578 ++ctr; 579 if ((ctr & 0xFFF) == 0 || !os::is_MP()) { 580 if (Yields > 5) { 581 os::naked_short_sleep(1); 582 } else { 583 os::naked_yield(); 584 ++Yields; 585 } 586 } else { 587 SpinPause(); 588 } 589 } 590 if (Atomic::cmpxchg(adr, 0, 1) == 0) return; 591 } 592 } 593 594 void Thread::SpinRelease(volatile int * adr) { 595 assert(*adr != 0, "invariant"); 596 OrderAccess::fence(); // guarantee at least release consistency. 597 // Roach-motel semantics. 598 // It's safe if subsequent LDs and STs float "up" into the critical section, 599 // but prior LDs and STs within the critical section can't be allowed 600 // to reorder or float past the ST that releases the lock. 601 // Loads and stores in the critical section - which appear in program 602 // order before the store that releases the lock - must also appear 603 // before the store that releases the lock in memory visibility order. 604 // Conceptually we need a #loadstore|#storestore "release" MEMBAR before 605 // the ST of 0 into the lock-word which releases the lock, so fence 606 // more than covers this on all platforms. 607 *adr = 0; 608 } 609 610 const char* ProfileVMCallContext::name(PerfTraceTime* t) { 611 return t->name(); 612 } 613 614 int ProfileVMCallContext::_perf_nested_runtime_calls_count = 0; 615 616 void ProfileVMCallContext::notify_nested_rt_call(PerfTraceTime* outer_timer, PerfTraceTime* inner_timer) { 617 log_debug(init)("Nested runtime call: inner=%s outer=%s", inner_timer->name(), outer_timer->name()); 618 Atomic::inc(&ProfileVMCallContext::_perf_nested_runtime_calls_count); 619 } 620