Mercurial > hg > graal-compiler
annotate src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp @ 10185:d50cc62e94ff
8012715: G1: GraphKit accesses PtrQueue::_index as int but is size_t
Summary: In graphKit INT operations were generated to access PtrQueue::_index which has type size_t. This is 64 bit on 64-bit machines. No problems occur on little endian machines as long as the index fits into 32 bit, but on big endian machines the upper part is read, which is zero. This leads to unnecessary branches to the slow path in the runtime.
Reviewed-by: twisti, johnc
Contributed-by: Martin Doerr <martin.doerr@sap.com>
author | johnc |
---|---|
date | Wed, 24 Apr 2013 14:48:43 -0700 |
parents | da91efe96a93 |
children | 190899198332 |
rev | line source |
---|---|
0 | 1 /* |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3357
diff
changeset
|
2 * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
113
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
113
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
113
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef SHARE_VM_GC_IMPLEMENTATION_PARNEW_PAROOPCLOSURES_INLINE_HPP |
26 #define SHARE_VM_GC_IMPLEMENTATION_PARNEW_PAROOPCLOSURES_INLINE_HPP | |
27 | |
28 #include "gc_implementation/parNew/parNewGeneration.hpp" | |
29 #include "gc_implementation/parNew/parOopClosures.hpp" | |
30 #include "memory/cardTableRS.hpp" | |
31 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
32 template <class T> inline void ParScanWeakRefClosure::do_oop_work(T* p) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
33 assert (!oopDesc::is_null(*p), "null weak reference?"); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
34 oop obj = oopDesc::load_decode_heap_oop_not_null(p); |
0 | 35 // weak references are sometimes scanned twice; must check |
36 // that to-space doesn't already contain this object | |
37 if ((HeapWord*)obj < _boundary && !_g->to()->is_in_reserved(obj)) { | |
38 // we need to ensure that it is copied (see comment in | |
39 // ParScanClosure::do_oop_work). | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3357
diff
changeset
|
40 Klass* objK = obj->klass(); |
0 | 41 markOop m = obj->mark(); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
42 oop new_obj; |
0 | 43 if (m->is_marked()) { // Contains forwarding pointer. |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
44 new_obj = ParNewGeneration::real_forwardee(obj); |
0 | 45 } else { |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3357
diff
changeset
|
46 size_t obj_sz = obj->size_given_klass(objK); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
47 new_obj = ((ParNewGeneration*)_g)->copy_to_survivor_space(_par_scan_state, |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
48 obj, obj_sz, m); |
0 | 49 } |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
50 oopDesc::encode_store_heap_oop_not_null(p, new_obj); |
0 | 51 } |
52 } | |
53 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
54 inline void ParScanWeakRefClosure::do_oop_nv(oop* p) { ParScanWeakRefClosure::do_oop_work(p); } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
55 inline void ParScanWeakRefClosure::do_oop_nv(narrowOop* p) { ParScanWeakRefClosure::do_oop_work(p); } |
0 | 56 |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
57 template <class T> inline void ParScanClosure::par_do_barrier(T* p) { |
0 | 58 assert(generation()->is_in_reserved(p), "expected ref in generation"); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
59 assert(!oopDesc::is_null(*p), "expected non-null object"); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
60 oop obj = oopDesc::load_decode_heap_oop_not_null(p); |
0 | 61 // If p points to a younger generation, mark the card. |
62 if ((HeapWord*)obj < gen_boundary()) { | |
63 rs()->write_ref_field_gc_par(p, obj); | |
64 } | |
65 } | |
66 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
67 template <class T> |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
68 inline void ParScanClosure::do_oop_work(T* p, |
0 | 69 bool gc_barrier, |
70 bool root_scan) { | |
71 assert((!Universe::heap()->is_in_reserved(p) || | |
72 generation()->is_in_reserved(p)) | |
73 && (generation()->level() == 0 || gc_barrier), | |
74 "The gen must be right, and we must be doing the barrier " | |
75 "in older generations."); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
76 T heap_oop = oopDesc::load_heap_oop(p); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
77 if (!oopDesc::is_null(heap_oop)) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
78 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); |
0 | 79 if ((HeapWord*)obj < _boundary) { |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
1972
diff
changeset
|
80 #ifndef PRODUCT |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
1972
diff
changeset
|
81 if (_g->to()->is_in_reserved(obj)) { |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
1972
diff
changeset
|
82 tty->print_cr("Scanning field (" PTR_FORMAT ") twice?", p); |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
1972
diff
changeset
|
83 GenCollectedHeap* gch = (GenCollectedHeap*)Universe::heap(); |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
1972
diff
changeset
|
84 Space* sp = gch->space_containing(p); |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
1972
diff
changeset
|
85 oop obj = oop(sp->block_start(p)); |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
1972
diff
changeset
|
86 assert((HeapWord*)obj < (HeapWord*)p, "Error"); |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
1972
diff
changeset
|
87 tty->print_cr("Object: " PTR_FORMAT, obj); |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
1972
diff
changeset
|
88 tty->print_cr("-------"); |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
1972
diff
changeset
|
89 obj->print(); |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
1972
diff
changeset
|
90 tty->print_cr("-----"); |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
1972
diff
changeset
|
91 tty->print_cr("Heap:"); |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
1972
diff
changeset
|
92 tty->print_cr("-----"); |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
1972
diff
changeset
|
93 gch->print(); |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
1972
diff
changeset
|
94 ShouldNotReachHere(); |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
1972
diff
changeset
|
95 } |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
1972
diff
changeset
|
96 #endif |
0 | 97 // OK, we need to ensure that it is copied. |
98 // We read the klass and mark in this order, so that we can reliably | |
99 // get the size of the object: if the mark we read is not a | |
100 // forwarding pointer, then the klass is valid: the klass is only | |
101 // overwritten with an overflow next pointer after the object is | |
102 // forwarded. | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3357
diff
changeset
|
103 Klass* objK = obj->klass(); |
0 | 104 markOop m = obj->mark(); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
105 oop new_obj; |
0 | 106 if (m->is_marked()) { // Contains forwarding pointer. |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
107 new_obj = ParNewGeneration::real_forwardee(obj); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
108 oopDesc::encode_store_heap_oop_not_null(p, new_obj); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3357
diff
changeset
|
109 #ifndef PRODUCT |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3357
diff
changeset
|
110 if (TraceScavenge) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3357
diff
changeset
|
111 gclog_or_tty->print_cr("{%s %s ( " PTR_FORMAT " ) " PTR_FORMAT " -> " PTR_FORMAT " (%d)}", |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3357
diff
changeset
|
112 "forwarded ", |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3357
diff
changeset
|
113 new_obj->klass()->internal_name(), p, obj, new_obj, new_obj->size()); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3357
diff
changeset
|
114 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3357
diff
changeset
|
115 #endif |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3357
diff
changeset
|
116 |
0 | 117 } else { |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3357
diff
changeset
|
118 size_t obj_sz = obj->size_given_klass(objK); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
119 new_obj = _g->copy_to_survivor_space(_par_scan_state, obj, obj_sz, m); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
120 oopDesc::encode_store_heap_oop_not_null(p, new_obj); |
0 | 121 if (root_scan) { |
122 // This may have pushed an object. If we have a root | |
123 // category with a lot of roots, can't let the queue get too | |
124 // full: | |
125 (void)_par_scan_state->trim_queues(10 * ParallelGCThreads); | |
126 } | |
127 } | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3357
diff
changeset
|
128 if (is_scanning_a_klass()) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3357
diff
changeset
|
129 do_klass_barrier(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3357
diff
changeset
|
130 } else if (gc_barrier) { |
0 | 131 // Now call parent closure |
132 par_do_barrier(p); | |
133 } | |
134 } | |
135 } | |
136 } | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
137 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
138 inline void ParScanWithBarrierClosure::do_oop_nv(oop* p) { ParScanClosure::do_oop_work(p, true, false); } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
139 inline void ParScanWithBarrierClosure::do_oop_nv(narrowOop* p) { ParScanClosure::do_oop_work(p, true, false); } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
140 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
141 inline void ParScanWithoutBarrierClosure::do_oop_nv(oop* p) { ParScanClosure::do_oop_work(p, false, false); } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
142 inline void ParScanWithoutBarrierClosure::do_oop_nv(narrowOop* p) { ParScanClosure::do_oop_work(p, false, false); } |
1972 | 143 |
144 #endif // SHARE_VM_GC_IMPLEMENTATION_PARNEW_PAROOPCLOSURES_INLINE_HPP |