annotate src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp @ 196:d1605aabd0a1 jdk7-b30

6719955: Update copyright year Summary: Update copyright year for files that have been modified in 2008 Reviewed-by: ohair, tbell
author xdono
date Wed, 02 Jul 2008 12:55:16 -0700
parents ba764ed4b6f2
children df6caf649ff7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
196
d1605aabd0a1 6719955: Update copyright year
xdono
parents: 113
diff changeset
2 * Copyright 2002-2008 Sun Microsystems, Inc. All Rights Reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
a61af66fc99e Initial load
duke
parents:
diff changeset
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
a61af66fc99e Initial load
duke
parents:
diff changeset
20 * CA 95054 USA or visit www.sun.com if you need additional information or
a61af66fc99e Initial load
duke
parents:
diff changeset
21 * have any questions.
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 inline PSPromotionManager* PSPromotionManager::manager_array(int index) {
a61af66fc99e Initial load
duke
parents:
diff changeset
26 assert(_manager_array != NULL, "access of NULL manager_array");
a61af66fc99e Initial load
duke
parents:
diff changeset
27 assert(index >= 0 && index <= (int)ParallelGCThreads, "out of range manager_array access");
a61af66fc99e Initial load
duke
parents:
diff changeset
28 return _manager_array[index];
a61af66fc99e Initial load
duke
parents:
diff changeset
29 }
a61af66fc99e Initial load
duke
parents:
diff changeset
30
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
31 template <class T>
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
32 inline void PSPromotionManager::claim_or_forward_internal_depth(T* p) {
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
33 if (p != NULL) { // XXX: error if p != NULL here
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
34 oop o = oopDesc::load_decode_heap_oop_not_null(p);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
35 if (o->is_forwarded()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
36 o = o->forwardee();
a61af66fc99e Initial load
duke
parents:
diff changeset
37 // Card mark
a61af66fc99e Initial load
duke
parents:
diff changeset
38 if (PSScavenge::is_obj_in_young((HeapWord*) o)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
39 PSScavenge::card_table()->inline_write_ref_field_gc(p, o);
a61af66fc99e Initial load
duke
parents:
diff changeset
40 }
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
41 oopDesc::encode_store_heap_oop_not_null(p, o);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
42 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
43 push_depth(p);
a61af66fc99e Initial load
duke
parents:
diff changeset
44 }
a61af66fc99e Initial load
duke
parents:
diff changeset
45 }
a61af66fc99e Initial load
duke
parents:
diff changeset
46 }
a61af66fc99e Initial load
duke
parents:
diff changeset
47
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
48 template <class T>
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
49 inline void PSPromotionManager::claim_or_forward_internal_breadth(T* p) {
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
50 if (p != NULL) { // XXX: error if p != NULL here
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
51 oop o = oopDesc::load_decode_heap_oop_not_null(p);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
52 if (o->is_forwarded()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
53 o = o->forwardee();
a61af66fc99e Initial load
duke
parents:
diff changeset
54 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
55 o = copy_to_survivor_space(o, false);
a61af66fc99e Initial load
duke
parents:
diff changeset
56 }
a61af66fc99e Initial load
duke
parents:
diff changeset
57 // Card mark
a61af66fc99e Initial load
duke
parents:
diff changeset
58 if (PSScavenge::is_obj_in_young((HeapWord*) o)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
59 PSScavenge::card_table()->inline_write_ref_field_gc(p, o);
a61af66fc99e Initial load
duke
parents:
diff changeset
60 }
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
61 oopDesc::encode_store_heap_oop_not_null(p, o);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
62 }
a61af66fc99e Initial load
duke
parents:
diff changeset
63 }
a61af66fc99e Initial load
duke
parents:
diff changeset
64
a61af66fc99e Initial load
duke
parents:
diff changeset
65 inline void PSPromotionManager::flush_prefetch_queue() {
a61af66fc99e Initial load
duke
parents:
diff changeset
66 assert(!depth_first(), "invariant");
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
67 for (int i = 0; i < _prefetch_queue.length(); i++) {
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
68 claim_or_forward_internal_breadth((oop*)_prefetch_queue.pop());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
69 }
a61af66fc99e Initial load
duke
parents:
diff changeset
70 }
a61af66fc99e Initial load
duke
parents:
diff changeset
71
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
72 template <class T>
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
73 inline void PSPromotionManager::claim_or_forward_depth(T* p) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
74 assert(depth_first(), "invariant");
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
75 assert(PSScavenge::should_scavenge(p, true), "revisiting object?");
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
76 assert(Universe::heap()->kind() == CollectedHeap::ParallelScavengeHeap,
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
77 "Sanity");
0
a61af66fc99e Initial load
duke
parents:
diff changeset
78 assert(Universe::heap()->is_in(p), "pointer outside heap");
a61af66fc99e Initial load
duke
parents:
diff changeset
79
a61af66fc99e Initial load
duke
parents:
diff changeset
80 claim_or_forward_internal_depth(p);
a61af66fc99e Initial load
duke
parents:
diff changeset
81 }
a61af66fc99e Initial load
duke
parents:
diff changeset
82
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
83 template <class T>
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
84 inline void PSPromotionManager::claim_or_forward_breadth(T* p) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
85 assert(!depth_first(), "invariant");
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
86 assert(PSScavenge::should_scavenge(p, true), "revisiting object?");
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
87 assert(Universe::heap()->kind() == CollectedHeap::ParallelScavengeHeap,
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
88 "Sanity");
0
a61af66fc99e Initial load
duke
parents:
diff changeset
89 assert(Universe::heap()->is_in(p), "pointer outside heap");
a61af66fc99e Initial load
duke
parents:
diff changeset
90
a61af66fc99e Initial load
duke
parents:
diff changeset
91 if (UsePrefetchQueue) {
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
92 claim_or_forward_internal_breadth((T*)_prefetch_queue.push_and_pop(p));
0
a61af66fc99e Initial load
duke
parents:
diff changeset
93 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
94 // This option is used for testing. The use of the prefetch
a61af66fc99e Initial load
duke
parents:
diff changeset
95 // queue can delay the processing of the objects and thus
a61af66fc99e Initial load
duke
parents:
diff changeset
96 // change the order of object scans. For example, remembered
a61af66fc99e Initial load
duke
parents:
diff changeset
97 // set updates are typically the clearing of the remembered
a61af66fc99e Initial load
duke
parents:
diff changeset
98 // set (the cards) followed by updates of the remembered set
a61af66fc99e Initial load
duke
parents:
diff changeset
99 // for young-to-old pointers. In a situation where there
a61af66fc99e Initial load
duke
parents:
diff changeset
100 // is an error in the sequence of clearing and updating
a61af66fc99e Initial load
duke
parents:
diff changeset
101 // (e.g. clear card A, update card A, erroneously clear
a61af66fc99e Initial load
duke
parents:
diff changeset
102 // card A again) the error can be obscured by a delay
a61af66fc99e Initial load
duke
parents:
diff changeset
103 // in the update due to the use of the prefetch queue
a61af66fc99e Initial load
duke
parents:
diff changeset
104 // (e.g., clear card A, erroneously clear card A again,
a61af66fc99e Initial load
duke
parents:
diff changeset
105 // update card A that was pushed into the prefetch queue
a61af66fc99e Initial load
duke
parents:
diff changeset
106 // and thus delayed until after the erronous clear). The
a61af66fc99e Initial load
duke
parents:
diff changeset
107 // length of the delay is random depending on the objects
a61af66fc99e Initial load
duke
parents:
diff changeset
108 // in the queue and the delay can be zero.
a61af66fc99e Initial load
duke
parents:
diff changeset
109 claim_or_forward_internal_breadth(p);
a61af66fc99e Initial load
duke
parents:
diff changeset
110 }
a61af66fc99e Initial load
duke
parents:
diff changeset
111 }
a61af66fc99e Initial load
duke
parents:
diff changeset
112
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
113 inline void PSPromotionManager::process_popped_location_depth(StarTask p) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
114 if (is_oop_masked(p)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
115 assert(PSChunkLargeArrays, "invariant");
a61af66fc99e Initial load
duke
parents:
diff changeset
116 oop const old = unmask_chunked_array_oop(p);
a61af66fc99e Initial load
duke
parents:
diff changeset
117 process_array_chunk(old);
a61af66fc99e Initial load
duke
parents:
diff changeset
118 } else {
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
119 if (p.is_narrow()) {
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
120 PSScavenge::copy_and_push_safe_barrier(this, (narrowOop*)p);
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
121 } else {
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
122 PSScavenge::copy_and_push_safe_barrier(this, (oop*)p);
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
123 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
124 }
a61af66fc99e Initial load
duke
parents:
diff changeset
125 }