218 virtual HeapWord* allocate(size_t word_size) = 0; |
218 virtual HeapWord* allocate(size_t word_size) = 0; |
219 |
219 |
220 // Allocation (return NULL if full). Enforces mutual exclusion internally. |
220 // Allocation (return NULL if full). Enforces mutual exclusion internally. |
221 virtual HeapWord* par_allocate(size_t word_size) = 0; |
221 virtual HeapWord* par_allocate(size_t word_size) = 0; |
222 |
222 |
|
223 #if INCLUDE_SERIALGC |
223 // Mark-sweep-compact support: all spaces can update pointers to objects |
224 // Mark-sweep-compact support: all spaces can update pointers to objects |
224 // moving as a part of compaction. |
225 // moving as a part of compaction. |
225 virtual void adjust_pointers() = 0; |
226 virtual void adjust_pointers() = 0; |
|
227 #endif |
226 |
228 |
227 virtual void print() const; |
229 virtual void print() const; |
228 virtual void print_on(outputStream* st) const; |
230 virtual void print_on(outputStream* st) const; |
229 virtual void print_short() const; |
231 virtual void print_short() const; |
230 virtual void print_short_on(outputStream* st) const; |
232 virtual void print_short_on(outputStream* st) const; |
403 |
405 |
404 void set_next_compaction_space(CompactibleSpace* csp) { |
406 void set_next_compaction_space(CompactibleSpace* csp) { |
405 _next_compaction_space = csp; |
407 _next_compaction_space = csp; |
406 } |
408 } |
407 |
409 |
|
410 #if INCLUDE_SERIALGC |
408 // MarkSweep support phase2 |
411 // MarkSweep support phase2 |
409 |
412 |
410 // Start the process of compaction of the current space: compute |
413 // Start the process of compaction of the current space: compute |
411 // post-compaction addresses, and insert forwarding pointers. The fields |
414 // post-compaction addresses, and insert forwarding pointers. The fields |
412 // "cp->gen" and "cp->compaction_space" are the generation and space into |
415 // "cp->gen" and "cp->compaction_space" are the generation and space into |
418 virtual void prepare_for_compaction(CompactPoint* cp) = 0; |
421 virtual void prepare_for_compaction(CompactPoint* cp) = 0; |
419 // MarkSweep support phase3 |
422 // MarkSweep support phase3 |
420 virtual void adjust_pointers(); |
423 virtual void adjust_pointers(); |
421 // MarkSweep support phase4 |
424 // MarkSweep support phase4 |
422 virtual void compact(); |
425 virtual void compact(); |
|
426 #endif // INCLUDE_SERIALGC |
423 |
427 |
424 // The maximum percentage of objects that can be dead in the compacted |
428 // The maximum percentage of objects that can be dead in the compacted |
425 // live part of a compacted space ("deadwood" support.) |
429 // live part of a compacted space ("deadwood" support.) |
426 virtual size_t allowed_dead_ratio() const { return 0; }; |
430 virtual size_t allowed_dead_ratio() const { return 0; }; |
427 |
431 |
472 // The space argument should be a subclass of CompactibleSpace, implementing |
476 // The space argument should be a subclass of CompactibleSpace, implementing |
473 // scan_limit(), scanned_block_is_obj(), and scanned_block_size(), |
477 // scan_limit(), scanned_block_is_obj(), and scanned_block_size(), |
474 // and possibly also overriding obj_size(), and adjust_obj_size(). |
478 // and possibly also overriding obj_size(), and adjust_obj_size(). |
475 // These functions should avoid virtual calls whenever possible. |
479 // These functions should avoid virtual calls whenever possible. |
476 |
480 |
|
481 #if INCLUDE_SERIALGC |
477 // Frequently calls adjust_obj_size(). |
482 // Frequently calls adjust_obj_size(). |
478 template <class SpaceType> |
483 template <class SpaceType> |
479 static inline void scan_and_adjust_pointers(SpaceType* space); |
484 static inline void scan_and_adjust_pointers(SpaceType* space); |
|
485 #endif |
480 |
486 |
481 // Frequently calls obj_size(). |
487 // Frequently calls obj_size(). |
482 template <class SpaceType> |
488 template <class SpaceType> |
483 static inline void scan_and_compact(SpaceType* space); |
489 static inline void scan_and_compact(SpaceType* space); |
484 |
490 |
601 assert(new_limit <= top(), "uninitialized objects in the safe range"); |
607 assert(new_limit <= top(), "uninitialized objects in the safe range"); |
602 _concurrent_iteration_safe_limit = new_limit; |
608 _concurrent_iteration_safe_limit = new_limit; |
603 } |
609 } |
604 |
610 |
605 |
611 |
606 #if INCLUDE_ALL_GCS |
612 #if INCLUDE_CMSGC |
607 // In support of parallel oop_iterate. |
613 // In support of parallel oop_iterate. |
608 #define ContigSpace_PAR_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \ |
614 #define ContigSpace_PAR_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \ |
609 void par_oop_iterate(MemRegion mr, OopClosureType* blk); |
615 void par_oop_iterate(MemRegion mr, OopClosureType* blk); |
610 |
616 |
611 ALL_PAR_OOP_ITERATE_CLOSURES(ContigSpace_PAR_OOP_ITERATE_DECL) |
617 ALL_PAR_OOP_ITERATE_CLOSURES(ContigSpace_PAR_OOP_ITERATE_DECL) |
612 #undef ContigSpace_PAR_OOP_ITERATE_DECL |
618 #undef ContigSpace_PAR_OOP_ITERATE_DECL |
613 #endif // INCLUDE_ALL_GCS |
619 #endif // INCLUDE_CMSGC |
614 |
620 |
615 // Compaction support |
621 // Compaction support |
616 virtual void reset_after_compaction() { |
622 virtual void reset_after_compaction() { |
617 assert(compaction_top() >= bottom() && compaction_top() <= end(), "should point inside space"); |
623 assert(compaction_top() >= bottom() && compaction_top() <= end(), "should point inside space"); |
618 set_top(compaction_top()); |
624 set_top(compaction_top()); |
652 |
658 |
653 // Addresses for inlined allocation |
659 // Addresses for inlined allocation |
654 HeapWord** top_addr() { return &_top; } |
660 HeapWord** top_addr() { return &_top; } |
655 HeapWord** end_addr() { return &_end; } |
661 HeapWord** end_addr() { return &_end; } |
656 |
662 |
|
663 #if INCLUDE_SERIALGC |
657 // Overrides for more efficient compaction support. |
664 // Overrides for more efficient compaction support. |
658 void prepare_for_compaction(CompactPoint* cp); |
665 void prepare_for_compaction(CompactPoint* cp); |
|
666 #endif |
659 |
667 |
660 virtual void print_on(outputStream* st) const; |
668 virtual void print_on(outputStream* st) const; |
661 |
669 |
662 // Checked dynamic downcasts. |
670 // Checked dynamic downcasts. |
663 virtual ContiguousSpace* toContiguousSpace() { |
671 virtual ContiguousSpace* toContiguousSpace() { |