1.1 --- a/src/share/vm/memory/heap.hpp Tue Apr 16 10:04:01 2013 -0700 1.2 +++ b/src/share/vm/memory/heap.hpp Thu Apr 11 13:57:44 2013 +0200 1.3 @@ -91,11 +91,11 @@ 1.4 size_t _next_segment; 1.5 1.6 FreeBlock* _freelist; 1.7 - size_t _free_segments; // No. of segments in freelist 1.8 + size_t _freelist_segments; // No. of segments in freelist 1.9 1.10 // Helper functions 1.11 - size_t number_of_segments(size_t size) const { return (size + _segment_size - 1) >> _log2_segment_size; } 1.12 - size_t size(size_t number_of_segments) const { return number_of_segments << _log2_segment_size; } 1.13 + size_t size_to_segments(size_t size) const { return (size + _segment_size - 1) >> _log2_segment_size; } 1.14 + size_t segments_to_size(size_t number_of_segments) const { return number_of_segments << _log2_segment_size; } 1.15 1.16 size_t segment_for(void* p) const { return ((char*)p - _memory.low()) >> _log2_segment_size; } 1.17 HeapBlock* block_at(size_t i) const { return (HeapBlock*)(_memory.low() + (i << _log2_segment_size)); } 1.18 @@ -110,7 +110,7 @@ 1.19 1.20 // Toplevel freelist management 1.21 void add_to_freelist(HeapBlock *b); 1.22 - FreeBlock* search_freelist(size_t length); 1.23 + FreeBlock* search_freelist(size_t length, bool is_critical); 1.24 1.25 // Iteration helpers 1.26 void* next_free(HeapBlock* b) const; 1.27 @@ -132,22 +132,19 @@ 1.28 void clear(); // clears all heap contents 1.29 1.30 // Memory allocation 1.31 - void* allocate (size_t size); // allocates a block of size or returns NULL 1.32 + void* allocate (size_t size, bool is_critical); // allocates a block of size or returns NULL 1.33 void deallocate(void* p); // deallocates a block 1.34 1.35 // Attributes 1.36 - void* begin() const { return _memory.low (); } 1.37 - void* end() const { return _memory.high(); } 1.38 - bool contains(void* p) const { return begin() <= p && p < end(); } 1.39 - void* find_start(void* p) const; // returns the block containing p or NULL 1.40 - size_t alignment_unit() const; // alignment of any block 1.41 - size_t alignment_offset() const; // offset of first byte of any block, within the enclosing alignment unit 1.42 - static size_t header_size(); // returns the header size for each heap block 1.43 + char* low_boundary() const { return _memory.low_boundary (); } 1.44 + char* high() const { return _memory.high(); } 1.45 + char* high_boundary() const { return _memory.high_boundary(); } 1.46 1.47 - // Returns reserved area high and low addresses 1.48 - char *low_boundary() const { return _memory.low_boundary (); } 1.49 - char *high() const { return _memory.high(); } 1.50 - char *high_boundary() const { return _memory.high_boundary(); } 1.51 + bool contains(const void* p) const { return low_boundary() <= p && p < high(); } 1.52 + void* find_start(void* p) const; // returns the block containing p or NULL 1.53 + size_t alignment_unit() const; // alignment of any block 1.54 + size_t alignment_offset() const; // offset of first byte of any block, within the enclosing alignment unit 1.55 + static size_t header_size(); // returns the header size for each heap block 1.56 1.57 // Iteration 1.58 1.59 @@ -161,8 +158,11 @@ 1.60 size_t max_capacity() const; 1.61 size_t allocated_capacity() const; 1.62 size_t unallocated_capacity() const { return max_capacity() - allocated_capacity(); } 1.63 - size_t largest_free_block() const; 1.64 1.65 +private: 1.66 + size_t heap_unallocated_capacity() const; 1.67 + 1.68 +public: 1.69 // Debugging 1.70 void verify(); 1.71 void print() PRODUCT_RETURN;