author | acorn |
Thu, 05 Mar 2009 22:07:29 -0500 | |
changeset 2140 | 07437c6a4cd4 |
parent 1388 | 3677f5f3d66b |
child 3262 | 30d1c247fc25 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
670 | 2 |
* Copyright 2001-2008 Sun Microsystems, Inc. All Rights Reserved. |
1 | 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 |
inline OopsInGenClosure::OopsInGenClosure(Generation* gen) : |
|
26 |
OopClosure(gen->ref_processor()), _orig_gen(gen), _rs(NULL) { |
|
27 |
set_generation(gen); |
|
28 |
} |
|
29 |
||
30 |
inline void OopsInGenClosure::set_generation(Generation* gen) { |
|
31 |
_gen = gen; |
|
32 |
_gen_boundary = _gen->reserved().start(); |
|
33 |
// Barrier set for the heap, must be set after heap is initialized |
|
34 |
if (_rs == NULL) { |
|
35 |
GenRemSet* rs = SharedHeap::heap()->rem_set(); |
|
36 |
assert(rs->rs_kind() == GenRemSet::CardTable, "Wrong rem set kind"); |
|
37 |
_rs = (CardTableRS*)rs; |
|
38 |
} |
|
39 |
} |
|
40 |
||
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
41 |
template <class T> inline void OopsInGenClosure::do_barrier(T* p) { |
1 | 42 |
assert(generation()->is_in_reserved(p), "expected ref in generation"); |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
43 |
assert(!oopDesc::is_null(*p), "expected non-null object"); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
44 |
oop obj = oopDesc::load_decode_heap_oop_not_null(p); |
1 | 45 |
// If p points to a younger generation, mark the card. |
46 |
if ((HeapWord*)obj < _gen_boundary) { |
|
47 |
_rs->inline_write_ref_field_gc(p, obj); |
|
48 |
} |
|
49 |
} |
|
50 |
||
1374
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
51 |
inline void OopsInGenClosure::par_do_barrier(oop* p) { |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
52 |
assert(generation()->is_in_reserved(p), "expected ref in generation"); |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
53 |
oop obj = *p; |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
54 |
assert(obj != NULL, "expected non-null object"); |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
55 |
// If p points to a younger generation, mark the card. |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
56 |
if ((HeapWord*)obj < gen_boundary()) { |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
57 |
rs()->write_ref_field_gc_par(p, obj); |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
58 |
} |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
59 |
} |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
60 |
|
1 | 61 |
// NOTE! Any changes made here should also be made |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
62 |
// in FastScanClosure::do_oop_work() |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
63 |
template <class T> inline void ScanClosure::do_oop_work(T* p) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
64 |
T heap_oop = oopDesc::load_heap_oop(p); |
1 | 65 |
// Should we copy the obj? |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
66 |
if (!oopDesc::is_null(heap_oop)) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
67 |
oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); |
1 | 68 |
if ((HeapWord*)obj < _boundary) { |
69 |
assert(!_g->to()->is_in_reserved(obj), "Scanning field twice?"); |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
70 |
oop new_obj = obj->is_forwarded() ? obj->forwardee() |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
71 |
: _g->copy_to_survivor_space(obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
72 |
oopDesc::encode_store_heap_oop_not_null(p, new_obj); |
1 | 73 |
} |
74 |
if (_gc_barrier) { |
|
75 |
// Now call parent closure |
|
76 |
do_barrier(p); |
|
77 |
} |
|
78 |
} |
|
79 |
} |
|
80 |
||
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
81 |
inline void ScanClosure::do_oop_nv(oop* p) { ScanClosure::do_oop_work(p); } |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
82 |
inline void ScanClosure::do_oop_nv(narrowOop* p) { ScanClosure::do_oop_work(p); } |
1 | 83 |
|
84 |
// NOTE! Any changes made here should also be made |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
85 |
// in ScanClosure::do_oop_work() |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
86 |
template <class T> inline void FastScanClosure::do_oop_work(T* p) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
87 |
T heap_oop = oopDesc::load_heap_oop(p); |
1 | 88 |
// Should we copy the obj? |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
89 |
if (!oopDesc::is_null(heap_oop)) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
90 |
oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); |
1 | 91 |
if ((HeapWord*)obj < _boundary) { |
92 |
assert(!_g->to()->is_in_reserved(obj), "Scanning field twice?"); |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
93 |
oop new_obj = obj->is_forwarded() ? obj->forwardee() |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
94 |
: _g->copy_to_survivor_space(obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
95 |
oopDesc::encode_store_heap_oop_not_null(p, new_obj); |
1 | 96 |
if (_gc_barrier) { |
97 |
// Now call parent closure |
|
98 |
do_barrier(p); |
|
99 |
} |
|
100 |
} |
|
101 |
} |
|
102 |
} |
|
103 |
||
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
104 |
inline void FastScanClosure::do_oop_nv(oop* p) { FastScanClosure::do_oop_work(p); } |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
105 |
inline void FastScanClosure::do_oop_nv(narrowOop* p) { FastScanClosure::do_oop_work(p); } |
1 | 106 |
|
107 |
// Note similarity to ScanClosure; the difference is that |
|
108 |
// the barrier set is taken care of outside this closure. |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
109 |
template <class T> inline void ScanWeakRefClosure::do_oop_work(T* p) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
110 |
assert(!oopDesc::is_null(*p), "null weak reference?"); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
111 |
oop obj = oopDesc::load_decode_heap_oop_not_null(p); |
1 | 112 |
// weak references are sometimes scanned twice; must check |
113 |
// that to-space doesn't already contain this object |
|
114 |
if ((HeapWord*)obj < _boundary && !_g->to()->is_in_reserved(obj)) { |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
115 |
oop new_obj = obj->is_forwarded() ? obj->forwardee() |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
116 |
: _g->copy_to_survivor_space(obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
117 |
oopDesc::encode_store_heap_oop_not_null(p, new_obj); |
1 | 118 |
} |
119 |
} |
|
120 |
||
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
121 |
inline void ScanWeakRefClosure::do_oop_nv(oop* p) { ScanWeakRefClosure::do_oop_work(p); } |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
122 |
inline void ScanWeakRefClosure::do_oop_nv(narrowOop* p) { ScanWeakRefClosure::do_oop_work(p); } |