< prev index next >

src/hotspot/share/memory/heap.cpp

Print this page




 398 HeapBlock* CodeHeap::block_start(void* q) const {
 399   HeapBlock* b = (HeapBlock*)find_start(q);
 400   if (b == NULL) return NULL;
 401   return b - 1;
 402 }
 403 
 404 // Returns the next Heap block an offset into one
 405 HeapBlock* CodeHeap::next_block(HeapBlock *b) const {
 406   if (b == NULL) return NULL;
 407   size_t i = segment_for(b) + b->length();
 408   if (i < _next_segment)
 409     return block_at(i);
 410   return NULL;
 411 }
 412 
 413 
 414 // Returns current capacity
 415 size_t CodeHeap::capacity() const {
 416   return _memory.committed_size();
 417 }
 418 d
 419 size_t CodeHeap::max_capacity() const {
 420   return _memory.reserved_size();
 421 }
 422 
 423 int CodeHeap::allocated_segments() const {
 424   return (int)_next_segment;
 425 }
 426 
 427 size_t CodeHeap::allocated_capacity() const {
 428   // size of used heap - size on freelist
 429   return segments_to_size(_next_segment - _freelist_segments);
 430 }
 431 
 432 // Returns size of the unallocated heap block
 433 size_t CodeHeap::heap_unallocated_capacity() const {
 434   // Total number of segments - number currently used
 435   return segments_to_size(_number_of_reserved_segments - _next_segment);
 436 }
 437 
 438 // Free list management




 398 HeapBlock* CodeHeap::block_start(void* q) const {
 399   HeapBlock* b = (HeapBlock*)find_start(q);
 400   if (b == NULL) return NULL;
 401   return b - 1;
 402 }
 403 
 404 // Returns the next Heap block an offset into one
 405 HeapBlock* CodeHeap::next_block(HeapBlock *b) const {
 406   if (b == NULL) return NULL;
 407   size_t i = segment_for(b) + b->length();
 408   if (i < _next_segment)
 409     return block_at(i);
 410   return NULL;
 411 }
 412 
 413 
 414 // Returns current capacity
 415 size_t CodeHeap::capacity() const {
 416   return _memory.committed_size();
 417 }
 418 
 419 size_t CodeHeap::max_capacity() const {
 420   return _memory.reserved_size();
 421 }
 422 
 423 int CodeHeap::allocated_segments() const {
 424   return (int)_next_segment;
 425 }
 426 
 427 size_t CodeHeap::allocated_capacity() const {
 428   // size of used heap - size on freelist
 429   return segments_to_size(_next_segment - _freelist_segments);
 430 }
 431 
 432 // Returns size of the unallocated heap block
 433 size_t CodeHeap::heap_unallocated_capacity() const {
 434   // Total number of segments - number currently used
 435   return segments_to_size(_number_of_reserved_segments - _next_segment);
 436 }
 437 
 438 // Free list management


< prev index next >