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.
|
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 template <class SpaceType>
366 static inline void verify_up_to_first_dead(SpaceType* space) NOT_DEBUG_RETURN;
367
368 template <class SpaceType>
369 static inline void clear_empty_region(SpaceType* space);
370
371 public:
372 CompactibleSpace() :
373 _compaction_top(NULL), _next_compaction_space(NULL) {}
374
375 virtual void initialize(MemRegion mr, bool clear_space, bool mangle_space);
376 virtual void clear(bool mangle_space);
377
378 // Used temporarily during a compaction phase to hold the value
379 // top should have when compaction is complete.
380 HeapWord* compaction_top() const { return _compaction_top; }
381
382 void set_compaction_top(HeapWord* value) {
383 assert(value == NULL || (value >= bottom() && value <= end()),
384 "should point inside space");
385 _compaction_top = value;
386 }
387
388 // Perform operations on the space needed after a compaction
389 // has been performed.
|