77 |
77 |
78 inline HandleMark::HandleMark() { |
78 inline HandleMark::HandleMark() { |
79 initialize(Thread::current()); |
79 initialize(Thread::current()); |
80 } |
80 } |
81 |
81 |
82 |
|
83 inline void HandleMark::push() { |
82 inline void HandleMark::push() { |
84 // This is intentionally a NOP. pop_and_restore will reset |
83 // This is intentionally a NOP. pop_and_restore will reset |
85 // values to the HandleMark further down the stack, typically |
84 // values to the HandleMark further down the stack, typically |
86 // in JavaCalls::call_helper. |
85 // in JavaCalls::call_helper. |
87 debug_only(_area->_handle_mark_nesting++); |
86 debug_only(_area->_handle_mark_nesting++); |
88 } |
87 } |
89 |
88 |
90 inline void HandleMark::pop_and_restore() { |
89 inline void HandleMark::pop_and_restore() { |
91 HandleArea* area = _area; // help compilers with poor alias analysis |
|
92 // Delete later chunks |
90 // Delete later chunks |
93 if( _chunk->next() ) { |
91 if(_chunk->next() != NULL) { |
94 // reset arena size before delete chunks. Otherwise, the total |
92 assert(_area->size_in_bytes() > size_in_bytes(), "Sanity check"); |
95 // arena size could exceed total chunk size |
93 chop_later_chunks(); |
96 assert(area->size_in_bytes() > size_in_bytes(), "Sanity check"); |
|
97 area->set_size_in_bytes(size_in_bytes()); |
|
98 _chunk->next_chop(); |
|
99 } else { |
94 } else { |
100 assert(area->size_in_bytes() == size_in_bytes(), "Sanity check"); |
95 assert(_area->size_in_bytes() == size_in_bytes(), "Sanity check"); |
101 } |
96 } |
102 // Roll back arena to saved top markers |
97 // Roll back arena to saved top markers |
103 area->_chunk = _chunk; |
98 _area->_chunk = _chunk; |
104 area->_hwm = _hwm; |
99 _area->_hwm = _hwm; |
105 area->_max = _max; |
100 _area->_max = _max; |
106 debug_only(area->_handle_mark_nesting--); |
101 debug_only(_area->_handle_mark_nesting--); |
107 } |
102 } |
108 |
103 |
109 inline HandleMarkCleaner::HandleMarkCleaner(Thread* thread) { |
104 inline HandleMarkCleaner::HandleMarkCleaner(Thread* thread) { |
110 _thread = thread; |
105 _thread = thread; |
111 _thread->last_handle_mark()->push(); |
106 _thread->last_handle_mark()->push(); |