465 // Minimum size of a free block.
466 virtual size_t minimum_free_block_size() const { return 0; }
467
468 // This the function is invoked when an allocation of an object covering
469 // "start" to "end occurs crosses the threshold; returns the next
470 // threshold. (The default implementation does nothing.)
471 virtual HeapWord* cross_threshold(HeapWord* start, HeapWord* the_end) {
472 return end();
473 }
474
475 // Below are template functions for scan_and_* algorithms (avoiding virtual calls).
476 // The space argument should be a subclass of CompactibleSpace, implementing
477 // scan_limit(), scanned_block_is_obj(), and scanned_block_size(),
478 // and possibly also overriding obj_size(), and adjust_obj_size().
479 // These functions should avoid virtual calls whenever possible.
480
481 #if INCLUDE_SERIALGC
482 // Frequently calls adjust_obj_size().
483 template <class SpaceType>
484 static inline void scan_and_adjust_pointers(SpaceType* space);
485 #endif
486
487 // Frequently calls obj_size().
488 template <class SpaceType>
489 static inline void scan_and_compact(SpaceType* space);
490
491 // Frequently calls scanned_block_is_obj() and scanned_block_size().
492 // Requires the scan_limit() function.
493 template <class SpaceType>
494 static inline void scan_and_forward(SpaceType* space, CompactPoint* cp);
495 };
496
497 class GenSpaceMangler;
498
499 // A space in which the free area is contiguous. It therefore supports
500 // faster allocation, and compaction.
501 class ContiguousSpace: public CompactibleSpace {
502 friend class VMStructs;
503 // Allow scan_and_forward function to call (private) overrides for auxiliary functions on this class
504 template <typename SpaceType>
505 friend void CompactibleSpace::scan_and_forward(SpaceType* space, CompactPoint* cp);
506
507 private:
508 // Auxiliary functions for scan_and_forward support.
509 // See comments for CompactibleSpace for more information.
510 inline HeapWord* scan_limit() const {
511 return top();
512 }
513
514 inline bool scanned_block_is_obj(const HeapWord* addr) const {
515 return true; // Always true, since scan_limit is top
516 }
517
518 inline size_t scanned_block_size(const HeapWord* addr) const;
519
520 protected:
521 HeapWord* _top;
522 HeapWord* _concurrent_iteration_safe_limit;
523 // A helper for mangling the unused area of the space in debug builds.
524 GenSpaceMangler* _mangler;
525
|
465 // Minimum size of a free block.
466 virtual size_t minimum_free_block_size() const { return 0; }
467
468 // This the function is invoked when an allocation of an object covering
469 // "start" to "end occurs crosses the threshold; returns the next
470 // threshold. (The default implementation does nothing.)
471 virtual HeapWord* cross_threshold(HeapWord* start, HeapWord* the_end) {
472 return end();
473 }
474
475 // Below are template functions for scan_and_* algorithms (avoiding virtual calls).
476 // The space argument should be a subclass of CompactibleSpace, implementing
477 // scan_limit(), scanned_block_is_obj(), and scanned_block_size(),
478 // and possibly also overriding obj_size(), and adjust_obj_size().
479 // These functions should avoid virtual calls whenever possible.
480
481 #if INCLUDE_SERIALGC
482 // Frequently calls adjust_obj_size().
483 template <class SpaceType>
484 static inline void scan_and_adjust_pointers(SpaceType* space);
485
486 // Frequently calls obj_size().
487 template <class SpaceType>
488 static inline void scan_and_compact(SpaceType* space);
489
490 // Frequently calls scanned_block_is_obj() and scanned_block_size().
491 // Requires the scan_limit() function.
492 template <class SpaceType>
493 static inline void scan_and_forward(SpaceType* space, CompactPoint* cp);
494 #endif
495 };
496
497 class GenSpaceMangler;
498
499 // A space in which the free area is contiguous. It therefore supports
500 // faster allocation, and compaction.
501 class ContiguousSpace: public CompactibleSpace {
502 friend class VMStructs;
503 #if INCLUDE_SERIALGC
504 // Allow scan_and_forward function to call (private) overrides for auxiliary functions on this class
505 template <typename SpaceType>
506 friend void CompactibleSpace::scan_and_forward(SpaceType* space, CompactPoint* cp);
507 #endif
508
509 private:
510 // Auxiliary functions for scan_and_forward support.
511 // See comments for CompactibleSpace for more information.
512 inline HeapWord* scan_limit() const {
513 return top();
514 }
515
516 inline bool scanned_block_is_obj(const HeapWord* addr) const {
517 return true; // Always true, since scan_limit is top
518 }
519
520 inline size_t scanned_block_size(const HeapWord* addr) const;
521
522 protected:
523 HeapWord* _top;
524 HeapWord* _concurrent_iteration_safe_limit;
525 // A helper for mangling the unused area of the space in debug builds.
526 GenSpaceMangler* _mangler;
527
|