132 HeapBlock* first_block() const;
133 HeapBlock* next_block(HeapBlock* b) const;
134 HeapBlock* block_start(void* p) const;
135
136 // to perform additional actions on creation of executable code
137 void on_code_mapping(char* base, size_t size);
138 void clear(); // clears all heap contents
139
140 public:
141 CodeHeap(const char* name, const int code_blob_type);
142
143 // Heap extents
144 bool reserve(ReservedSpace rs, size_t committed_size, size_t segment_size);
145 bool expand_by(size_t size); // expands committed memory by size
146
147 // Memory allocation
148 void* allocate (size_t size); // Allocate 'size' bytes in the code cache or return NULL
149 void deallocate(void* p); // Deallocate memory
150
151 // Attributes
152 char* low_boundary() const { return _memory.low_boundary (); }
153 char* high() const { return _memory.high(); }
154 char* high_boundary() const { return _memory.high_boundary(); }
155
156 virtual bool contains(const void* p) const { return low_boundary() <= p && p < high(); }
157 virtual bool contains_blob(const CodeBlob* blob) const { return low_boundary() <= (char*) blob && (char*) blob < high(); }
158
159 virtual void* find_start(void* p) const; // returns the block containing p or NULL
160 virtual CodeBlob* find_blob_unsafe(void* start) const;
161 size_t alignment_unit() const; // alignment of any block
162 size_t alignment_offset() const; // offset of first byte of any block, within the enclosing alignment unit
163 static size_t header_size(); // returns the header size for each heap block
164
165 size_t allocated_in_freelist() const { return _freelist_segments * CodeCacheSegmentSize; }
166 int freelist_length() const { return _freelist_length; } // number of elements in the freelist
167
168 // returns the first block or NULL
169 virtual void* first() const { return next_used(first_block()); }
170 // returns the next block given a block p or NULL
171 virtual void* next(void* p) const { return next_used(next_block(block_start(p))); }
172
173 // Statistics
174 size_t capacity() const;
175 size_t max_capacity() const;
176 int allocated_segments() const;
177 size_t allocated_capacity() const;
|
132 HeapBlock* first_block() const;
133 HeapBlock* next_block(HeapBlock* b) const;
134 HeapBlock* block_start(void* p) const;
135
136 // to perform additional actions on creation of executable code
137 void on_code_mapping(char* base, size_t size);
138 void clear(); // clears all heap contents
139
140 public:
141 CodeHeap(const char* name, const int code_blob_type);
142
143 // Heap extents
144 bool reserve(ReservedSpace rs, size_t committed_size, size_t segment_size);
145 bool expand_by(size_t size); // expands committed memory by size
146
147 // Memory allocation
148 void* allocate (size_t size); // Allocate 'size' bytes in the code cache or return NULL
149 void deallocate(void* p); // Deallocate memory
150
151 // Attributes
152 char* low_boundary() const { return _memory.low_boundary(); }
153 char* high() const { return _memory.high(); }
154 char* high_boundary() const { return _memory.high_boundary(); }
155
156 bool contains(const void* p) const { return low_boundary() <= p && p < high(); }
157 bool contains_blob(const CodeBlob* blob) const { return low_boundary() <= (char*) blob && (char*) blob < high(); }
158
159 virtual void* find_start(void* p) const; // returns the block containing p or NULL
160 virtual CodeBlob* find_blob_unsafe(void* start) const;
161 size_t alignment_unit() const; // alignment of any block
162 size_t alignment_offset() const; // offset of first byte of any block, within the enclosing alignment unit
163 static size_t header_size(); // returns the header size for each heap block
164
165 size_t allocated_in_freelist() const { return _freelist_segments * CodeCacheSegmentSize; }
166 int freelist_length() const { return _freelist_length; } // number of elements in the freelist
167
168 // returns the first block or NULL
169 virtual void* first() const { return next_used(first_block()); }
170 // returns the next block given a block p or NULL
171 virtual void* next(void* p) const { return next_used(next_block(block_start(p))); }
172
173 // Statistics
174 size_t capacity() const;
175 size_t max_capacity() const;
176 int allocated_segments() const;
177 size_t allocated_capacity() const;
|