992 _region_index_end(region_index_end) {}
993 };
994
995 public:
996 // Inline closure decls
997 //
998 class IsAliveClosure: public BoolObjectClosure {
999 public:
1000 virtual bool do_object_b(oop p);
1001 };
1002
1003 friend class RefProcTaskProxy;
1004 friend class PSParallelCompactTest;
1005
1006 private:
1007 static STWGCTimer _gc_timer;
1008 static ParallelOldTracer _gc_tracer;
1009 static elapsedTimer _accumulated_time;
1010 static unsigned int _total_invocations;
1011 static unsigned int _maximum_compaction_gc_num;
1012 static jlong _time_of_last_gc; // ms
1013 static CollectorCounters* _counters;
1014 static ParMarkBitMap _mark_bitmap;
1015 static ParallelCompactData _summary_data;
1016 static IsAliveClosure _is_alive_closure;
1017 static SpaceInfo _space_info[last_space_id];
1018
1019 // Reference processing (used in ...follow_contents)
1020 static SpanSubjectToDiscoveryClosure _span_based_discoverer;
1021 static ReferenceProcessor* _ref_processor;
1022
1023 // Values computed at initialization and used by dead_wood_limiter().
1024 static double _dwl_mean;
1025 static double _dwl_std_dev;
1026 static double _dwl_first_term;
1027 static double _dwl_adjustment;
1028 #ifdef ASSERT
1029 static bool _dwl_initialized;
1030 #endif // #ifdef ASSERT
1031
1032 public:
1106 static void summarize_spaces_quick();
1107 static void summarize_space(SpaceId id, bool maximum_compaction);
1108 static void summary_phase(ParCompactionManager* cm, bool maximum_compaction);
1109
1110 // Adjust addresses in roots. Does not adjust addresses in heap.
1111 static void adjust_roots(ParCompactionManager* cm);
1112
1113 DEBUG_ONLY(static void write_block_fill_histogram();)
1114
1115 // Move objects to new locations.
1116 static void compact_perm(ParCompactionManager* cm);
1117 static void compact();
1118
1119 // Add available regions to the stack and draining tasks to the task queue.
1120 static void prepare_region_draining_tasks(uint parallel_gc_threads);
1121
1122 // Add dense prefix update tasks to the task queue.
1123 static void enqueue_dense_prefix_tasks(TaskQueue& task_queue,
1124 uint parallel_gc_threads);
1125
1126 // Reset time since last full gc
1127 static void reset_millis_since_last_gc();
1128
1129 #ifndef PRODUCT
1130 // Print generic summary data
1131 static void print_generic_summary_data(ParallelCompactData& summary_data,
1132 HeapWord* const beg_addr,
1133 HeapWord* const end_addr);
1134 #endif // #ifndef PRODUCT
1135
1136 public:
1137
1138 PSParallelCompact();
1139
1140 static void invoke(bool maximum_heap_compaction);
1141 static bool invoke_no_policy(bool maximum_heap_compaction);
1142
1143 static void post_initialize();
1144 // Perform initialization for PSParallelCompact that requires
1145 // allocations. This should be called during the VM initialization
1146 // at a pointer where it would be appropriate to return a JNI_ENOMEM
1147 // in the event of a failure.
1148 static bool initialize();
1231 // Collect empty regions as shadow regions and initialize the
1232 // _next_shadow_region filed for each compact manager
1233 static void initialize_shadow_regions(uint parallel_gc_threads);
1234
1235 // Fill in the block table for the specified region.
1236 static void fill_blocks(size_t region_idx);
1237
1238 // Update the deferred objects in the space.
1239 static void update_deferred_objects(ParCompactionManager* cm, SpaceId id);
1240
1241 static ParMarkBitMap* mark_bitmap() { return &_mark_bitmap; }
1242 static ParallelCompactData& summary_data() { return _summary_data; }
1243
1244 // Reference Processing
1245 static ReferenceProcessor* const ref_processor() { return _ref_processor; }
1246
1247 static STWGCTimer* gc_timer() { return &_gc_timer; }
1248
1249 // Return the SpaceId for the given address.
1250 static SpaceId space_id(HeapWord* addr);
1251
1252 // Time since last full gc (in milliseconds).
1253 static jlong millis_since_last_gc();
1254
1255 static void print_on_error(outputStream* st);
1256
1257 #ifndef PRODUCT
1258 // Debugging support.
1259 static const char* space_names[last_space_id];
1260 static void print_region_ranges();
1261 static void print_dense_prefix_stats(const char* const algorithm,
1262 const SpaceId id,
1263 const bool maximum_compaction,
1264 HeapWord* const addr);
1265 static void summary_phase_msg(SpaceId dst_space_id,
1266 HeapWord* dst_beg, HeapWord* dst_end,
1267 SpaceId src_space_id,
1268 HeapWord* src_beg, HeapWord* src_end);
1269 #endif // #ifndef PRODUCT
1270
1271 #ifdef ASSERT
1272 // Sanity check the new location of a word in the heap.
1273 static inline void check_new_location(HeapWord* old_addr, HeapWord* new_addr);
|
992 _region_index_end(region_index_end) {}
993 };
994
995 public:
996 // Inline closure decls
997 //
998 class IsAliveClosure: public BoolObjectClosure {
999 public:
1000 virtual bool do_object_b(oop p);
1001 };
1002
1003 friend class RefProcTaskProxy;
1004 friend class PSParallelCompactTest;
1005
1006 private:
1007 static STWGCTimer _gc_timer;
1008 static ParallelOldTracer _gc_tracer;
1009 static elapsedTimer _accumulated_time;
1010 static unsigned int _total_invocations;
1011 static unsigned int _maximum_compaction_gc_num;
1012 static CollectorCounters* _counters;
1013 static ParMarkBitMap _mark_bitmap;
1014 static ParallelCompactData _summary_data;
1015 static IsAliveClosure _is_alive_closure;
1016 static SpaceInfo _space_info[last_space_id];
1017
1018 // Reference processing (used in ...follow_contents)
1019 static SpanSubjectToDiscoveryClosure _span_based_discoverer;
1020 static ReferenceProcessor* _ref_processor;
1021
1022 // Values computed at initialization and used by dead_wood_limiter().
1023 static double _dwl_mean;
1024 static double _dwl_std_dev;
1025 static double _dwl_first_term;
1026 static double _dwl_adjustment;
1027 #ifdef ASSERT
1028 static bool _dwl_initialized;
1029 #endif // #ifdef ASSERT
1030
1031 public:
1105 static void summarize_spaces_quick();
1106 static void summarize_space(SpaceId id, bool maximum_compaction);
1107 static void summary_phase(ParCompactionManager* cm, bool maximum_compaction);
1108
1109 // Adjust addresses in roots. Does not adjust addresses in heap.
1110 static void adjust_roots(ParCompactionManager* cm);
1111
1112 DEBUG_ONLY(static void write_block_fill_histogram();)
1113
1114 // Move objects to new locations.
1115 static void compact_perm(ParCompactionManager* cm);
1116 static void compact();
1117
1118 // Add available regions to the stack and draining tasks to the task queue.
1119 static void prepare_region_draining_tasks(uint parallel_gc_threads);
1120
1121 // Add dense prefix update tasks to the task queue.
1122 static void enqueue_dense_prefix_tasks(TaskQueue& task_queue,
1123 uint parallel_gc_threads);
1124
1125 #ifndef PRODUCT
1126 // Print generic summary data
1127 static void print_generic_summary_data(ParallelCompactData& summary_data,
1128 HeapWord* const beg_addr,
1129 HeapWord* const end_addr);
1130 #endif // #ifndef PRODUCT
1131
1132 public:
1133
1134 PSParallelCompact();
1135
1136 static void invoke(bool maximum_heap_compaction);
1137 static bool invoke_no_policy(bool maximum_heap_compaction);
1138
1139 static void post_initialize();
1140 // Perform initialization for PSParallelCompact that requires
1141 // allocations. This should be called during the VM initialization
1142 // at a pointer where it would be appropriate to return a JNI_ENOMEM
1143 // in the event of a failure.
1144 static bool initialize();
1227 // Collect empty regions as shadow regions and initialize the
1228 // _next_shadow_region filed for each compact manager
1229 static void initialize_shadow_regions(uint parallel_gc_threads);
1230
1231 // Fill in the block table for the specified region.
1232 static void fill_blocks(size_t region_idx);
1233
1234 // Update the deferred objects in the space.
1235 static void update_deferred_objects(ParCompactionManager* cm, SpaceId id);
1236
1237 static ParMarkBitMap* mark_bitmap() { return &_mark_bitmap; }
1238 static ParallelCompactData& summary_data() { return _summary_data; }
1239
1240 // Reference Processing
1241 static ReferenceProcessor* const ref_processor() { return _ref_processor; }
1242
1243 static STWGCTimer* gc_timer() { return &_gc_timer; }
1244
1245 // Return the SpaceId for the given address.
1246 static SpaceId space_id(HeapWord* addr);
1247
1248 static void print_on_error(outputStream* st);
1249
1250 #ifndef PRODUCT
1251 // Debugging support.
1252 static const char* space_names[last_space_id];
1253 static void print_region_ranges();
1254 static void print_dense_prefix_stats(const char* const algorithm,
1255 const SpaceId id,
1256 const bool maximum_compaction,
1257 HeapWord* const addr);
1258 static void summary_phase_msg(SpaceId dst_space_id,
1259 HeapWord* dst_beg, HeapWord* dst_end,
1260 SpaceId src_space_id,
1261 HeapWord* src_beg, HeapWord* src_end);
1262 #endif // #ifndef PRODUCT
1263
1264 #ifdef ASSERT
1265 // Sanity check the new location of a word in the heap.
1266 static inline void check_new_location(HeapWord* old_addr, HeapWord* new_addr);
|