author | stefank |
Sat, 26 May 2018 06:59:49 +0200 | |
changeset 50752 | 9d62da00bf15 |
parent 50728 | 9375184cec98 |
child 53244 | 9807daeb47c4 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
50728 | 2 |
* Copyright (c) 2001, 2018, 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:
670
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
670
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:
670
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
30764 | 25 |
#ifndef SHARE_VM_GC_SERIAL_DEFNEWGENERATION_INLINE_HPP |
26 |
#define SHARE_VM_GC_SERIAL_DEFNEWGENERATION_INLINE_HPP |
|
7397 | 27 |
|
30764 | 28 |
#include "gc/serial/defNewGeneration.hpp" |
29 |
#include "gc/shared/cardTableRS.hpp" |
|
30 |
#include "gc/shared/genCollectedHeap.hpp" |
|
31 |
#include "gc/shared/genOopClosures.inline.hpp" |
|
50034
01a88f825a84
8202641: Replace OOP_SINCE_SAVE_MARKS with templates
stefank
parents:
49592
diff
changeset
|
32 |
#include "gc/shared/space.inline.hpp" |
49592
77fb0be7d19f
8199946: Move load/store and encode/decode out of oopDesc
stefank
parents:
47216
diff
changeset
|
33 |
#include "oops/access.inline.hpp" |
7397 | 34 |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
35 |
// Methods of protected closure types |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
36 |
|
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
37 |
template <class T> |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
38 |
inline void DefNewGeneration::KeepAliveClosure::do_oop_work(T* p) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
39 |
#ifdef ASSERT |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
40 |
{ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
41 |
// We never expect to see a null reference being processed |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
42 |
// as a weak reference. |
50728 | 43 |
oop obj = RawAccess<IS_NOT_NULL>::oop_load(p); |
46968
9119841280f4
8160399: is_oop_or_null involves undefined behavior
coleenp
parents:
32623
diff
changeset
|
44 |
assert (oopDesc::is_oop(obj), "expected an oop while scanning weak refs"); |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
45 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
46 |
#endif // ASSERT |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
47 |
|
50752 | 48 |
Devirtualizer::do_oop_no_verify(_cl, p); |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
49 |
|
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
50 |
// Card marking is trickier for weak refs. |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
51 |
// This oop is a 'next' field which was filled in while we |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
52 |
// were discovering weak references. While we might not need |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
53 |
// to take a special action to keep this reference alive, we |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
54 |
// will need to dirty a card as the field was modified. |
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 |
// Alternatively, we could create a method which iterates through |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
57 |
// each generation, allowing them in turn to examine the modified |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
58 |
// field. |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
59 |
// |
32623
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
30764
diff
changeset
|
60 |
// We could check that p is also in the old generation, but |
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
30764
diff
changeset
|
61 |
// dirty cards in the young gen are never scanned, so the |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
62 |
// extra check probably isn't worthwhile. |
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
29701
diff
changeset
|
63 |
if (GenCollectedHeap::heap()->is_in_reserved(p)) { |
50728 | 64 |
oop obj = RawAccess<IS_NOT_NULL>::oop_load(p); |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
65 |
_rs->inline_write_ref_field_gc(p, obj); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
66 |
} |
1 | 67 |
} |
68 |
||
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
69 |
template <class T> |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
70 |
inline void DefNewGeneration::FastKeepAliveClosure::do_oop_work(T* p) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
71 |
#ifdef ASSERT |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
72 |
{ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
73 |
// We never expect to see a null reference being processed |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
74 |
// as a weak reference. |
50728 | 75 |
oop obj = RawAccess<IS_NOT_NULL>::oop_load(p); |
46968
9119841280f4
8160399: is_oop_or_null involves undefined behavior
coleenp
parents:
32623
diff
changeset
|
76 |
assert (oopDesc::is_oop(obj), "expected an oop while scanning weak refs"); |
1 | 77 |
} |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
78 |
#endif // ASSERT |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
79 |
|
50752 | 80 |
Devirtualizer::do_oop_no_verify(_cl, p); |
1 | 81 |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
82 |
// Optimized for Defnew generation if it's the youngest generation: |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
83 |
// we set a younger_gen card if we have an older->youngest |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
84 |
// generation pointer. |
50728 | 85 |
oop obj = RawAccess<IS_NOT_NULL>::oop_load(p); |
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
29701
diff
changeset
|
86 |
if (((HeapWord*)obj < _boundary) && GenCollectedHeap::heap()->is_in_reserved(p)) { |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
87 |
_rs->inline_write_ref_field_gc(p, obj); |
1 | 88 |
} |
89 |
} |
|
7397 | 90 |
|
50034
01a88f825a84
8202641: Replace OOP_SINCE_SAVE_MARKS with templates
stefank
parents:
49592
diff
changeset
|
91 |
template <typename OopClosureType> |
01a88f825a84
8202641: Replace OOP_SINCE_SAVE_MARKS with templates
stefank
parents:
49592
diff
changeset
|
92 |
void DefNewGeneration::oop_since_save_marks_iterate(OopClosureType* cl) { |
01a88f825a84
8202641: Replace OOP_SINCE_SAVE_MARKS with templates
stefank
parents:
49592
diff
changeset
|
93 |
cl->set_generation(this); |
01a88f825a84
8202641: Replace OOP_SINCE_SAVE_MARKS with templates
stefank
parents:
49592
diff
changeset
|
94 |
eden()->oop_since_save_marks_iterate(cl); |
01a88f825a84
8202641: Replace OOP_SINCE_SAVE_MARKS with templates
stefank
parents:
49592
diff
changeset
|
95 |
to()->oop_since_save_marks_iterate(cl); |
01a88f825a84
8202641: Replace OOP_SINCE_SAVE_MARKS with templates
stefank
parents:
49592
diff
changeset
|
96 |
from()->oop_since_save_marks_iterate(cl); |
01a88f825a84
8202641: Replace OOP_SINCE_SAVE_MARKS with templates
stefank
parents:
49592
diff
changeset
|
97 |
cl->reset_generation(); |
01a88f825a84
8202641: Replace OOP_SINCE_SAVE_MARKS with templates
stefank
parents:
49592
diff
changeset
|
98 |
save_marks(); |
01a88f825a84
8202641: Replace OOP_SINCE_SAVE_MARKS with templates
stefank
parents:
49592
diff
changeset
|
99 |
} |
01a88f825a84
8202641: Replace OOP_SINCE_SAVE_MARKS with templates
stefank
parents:
49592
diff
changeset
|
100 |
|
30764 | 101 |
#endif // SHARE_VM_GC_SERIAL_DEFNEWGENERATION_INLINE_HPP |