--- old/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp 2014-10-17 16:28:35.000000000 +0200 +++ new/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp 2014-10-17 16:28:35.000000000 +0200 @@ -63,36 +63,47 @@ #pragma warning( disable:4355 ) // 'this' : used in base member initializer list #endif ParScanThreadState::ParScanThreadState(Space* to_space_, - ParNewGeneration* gen_, + ParNewGeneration* young_gen_, Generation* old_gen_, int thread_num_, ObjToScanQueueSet* work_queue_set_, Stack* overflow_stacks_, size_t desired_plab_sz_, - ParallelTaskTerminator& term_) : - _to_space(to_space_), _old_gen(old_gen_), _young_gen(gen_), _thread_num(thread_num_), - _work_queue(work_queue_set_->queue(thread_num_)), _to_space_full(false), - _overflow_stack(overflow_stacks_ ? overflow_stacks_ + thread_num_ : NULL), - _ageTable(false), // false ==> not the global age table, no perf data. - _to_space_alloc_buffer(desired_plab_sz_), - _to_space_closure(gen_, this), _old_gen_closure(gen_, this), - _to_space_root_closure(gen_, this), _old_gen_root_closure(gen_, this), - _older_gen_closure(gen_, this), - _evacuate_followers(this, &_to_space_closure, &_old_gen_closure, - &_to_space_root_closure, gen_, &_old_gen_root_closure, - work_queue_set_, &term_), - _is_alive_closure(gen_), _scan_weak_ref_closure(gen_, this), - _keep_alive_closure(&_scan_weak_ref_closure), - _strong_roots_time(0.0), _term_time(0.0) -{ + ParallelTaskTerminator& term_) + : _to_space(to_space_), + _old_gen(old_gen_), + _young_gen(young_gen_), + _thread_num(thread_num_), + _work_queue(work_queue_set_->queue(thread_num_)), + _to_space_full(false), + _overflow_stack(overflow_stacks_ ? overflow_stacks_ + thread_num_ : NULL), + _ageTable(false), // false ==> not the global age table, no perf data. + _to_space_alloc_buffer(desired_plab_sz_), + _to_space_closure(young_gen_, this), + _old_gen_closure(young_gen_, this), + _to_space_root_closure(young_gen_, this), + _old_gen_root_closure(young_gen_, this), + _older_gen_closure(young_gen_, this), + _evacuate_followers(this, + &_to_space_closure, + &_old_gen_closure, + &_to_space_root_closure, + young_gen_, + &_old_gen_root_closure, + work_queue_set_, + &term_), + _is_alive_closure(young_gen_), + _scan_weak_ref_closure(young_gen_, this), + _keep_alive_closure(&_scan_weak_ref_closure), + _strong_roots_time(0.0), + _term_time(0.0) { #if TASKQUEUE_STATS _term_attempts = 0; _overflow_refills = 0; _overflow_refill_objs = 0; #endif // TASKQUEUE_STATS - _survivor_chunk_array = - (ChunkArray*) old_gen()->get_data_recorder(thread_num()); + _survivor_chunk_array = (ChunkArray*) old_gen()->get_data_recorder(thread_num()); _hash_seed = 17; // Might want to take time-based random value. _start = os::elapsedTime(); _old_gen_closure.set_generation(old_gen_); @@ -155,7 +166,6 @@ } } - void ParScanThreadState::trim_queues(int max_size) { ObjToScanQueue* queue = work_queue(); do { @@ -223,15 +233,12 @@ } HeapWord* ParScanThreadState::alloc_in_to_space_slow(size_t word_sz) { - - // Otherwise, if the object is small enough, try to reallocate the - // buffer. + // If the object is small enough, try to reallocate the buffer. HeapWord* obj = NULL; if (!_to_space_full) { ParGCAllocBuffer* const plab = to_space_alloc_buffer(); Space* const sp = to_space(); - if (word_sz * 100 < - ParallelGCBufferWastePct * plab->word_sz()) { + if (word_sz * 100 < ParallelGCBufferWastePct * plab->word_sz()) { // Is small enough; abandon this buffer and start a new one. plab->retire(false, false); size_t buf_size = plab->word_sz(); @@ -273,9 +280,7 @@ return obj; } - -void ParScanThreadState::undo_alloc_in_to_space(HeapWord* obj, - size_t word_sz) { +void ParScanThreadState::undo_alloc_in_to_space(HeapWord* obj, size_t word_sz) { // Is the alloc in the current alloc buffer? if (to_space_alloc_buffer()->contains(obj)) { assert(to_space_alloc_buffer()->contains(obj + word_sz - 1), @@ -301,7 +306,7 @@ ParNewGeneration& gen, Generation& old_gen, ObjToScanQueueSet& queue_set, - Stack* overflow_stacks_, + Stack* overflow_stacks, size_t desired_plab_sz, ParallelTaskTerminator& term); @@ -326,21 +331,24 @@ private: ParallelTaskTerminator& _term; ParNewGeneration& _gen; - Generation& _next_gen; + Generation& _old_gen; public: bool is_valid(int id) const { return id < length(); } ParallelTaskTerminator* terminator() { return &_term; } }; - -ParScanThreadStateSet::ParScanThreadStateSet( - int num_threads, Space& to_space, ParNewGeneration& gen, - Generation& old_gen, ObjToScanQueueSet& queue_set, - Stack* overflow_stacks, - size_t desired_plab_sz, ParallelTaskTerminator& term) +ParScanThreadStateSet::ParScanThreadStateSet(int num_threads, + Space& to_space, + ParNewGeneration& gen, + Generation& old_gen, + ObjToScanQueueSet& queue_set, + Stack* overflow_stacks, + size_t desired_plab_sz, + ParallelTaskTerminator& term) : ResourceArray(sizeof(ParScanThreadState), num_threads), - _gen(gen), _next_gen(old_gen), _term(term) -{ + _gen(gen), + _old_gen(old_gen), + _term(term) { assert(num_threads > 0, "sanity check!"); assert(ParGCUseLocalOverflow == (overflow_stacks != NULL), "overflow_stack allocation mismatch"); @@ -352,8 +360,7 @@ } } -inline ParScanThreadState& ParScanThreadStateSet::thread_state(int i) -{ +inline ParScanThreadState& ParScanThreadStateSet::thread_state(int i) { assert(i >= 0 && i < length(), "sanity check!"); return ((ParScanThreadState*)_data)[i]; } @@ -367,8 +374,7 @@ } } -void ParScanThreadStateSet::reset(int active_threads, bool promotion_failed) -{ +void ParScanThreadStateSet::reset(int active_threads, bool promotion_failed) { _term.reset_for_reuse(active_threads); if (promotion_failed) { for (int i = 0; i < length(); ++i) { @@ -379,24 +385,20 @@ #if TASKQUEUE_STATS void -ParScanThreadState::reset_stats() -{ +ParScanThreadState::reset_stats() { taskqueue_stats().reset(); _term_attempts = 0; _overflow_refills = 0; _overflow_refill_objs = 0; } -void ParScanThreadStateSet::reset_stats() -{ +void ParScanThreadStateSet::reset_stats() { for (int i = 0; i < length(); ++i) { thread_state(i).reset_stats(); } } -void -ParScanThreadStateSet::print_termination_stats_hdr(outputStream* const st) -{ +void ParScanThreadStateSet::print_termination_stats_hdr(outputStream* const st) { st->print_raw_cr("GC Termination Stats"); st->print_raw_cr(" elapsed --strong roots-- " "-------termination-------"); @@ -406,8 +408,7 @@ "--------- ------ --------"); } -void ParScanThreadStateSet::print_termination_stats(outputStream* const st) -{ +void ParScanThreadStateSet::print_termination_stats(outputStream* const st) { print_termination_stats_hdr(st); for (int i = 0; i < length(); ++i) { @@ -423,15 +424,13 @@ } // Print stats related to work queue activity. -void ParScanThreadStateSet::print_taskqueue_stats_hdr(outputStream* const st) -{ +void ParScanThreadStateSet::print_taskqueue_stats_hdr(outputStream* const st) { st->print_raw_cr("GC Task Stats"); st->print_raw("thr "); TaskQueueStats::print_header(1, st); st->cr(); st->print_raw("--- "); TaskQueueStats::print_header(2, st); st->cr(); } -void ParScanThreadStateSet::print_taskqueue_stats(outputStream* const st) -{ +void ParScanThreadStateSet::print_taskqueue_stats(outputStream* const st) { print_taskqueue_stats_hdr(st); TaskQueueStats totals; @@ -453,8 +452,7 @@ } #endif // TASKQUEUE_STATS -void ParScanThreadStateSet::flush() -{ +void ParScanThreadStateSet::flush() { // Work in this loop should be kept as lightweight as // possible since this might otherwise become a bottleneck // to scaling. Should we add heavy-weight work into this @@ -475,8 +473,8 @@ _gen.age_table()->merge(local_table); // Inform old gen that we're done. - _next_gen.par_promote_alloc_done(i); - _next_gen.par_oop_since_save_marks_iterate_done(i); + _old_gen.par_promote_alloc_done(i); + _old_gen.par_oop_since_save_marks_iterate_done(i); } if (UseConcMarkSweepGC && ParallelGCThreads > 0) { @@ -490,10 +488,10 @@ } ParScanClosure::ParScanClosure(ParNewGeneration* g, - ParScanThreadState* par_scan_state) : - OopsInKlassOrGenClosure(g), _par_scan_state(par_scan_state), _g(g) -{ - assert(_g->level() == 0, "Optimized for youngest generation"); + ParScanThreadState* par_scan_state) + : OopsInKlassOrGenClosure(g), + _par_scan_state(par_scan_state), + _g(g) { _boundary = _g->reserved().end(); } @@ -511,8 +509,9 @@ ParScanWeakRefClosure::ParScanWeakRefClosure(ParNewGeneration* g, ParScanThreadState* par_scan_state) - : ScanWeakRefClosure(g), _par_scan_state(par_scan_state) -{} + : ScanWeakRefClosure(g), + _par_scan_state(par_scan_state) { +} void ParScanWeakRefClosure::do_oop(oop* p) { ParScanWeakRefClosure::do_oop_work(p); } void ParScanWeakRefClosure::do_oop(narrowOop* p) { ParScanWeakRefClosure::do_oop_work(p); } @@ -521,31 +520,28 @@ #pragma warning(disable: 4786) /* identifier was truncated to '255' characters in the browser information */ #endif -ParEvacuateFollowersClosure::ParEvacuateFollowersClosure( - ParScanThreadState* par_scan_state_, - ParScanWithoutBarrierClosure* to_space_closure_, - ParScanWithBarrierClosure* old_gen_closure_, - ParRootScanWithoutBarrierClosure* to_space_root_closure_, - ParNewGeneration* par_gen_, - ParRootScanWithBarrierTwoGensClosure* old_gen_root_closure_, - ObjToScanQueueSet* task_queues_, - ParallelTaskTerminator* terminator_) : - - _par_scan_state(par_scan_state_), - _to_space_closure(to_space_closure_), - _old_gen_closure(old_gen_closure_), - _to_space_root_closure(to_space_root_closure_), - _old_gen_root_closure(old_gen_root_closure_), - _par_gen(par_gen_), - _task_queues(task_queues_), - _terminator(terminator_) -{} +ParEvacuateFollowersClosure::ParEvacuateFollowersClosure(ParScanThreadState* par_scan_state, + ParScanWithoutBarrierClosure* to_space_closure, + ParScanWithBarrierClosure* old_gen_closure, + ParRootScanWithoutBarrierClosure* to_space_root_closure, + ParNewGeneration* par_gen, + ParRootScanWithBarrierTwoGensClosure* old_gen_root_closure, + ObjToScanQueueSet* task_queues, + ParallelTaskTerminator* terminator) + : _par_scan_state(par_scan_state), + _to_space_closure(to_space_closure), + _old_gen_closure(old_gen_closure), + _to_space_root_closure(to_space_root_closure), + _old_gen_root_closure(old_gen_root_closure), + _par_gen(par_gen), + _task_queues(task_queues), + _terminator(terminator) { +} void ParEvacuateFollowersClosure::do_void() { ObjToScanQueue* work_q = par_scan_state()->work_queue(); while (true) { - // Scan to-space and old-gen objs until we run out of both. oop obj_to_scan; par_scan_state()->trim_queues(0); @@ -578,18 +574,20 @@ par_scan_state()->end_term_time(); } -ParNewGenTask::ParNewGenTask(ParNewGeneration* gen, Generation* next_gen, - HeapWord* young_old_boundary, ParScanThreadStateSet* state_set) : - AbstractGangTask("ParNewGeneration collection"), - _gen(gen), _next_gen(next_gen), +ParNewGenTask::ParNewGenTask(ParNewGeneration* young_gen, + Generation* old_gen, + HeapWord* young_old_boundary, + ParScanThreadStateSet* state_set) + : AbstractGangTask("ParNewGeneration collection"), + _young_gen(young_gen), _old_gen(old_gen), _young_old_boundary(young_old_boundary), - _state_set(state_set) - {} + _state_set(state_set) { +} // Reset the terminator for the given number of // active threads. void ParNewGenTask::set_for_termination(int active_workers) { - _state_set->reset(active_workers, _gen->promotion_failed()); + _state_set->reset(active_workers, _young_gen->promotion_failed()); // Should the heap be passed in? There's only 1 for now so // grab it instead. GenCollectedHeap* gch = GenCollectedHeap::heap(); @@ -602,10 +600,8 @@ // and handle marks. ResourceMark rm; HandleMark hm; - // We would need multiple old-gen queues otherwise. - assert(gch->n_gens() == 2, "Par young collection currently only works with one older gen."); - Generation* old_gen = gch->next_gen(_gen); + Generation* old_gen = gch->old_gen(); ParScanThreadState& par_scan_state = _state_set->thread_state(worker_id); assert(_state_set->is_valid(worker_id), "Should not have been called"); @@ -619,7 +615,7 @@ false); par_scan_state.start_strong_roots(); - gch->gen_process_roots(_gen->level(), + gch->gen_process_roots(Generation::Young, true, // Process younger gens, if any, // as strong roots. false, // no scope; this is parallel code @@ -640,12 +636,11 @@ #pragma warning( disable:4355 ) // 'this' : used in base member initializer list #endif ParNewGeneration:: -ParNewGeneration(ReservedSpace rs, size_t initial_byte_size, int level) - : DefNewGeneration(rs, initial_byte_size, level, "PCopy"), - _overflow_list(NULL), - _is_alive_closure(this), - _plab_stats(YoungPLABSize, PLABWeight) -{ +ParNewGeneration(ReservedSpace rs, size_t initial_byte_size) + : DefNewGeneration(rs, initial_byte_size, "PCopy"), + _overflow_list(NULL), + _is_alive_closure(this), + _plab_stats(YoungPLABSize, PLABWeight) { NOT_PRODUCT(_overflow_counter = ParGCWorkQueueOverflowInterval;) NOT_PRODUCT(_num_par_pushes = 0;) _task_queues = new ObjToScanQueueSet(ParallelGCThreads); @@ -657,12 +652,12 @@ _task_queues->register_queue(i1, q); } - for (uint i2 = 0; i2 < ParallelGCThreads; i2++) + for (uint i2 = 0; i2 < ParallelGCThreads; i2++) { _task_queues->queue(i2)->initialize(); + } _overflow_stacks = NULL; if (ParGCUseLocalOverflow) { - // typedef to workaround NEW_C_HEAP_ARRAY macro, which can not deal // with ',' typedef Stack GCOopStack; @@ -688,8 +683,9 @@ #endif // ParNewGeneration:: -ParKeepAliveClosure::ParKeepAliveClosure(ParScanWeakRefClosure* cl) : - DefNewGeneration::KeepAliveClosure(cl), _par_cl(cl) {} +ParKeepAliveClosure::ParKeepAliveClosure(ParScanWeakRefClosure* cl) + : DefNewGeneration::KeepAliveClosure(cl), _par_cl(cl) { +} template void /*ParNewGeneration::*/ParKeepAliveClosure::do_oop_work(T* p) { @@ -715,8 +711,9 @@ void /*ParNewGeneration::*/ParKeepAliveClosure::do_oop(narrowOop* p) { ParKeepAliveClosure::do_oop_work(p); } // ParNewGeneration:: -KeepAliveClosure::KeepAliveClosure(ScanWeakRefClosure* cl) : - DefNewGeneration::KeepAliveClosure(cl) {} +KeepAliveClosure::KeepAliveClosure(ScanWeakRefClosure* cl) + : DefNewGeneration::KeepAliveClosure(cl) { +} template void /*ParNewGeneration::*/KeepAliveClosure::do_oop_work(T* p) { @@ -768,7 +765,7 @@ typedef AbstractRefProcTaskExecutor::ProcessTask ProcessTask; public: ParNewRefProcTaskProxy(ProcessTask& task, ParNewGeneration& gen, - Generation& next_gen, + Generation& old_gen, HeapWord* young_old_boundary, ParScanThreadStateSet& state_set); @@ -778,29 +775,27 @@ _state_set.terminator()->reset_for_reuse(active_workers); } private: - ParNewGeneration& _gen; + ParNewGeneration& _young_gen; ProcessTask& _task; - Generation& _next_gen; + Generation& _old_gen; HeapWord* _young_old_boundary; ParScanThreadStateSet& _state_set; }; -ParNewRefProcTaskProxy::ParNewRefProcTaskProxy( - ProcessTask& task, ParNewGeneration& gen, - Generation& next_gen, - HeapWord* young_old_boundary, - ParScanThreadStateSet& state_set) +ParNewRefProcTaskProxy::ParNewRefProcTaskProxy(ProcessTask& task, + ParNewGeneration& young_gen, + Generation& old_gen, + HeapWord* young_old_boundary, + ParScanThreadStateSet& state_set) : AbstractGangTask("ParNewGeneration parallel reference processing"), - _gen(gen), + _young_gen(young_gen), _task(task), - _next_gen(next_gen), + _old_gen(old_gen), _young_old_boundary(young_old_boundary), - _state_set(state_set) -{ + _state_set(state_set) { } -void ParNewRefProcTaskProxy::work(uint worker_id) -{ +void ParNewRefProcTaskProxy::work(uint worker_id) { ResourceMark rm; HandleMark hm; ParScanThreadState& par_scan_state = _state_set.thread_state(worker_id); @@ -817,33 +812,29 @@ public: ParNewRefEnqueueTaskProxy(EnqueueTask& task) : AbstractGangTask("ParNewGeneration parallel reference enqueue"), - _task(task) - { } + _task(task) { + } - virtual void work(uint worker_id) - { + virtual void work(uint worker_id) { _task.work(worker_id); } }; - -void ParNewRefProcTaskExecutor::execute(ProcessTask& task) -{ +void ParNewRefProcTaskExecutor::execute(ProcessTask& task) { GenCollectedHeap* gch = GenCollectedHeap::heap(); assert(gch->kind() == CollectedHeap::GenCollectedHeap, "not a generational heap"); FlexibleWorkGang* workers = gch->workers(); assert(workers != NULL, "Need parallel worker threads."); _state_set.reset(workers->active_workers(), _generation.promotion_failed()); - ParNewRefProcTaskProxy rp_task(task, _generation, *_generation.next_gen(), + ParNewRefProcTaskProxy rp_task(task, _generation, *(gch->old_gen()), _generation.reserved().end(), _state_set); workers->run_task(&rp_task); _state_set.reset(0 /* bad value in debug if not reset */, _generation.promotion_failed()); } -void ParNewRefProcTaskExecutor::execute(EnqueueTask& task) -{ +void ParNewRefProcTaskExecutor::execute(EnqueueTask& task) { GenCollectedHeap* gch = GenCollectedHeap::heap(); FlexibleWorkGang* workers = gch->workers(); assert(workers != NULL, "Need parallel worker threads."); @@ -851,34 +842,35 @@ workers->run_task(&enq_task); } -void ParNewRefProcTaskExecutor::set_single_threaded_mode() -{ +void ParNewRefProcTaskExecutor::set_single_threaded_mode() { _state_set.flush(); GenCollectedHeap* gch = GenCollectedHeap::heap(); gch->set_par_threads(0); // 0 ==> non-parallel. gch->save_marks(); } -ScanClosureWithParBarrier:: -ScanClosureWithParBarrier(ParNewGeneration* g, bool gc_barrier) : - ScanClosure(g, gc_barrier) {} +ScanClosureWithParBarrier::ScanClosureWithParBarrier(ParNewGeneration* g, + bool gc_barrier) + : ScanClosure(g, gc_barrier) { +} EvacuateFollowersClosureGeneral:: -EvacuateFollowersClosureGeneral(GenCollectedHeap* gch, int level, +EvacuateFollowersClosureGeneral(GenCollectedHeap* gch, OopsInGenClosure* cur, - OopsInGenClosure* older) : - _gch(gch), _level(level), - _scan_cur_or_nonheap(cur), _scan_older(older) -{} + OopsInGenClosure* older) + : _gch(gch), + _scan_cur_or_nonheap(cur), + _scan_older(older) { +} void EvacuateFollowersClosureGeneral::do_void() { do { // Beware: this call will lead to closure applications via virtual // calls. - _gch->oop_since_save_marks_iterate(_level, + _gch->oop_since_save_marks_iterate(Generation::Young, _scan_cur_or_nonheap, _scan_older); - } while (!_gch->no_allocs_since_save_marks(_level)); + } while (!_gch->no_allocs_since_save_marks(true /* include_young */)); } @@ -886,7 +878,9 @@ bool ParNewGeneration::_avoid_promotion_undo = false; -void ParNewGeneration::handle_promotion_failed(GenCollectedHeap* gch, ParScanThreadStateSet& thread_state_set, ParNewTracer& gc_tracer) { +void ParNewGeneration::handle_promotion_failed(GenCollectedHeap* gch, + ParScanThreadStateSet& thread_state_set, + ParNewTracer& gc_tracer) { assert(_promo_failure_scan_stack.is_empty(), "post condition"); _promo_failure_scan_stack.clear(true); // Clear cached segments. @@ -899,7 +893,7 @@ from()->set_next_compaction_space(to()); gch->set_incremental_collection_failed(); // Inform the next generation that a promotion failure occurred. - _next_gen->promotion_failure_occurred(); + _old_gen->promotion_failure_occurred(); // Trace promotion failure in the parallel GC threads thread_state_set.trace_promotion_failed(gc_tracer); @@ -931,9 +925,7 @@ workers->active_workers(), Threads::number_of_non_daemon_threads()); workers->set_active_workers(active_workers); - assert(gch->n_gens() == 2, - "Par collection currently only works with single older gen."); - _next_gen = gch->next_gen(this); + _old_gen = gch->old_gen(); // Do we have to avoid promotion_undo? if (gch->collector_policy()->is_concurrent_mark_sweep_policy()) { set_avoid_promotion_undo(true); @@ -979,10 +971,10 @@ // because only those workers go through the termination protocol. ParallelTaskTerminator _term(n_workers, task_queues()); ParScanThreadStateSet thread_state_set(workers->active_workers(), - *to(), *this, *_next_gen, *task_queues(), + *to(), *this, *_old_gen, *task_queues(), _overflow_stacks, desired_plab_sz(), _term); - ParNewGenTask tsk(this, _next_gen, reserved().end(), &thread_state_set); + ParNewGenTask tsk(this, _old_gen, reserved().end(), &thread_state_set); gch->set_par_threads(n_workers); gch->rem_set()->prepare_for_younger_refs_iterate(true); // It turns out that even when we're using 1 thread, doing the work in a @@ -1007,7 +999,7 @@ ScanClosure scan_without_gc_barrier(this, false); ScanClosureWithParBarrier scan_with_gc_barrier(this, true); set_promo_failure_scan_stack_closure(&scan_without_gc_barrier); - EvacuateFollowersClosureGeneral evacuate_followers(gch, _level, + EvacuateFollowersClosureGeneral evacuate_followers(gch, &scan_without_gc_barrier, &scan_with_gc_barrier); rp->setup_policy(clear_all_soft_refs); // Can the mt_degree be set later (at run_task() time would be best)? @@ -1193,11 +1185,10 @@ forward_ptr = old->forward_to_atomic(ClaimedForwardPtr); if (forward_ptr != NULL) { // someone else beat us to it. - return real_forwardee(old); + return real_forwardee(old); } - new_obj = _next_gen->par_promote(par_scan_state->thread_num(), - old, m, sz); + new_obj = _old_gen->par_promote(par_scan_state->thread_num(), old, m, sz); if (new_obj == NULL) { // promotion failed, forward to self @@ -1227,8 +1218,11 @@ // information. if (TraceScavenge) { gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}", - is_in_reserved(new_obj) ? "copying" : "tenuring", - new_obj->klass()->internal_name(), (void *)old, (void *)new_obj, new_obj->size()); + is_in_reserved(new_obj) ? "copying" : "tenuring", + new_obj->klass()->internal_name(), + (void *)old, + (void *)new_obj, + new_obj->size()); } #endif @@ -1314,8 +1308,8 @@ if (new_obj == NULL) { // Either to-space is full or we decided to promote // try allocating obj tenured - new_obj = _next_gen->par_promote(par_scan_state->thread_num(), - old, m, sz); + new_obj = _old_gen->par_promote(par_scan_state->thread_num(), + old, m, sz); if (new_obj == NULL) { // promotion failed, forward to self @@ -1348,8 +1342,11 @@ // information. if (TraceScavenge) { gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}", - is_in_reserved(new_obj) ? "copying" : "tenuring", - new_obj->klass()->internal_name(), (void *)old, (void *)new_obj, new_obj->size()); + is_in_reserved(new_obj) ? "copying" : "tenuring", + new_obj->klass()->internal_name(), + (void*)old, + (void*)new_obj, + new_obj->size()); } #endif @@ -1395,8 +1392,8 @@ par_scan_state->undo_alloc_in_to_space((HeapWord*)new_obj, sz); } else { assert(!_avoid_promotion_undo, "Should not be here if avoiding."); - _next_gen->par_promote_alloc_undo(par_scan_state->thread_num(), - (HeapWord*)new_obj, sz); + _old_gen->par_promote_alloc_undo(par_scan_state->thread_num(), + (HeapWord*)new_obj, sz); } return forward_ptr; @@ -1511,7 +1508,9 @@ assert(!UseCompressedOops, "Error"); assert(par_scan_state->overflow_stack() == NULL, "Error"); - if (_overflow_list == NULL) return false; + if (_overflow_list == NULL) { + return false; + } // Otherwise, there was something there; try claiming the list. oop prefix = cast_to_oop(Atomic::xchg_ptr(BUSY, &_overflow_list));