95 |
95 |
96 #ifdef ASSERT |
96 #ifdef ASSERT |
97 bool G1ParScanThreadState::verify_ref(narrowOop* ref) const { |
97 bool G1ParScanThreadState::verify_ref(narrowOop* ref) const { |
98 assert(ref != NULL, "invariant"); |
98 assert(ref != NULL, "invariant"); |
99 assert(UseCompressedOops, "sanity"); |
99 assert(UseCompressedOops, "sanity"); |
100 assert(!has_partial_array_mask(ref), err_msg("ref=" PTR_FORMAT, p2i(ref))); |
100 assert(!has_partial_array_mask(ref), "ref=" PTR_FORMAT, p2i(ref)); |
101 oop p = oopDesc::load_decode_heap_oop(ref); |
101 oop p = oopDesc::load_decode_heap_oop(ref); |
102 assert(_g1h->is_in_g1_reserved(p), |
102 assert(_g1h->is_in_g1_reserved(p), |
103 err_msg("ref=" PTR_FORMAT " p=" PTR_FORMAT, p2i(ref), p2i(p))); |
103 "ref=" PTR_FORMAT " p=" PTR_FORMAT, p2i(ref), p2i(p)); |
104 return true; |
104 return true; |
105 } |
105 } |
106 |
106 |
107 bool G1ParScanThreadState::verify_ref(oop* ref) const { |
107 bool G1ParScanThreadState::verify_ref(oop* ref) const { |
108 assert(ref != NULL, "invariant"); |
108 assert(ref != NULL, "invariant"); |
109 if (has_partial_array_mask(ref)) { |
109 if (has_partial_array_mask(ref)) { |
110 // Must be in the collection set--it's already been copied. |
110 // Must be in the collection set--it's already been copied. |
111 oop p = clear_partial_array_mask(ref); |
111 oop p = clear_partial_array_mask(ref); |
112 assert(_g1h->obj_in_cs(p), |
112 assert(_g1h->obj_in_cs(p), |
113 err_msg("ref=" PTR_FORMAT " p=" PTR_FORMAT, p2i(ref), p2i(p))); |
113 "ref=" PTR_FORMAT " p=" PTR_FORMAT, p2i(ref), p2i(p)); |
114 } else { |
114 } else { |
115 oop p = oopDesc::load_decode_heap_oop(ref); |
115 oop p = oopDesc::load_decode_heap_oop(ref); |
116 assert(_g1h->is_in_g1_reserved(p), |
116 assert(_g1h->is_in_g1_reserved(p), |
117 err_msg("ref=" PTR_FORMAT " p=" PTR_FORMAT, p2i(ref), p2i(p))); |
117 "ref=" PTR_FORMAT " p=" PTR_FORMAT, p2i(ref), p2i(p)); |
118 } |
118 } |
119 return true; |
119 return true; |
120 } |
120 } |
121 |
121 |
122 bool G1ParScanThreadState::verify_task(StarTask ref) const { |
122 bool G1ParScanThreadState::verify_task(StarTask ref) const { |
145 HeapWord* G1ParScanThreadState::allocate_in_next_plab(InCSetState const state, |
145 HeapWord* G1ParScanThreadState::allocate_in_next_plab(InCSetState const state, |
146 InCSetState* dest, |
146 InCSetState* dest, |
147 size_t word_sz, |
147 size_t word_sz, |
148 AllocationContext_t const context, |
148 AllocationContext_t const context, |
149 bool previous_plab_refill_failed) { |
149 bool previous_plab_refill_failed) { |
150 assert(state.is_in_cset_or_humongous(), err_msg("Unexpected state: " CSETSTATE_FORMAT, state.value())); |
150 assert(state.is_in_cset_or_humongous(), "Unexpected state: " CSETSTATE_FORMAT, state.value()); |
151 assert(dest->is_in_cset_or_humongous(), err_msg("Unexpected dest: " CSETSTATE_FORMAT, dest->value())); |
151 assert(dest->is_in_cset_or_humongous(), "Unexpected dest: " CSETSTATE_FORMAT, dest->value()); |
152 |
152 |
153 // Right now we only have two types of regions (young / old) so |
153 // Right now we only have two types of regions (young / old) so |
154 // let's keep the logic here simple. We can generalize it when necessary. |
154 // let's keep the logic here simple. We can generalize it when necessary. |
155 if (dest->is_young()) { |
155 if (dest->is_young()) { |
156 bool plab_refill_in_old_failed = false; |
156 bool plab_refill_in_old_failed = false; |
357 } |
357 } |
358 _flushed = true; |
358 _flushed = true; |
359 } |
359 } |
360 |
360 |
361 oop G1ParScanThreadState::handle_evacuation_failure_par(oop old, markOop m) { |
361 oop G1ParScanThreadState::handle_evacuation_failure_par(oop old, markOop m) { |
362 assert(_g1h->obj_in_cs(old), |
362 assert(_g1h->obj_in_cs(old), "Object " PTR_FORMAT " should be in the CSet", p2i(old)); |
363 err_msg("Object " PTR_FORMAT " should be in the CSet", p2i(old))); |
|
364 |
363 |
365 oop forward_ptr = old->forward_to_atomic(old); |
364 oop forward_ptr = old->forward_to_atomic(old); |
366 if (forward_ptr == NULL) { |
365 if (forward_ptr == NULL) { |
367 // Forward-to-self succeeded. We are the "owner" of the object. |
366 // Forward-to-self succeeded. We are the "owner" of the object. |
368 HeapRegion* r = _g1h->heap_region_containing(old); |
367 HeapRegion* r = _g1h->heap_region_containing(old); |
381 } else { |
380 } else { |
382 // Forward-to-self failed. Either someone else managed to allocate |
381 // Forward-to-self failed. Either someone else managed to allocate |
383 // space for this object (old != forward_ptr) or they beat us in |
382 // space for this object (old != forward_ptr) or they beat us in |
384 // self-forwarding it (old == forward_ptr). |
383 // self-forwarding it (old == forward_ptr). |
385 assert(old == forward_ptr || !_g1h->obj_in_cs(forward_ptr), |
384 assert(old == forward_ptr || !_g1h->obj_in_cs(forward_ptr), |
386 err_msg("Object " PTR_FORMAT " forwarded to: " PTR_FORMAT " " |
385 "Object " PTR_FORMAT " forwarded to: " PTR_FORMAT " " |
387 "should not be in the CSet", |
386 "should not be in the CSet", |
388 p2i(old), p2i(forward_ptr))); |
387 p2i(old), p2i(forward_ptr)); |
389 return forward_ptr; |
388 return forward_ptr; |
390 } |
389 } |
391 } |
390 } |
392 |
391 |