911 // also ready for filling. The ready list is initially filled with empty |
911 // also ready for filling. The ready list is initially filled with empty |
912 // regions and regions compacting into themselves. There is always at least 1 |
912 // regions and regions compacting into themselves. There is always at least 1 |
913 // region that can be put on the ready list. The regions are atomically added |
913 // region that can be put on the ready list. The regions are atomically added |
914 // and removed from the ready list. |
914 // and removed from the ready list. |
915 |
915 |
|
916 class TaskQueue; |
|
917 |
916 class PSParallelCompact : AllStatic { |
918 class PSParallelCompact : AllStatic { |
917 public: |
919 public: |
918 // Convenient access to type names. |
920 // Convenient access to type names. |
919 typedef ParMarkBitMap::idx_t idx_t; |
921 typedef ParMarkBitMap::idx_t idx_t; |
920 typedef ParallelCompactData::RegionData RegionData; |
922 typedef ParallelCompactData::RegionData RegionData; |
922 |
924 |
923 typedef enum { |
925 typedef enum { |
924 old_space_id, eden_space_id, |
926 old_space_id, eden_space_id, |
925 from_space_id, to_space_id, last_space_id |
927 from_space_id, to_space_id, last_space_id |
926 } SpaceId; |
928 } SpaceId; |
|
929 |
|
930 struct UpdateDensePrefixTask : public CHeapObj<mtGC> { |
|
931 SpaceId _space_id; |
|
932 size_t _region_index_start; |
|
933 size_t _region_index_end; |
|
934 |
|
935 UpdateDensePrefixTask() : |
|
936 _space_id(SpaceId(0)), |
|
937 _region_index_start(0), |
|
938 _region_index_end(0) {} |
|
939 |
|
940 UpdateDensePrefixTask(SpaceId space_id, |
|
941 size_t region_index_start, |
|
942 size_t region_index_end) : |
|
943 _space_id(space_id), |
|
944 _region_index_start(region_index_start), |
|
945 _region_index_end(region_index_end) {} |
|
946 }; |
927 |
947 |
928 public: |
948 public: |
929 // Inline closure decls |
949 // Inline closure decls |
930 // |
950 // |
931 class IsAliveClosure: public BoolObjectClosure { |
951 class IsAliveClosure: public BoolObjectClosure { |
1048 // Move objects to new locations. |
1068 // Move objects to new locations. |
1049 static void compact_perm(ParCompactionManager* cm); |
1069 static void compact_perm(ParCompactionManager* cm); |
1050 static void compact(); |
1070 static void compact(); |
1051 |
1071 |
1052 // Add available regions to the stack and draining tasks to the task queue. |
1072 // Add available regions to the stack and draining tasks to the task queue. |
1053 static void prepare_region_draining_tasks(GCTaskQueue* q, |
1073 static void prepare_region_draining_tasks(uint parallel_gc_threads); |
1054 uint parallel_gc_threads); |
|
1055 |
1074 |
1056 // Add dense prefix update tasks to the task queue. |
1075 // Add dense prefix update tasks to the task queue. |
1057 static void enqueue_dense_prefix_tasks(GCTaskQueue* q, |
1076 static void enqueue_dense_prefix_tasks(TaskQueue& task_queue, |
1058 uint parallel_gc_threads); |
1077 uint parallel_gc_threads); |
1059 |
|
1060 // Add region stealing tasks to the task queue. |
|
1061 static void enqueue_region_stealing_tasks( |
|
1062 GCTaskQueue* q, |
|
1063 ParallelTaskTerminator* terminator_ptr, |
|
1064 uint parallel_gc_threads); |
|
1065 |
1078 |
1066 // If objects are left in eden after a collection, try to move the boundary |
1079 // If objects are left in eden after a collection, try to move the boundary |
1067 // and absorb them into the old gen. Returns true if eden was emptied. |
1080 // and absorb them into the old gen. Returns true if eden was emptied. |
1068 static bool absorb_live_data_from_eden(PSAdaptiveSizePolicy* size_policy, |
1081 static bool absorb_live_data_from_eden(PSAdaptiveSizePolicy* size_policy, |
1069 PSYoungGen* young_gen, |
1082 PSYoungGen* young_gen, |