316 void Thread::record_stack_base_and_size() { |
316 void Thread::record_stack_base_and_size() { |
317 set_stack_base(os::current_stack_base()); |
317 set_stack_base(os::current_stack_base()); |
318 set_stack_size(os::current_stack_size()); |
318 set_stack_size(os::current_stack_size()); |
319 |
319 |
320 // record thread's native stack, stack grows downward |
320 // record thread's native stack, stack grows downward |
321 address vm_base = _stack_base - _stack_size; |
321 address low_stack_addr = stack_base() - stack_size(); |
322 MemTracker::record_virtual_memory_reserve(vm_base, _stack_size, |
322 MemTracker::record_thread_stack(low_stack_addr, stack_size(), this, |
323 CURRENT_PC, this); |
323 CURRENT_PC); |
324 MemTracker::record_virtual_memory_type(vm_base, mtThreadStack); |
|
325 } |
324 } |
326 |
325 |
327 |
326 |
328 Thread::~Thread() { |
327 Thread::~Thread() { |
329 // Reclaim the objectmonitors from the omFreeList of the moribund thread. |
328 // Reclaim the objectmonitors from the omFreeList of the moribund thread. |
330 ObjectSynchronizer::omFlush (this) ; |
329 ObjectSynchronizer::omFlush (this) ; |
331 |
330 |
332 MemTracker::record_virtual_memory_release((_stack_base - _stack_size), |
331 address low_stack_addr = stack_base() - stack_size(); |
333 _stack_size, this); |
332 MemTracker::release_thread_stack(low_stack_addr, stack_size(), this); |
334 |
333 |
335 // deallocate data structures |
334 // deallocate data structures |
336 delete resource_area(); |
335 delete resource_area(); |
337 // since the handle marks are using the handle area, we have to deallocated the root |
336 // since the handle marks are using the handle area, we have to deallocated the root |
338 // handle mark before deallocating the thread's handle area, |
337 // handle mark before deallocating the thread's handle area, |