Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/hotspot/share/gc/z/zForwarding.hpp
40957 views
1
/*
2
* Copyright (c) 2015, 2020, 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
#ifndef SHARE_GC_Z_ZFORWARDING_HPP
25
#define SHARE_GC_Z_ZFORWARDING_HPP
26
27
#include "gc/z/zAttachedArray.hpp"
28
#include "gc/z/zForwardingEntry.hpp"
29
#include "gc/z/zLock.hpp"
30
#include "gc/z/zVirtualMemory.hpp"
31
32
class ObjectClosure;
33
class ZForwardingAllocator;
34
class ZPage;
35
36
typedef size_t ZForwardingCursor;
37
38
class ZForwarding {
39
friend class VMStructs;
40
friend class ZForwardingTest;
41
42
private:
43
typedef ZAttachedArray<ZForwarding, ZForwardingEntry> AttachedArray;
44
45
const ZVirtualMemory _virtual;
46
const size_t _object_alignment_shift;
47
const AttachedArray _entries;
48
ZPage* _page;
49
mutable ZConditionLock _ref_lock;
50
volatile int32_t _ref_count;
51
bool _ref_abort;
52
bool _in_place;
53
54
ZForwardingEntry* entries() const;
55
ZForwardingEntry at(ZForwardingCursor* cursor) const;
56
ZForwardingEntry first(uintptr_t from_index, ZForwardingCursor* cursor) const;
57
ZForwardingEntry next(ZForwardingCursor* cursor) const;
58
59
ZForwarding(ZPage* page, size_t nentries);
60
61
public:
62
static uint32_t nentries(const ZPage* page);
63
static ZForwarding* alloc(ZForwardingAllocator* allocator, ZPage* page);
64
65
uint8_t type() const;
66
uintptr_t start() const;
67
size_t size() const;
68
size_t object_alignment_shift() const;
69
void object_iterate(ObjectClosure *cl);
70
71
bool retain_page();
72
ZPage* claim_page();
73
void release_page();
74
bool wait_page_released() const;
75
ZPage* detach_page();
76
void abort_page();
77
78
void set_in_place();
79
bool in_place() const;
80
81
ZForwardingEntry find(uintptr_t from_index, ZForwardingCursor* cursor) const;
82
uintptr_t insert(uintptr_t from_index, uintptr_t to_offset, ZForwardingCursor* cursor);
83
84
void verify() const;
85
};
86
87
#endif // SHARE_GC_Z_ZFORWARDING_HPP
88
89