Mercurial > hg > truffle
annotate src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp @ 6521:2a0c9f20baa1
consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 05 Oct 2012 17:55:12 +0200 |
parents | 95f6641e38e0 |
children | da91efe96a93 |
rev | line source |
---|---|
0 | 1 /* |
4909 | 2 * Copyright (c) 2002, 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:
196
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
196
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:
196
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSSCAVENGE_INLINE_HPP |
26 #define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSSCAVENGE_INLINE_HPP | |
27 | |
28 #include "gc_implementation/parallelScavenge/cardTableExtension.hpp" | |
29 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp" | |
30 #include "gc_implementation/parallelScavenge/psPromotionManager.hpp" | |
4909 | 31 #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp" |
1972 | 32 #include "gc_implementation/parallelScavenge/psScavenge.hpp" |
33 | |
0 | 34 inline void PSScavenge::save_to_space_top_before_gc() { |
35 ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap(); | |
36 _to_space_top_before_gc = heap->young_gen()->to_space()->top(); | |
37 } | |
38 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
39 template <class T> inline bool PSScavenge::should_scavenge(T* p) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
40 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
|
41 if (oopDesc::is_null(heap_oop)) return false; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
42 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
43 return PSScavenge::is_obj_in_young((HeapWord*)obj); |
0 | 44 } |
45 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
46 template <class T> |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
47 inline bool PSScavenge::should_scavenge(T* p, MutableSpace* to_space) { |
0 | 48 if (should_scavenge(p)) { |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
49 oop obj = oopDesc::load_decode_heap_oop_not_null(p); |
0 | 50 // Skip objects copied to to_space since the scavenge started. |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
51 HeapWord* const addr = (HeapWord*)obj; |
0 | 52 return addr < to_space_top_before_gc() || addr >= to_space->end(); |
53 } | |
54 return false; | |
55 } | |
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> |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
58 inline bool PSScavenge::should_scavenge(T* p, bool check_to_space) { |
0 | 59 if (check_to_space) { |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
60 ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap(); |
0 | 61 return should_scavenge(p, heap->young_gen()->to_space()); |
62 } | |
63 return should_scavenge(p); | |
64 } | |
65 | |
66 // Attempt to "claim" oop at p via CAS, push the new obj if successful | |
67 // This version tests the oop* to make sure it is within the heap before | |
68 // attempting marking. | |
4909 | 69 template <class T, bool promote_immediately> |
0 | 70 inline void PSScavenge::copy_and_push_safe_barrier(PSPromotionManager* pm, |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
71 T* p) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
72 assert(should_scavenge(p, true), "revisiting object?"); |
0 | 73 |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
74 oop o = oopDesc::load_decode_heap_oop_not_null(p); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
75 oop new_obj = o->is_forwarded() |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
76 ? o->forwardee() |
4909 | 77 : pm->copy_to_survivor_space<promote_immediately>(o); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
78 oopDesc::encode_store_heap_oop_not_null(p, new_obj); |
0 | 79 |
80 // We cannot mark without test, as some code passes us pointers | |
81 // that are outside the heap. | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
82 if ((!PSScavenge::is_obj_in_young((HeapWord*)p)) && |
0 | 83 Universe::heap()->is_in_reserved(p)) { |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
84 if (PSScavenge::is_obj_in_young((HeapWord*)new_obj)) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
85 card_table()->inline_write_ref_field_gc(p, new_obj); |
0 | 86 } |
87 } | |
88 } | |
1972 | 89 |
4909 | 90 template<bool promote_immediately> |
91 class PSRootsClosure: public OopClosure { | |
2379
b099aaf51bf8
6962931: move interned strings out of the perm gen
jcoomes
parents:
1972
diff
changeset
|
92 private: |
b099aaf51bf8
6962931: move interned strings out of the perm gen
jcoomes
parents:
1972
diff
changeset
|
93 PSPromotionManager* _promotion_manager; |
b099aaf51bf8
6962931: move interned strings out of the perm gen
jcoomes
parents:
1972
diff
changeset
|
94 |
b099aaf51bf8
6962931: move interned strings out of the perm gen
jcoomes
parents:
1972
diff
changeset
|
95 protected: |
b099aaf51bf8
6962931: move interned strings out of the perm gen
jcoomes
parents:
1972
diff
changeset
|
96 template <class T> void do_oop_work(T *p) { |
b099aaf51bf8
6962931: move interned strings out of the perm gen
jcoomes
parents:
1972
diff
changeset
|
97 if (PSScavenge::should_scavenge(p)) { |
b099aaf51bf8
6962931: move interned strings out of the perm gen
jcoomes
parents:
1972
diff
changeset
|
98 // We never card mark roots, maybe call a func without test? |
4909 | 99 PSScavenge::copy_and_push_safe_barrier<T, promote_immediately>(_promotion_manager, p); |
2379
b099aaf51bf8
6962931: move interned strings out of the perm gen
jcoomes
parents:
1972
diff
changeset
|
100 } |
b099aaf51bf8
6962931: move interned strings out of the perm gen
jcoomes
parents:
1972
diff
changeset
|
101 } |
b099aaf51bf8
6962931: move interned strings out of the perm gen
jcoomes
parents:
1972
diff
changeset
|
102 public: |
4909 | 103 PSRootsClosure(PSPromotionManager* pm) : _promotion_manager(pm) { } |
104 void do_oop(oop* p) { PSRootsClosure::do_oop_work(p); } | |
105 void do_oop(narrowOop* p) { PSRootsClosure::do_oop_work(p); } | |
2379
b099aaf51bf8
6962931: move interned strings out of the perm gen
jcoomes
parents:
1972
diff
changeset
|
106 }; |
b099aaf51bf8
6962931: move interned strings out of the perm gen
jcoomes
parents:
1972
diff
changeset
|
107 |
4909 | 108 typedef PSRootsClosure</*promote_immediately=*/false> PSScavengeRootsClosure; |
109 typedef PSRootsClosure</*promote_immediately=*/true> PSPromoteRootsClosure; | |
110 | |
1972 | 111 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSSCAVENGE_INLINE_HPP |