334 ThreadLocalStorage::set_thread(this);
335 assert(Thread::current() == ThreadLocalStorage::thread(), "TLS mismatch!");
336 }
337
338 void Thread::clear_thread_current() {
339 assert(Thread::current() == ThreadLocalStorage::thread(), "TLS mismatch!");
340 #ifndef USE_LIBRARY_BASED_TLS_ONLY
341 _thr_current = NULL;
342 #endif
343 ThreadLocalStorage::set_thread(NULL);
344 }
345
346 void Thread::record_stack_base_and_size() {
347 // Note: at this point, Thread object is not yet initialized. Do not rely on
348 // any members being initialized. Do not rely on Thread::current() being set.
349 // If possible, refrain from doing anything which may crash or assert since
350 // quite probably those crash dumps will be useless.
351 set_stack_base(os::current_stack_base());
352 set_stack_size(os::current_stack_size());
353
354 #ifdef SOLARIS
355 if (os::is_primordial_thread()) {
356 os::Solaris::correct_stack_boundaries_for_primordial_thread(this);
357 }
358 #endif
359
360 // Set stack limits after thread is initialized.
361 if (is_Java_thread()) {
362 ((JavaThread*) this)->set_stack_overflow_limit();
363 ((JavaThread*) this)->set_reserved_stack_activation(stack_base());
364 }
365 }
366
367 #if INCLUDE_NMT
368 void Thread::register_thread_stack_with_NMT() {
369 MemTracker::record_thread_stack(stack_end(), stack_size());
370 }
371 #endif // INCLUDE_NMT
372
373 void Thread::call_run() {
374 DEBUG_ONLY(_run_state = CALL_RUN;)
375
376 // At this point, Thread object should be fully initialized and
377 // Thread::current() should be set.
378
379 assert(Thread::current_or_null() != NULL, "current thread is unset");
|
334 ThreadLocalStorage::set_thread(this);
335 assert(Thread::current() == ThreadLocalStorage::thread(), "TLS mismatch!");
336 }
337
338 void Thread::clear_thread_current() {
339 assert(Thread::current() == ThreadLocalStorage::thread(), "TLS mismatch!");
340 #ifndef USE_LIBRARY_BASED_TLS_ONLY
341 _thr_current = NULL;
342 #endif
343 ThreadLocalStorage::set_thread(NULL);
344 }
345
346 void Thread::record_stack_base_and_size() {
347 // Note: at this point, Thread object is not yet initialized. Do not rely on
348 // any members being initialized. Do not rely on Thread::current() being set.
349 // If possible, refrain from doing anything which may crash or assert since
350 // quite probably those crash dumps will be useless.
351 set_stack_base(os::current_stack_base());
352 set_stack_size(os::current_stack_size());
353
354 // Set stack limits after thread is initialized.
355 if (is_Java_thread()) {
356 ((JavaThread*) this)->set_stack_overflow_limit();
357 ((JavaThread*) this)->set_reserved_stack_activation(stack_base());
358 }
359 }
360
361 #if INCLUDE_NMT
362 void Thread::register_thread_stack_with_NMT() {
363 MemTracker::record_thread_stack(stack_end(), stack_size());
364 }
365 #endif // INCLUDE_NMT
366
367 void Thread::call_run() {
368 DEBUG_ONLY(_run_state = CALL_RUN;)
369
370 // At this point, Thread object should be fully initialized and
371 // Thread::current() should be set.
372
373 assert(Thread::current_or_null() != NULL, "current thread is unset");
|