// A simple single-linked list of chunks, used in MetaspaceArena to keep // a list of retired chunks, as well as in the ChunkHeaderPool to keep // a cache of unused chunk headers.
class MetachunkList {
Metachunk* _first;
IntCounter _num_chunks;
// Note: The chunks inside this list may be dead (->chunk header pool). // So, do not call c->word size on them or anything else which may not // work with dead chunks.
// Check that list does not contain the given chunk; Note that since that check // is expensive, it is subject to VerifyMetaspaceInterval.
DEBUG_ONLY(void verify_does_not_contain(const Metachunk* c) const;)
public:
MetachunkList() : _first(NULL), _num_chunks() {}
int count() const { return _num_chunks.get(); }
void add(Metachunk* c) {
DEBUG_ONLY(verify_does_not_contain(c);)
c->set_next(_first); if (_first) {
_first->set_prev(c);
}
_first = c;
_num_chunks.increment();
}
Metachunk* remove_first() { if (_first) {
Metachunk* c = _first;
_first = _first->next(); if (_first) {
_first->set_prev(NULL);
}
_num_chunks.decrement();
c->set_prev(NULL);
c->set_next(NULL); return c;
} return NULL;
}
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.