--- old/src/share/vm/gc_implementation/g1/g1ParScanThreadState.hpp 2014-12-03 13:26:05.720191674 +0100 +++ new/src/share/vm/gc_implementation/g1/g1ParScanThreadState.hpp 2014-12-03 13:26:05.652189681 +0100 @@ -46,14 +46,16 @@ G1SATBCardTableModRefBS* _ct_bs; G1RemSet* _g1_rem; - G1ParGCAllocator* _g1_par_allocator; + G1ParGCAllocator* _g1_par_allocator; - ageTable _age_table; + ageTable _age_table; + in_cset_state_t _dest[InCSetState::Num]; + // Local tenuring threshold. + uint _tenuring_threshold; + G1ParScanClosure _scanner; - G1ParScanClosure _scanner; - - size_t _alloc_buffer_waste; - size_t _undo_waste; + size_t _alloc_buffer_waste; + size_t _undo_waste; OopsInHeapRegionClosure* _evac_failure_cl; @@ -82,6 +84,14 @@ DirtyCardQueue& dirty_card_queue() { return _dcq; } G1SATBCardTableModRefBS* ctbs() { return _ct_bs; } + in_cset_state_t dest(uint index) const { + assert(index < InCSetState::Num, + err_msg("dest index out-of-bounds: %u", index)); + assert(_dest[index] != InCSetState::NotInCSet, + err_msg("dest is invalid: %u", index)); + return _dest[index]; + } + public: G1ParScanThreadState(G1CollectedHeap* g1h, uint queue_num, ReferenceProcessor* rp); ~G1ParScanThreadState(); @@ -112,7 +122,6 @@ } } } - public: void set_evac_failure_closure(OopsInHeapRegionClosure* evac_failure_cl) { _evac_failure_cl = evac_failure_cl; @@ -193,9 +202,20 @@ template inline void deal_with_reference(T* ref_to_scan); inline void dispatch_reference(StarTask ref); + + // Tries to allocate word_sz in the PLAB of the next "generation" after trying to + // allocate into dest. State is the original (source) cset state for the object + // that is allocated for. + // Returns a non-NULL pointer if successful, and updates dest if required. + HeapWord* allocate_in_next_plab(in_cset_state_t const state, + in_cset_state_t* dest, + size_t word_sz, + AllocationContext_t const context); + + inline in_cset_state_t next_state(in_cset_state_t const state, markOop const m, uint& age); public: - oop copy_to_survivor_space(oop const obj, markOop const old_mark); + oop copy_to_survivor_space(in_cset_state_t const state, oop const obj, markOop const old_mark); void trim_queue();