class CodeHeap : public CHeapObj<mtCode> {
friend class VMStructs; protected:
VirtualSpace _memory; // the memory holding the blocks
VirtualSpace _segmap; // the memory holding the segment map
size_t _number_of_committed_segments;
size_t _number_of_reserved_segments;
size_t _segment_size;
int _log2_segment_size;
size_t _next_segment;
FreeBlock* _freelist;
FreeBlock* _last_insert_point; // last insert point in add_to_freelist
size_t _freelist_segments; // No. of segments in freelist
int _freelist_length;
size_t _max_allocated_capacity; // Peak capacity that was allocated during lifetime of the heap
const char* _name; // Name of the CodeHeap const CodeBlobType _code_blob_type; // CodeBlobType it contains
int _blob_count; // Number of CodeBlobs
int _nmethod_count; // Number of nmethods
int _adapter_count; // Number of adapters
int _full_count; // Number of times the code heap was full
int _fragmentation_count; // #FreeBlock joins without fully initializing segment map elements.
enum { free_sentinel = 0xFF }; staticconst int fragmentation_limit = 10000; // defragment after that many potential fragmentations. staticconst int freelist_limit = 100; // improve insert point search if list is longer than this limit. static char segmap_template[free_sentinel+1];
// Memory allocation void* allocate (size_t size); // Allocate 'size' bytes in the code cache or return NULL void deallocate(void* p); // Deallocate memory // Free the tail of segments allocated by the last call to 'allocate()' which exceed 'used_size'. // ATTENTION: this is only safe to use if there was no other call to 'allocate()' after // 'p' was allocated. Only intended for freeing memory which would be otherwise // wasted after the interpreter generation because we don't know the interpreter size // beforehand and we also can't easily relocate the interpreter to a new location. void deallocate_tail(void* p, size_t used_size);
// Containment means "contained in committed space". bool contains(constvoid* p) const { return low() <= p && p < high(); } bool contains_blob(const CodeBlob* blob) const { return contains((void*)blob);
}
virtualvoid* find_start(void* p) const; // returns the block containing p or NULL virtual CodeBlob* find_blob(void* start) const;
size_t alignment_unit() const; // alignment of any block
size_t alignment_offset() const; // offset of first byte of any block, within the enclosing alignment unit static size_t header_size() { returnsizeof(HeapBlock); } // returns the header size for each heap block
size_t segment_size() const { return _segment_size; } // for CodeHeapState
HeapBlock* first_block() const; // for CodeHeapState
HeapBlock* next_block(HeapBlock* b) const; // for CodeHeapState
HeapBlock* split_block(HeapBlock* b, size_t split_seg); // split one block into two
FreeBlock* freelist() const { return _freelist; } // for CodeHeapState
size_t allocated_in_freelist() const { return _freelist_segments * CodeCacheSegmentSize; }
int freelist_length() const { return _freelist_length; } // number of elements in the freelist
// returns the first block or NULL virtualvoid* first() const { return next_used(first_block()); } // returns the next block given a block p or NULL virtualvoid* next(void* p) const { return next_used(next_block(block_start(p))); }
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.