295 }
296 #endif /* ASSERT */
297 }
298
299 void Thread::initialize_thread_local_storage() {
300 // Note: Make sure this method only calls
301 // non-blocking operations. Otherwise, it might not work
302 // with the thread-startup/safepoint interaction.
303
304 // During Java thread startup, safepoint code should allow this
305 // method to complete because it may need to allocate memory to
306 // store information for the new thread.
307
308 // initialize structure dependent on thread local storage
309 ThreadLocalStorage::set_thread(this);
310 }
311
312 void Thread::record_stack_base_and_size() {
313 set_stack_base(os::current_stack_base());
314 set_stack_size(os::current_stack_size());
315 // CR 7190089: on Solaris, primordial thread's stack is adjusted
316 // in initialize_thread(). Without the adjustment, stack size is
317 // incorrect if stack is set to unlimited (ulimit -s unlimited).
318 // So far, only Solaris has real implementation of initialize_thread().
319 //
320 // set up any platform-specific state.
321 os::initialize_thread(this);
322
323 #if INCLUDE_NMT
324 // record thread's native stack, stack grows downward
325 address stack_low_addr = stack_base() - stack_size();
326 MemTracker::record_thread_stack(stack_low_addr, stack_size(), this,
327 CURRENT_PC);
328 #endif // INCLUDE_NMT
329 }
330
331
332 Thread::~Thread() {
333 // Reclaim the objectmonitors from the omFreeList of the moribund thread.
334 ObjectSynchronizer::omFlush (this) ;
|
295 }
296 #endif /* ASSERT */
297 }
298
299 void Thread::initialize_thread_local_storage() {
300 // Note: Make sure this method only calls
301 // non-blocking operations. Otherwise, it might not work
302 // with the thread-startup/safepoint interaction.
303
304 // During Java thread startup, safepoint code should allow this
305 // method to complete because it may need to allocate memory to
306 // store information for the new thread.
307
308 // initialize structure dependent on thread local storage
309 ThreadLocalStorage::set_thread(this);
310 }
311
312 void Thread::record_stack_base_and_size() {
313 set_stack_base(os::current_stack_base());
314 set_stack_size(os::current_stack_size());
315 if (is_Java_thread()) {
316 ((JavaThread*) this)->set_stack_overflow_limit();
317 }
318 // CR 7190089: on Solaris, primordial thread's stack is adjusted
319 // in initialize_thread(). Without the adjustment, stack size is
320 // incorrect if stack is set to unlimited (ulimit -s unlimited).
321 // So far, only Solaris has real implementation of initialize_thread().
322 //
323 // set up any platform-specific state.
324 os::initialize_thread(this);
325
326 #if INCLUDE_NMT
327 // record thread's native stack, stack grows downward
328 address stack_low_addr = stack_base() - stack_size();
329 MemTracker::record_thread_stack(stack_low_addr, stack_size(), this,
330 CURRENT_PC);
331 #endif // INCLUDE_NMT
332 }
333
334
335 Thread::~Thread() {
336 // Reclaim the objectmonitors from the omFreeList of the moribund thread.
337 ObjectSynchronizer::omFlush (this) ;
|