1 /* |
1 /* |
2 * Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved. |
2 * Copyright 2001-2010 Sun Microsystems, Inc. All Rights Reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
67 void ConcurrentG1RefineThread::sample_young_list_rs_lengths() { |
67 void ConcurrentG1RefineThread::sample_young_list_rs_lengths() { |
68 G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
68 G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
69 G1CollectorPolicy* g1p = g1h->g1_policy(); |
69 G1CollectorPolicy* g1p = g1h->g1_policy(); |
70 if (g1p->adaptive_young_list_length()) { |
70 if (g1p->adaptive_young_list_length()) { |
71 int regions_visited = 0; |
71 int regions_visited = 0; |
72 g1h->young_list_rs_length_sampling_init(); |
72 g1h->young_list()->rs_length_sampling_init(); |
73 while (g1h->young_list_rs_length_sampling_more()) { |
73 while (g1h->young_list()->rs_length_sampling_more()) { |
74 g1h->young_list_rs_length_sampling_next(); |
74 g1h->young_list()->rs_length_sampling_next(); |
75 ++regions_visited; |
75 ++regions_visited; |
76 |
76 |
77 // we try to yield every time we visit 10 regions |
77 // we try to yield every time we visit 10 regions |
78 if (regions_visited == 10) { |
78 if (regions_visited == 10) { |
79 if (_sts.should_yield()) { |
79 if (_sts.should_yield()) { |
160 wait_for_universe_init(); |
160 wait_for_universe_init(); |
161 |
161 |
162 if (_worker_id >= cg1r()->worker_thread_num()) { |
162 if (_worker_id >= cg1r()->worker_thread_num()) { |
163 run_young_rs_sampling(); |
163 run_young_rs_sampling(); |
164 terminate(); |
164 terminate(); |
|
165 return; |
165 } |
166 } |
166 |
167 |
167 _vtime_start = os::elapsedVTime(); |
168 _vtime_start = os::elapsedVTime(); |
168 while (!_should_terminate) { |
169 while (!_should_terminate) { |
169 DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set(); |
170 DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set(); |