comparison src/share/vm/gc_implementation/g1/concurrentZFThread.hpp @ 342:37f87013dfd8

6711316: Open source the Garbage-First garbage collector Summary: First mercurial integration of the code for the Garbage-First garbage collector. Reviewed-by: apetrusenko, iveresov, jmasa, sgoldman, tonyp, ysr
author ysr
date Thu, 05 Jun 2008 15:57:56 -0700
parents
children 315a5d70b295
comparison
equal deleted inserted replaced
189:0b27f3512f9e 342:37f87013dfd8
1 /*
2 * Copyright 2001-2007 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 *
23 */
24
25 // The Concurrent ZF Thread. Performs concurrent zero-filling.
26
27 class ConcurrentZFThread: public ConcurrentGCThread {
28 friend class VMStructs;
29 friend class ZeroFillRegionClosure;
30
31 private:
32
33 // Zero fill the heap region.
34 void processHeapRegion(HeapRegion* r);
35
36 // Stats
37 // Allocation (protected by heap lock).
38 static int _region_allocs; // Number of regions allocated
39 static int _sync_zfs; // Synchronous zero-fills +
40 static int _zf_waits; // Wait for conc zero-fill completion.
41
42 // Number of regions CFZ thread fills.
43 static int _regions_filled;
44
45 COTracker _co_tracker;
46
47 double _vtime_start; // Initial virtual time.
48
49 // These are static because the "print_summary_info" method is, and
50 // it currently assumes there is only one ZF thread. We'll change when
51 // we need to.
52 static double _vtime_accum; // Initial virtual time.
53 static double vtime_accum() { return _vtime_accum; }
54
55 // Offer yield for GC. Returns true if yield occurred.
56 bool offer_yield();
57
58 public:
59 // Constructor
60 ConcurrentZFThread();
61
62 // Main loop.
63 virtual void run();
64
65 // Printing
66 void print();
67
68 // Waits until "r" has been zero-filled. Requires caller to hold the
69 // ZF_mon.
70 static void wait_for_ZF_completed(HeapRegion* r);
71
72 // Get or clear the current unclean region. Should be done
73 // while holding the ZF_needed_mon lock.
74
75 // shutdown
76 static void stop();
77
78 // Stats
79 static void note_region_alloc() {_region_allocs++; }
80 static void note_sync_zfs() { _sync_zfs++; }
81 static void note_zf_wait() { _zf_waits++; }
82 static void note_region_filled() { _regions_filled++; }
83
84 static void print_summary_info();
85 };