4268
4269 void G1CollectedHeap::remove_self_forwarding_pointers() {
4270 double remove_self_forwards_start = os::elapsedTime();
4271
4272 G1ParRemoveSelfForwardPtrsTask rsfp_task;
4273 workers()->run_task(&rsfp_task);
4274
4275 // Now restore saved marks, if any.
4276 for (uint i = 0; i < ParallelGCThreads; i++) {
4277 OopAndMarkOopStack& cur = _preserved_objs[i];
4278 while (!cur.is_empty()) {
4279 OopAndMarkOop elem = cur.pop();
4280 elem.set_mark();
4281 }
4282 cur.clear(true);
4283 }
4284
4285 g1_policy()->phase_times()->record_evac_fail_remove_self_forwards((os::elapsedTime() - remove_self_forwards_start) * 1000.0);
4286 }
4287
4288 void G1CollectedHeap::preserve_mark_during_evac_failure(uint queue_num, oop obj, markOop m) {
4289 if (!_evacuation_failed) {
4290 _evacuation_failed = true;
4291 }
4292
4293 _evacuation_failed_info_array[queue_num].register_copy_failure(obj->size());
4294
4295 // We want to call the "for_promotion_failure" version only in the
4296 // case of a promotion failure.
4297 if (m->must_be_preserved_for_promotion_failure(obj)) {
4298 OopAndMarkOop elem(obj, m);
4299 _preserved_objs[queue_num].push(elem);
4300 }
4301 }
4302
4303 void G1ParCopyHelper::mark_object(oop obj) {
4304 assert(!_g1->heap_region_containing(obj)->in_collection_set(), "should not mark objects in the CSet");
4305
4306 // We know that the object is not moving so it's safe to read its size.
4307 _cm->grayRoot(obj, (size_t) obj->size(), _worker_id);
4308 }
4309
4310 void G1ParCopyHelper::mark_forwarded_object(oop from_obj, oop to_obj) {
4311 assert(from_obj->is_forwarded(), "from obj should be forwarded");
4312 assert(from_obj->forwardee() == to_obj, "to obj should be the forwardee");
4313 assert(from_obj != to_obj, "should not be self-forwarded");
4314
4315 assert(_g1->heap_region_containing(from_obj)->in_collection_set(), "from obj should be in the CSet");
4316 assert(!_g1->heap_region_containing(to_obj)->in_collection_set(), "should not mark objects in the CSet");
4317
4318 // The object might be in the process of being copied by another
4319 // worker so we cannot trust that its to-space image is
|
4268
4269 void G1CollectedHeap::remove_self_forwarding_pointers() {
4270 double remove_self_forwards_start = os::elapsedTime();
4271
4272 G1ParRemoveSelfForwardPtrsTask rsfp_task;
4273 workers()->run_task(&rsfp_task);
4274
4275 // Now restore saved marks, if any.
4276 for (uint i = 0; i < ParallelGCThreads; i++) {
4277 OopAndMarkOopStack& cur = _preserved_objs[i];
4278 while (!cur.is_empty()) {
4279 OopAndMarkOop elem = cur.pop();
4280 elem.set_mark();
4281 }
4282 cur.clear(true);
4283 }
4284
4285 g1_policy()->phase_times()->record_evac_fail_remove_self_forwards((os::elapsedTime() - remove_self_forwards_start) * 1000.0);
4286 }
4287
4288 void G1CollectedHeap::preserve_mark_during_evac_failure(uint worker_id, oop obj, markOop m) {
4289 if (!_evacuation_failed) {
4290 _evacuation_failed = true;
4291 }
4292
4293 _evacuation_failed_info_array[worker_id].register_copy_failure(obj->size());
4294
4295 // We want to call the "for_promotion_failure" version only in the
4296 // case of a promotion failure.
4297 if (m->must_be_preserved_for_promotion_failure(obj)) {
4298 OopAndMarkOop elem(obj, m);
4299 _preserved_objs[worker_id].push(elem);
4300 }
4301 }
4302
4303 void G1ParCopyHelper::mark_object(oop obj) {
4304 assert(!_g1->heap_region_containing(obj)->in_collection_set(), "should not mark objects in the CSet");
4305
4306 // We know that the object is not moving so it's safe to read its size.
4307 _cm->grayRoot(obj, (size_t) obj->size(), _worker_id);
4308 }
4309
4310 void G1ParCopyHelper::mark_forwarded_object(oop from_obj, oop to_obj) {
4311 assert(from_obj->is_forwarded(), "from obj should be forwarded");
4312 assert(from_obj->forwardee() == to_obj, "to obj should be the forwardee");
4313 assert(from_obj != to_obj, "should not be self-forwarded");
4314
4315 assert(_g1->heap_region_containing(from_obj)->in_collection_set(), "from obj should be in the CSet");
4316 assert(!_g1->heap_region_containing(to_obj)->in_collection_set(), "should not mark objects in the CSet");
4317
4318 // The object might be in the process of being copied by another
4319 // worker so we cannot trust that its to-space image is
|