Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/hotspot/share/gc/serial/defNewGeneration.inline.hpp
41152 views
1
/*
2
* Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
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
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*
23
*/
24
25
#ifndef SHARE_GC_SERIAL_DEFNEWGENERATION_INLINE_HPP
26
#define SHARE_GC_SERIAL_DEFNEWGENERATION_INLINE_HPP
27
28
#include "gc/serial/defNewGeneration.hpp"
29
30
#include "gc/shared/cardTableRS.hpp"
31
#include "gc/shared/genCollectedHeap.hpp"
32
#include "gc/shared/genOopClosures.inline.hpp"
33
#include "gc/shared/space.inline.hpp"
34
#include "oops/access.inline.hpp"
35
36
// Methods of protected closure types
37
38
template <class T>
39
inline void DefNewGeneration::KeepAliveClosure::do_oop_work(T* p) {
40
#ifdef ASSERT
41
{
42
// We never expect to see a null reference being processed
43
// as a weak reference.
44
oop obj = RawAccess<IS_NOT_NULL>::oop_load(p);
45
assert (oopDesc::is_oop(obj), "expected an oop while scanning weak refs");
46
}
47
#endif // ASSERT
48
49
Devirtualizer::do_oop(_cl, p);
50
51
// Card marking is trickier for weak refs.
52
// This oop is a 'next' field which was filled in while we
53
// were discovering weak references. While we might not need
54
// to take a special action to keep this reference alive, we
55
// will need to dirty a card as the field was modified.
56
//
57
// Alternatively, we could create a method which iterates through
58
// each generation, allowing them in turn to examine the modified
59
// field.
60
//
61
// We could check that p is also in the old generation, but
62
// dirty cards in the young gen are never scanned, so the
63
// extra check probably isn't worthwhile.
64
if (GenCollectedHeap::heap()->is_in_reserved(p)) {
65
_rs->inline_write_ref_field_gc(p);
66
}
67
}
68
69
template <class T>
70
inline void DefNewGeneration::FastKeepAliveClosure::do_oop_work(T* p) {
71
#ifdef ASSERT
72
{
73
// We never expect to see a null reference being processed
74
// as a weak reference.
75
oop obj = RawAccess<IS_NOT_NULL>::oop_load(p);
76
assert (oopDesc::is_oop(obj), "expected an oop while scanning weak refs");
77
}
78
#endif // ASSERT
79
80
Devirtualizer::do_oop(_cl, p);
81
82
// Optimized for Defnew generation if it's the youngest generation:
83
// we set a younger_gen card if we have an older->youngest
84
// generation pointer.
85
oop obj = RawAccess<IS_NOT_NULL>::oop_load(p);
86
if ((cast_from_oop<HeapWord*>(obj) < _boundary) && GenCollectedHeap::heap()->is_in_reserved(p)) {
87
_rs->inline_write_ref_field_gc(p);
88
}
89
}
90
91
template <typename OopClosureType>
92
void DefNewGeneration::oop_since_save_marks_iterate(OopClosureType* cl) {
93
eden()->oop_since_save_marks_iterate(cl);
94
to()->oop_since_save_marks_iterate(cl);
95
from()->oop_since_save_marks_iterate(cl);
96
97
save_marks();
98
}
99
100
#endif // SHARE_GC_SERIAL_DEFNEWGENERATION_INLINE_HPP
101
102