186 }
187
188 InCSetState G1ParScanThreadState::next_state(InCSetState const state, markOop const m, uint& age) {
189 if (state.is_young()) {
190 age = !m->has_displaced_mark_helper() ? m->age()
191 : m->displaced_mark_helper()->age();
192 if (age < _tenuring_threshold) {
193 return state;
194 }
195 }
196 return dest(state);
197 }
198
199 void G1ParScanThreadState::report_promotion_event(InCSetState const dest_state,
200 oop const old, size_t word_sz, uint age,
201 HeapWord * const obj_ptr) const {
202 PLAB* alloc_buf = _plab_allocator->alloc_buffer(dest_state);
203 if (alloc_buf->contains(obj_ptr)) {
204 _g1h->_gc_tracer_stw->report_promotion_in_new_plab_event(old->klass(), word_sz * HeapWordSize, age,
205 dest_state.value() == InCSetState::Old,
206 alloc_buf->word_sz());
207 } else {
208 _g1h->_gc_tracer_stw->report_promotion_outside_plab_event(old->klass(), word_sz * HeapWordSize, age,
209 dest_state.value() == InCSetState::Old);
210 }
211 }
212
213 oop G1ParScanThreadState::copy_to_survivor_space(InCSetState const state,
214 oop const old,
215 markOop const old_mark) {
216 const size_t word_sz = old->size();
217 HeapRegion* const from_region = _g1h->heap_region_containing(old);
218 // +1 to make the -1 indexes valid...
219 const int young_index = from_region->young_index_in_cset()+1;
220 assert( (from_region->is_young() && young_index > 0) ||
221 (!from_region->is_young() && young_index == 0), "invariant" );
222
223 uint age = 0;
224 InCSetState dest_state = next_state(state, old_mark, age);
225 // The second clause is to prevent premature evacuation failure in case there
226 // is still space in survivor, but old gen is full.
|
186 }
187
188 InCSetState G1ParScanThreadState::next_state(InCSetState const state, markOop const m, uint& age) {
189 if (state.is_young()) {
190 age = !m->has_displaced_mark_helper() ? m->age()
191 : m->displaced_mark_helper()->age();
192 if (age < _tenuring_threshold) {
193 return state;
194 }
195 }
196 return dest(state);
197 }
198
199 void G1ParScanThreadState::report_promotion_event(InCSetState const dest_state,
200 oop const old, size_t word_sz, uint age,
201 HeapWord * const obj_ptr) const {
202 PLAB* alloc_buf = _plab_allocator->alloc_buffer(dest_state);
203 if (alloc_buf->contains(obj_ptr)) {
204 _g1h->_gc_tracer_stw->report_promotion_in_new_plab_event(old->klass(), word_sz * HeapWordSize, age,
205 dest_state.value() == InCSetState::Old,
206 alloc_buf->word_sz() * HeapWordSize);
207 } else {
208 _g1h->_gc_tracer_stw->report_promotion_outside_plab_event(old->klass(), word_sz * HeapWordSize, age,
209 dest_state.value() == InCSetState::Old);
210 }
211 }
212
213 oop G1ParScanThreadState::copy_to_survivor_space(InCSetState const state,
214 oop const old,
215 markOop const old_mark) {
216 const size_t word_sz = old->size();
217 HeapRegion* const from_region = _g1h->heap_region_containing(old);
218 // +1 to make the -1 indexes valid...
219 const int young_index = from_region->young_index_in_cset()+1;
220 assert( (from_region->is_young() && young_index > 0) ||
221 (!from_region->is_young() && young_index == 0), "invariant" );
222
223 uint age = 0;
224 InCSetState dest_state = next_state(state, old_mark, age);
225 // The second clause is to prevent premature evacuation failure in case there
226 // is still space in survivor, but old gen is full.
|