static uintx chunk_oops_do(OopClosure* f, Chunk* chunk, char* chunk_top) {
oop* bottom = (oop*) chunk->bottom();
oop* top = (oop*) chunk_top;
uintx handles_visited = top - bottom;
assert(top >= bottom && top <= (oop*) chunk->top(), "just checking"); // during GC phase 3, a handle may be a forward pointer that // is not yet valid, so loosen the assertion while (bottom < top) {
f->do_oop(bottom++);
} return handles_visited;
}
void HandleArea::oops_do(OopClosure* f) {
uintx handles_visited = 0; // First handle the current chunk. It is filled to the high water mark.
handles_visited += chunk_oops_do(f, _chunk, _hwm); // Then handle all previous chunks. They are completely filled.
Chunk* k = _first; while(k != _chunk) {
handles_visited += chunk_oops_do(f, k, k->top());
k = k->next();
}
if (_prev != NULL) _prev->oops_do(f);
}
void HandleMark::initialize(Thread* thread) {
_thread = thread; // Not the current thread during thread creation. // Save area
_area = thread->handle_area(); // Save current top
_chunk = _area->_chunk;
_hwm = _area->_hwm;
_max = _area->_max;
_size_in_bytes = _area->_size_in_bytes;
debug_only(_area->_handle_mark_nesting++);
assert(_area->_handle_mark_nesting > 0, "must stack allocate HandleMarks");
// Link this in the thread
set_previous_handle_mark(thread->last_handle_mark());
thread->set_last_handle_mark(this);
}
pop_and_restore(); #ifdef ASSERT // clear out first chunk (to detect allocation bugs) if (ZapVMHandleArea) {
memset(_hwm, badHandleValue, _max - _hwm);
} #endif
// Unlink this from the thread
_thread->set_last_handle_mark(previous_handle_mark());
}
void HandleMark::chop_later_chunks() { // reset arena size before delete chunks. Otherwise, the total // arena size could exceed total chunk size
_area->set_size_in_bytes(size_in_bytes());
_chunk->next_chop();
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.