345 // - adjust_obj_size and adjust_pointers() 346 // - obj_size and compact(). 347 // 348 // Additionally, this also means that changes to block_size() or block_is_obj() that 349 // should be effective during the compaction operations must provide a corresponding 350 // definition of scanned_block_size/scanned_block_is_obj respectively. 351 class CompactibleSpace: public Space { 352 friend class VMStructs; 353 friend class CompactibleFreeListSpace; 354 private: 355 HeapWord* _compaction_top; 356 CompactibleSpace* _next_compaction_space; 357 358 // Auxiliary functions for scan_and_{forward,adjust_pointers,compact} support. 359 inline size_t adjust_obj_size(size_t size) const { 360 return size; 361 } 362 363 inline size_t obj_size(const HeapWord* addr) const; 364 365 public: 366 CompactibleSpace() : 367 _compaction_top(NULL), _next_compaction_space(NULL) {} 368 369 virtual void initialize(MemRegion mr, bool clear_space, bool mangle_space); 370 virtual void clear(bool mangle_space); 371 372 // Used temporarily during a compaction phase to hold the value 373 // top should have when compaction is complete. 374 HeapWord* compaction_top() const { return _compaction_top; } 375 376 void set_compaction_top(HeapWord* value) { 377 assert(value == NULL || (value >= bottom() && value <= end()), 378 "should point inside space"); 379 _compaction_top = value; 380 } 381 382 // Perform operations on the space needed after a compaction 383 // has been performed. 384 virtual void reset_after_compaction() = 0; | 345 // - adjust_obj_size and adjust_pointers() 346 // - obj_size and compact(). 347 // 348 // Additionally, this also means that changes to block_size() or block_is_obj() that 349 // should be effective during the compaction operations must provide a corresponding 350 // definition of scanned_block_size/scanned_block_is_obj respectively. 351 class CompactibleSpace: public Space { 352 friend class VMStructs; 353 friend class CompactibleFreeListSpace; 354 private: 355 HeapWord* _compaction_top; 356 CompactibleSpace* _next_compaction_space; 357 358 // Auxiliary functions for scan_and_{forward,adjust_pointers,compact} support. 359 inline size_t adjust_obj_size(size_t size) const { 360 return size; 361 } 362 363 inline size_t obj_size(const HeapWord* addr) const; 364 365 void verify_up_to_first_dead() PRODUCT_RETURN; 366 367 public: 368 CompactibleSpace() : 369 _compaction_top(NULL), _next_compaction_space(NULL) {} 370 371 virtual void initialize(MemRegion mr, bool clear_space, bool mangle_space); 372 virtual void clear(bool mangle_space); 373 374 // Used temporarily during a compaction phase to hold the value 375 // top should have when compaction is complete. 376 HeapWord* compaction_top() const { return _compaction_top; } 377 378 void set_compaction_top(HeapWord* value) { 379 assert(value == NULL || (value >= bottom() && value <= end()), 380 "should point inside space"); 381 _compaction_top = value; 382 } 383 384 // Perform operations on the space needed after a compaction 385 // has been performed. 386 virtual void reset_after_compaction() = 0; |