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