author | jiangli |
Mon, 14 Aug 2017 14:32:17 -0400 | |
changeset 46810 | 7dad333205cd |
parent 46415 | 7d5a286cdf89 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
46285
5b673a9fa682
8171235: Move archive object code from G1MarkSweep into G1ArchiveAllocator
sjohanss
parents:
32606
diff
changeset
|
2 |
* Copyright (c) 2000, 2017, Oracle and/or its affiliates. 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5076
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5076
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5076
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
30764 | 25 |
#ifndef SHARE_VM_GC_SERIAL_MARKSWEEP_INLINE_HPP |
26 |
#define SHARE_VM_GC_SERIAL_MARKSWEEP_INLINE_HPP |
|
7397 | 27 |
|
30764 | 28 |
#include "gc/serial/markSweep.hpp" |
46810
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
46415
diff
changeset
|
29 |
#include "memory/metaspaceShared.hpp" |
32606
fdaa30d06ada
8129417: Oop iteration clean-up to remove oop_ms_follow_contents
sjohanss
parents:
31346
diff
changeset
|
30 |
#include "memory/universe.hpp" |
30764 | 31 |
#include "oops/markOop.inline.hpp" |
32606
fdaa30d06ada
8129417: Oop iteration clean-up to remove oop_ms_follow_contents
sjohanss
parents:
31346
diff
changeset
|
32 |
#include "oops/oop.inline.hpp" |
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
15088
diff
changeset
|
33 |
#if INCLUDE_ALL_GCS |
46285
5b673a9fa682
8171235: Move archive object code from G1MarkSweep into G1ArchiveAllocator
sjohanss
parents:
32606
diff
changeset
|
34 |
#include "gc/g1/g1Allocator.inline.hpp" |
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
15088
diff
changeset
|
35 |
#endif // INCLUDE_ALL_GCS |
7397 | 36 |
|
46810
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
46415
diff
changeset
|
37 |
inline bool MarkSweep::is_closed_archive_object(oop object) { |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
46415
diff
changeset
|
38 |
#if INCLUDE_ALL_GCS |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
46415
diff
changeset
|
39 |
return G1ArchiveAllocator::is_closed_archive_object(object); |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
46415
diff
changeset
|
40 |
#else |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
46415
diff
changeset
|
41 |
return false; |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
46415
diff
changeset
|
42 |
#endif |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
46415
diff
changeset
|
43 |
} |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
46415
diff
changeset
|
44 |
|
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
46415
diff
changeset
|
45 |
inline bool MarkSweep::is_open_archive_object(oop object) { |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
46415
diff
changeset
|
46 |
#if INCLUDE_ALL_GCS |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
46415
diff
changeset
|
47 |
return G1ArchiveAllocator::is_open_archive_object(object); |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
46415
diff
changeset
|
48 |
#else |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
46415
diff
changeset
|
49 |
return false; |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
46415
diff
changeset
|
50 |
#endif |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
46415
diff
changeset
|
51 |
} |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
46415
diff
changeset
|
52 |
|
31346
a70d45c06136
8042668: GC Support for shared heap ranges in CDS
jiangli
parents:
30764
diff
changeset
|
53 |
inline bool MarkSweep::is_archive_object(oop object) { |
a70d45c06136
8042668: GC Support for shared heap ranges in CDS
jiangli
parents:
30764
diff
changeset
|
54 |
#if INCLUDE_ALL_GCS |
46285
5b673a9fa682
8171235: Move archive object code from G1MarkSweep into G1ArchiveAllocator
sjohanss
parents:
32606
diff
changeset
|
55 |
return G1ArchiveAllocator::is_archive_object(object); |
31346
a70d45c06136
8042668: GC Support for shared heap ranges in CDS
jiangli
parents:
30764
diff
changeset
|
56 |
#else |
a70d45c06136
8042668: GC Support for shared heap ranges in CDS
jiangli
parents:
30764
diff
changeset
|
57 |
return false; |
a70d45c06136
8042668: GC Support for shared heap ranges in CDS
jiangli
parents:
30764
diff
changeset
|
58 |
#endif |
a70d45c06136
8042668: GC Support for shared heap ranges in CDS
jiangli
parents:
30764
diff
changeset
|
59 |
} |
a70d45c06136
8042668: GC Support for shared heap ranges in CDS
jiangli
parents:
30764
diff
changeset
|
60 |
|
29792
8c6fa07f0869
8075957: Reduce calls to the GC specific object visitors in oopDesc
stefank
parents:
27624
diff
changeset
|
61 |
inline int MarkSweep::adjust_pointers(oop obj) { |
46415
7d5a286cdf89
8138737: Remove oop_ms_adjust_pointers and use oop_iterate instead
sjohanss
parents:
46285
diff
changeset
|
62 |
return obj->oop_iterate_size(&MarkSweep::adjust_pointer_closure); |
29792
8c6fa07f0869
8075957: Reduce calls to the GC specific object visitors in oopDesc
stefank
parents:
27624
diff
changeset
|
63 |
} |
8c6fa07f0869
8075957: Reduce calls to the GC specific object visitors in oopDesc
stefank
parents:
27624
diff
changeset
|
64 |
|
17105
25b392a7740d
8012687: Remove unused is_root checks and closures
stefank
parents:
15482
diff
changeset
|
65 |
template <class T> inline void MarkSweep::adjust_pointer(T* p) { |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
66 |
T heap_oop = oopDesc::load_heap_oop(p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
67 |
if (!oopDesc::is_null(heap_oop)) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
68 |
oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); |
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
69 |
assert(Universe::heap()->is_in(obj), "should be in heap"); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
70 |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
71 |
oop new_obj = oop(obj->mark()->decode_pointer()); |
46810
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
46415
diff
changeset
|
72 |
|
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
46415
diff
changeset
|
73 |
assert(is_archive_object(obj) || // no forwarding of archive objects |
31346
a70d45c06136
8042668: GC Support for shared heap ranges in CDS
jiangli
parents:
30764
diff
changeset
|
74 |
new_obj != NULL || // is forwarding ptr? |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
75 |
obj->mark() == markOopDesc::prototype() || // not gc marked? |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11178
diff
changeset
|
76 |
(UseBiasedLocking && obj->mark()->has_bias_pattern()), |
31346
a70d45c06136
8042668: GC Support for shared heap ranges in CDS
jiangli
parents:
30764
diff
changeset
|
77 |
// not gc marked? |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
78 |
"should be forwarded"); |
46810
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
46415
diff
changeset
|
79 |
|
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
46415
diff
changeset
|
80 |
#ifndef PRODUCT |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
46415
diff
changeset
|
81 |
// open_archive objects are marked by GC. Their mark should |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
46415
diff
changeset
|
82 |
// not have forwarding ptr. |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
46415
diff
changeset
|
83 |
if (is_open_archive_object(obj)) { |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
46415
diff
changeset
|
84 |
assert(new_obj == NULL, "archive heap object has forwarding ptr"); |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
46415
diff
changeset
|
85 |
} |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
46415
diff
changeset
|
86 |
#endif |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
46415
diff
changeset
|
87 |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
88 |
if (new_obj != NULL) { |
46810
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
46415
diff
changeset
|
89 |
if (!is_closed_archive_object(obj)) { |
31346
a70d45c06136
8042668: GC Support for shared heap ranges in CDS
jiangli
parents:
30764
diff
changeset
|
90 |
assert(Universe::heap()->is_in_reserved(new_obj), |
a70d45c06136
8042668: GC Support for shared heap ranges in CDS
jiangli
parents:
30764
diff
changeset
|
91 |
"should be in object space"); |
a70d45c06136
8042668: GC Support for shared heap ranges in CDS
jiangli
parents:
30764
diff
changeset
|
92 |
oopDesc::encode_store_heap_oop_not_null(p, new_obj); |
a70d45c06136
8042668: GC Support for shared heap ranges in CDS
jiangli
parents:
30764
diff
changeset
|
93 |
} |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
94 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
95 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
96 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
97 |
|
30764 | 98 |
#endif // SHARE_VM_GC_SERIAL_MARKSWEEP_INLINE_HPP |