Mercurial > hg > truffle
comparison src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp @ 362:f8199438385b
Merge
author | apetrusenko |
---|---|
date | Wed, 17 Sep 2008 16:49:18 +0400 |
parents | 37f87013dfd8 |
children | df6caf649ff7 |
comparison
equal
deleted
inserted
replaced
316:5fa96a5a7e76 | 362:f8199438385b |
---|---|
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 /* | |
26 * This really ought to be an inline function, but apparently the C++ | |
27 * compiler sometimes sees fit to ignore inline declarations. Sigh. | |
28 */ | |
29 | |
30 // This must a ifdef'ed because the counting it controls is in a | |
31 // perf-critical inner loop. | |
32 #define FILTERINTOCSCLOSURE_DOHISTOGRAMCOUNT 0 | |
33 | |
34 inline void FilterIntoCSClosure::do_oop_nv(oop* p) { | |
35 oop obj = *p; | |
36 if (obj != NULL && _g1->obj_in_cs(obj)) { | |
37 _oc->do_oop(p); | |
38 #if FILTERINTOCSCLOSURE_DOHISTOGRAMCOUNT | |
39 _dcto_cl->incr_count(); | |
40 #endif | |
41 } | |
42 } | |
43 | |
44 inline void FilterIntoCSClosure::do_oop(oop* p) | |
45 { | |
46 do_oop_nv(p); | |
47 } | |
48 | |
49 #define FILTEROUTOFREGIONCLOSURE_DOHISTOGRAMCOUNT 0 | |
50 | |
51 inline void FilterOutOfRegionClosure::do_oop_nv(oop* p) { | |
52 oop obj = *p; | |
53 HeapWord* obj_hw = (HeapWord*)obj; | |
54 if (obj_hw != NULL && (obj_hw < _r_bottom || obj_hw >= _r_end)) { | |
55 _oc->do_oop(p); | |
56 #if FILTEROUTOFREGIONCLOSURE_DOHISTOGRAMCOUNT | |
57 _out_of_region++; | |
58 #endif | |
59 } | |
60 } | |
61 | |
62 inline void FilterOutOfRegionClosure::do_oop(oop* p) | |
63 { | |
64 do_oop_nv(p); | |
65 } | |
66 | |
67 inline void FilterInHeapRegionAndIntoCSClosure::do_oop_nv(oop* p) { | |
68 oop obj = *p; | |
69 if (obj != NULL && _g1->obj_in_cs(obj)) | |
70 _oc->do_oop(p); | |
71 } | |
72 | |
73 inline void FilterInHeapRegionAndIntoCSClosure::do_oop(oop* p) | |
74 { | |
75 do_oop_nv(p); | |
76 } | |
77 | |
78 | |
79 inline void FilterAndMarkInHeapRegionAndIntoCSClosure::do_oop_nv(oop* p) { | |
80 oop obj = *p; | |
81 if (obj != NULL) { | |
82 HeapRegion* hr = _g1->heap_region_containing((HeapWord*) obj); | |
83 if (hr != NULL) { | |
84 if (hr->in_collection_set()) | |
85 _oc->do_oop(p); | |
86 else if (!hr->is_young()) | |
87 _cm->grayRoot(obj); | |
88 } | |
89 } | |
90 } | |
91 | |
92 inline void FilterAndMarkInHeapRegionAndIntoCSClosure::do_oop(oop* p) | |
93 { | |
94 do_oop_nv(p); | |
95 } | |
96 | |
97 inline void G1ScanAndBalanceClosure::do_oop_nv(oop* p) { | |
98 RefToScanQueue* q; | |
99 if (ParallelGCThreads > 0) { | |
100 // Deal the work out equally. | |
101 _nq = (_nq + 1) % ParallelGCThreads; | |
102 q = _g1->task_queue(_nq); | |
103 } else { | |
104 q = _g1->task_queue(0); | |
105 } | |
106 bool nooverflow = q->push(p); | |
107 guarantee(nooverflow, "Overflow during poplularity region processing"); | |
108 } | |
109 | |
110 inline void G1ScanAndBalanceClosure::do_oop(oop* p) { | |
111 do_oop_nv(p); | |
112 } |