1132 #ifdef ASSERT
1133 class CheckCollectionSetClosure: public ShenandoahHeapRegionClosure {
1134 bool doHeapRegion(ShenandoahHeapRegion* r) {
1135 assert(! ShenandoahHeap::heap()->in_collection_set(r), "Should have been cleared by now");
1136 return false;
1137 }
1138 };
1139 #endif
1140
1141 void ShenandoahHeap::prepare_for_concurrent_evacuation() {
1142 assert(_ordered_regions->get(0)->region_number() == 0, "FIXME CHF. FIXME CHF!");
1143
1144 log_develop_trace(gc)("Thread %d started prepare_for_concurrent_evacuation", Thread::current()->osthread()->thread_id());
1145
1146 if (!cancelled_concgc()) {
1147
1148 recycle_dirty_regions();
1149
1150 ensure_parsability(true);
1151
1152 if (UseShenandoahMatrix) {
1153 if (PrintShenandoahMatrix) {
1154 outputStream* log = Log(gc)::info_stream();
1155 connection_matrix()->print_on(log);
1156 }
1157 }
1158
1159 if (ShenandoahVerify || (UseShenandoahMatrix && VerifyShenandoahMatrix)) {
1160 verify_heap_reachable_at_safepoint();
1161 }
1162
1163 #ifdef ASSERT
1164 if (ShenandoahVerify) {
1165 verify_heap_after_marking();
1166 }
1167 #endif
1168
1169 // NOTE: This needs to be done during a stop the world pause, because
1170 // putting regions into the collection set concurrently with Java threads
1171 // will create a race. In particular, acmp could fail because when we
1172 // resolve the first operand, the containing region might not yet be in
1173 // the collection set, and thus return the original oop. When the 2nd
1174 // operand gets resolved, the region could be in the collection set
1175 // and the oop gets evacuated. If both operands have originally been
1176 // the same, we get false negatives.
|
1132 #ifdef ASSERT
1133 class CheckCollectionSetClosure: public ShenandoahHeapRegionClosure {
1134 bool doHeapRegion(ShenandoahHeapRegion* r) {
1135 assert(! ShenandoahHeap::heap()->in_collection_set(r), "Should have been cleared by now");
1136 return false;
1137 }
1138 };
1139 #endif
1140
1141 void ShenandoahHeap::prepare_for_concurrent_evacuation() {
1142 assert(_ordered_regions->get(0)->region_number() == 0, "FIXME CHF. FIXME CHF!");
1143
1144 log_develop_trace(gc)("Thread %d started prepare_for_concurrent_evacuation", Thread::current()->osthread()->thread_id());
1145
1146 if (!cancelled_concgc()) {
1147
1148 recycle_dirty_regions();
1149
1150 ensure_parsability(true);
1151
1152 if (UseShenandoahMatrix && PrintShenandoahMatrix) {
1153 outputStream* log = Log(gc)::info_stream();
1154 connection_matrix()->print_on(log);
1155 }
1156
1157 if (ShenandoahVerify || (UseShenandoahMatrix && VerifyShenandoahMatrix)) {
1158 verify_heap_reachable_at_safepoint();
1159 }
1160
1161 #ifdef ASSERT
1162 if (ShenandoahVerify) {
1163 verify_heap_after_marking();
1164 }
1165 #endif
1166
1167 // NOTE: This needs to be done during a stop the world pause, because
1168 // putting regions into the collection set concurrently with Java threads
1169 // will create a race. In particular, acmp could fail because when we
1170 // resolve the first operand, the containing region might not yet be in
1171 // the collection set, and thus return the original oop. When the 2nd
1172 // operand gets resolved, the region could be in the collection set
1173 // and the oop gets evacuated. If both operands have originally been
1174 // the same, we get false negatives.
|