Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/hotspot/share/gc/z/zAllocationFlags.hpp
40957 views
1
/*
2
* Copyright (c) 2017, 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_ZALLOCATIONFLAGS_HPP
25
#define SHARE_GC_Z_ZALLOCATIONFLAGS_HPP
26
27
#include "gc/z/zBitField.hpp"
28
#include "memory/allocation.hpp"
29
30
//
31
// Allocation flags layout
32
// -----------------------
33
//
34
// 7 2 1 0
35
// +-----+-+-+-+
36
// |00000|1|1|1|
37
// +-----+-+-+-+
38
// | | | |
39
// | | | * 0-0 Non-Blocking Flag (1-bit)
40
// | | |
41
// | | * 1-1 Worker Relocation Flag (1-bit)
42
// | |
43
// | * 2-2 Low Address Flag (1-bit)
44
// |
45
// * 7-3 Unused (5-bits)
46
//
47
48
class ZAllocationFlags {
49
private:
50
typedef ZBitField<uint8_t, bool, 0, 1> field_non_blocking;
51
typedef ZBitField<uint8_t, bool, 1, 1> field_worker_relocation;
52
typedef ZBitField<uint8_t, bool, 2, 1> field_low_address;
53
54
uint8_t _flags;
55
56
public:
57
ZAllocationFlags() :
58
_flags(0) {}
59
60
void set_non_blocking() {
61
_flags |= field_non_blocking::encode(true);
62
}
63
64
void set_worker_relocation() {
65
_flags |= field_worker_relocation::encode(true);
66
}
67
68
void set_low_address() {
69
_flags |= field_low_address::encode(true);
70
}
71
72
bool non_blocking() const {
73
return field_non_blocking::decode(_flags);
74
}
75
76
bool worker_relocation() const {
77
return field_worker_relocation::decode(_flags);
78
}
79
80
bool low_address() const {
81
return field_low_address::decode(_flags);
82
}
83
};
84
85
#endif // SHARE_GC_Z_ZALLOCATIONFLAGS_HPP
86
87