author | coleenp |
Mon, 27 Jul 2009 17:23:52 -0400 | |
changeset 3579 | b18b94266d60 |
parent 3262 | 30d1c247fc25 |
child 3693 | af387bf37e8d |
permissions | -rw-r--r-- |
1 | 1 |
/* |
670 | 2 |
* Copyright 1997-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 |
# include "incls/_precompiled.incl" |
|
26 |
# include "incls/_instanceRefKlass.cpp.incl" |
|
27 |
||
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
28 |
template <class T> |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
29 |
static void specialized_oop_follow_contents(instanceRefKlass* ref, oop obj) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
30 |
T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj); |
3262
30d1c247fc25
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
1388
diff
changeset
|
31 |
T heap_oop = oopDesc::load_heap_oop(referent_addr); |
1 | 32 |
debug_only( |
33 |
if(TraceReferenceGC && PrintGCDetails) { |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
34 |
gclog_or_tty->print_cr("instanceRefKlass::oop_follow_contents " INTPTR_FORMAT, obj); |
1 | 35 |
} |
36 |
) |
|
3262
30d1c247fc25
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
1388
diff
changeset
|
37 |
if (!oopDesc::is_null(heap_oop)) { |
30d1c247fc25
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
1388
diff
changeset
|
38 |
oop referent = oopDesc::decode_heap_oop_not_null(heap_oop); |
1 | 39 |
if (!referent->is_gc_marked() && |
40 |
MarkSweep::ref_processor()-> |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
41 |
discover_reference(obj, ref->reference_type())) { |
1 | 42 |
// reference already enqueued, referent will be traversed later |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
43 |
ref->instanceKlass::oop_follow_contents(obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
44 |
debug_only( |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
45 |
if(TraceReferenceGC && PrintGCDetails) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
46 |
gclog_or_tty->print_cr(" Non NULL enqueued " INTPTR_FORMAT, obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
47 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
48 |
) |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
49 |
return; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
50 |
} else { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
51 |
// treat referent as normal oop |
1 | 52 |
debug_only( |
53 |
if(TraceReferenceGC && PrintGCDetails) { |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
54 |
gclog_or_tty->print_cr(" Non NULL normal " INTPTR_FORMAT, obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
55 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
56 |
) |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
57 |
MarkSweep::mark_and_push(referent_addr); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
58 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
59 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
60 |
// treat next as normal oop. next is a link in the pending list. |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
61 |
T* next_addr = (T*)java_lang_ref_Reference::next_addr(obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
62 |
debug_only( |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
63 |
if(TraceReferenceGC && PrintGCDetails) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
64 |
gclog_or_tty->print_cr(" Process next as normal " INTPTR_FORMAT, next_addr); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
65 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
66 |
) |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
67 |
MarkSweep::mark_and_push(next_addr); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
68 |
ref->instanceKlass::oop_follow_contents(obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
69 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
70 |
|
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
71 |
void instanceRefKlass::oop_follow_contents(oop obj) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
72 |
if (UseCompressedOops) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
73 |
specialized_oop_follow_contents<narrowOop>(this, obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
74 |
} else { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
75 |
specialized_oop_follow_contents<oop>(this, obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
76 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
77 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
78 |
|
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
79 |
#ifndef SERIALGC |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
80 |
template <class T> |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
81 |
static void specialized_oop_follow_contents(instanceRefKlass* ref, |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
82 |
ParCompactionManager* cm, |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
83 |
oop obj) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
84 |
T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj); |
3262
30d1c247fc25
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
1388
diff
changeset
|
85 |
T heap_oop = oopDesc::load_heap_oop(referent_addr); |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
86 |
debug_only( |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
87 |
if(TraceReferenceGC && PrintGCDetails) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
88 |
gclog_or_tty->print_cr("instanceRefKlass::oop_follow_contents " INTPTR_FORMAT, obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
89 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
90 |
) |
3262
30d1c247fc25
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
1388
diff
changeset
|
91 |
if (!oopDesc::is_null(heap_oop)) { |
30d1c247fc25
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
1388
diff
changeset
|
92 |
oop referent = oopDesc::decode_heap_oop_not_null(heap_oop); |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
93 |
if (PSParallelCompact::mark_bitmap()->is_unmarked(referent) && |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
94 |
PSParallelCompact::ref_processor()-> |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
95 |
discover_reference(obj, ref->reference_type())) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
96 |
// reference already enqueued, referent will be traversed later |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
97 |
ref->instanceKlass::oop_follow_contents(cm, obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
98 |
debug_only( |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
99 |
if(TraceReferenceGC && PrintGCDetails) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
100 |
gclog_or_tty->print_cr(" Non NULL enqueued " INTPTR_FORMAT, obj); |
1 | 101 |
} |
102 |
) |
|
103 |
return; |
|
104 |
} else { |
|
105 |
// treat referent as normal oop |
|
106 |
debug_only( |
|
107 |
if(TraceReferenceGC && PrintGCDetails) { |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
108 |
gclog_or_tty->print_cr(" Non NULL normal " INTPTR_FORMAT, obj); |
1 | 109 |
} |
110 |
) |
|
111 |
PSParallelCompact::mark_and_push(cm, referent_addr); |
|
112 |
} |
|
113 |
} |
|
114 |
// treat next as normal oop. next is a link in the pending list. |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
115 |
T* next_addr = (T*)java_lang_ref_Reference::next_addr(obj); |
1 | 116 |
debug_only( |
117 |
if(TraceReferenceGC && PrintGCDetails) { |
|
118 |
gclog_or_tty->print_cr(" Process next as normal " INTPTR_FORMAT, next_addr); |
|
119 |
} |
|
120 |
) |
|
121 |
PSParallelCompact::mark_and_push(cm, next_addr); |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
122 |
ref->instanceKlass::oop_follow_contents(cm, obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
123 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
124 |
|
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
125 |
void instanceRefKlass::oop_follow_contents(ParCompactionManager* cm, |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
126 |
oop obj) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
127 |
if (UseCompressedOops) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
128 |
specialized_oop_follow_contents<narrowOop>(this, cm, obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
129 |
} else { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
130 |
specialized_oop_follow_contents<oop>(this, cm, obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
131 |
} |
1 | 132 |
} |
133 |
#endif // SERIALGC |
|
134 |
||
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
135 |
#ifdef ASSERT |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
136 |
template <class T> void trace_reference_gc(const char *s, oop obj, |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
137 |
T* referent_addr, |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
138 |
T* next_addr, |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
139 |
T* discovered_addr) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
140 |
if(TraceReferenceGC && PrintGCDetails) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
141 |
gclog_or_tty->print_cr("%s obj " INTPTR_FORMAT, s, (address)obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
142 |
gclog_or_tty->print_cr(" referent_addr/* " INTPTR_FORMAT " / " |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
143 |
INTPTR_FORMAT, referent_addr, |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
144 |
referent_addr ? |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
145 |
(address)oopDesc::load_decode_heap_oop(referent_addr) : NULL); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
146 |
gclog_or_tty->print_cr(" next_addr/* " INTPTR_FORMAT " / " |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
147 |
INTPTR_FORMAT, next_addr, |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
148 |
next_addr ? (address)oopDesc::load_decode_heap_oop(next_addr) : NULL); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
149 |
gclog_or_tty->print_cr(" discovered_addr/* " INTPTR_FORMAT " / " |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
150 |
INTPTR_FORMAT, discovered_addr, |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
151 |
discovered_addr ? |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
152 |
(address)oopDesc::load_decode_heap_oop(discovered_addr) : NULL); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
153 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
154 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
155 |
#endif |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
156 |
|
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
157 |
template <class T> void specialized_oop_adjust_pointers(instanceRefKlass *ref, oop obj) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
158 |
T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
159 |
MarkSweep::adjust_pointer(referent_addr); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
160 |
T* next_addr = (T*)java_lang_ref_Reference::next_addr(obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
161 |
MarkSweep::adjust_pointer(next_addr); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
162 |
T* discovered_addr = (T*)java_lang_ref_Reference::discovered_addr(obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
163 |
MarkSweep::adjust_pointer(discovered_addr); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
164 |
debug_only(trace_reference_gc("instanceRefKlass::oop_adjust_pointers", obj, |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
165 |
referent_addr, next_addr, discovered_addr);) |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
166 |
} |
1 | 167 |
|
168 |
int instanceRefKlass::oop_adjust_pointers(oop obj) { |
|
169 |
int size = size_helper(); |
|
170 |
instanceKlass::oop_adjust_pointers(obj); |
|
171 |
||
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
172 |
if (UseCompressedOops) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
173 |
specialized_oop_adjust_pointers<narrowOop>(this, obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
174 |
} else { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
175 |
specialized_oop_adjust_pointers<oop>(this, obj); |
1 | 176 |
} |
177 |
return size; |
|
178 |
} |
|
179 |
||
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
180 |
#define InstanceRefKlass_SPECIALIZED_OOP_ITERATE(T, nv_suffix, contains) \ |
1374
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
181 |
if (closure->apply_to_weak_ref_discovered_field()) { \ |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
182 |
T* disc_addr = (T*)java_lang_ref_Reference::discovered_addr(obj); \ |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
183 |
closure->do_oop##nv_suffix(disc_addr); \ |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
184 |
} \ |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
185 |
\ |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
186 |
T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj); \ |
3262
30d1c247fc25
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
1388
diff
changeset
|
187 |
T heap_oop = oopDesc::load_heap_oop(referent_addr); \ |
30d1c247fc25
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
1388
diff
changeset
|
188 |
if (!oopDesc::is_null(heap_oop) && contains(referent_addr)) { \ |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
189 |
ReferenceProcessor* rp = closure->_ref_processor; \ |
3262
30d1c247fc25
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
1388
diff
changeset
|
190 |
oop referent = oopDesc::decode_heap_oop_not_null(heap_oop); \ |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
191 |
if (!referent->is_gc_marked() && (rp != NULL) && \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
192 |
rp->discover_reference(obj, reference_type())) { \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
193 |
return size; \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
194 |
} else { \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
195 |
/* treat referent as normal oop */ \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
196 |
SpecializationStats::record_do_oop_call##nv_suffix(SpecializationStats::irk);\ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
197 |
closure->do_oop##nv_suffix(referent_addr); \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
198 |
} \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
199 |
} \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
200 |
/* treat next as normal oop */ \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
201 |
T* next_addr = (T*)java_lang_ref_Reference::next_addr(obj); \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
202 |
if (contains(next_addr)) { \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
203 |
SpecializationStats::record_do_oop_call##nv_suffix(SpecializationStats::irk); \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
204 |
closure->do_oop##nv_suffix(next_addr); \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
205 |
} \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
206 |
return size; \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
207 |
|
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
208 |
|
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
209 |
template <class T> bool contains(T *t) { return true; } |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
210 |
|
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
211 |
// Macro to define instanceRefKlass::oop_oop_iterate for virtual/nonvirtual for |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
212 |
// all closures. Macros calling macros above for each oop size. |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
213 |
|
1 | 214 |
#define InstanceRefKlass_OOP_OOP_ITERATE_DEFN(OopClosureType, nv_suffix) \ |
215 |
\ |
|
216 |
int instanceRefKlass:: \ |
|
217 |
oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure) { \ |
|
218 |
/* Get size before changing pointers */ \ |
|
219 |
SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);\ |
|
220 |
\ |
|
221 |
int size = instanceKlass::oop_oop_iterate##nv_suffix(obj, closure); \ |
|
222 |
\ |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
223 |
if (UseCompressedOops) { \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
224 |
InstanceRefKlass_SPECIALIZED_OOP_ITERATE(narrowOop, nv_suffix, contains); \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
225 |
} else { \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
226 |
InstanceRefKlass_SPECIALIZED_OOP_ITERATE(oop, nv_suffix, contains); \ |
1 | 227 |
} \ |
228 |
} |
|
229 |
||
1374
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
230 |
#ifndef SERIALGC |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
231 |
#define InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN(OopClosureType, nv_suffix) \ |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
232 |
\ |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
233 |
int instanceRefKlass:: \ |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
234 |
oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* closure) { \ |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
235 |
/* Get size before changing pointers */ \ |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
236 |
SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);\ |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
237 |
\ |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
238 |
int size = instanceKlass::oop_oop_iterate_backwards##nv_suffix(obj, closure); \ |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
239 |
\ |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
240 |
if (UseCompressedOops) { \ |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
241 |
InstanceRefKlass_SPECIALIZED_OOP_ITERATE(narrowOop, nv_suffix, contains); \ |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
242 |
} else { \ |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
243 |
InstanceRefKlass_SPECIALIZED_OOP_ITERATE(oop, nv_suffix, contains); \ |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
244 |
} \ |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
245 |
} |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
246 |
#endif // !SERIALGC |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
247 |
|
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
248 |
|
1 | 249 |
#define InstanceRefKlass_OOP_OOP_ITERATE_DEFN_m(OopClosureType, nv_suffix) \ |
250 |
\ |
|
251 |
int instanceRefKlass:: \ |
|
252 |
oop_oop_iterate##nv_suffix##_m(oop obj, \ |
|
253 |
OopClosureType* closure, \ |
|
254 |
MemRegion mr) { \ |
|
255 |
SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);\ |
|
256 |
\ |
|
257 |
int size = instanceKlass::oop_oop_iterate##nv_suffix##_m(obj, closure, mr); \ |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
258 |
if (UseCompressedOops) { \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
259 |
InstanceRefKlass_SPECIALIZED_OOP_ITERATE(narrowOop, nv_suffix, mr.contains); \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
260 |
} else { \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
261 |
InstanceRefKlass_SPECIALIZED_OOP_ITERATE(oop, nv_suffix, mr.contains); \ |
1 | 262 |
} \ |
263 |
} |
|
264 |
||
265 |
ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_DEFN) |
|
1374
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
266 |
ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_DEFN) |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
267 |
#ifndef SERIALGC |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
268 |
ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN) |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
269 |
ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN) |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
270 |
#endif // SERIALGC |
1 | 271 |
ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_DEFN_m) |
1374
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
272 |
ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_DEFN_m) |
1 | 273 |
|
274 |
#ifndef SERIALGC |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
275 |
template <class T> |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
276 |
void specialized_oop_copy_contents(instanceRefKlass *ref, |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
277 |
PSPromotionManager* pm, oop obj) { |
1 | 278 |
assert(!pm->depth_first(), "invariant"); |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
279 |
T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
280 |
if (PSScavenge::should_scavenge(referent_addr)) { |
1 | 281 |
ReferenceProcessor* rp = PSScavenge::reference_processor(); |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
282 |
if (rp->discover_reference(obj, ref->reference_type())) { |
1 | 283 |
// reference already enqueued, referent and next will be traversed later |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
284 |
ref->instanceKlass::oop_copy_contents(pm, obj); |
1 | 285 |
return; |
286 |
} else { |
|
287 |
// treat referent as normal oop |
|
288 |
pm->claim_or_forward_breadth(referent_addr); |
|
289 |
} |
|
290 |
} |
|
291 |
// treat next as normal oop |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
292 |
T* next_addr = (T*)java_lang_ref_Reference::next_addr(obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
293 |
if (PSScavenge::should_scavenge(next_addr)) { |
1 | 294 |
pm->claim_or_forward_breadth(next_addr); |
295 |
} |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
296 |
ref->instanceKlass::oop_copy_contents(pm, obj); |
1 | 297 |
} |
298 |
||
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
299 |
void instanceRefKlass::oop_copy_contents(PSPromotionManager* pm, oop obj) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
300 |
if (UseCompressedOops) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
301 |
specialized_oop_copy_contents<narrowOop>(this, pm, obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
302 |
} else { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
303 |
specialized_oop_copy_contents<oop>(this, pm, obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
304 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
305 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
306 |
|
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
307 |
template <class T> |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
308 |
void specialized_oop_push_contents(instanceRefKlass *ref, |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
309 |
PSPromotionManager* pm, oop obj) { |
1 | 310 |
assert(pm->depth_first(), "invariant"); |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
311 |
T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
312 |
if (PSScavenge::should_scavenge(referent_addr)) { |
1 | 313 |
ReferenceProcessor* rp = PSScavenge::reference_processor(); |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
314 |
if (rp->discover_reference(obj, ref->reference_type())) { |
1 | 315 |
// reference already enqueued, referent and next will be traversed later |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
316 |
ref->instanceKlass::oop_push_contents(pm, obj); |
1 | 317 |
return; |
318 |
} else { |
|
319 |
// treat referent as normal oop |
|
320 |
pm->claim_or_forward_depth(referent_addr); |
|
321 |
} |
|
322 |
} |
|
323 |
// treat next as normal oop |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
324 |
T* next_addr = (T*)java_lang_ref_Reference::next_addr(obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
325 |
if (PSScavenge::should_scavenge(next_addr)) { |
1 | 326 |
pm->claim_or_forward_depth(next_addr); |
327 |
} |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
328 |
ref->instanceKlass::oop_push_contents(pm, obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
329 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
330 |
|
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
331 |
void instanceRefKlass::oop_push_contents(PSPromotionManager* pm, oop obj) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
332 |
if (UseCompressedOops) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
333 |
specialized_oop_push_contents<narrowOop>(this, pm, obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
334 |
} else { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
335 |
specialized_oop_push_contents<oop>(this, pm, obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
336 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
337 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
338 |
|
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
339 |
template <class T> |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
340 |
void specialized_oop_update_pointers(instanceRefKlass *ref, |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
341 |
ParCompactionManager* cm, oop obj) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
342 |
T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
343 |
PSParallelCompact::adjust_pointer(referent_addr); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
344 |
T* next_addr = (T*)java_lang_ref_Reference::next_addr(obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
345 |
PSParallelCompact::adjust_pointer(next_addr); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
346 |
T* discovered_addr = (T*)java_lang_ref_Reference::discovered_addr(obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
347 |
PSParallelCompact::adjust_pointer(discovered_addr); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
348 |
debug_only(trace_reference_gc("instanceRefKlass::oop_update_ptrs", obj, |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
349 |
referent_addr, next_addr, discovered_addr);) |
1 | 350 |
} |
351 |
||
352 |
int instanceRefKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) { |
|
353 |
instanceKlass::oop_update_pointers(cm, obj); |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
354 |
if (UseCompressedOops) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
355 |
specialized_oop_update_pointers<narrowOop>(this, cm, obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
356 |
} else { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
357 |
specialized_oop_update_pointers<oop>(this, cm, obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
358 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
359 |
return size_helper(); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
360 |
} |
1 | 361 |
|
362 |
||
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
363 |
template <class T> void |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
364 |
specialized_oop_update_pointers(ParCompactionManager* cm, oop obj, |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
365 |
HeapWord* beg_addr, HeapWord* end_addr) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
366 |
T* p; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
367 |
T* referent_addr = p = (T*)java_lang_ref_Reference::referent_addr(obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
368 |
PSParallelCompact::adjust_pointer(p, beg_addr, end_addr); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
369 |
T* next_addr = p = (T*)java_lang_ref_Reference::next_addr(obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
370 |
PSParallelCompact::adjust_pointer(p, beg_addr, end_addr); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
371 |
T* discovered_addr = p = (T*)java_lang_ref_Reference::discovered_addr(obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
372 |
PSParallelCompact::adjust_pointer(p, beg_addr, end_addr); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
373 |
debug_only(trace_reference_gc("instanceRefKlass::oop_update_ptrs", obj, |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
374 |
referent_addr, next_addr, discovered_addr);) |
1 | 375 |
} |
376 |
||
377 |
int |
|
378 |
instanceRefKlass::oop_update_pointers(ParCompactionManager* cm, oop obj, |
|
379 |
HeapWord* beg_addr, HeapWord* end_addr) { |
|
380 |
instanceKlass::oop_update_pointers(cm, obj, beg_addr, end_addr); |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
381 |
if (UseCompressedOops) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
382 |
specialized_oop_update_pointers<narrowOop>(cm, obj, beg_addr, end_addr); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
383 |
} else { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
384 |
specialized_oop_update_pointers<oop>(cm, obj, beg_addr, end_addr); |
1 | 385 |
} |
386 |
return size_helper(); |
|
387 |
} |
|
388 |
#endif // SERIALGC |
|
389 |
||
390 |
void instanceRefKlass::update_nonstatic_oop_maps(klassOop k) { |
|
391 |
// Clear the nonstatic oop-map entries corresponding to referent |
|
392 |
// and nextPending field. They are treated specially by the |
|
393 |
// garbage collector. |
|
394 |
// The discovered field is used only by the garbage collector |
|
395 |
// and is also treated specially. |
|
396 |
instanceKlass* ik = instanceKlass::cast(k); |
|
397 |
||
398 |
// Check that we have the right class |
|
399 |
debug_only(static bool first_time = true); |
|
400 |
assert(k == SystemDictionary::reference_klass() && first_time, |
|
401 |
"Invalid update of maps"); |
|
402 |
debug_only(first_time = false); |
|
403 |
assert(ik->nonstatic_oop_map_size() == 1, "just checking"); |
|
404 |
||
405 |
OopMapBlock* map = ik->start_of_nonstatic_oop_maps(); |
|
406 |
||
407 |
// Check that the current map is (2,4) - currently points at field with |
|
408 |
// offset 2 (words) and has 4 map entries. |
|
409 |
debug_only(int offset = java_lang_ref_Reference::referent_offset); |
|
410 |
debug_only(int length = ((java_lang_ref_Reference::discovered_offset - |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
411 |
java_lang_ref_Reference::referent_offset)/heapOopSize) + 1); |
1 | 412 |
|
413 |
if (UseSharedSpaces) { |
|
414 |
assert(map->offset() == java_lang_ref_Reference::queue_offset && |
|
415 |
map->length() == 1, "just checking"); |
|
416 |
} else { |
|
417 |
assert(map->offset() == offset && map->length() == length, |
|
418 |
"just checking"); |
|
419 |
||
420 |
// Update map to (3,1) - point to offset of 3 (words) with 1 map entry. |
|
421 |
map->set_offset(java_lang_ref_Reference::queue_offset); |
|
422 |
map->set_length(1); |
|
423 |
} |
|
424 |
} |
|
425 |
||
426 |
||
427 |
// Verification |
|
428 |
||
429 |
void instanceRefKlass::oop_verify_on(oop obj, outputStream* st) { |
|
430 |
instanceKlass::oop_verify_on(obj, st); |
|
431 |
// Verify referent field |
|
432 |
oop referent = java_lang_ref_Reference::referent(obj); |
|
433 |
||
434 |
// We should make this general to all heaps |
|
435 |
GenCollectedHeap* gch = NULL; |
|
436 |
if (Universe::heap()->kind() == CollectedHeap::GenCollectedHeap) |
|
437 |
gch = GenCollectedHeap::heap(); |
|
438 |
||
439 |
if (referent != NULL) { |
|
440 |
guarantee(referent->is_oop(), "referent field heap failed"); |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
441 |
if (gch != NULL && !gch->is_in_youngest(obj)) { |
1 | 442 |
// We do a specific remembered set check here since the referent |
443 |
// field is not part of the oop mask and therefore skipped by the |
|
444 |
// regular verify code. |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
445 |
if (UseCompressedOops) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
446 |
narrowOop* referent_addr = (narrowOop*)java_lang_ref_Reference::referent_addr(obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
447 |
obj->verify_old_oop(referent_addr, true); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
448 |
} else { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
449 |
oop* referent_addr = (oop*)java_lang_ref_Reference::referent_addr(obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
450 |
obj->verify_old_oop(referent_addr, true); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
451 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
452 |
} |
1 | 453 |
} |
454 |
// Verify next field |
|
455 |
oop next = java_lang_ref_Reference::next(obj); |
|
456 |
if (next != NULL) { |
|
1374
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
457 |
guarantee(next->is_oop(), "next field verify failed"); |
1 | 458 |
guarantee(next->is_instanceRef(), "next field verify failed"); |
459 |
if (gch != NULL && !gch->is_in_youngest(obj)) { |
|
460 |
// We do a specific remembered set check here since the next field is |
|
461 |
// not part of the oop mask and therefore skipped by the regular |
|
462 |
// verify code. |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
463 |
if (UseCompressedOops) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
464 |
narrowOop* next_addr = (narrowOop*)java_lang_ref_Reference::next_addr(obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
465 |
obj->verify_old_oop(next_addr, true); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
466 |
} else { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
467 |
oop* next_addr = (oop*)java_lang_ref_Reference::next_addr(obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
468 |
obj->verify_old_oop(next_addr, true); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
469 |
} |
1 | 470 |
} |
471 |
} |
|
472 |
} |
|
473 |
||
474 |
void instanceRefKlass::acquire_pending_list_lock(BasicLock *pending_list_basic_lock) { |
|
475 |
// we may enter this with pending exception set |
|
476 |
PRESERVE_EXCEPTION_MARK; // exceptions are never thrown, needed for TRAPS argument |
|
477 |
Handle h_lock(THREAD, java_lang_ref_Reference::pending_list_lock()); |
|
478 |
ObjectSynchronizer::fast_enter(h_lock, pending_list_basic_lock, false, THREAD); |
|
479 |
assert(ObjectSynchronizer::current_thread_holds_lock( |
|
480 |
JavaThread::current(), h_lock), |
|
481 |
"Locking should have succeeded"); |
|
482 |
if (HAS_PENDING_EXCEPTION) CLEAR_PENDING_EXCEPTION; |
|
483 |
} |
|
484 |
||
485 |
void instanceRefKlass::release_and_notify_pending_list_lock( |
|
486 |
BasicLock *pending_list_basic_lock) { |
|
487 |
// we may enter this with pending exception set |
|
488 |
PRESERVE_EXCEPTION_MARK; // exceptions are never thrown, needed for TRAPS argument |
|
489 |
// |
|
490 |
Handle h_lock(THREAD, java_lang_ref_Reference::pending_list_lock()); |
|
491 |
assert(ObjectSynchronizer::current_thread_holds_lock( |
|
492 |
JavaThread::current(), h_lock), |
|
493 |
"Lock should be held"); |
|
494 |
// Notify waiters on pending lists lock if there is any reference. |
|
495 |
if (java_lang_ref_Reference::pending_list() != NULL) { |
|
496 |
ObjectSynchronizer::notifyall(h_lock, THREAD); |
|
497 |
} |
|
498 |
ObjectSynchronizer::fast_exit(h_lock(), pending_list_basic_lock, THREAD); |
|
499 |
if (HAS_PENDING_EXCEPTION) CLEAR_PENDING_EXCEPTION; |
|
500 |
} |