5#ifndef RUNTIME_VM_BITFIELD_H_
6#define RUNTIME_VM_BITFIELD_H_
24 static_assert(
sizeof(std::atomic<T>) ==
sizeof(
T),
25 "Size of type changes when made atomic");
32 operator T()
const {
return field_.load(std::memory_order_relaxed); }
34 field_.store(tags, std::memory_order_relaxed);
38 T load(std::memory_order order)
const {
return field_.load(order); }
40 return *
reinterpret_cast<const T*
>(&field_);
45 return field_.compare_exchange_weak(old_tags, new_tags, order);
48 template <
class TargetBitField,
49 std::memory_order order = std::memory_order_relaxed>
54 template <
class TargetBitField,
55 std::memory_order order = std::memory_order_relaxed>
64 template <
class TargetBitField>
69 template <
class TargetBitField>
71 T old_field = field_.load(std::memory_order_relaxed);
74 new_field = TargetBitField::update(
value, old_field);
75 }
while (!field_.compare_exchange_weak(old_field, new_field,
76 std::memory_order_relaxed));
79 template <
class TargetBitField>
82 TargetBitField::update(
value, field_.load(std::memory_order_relaxed)),
83 std::memory_order_relaxed);
86 template <
class TargetBitField>
90 T old_field = field_.load(std::memory_order_relaxed);
94 if (old_value != conditional_old_value) {
97 T new_tags = TargetBitField::update(value_to_be_set, old_field);
98 if (field_.compare_exchange_weak(old_field, new_tags,
99 std::memory_order_relaxed)) {
100 return value_to_be_set;
106 template <
class TargetBitField>
109 T old_field = field_.fetch_or(mask, std::memory_order_relaxed);
113 template <
class TargetBitField>
116 T old_field = field_.fetch_and(mask, std::memory_order_relaxed);
121 std::atomic<T> field_;
133 typename Enable =
void>
139 "BitField does not fit into the type.");
141 "Should only sign extend signed bitfield types");
159 static constexpr int shift() {
return position; }
167 return encode_unchecked(
value);
176 auto const u =
static_cast<uint64_t
>(
value);
177 return static_cast<T>((
static_cast<int64_t
>(u << (64 -
kNextBit))) >>
181 return static_cast<T>((u >> position) &
mask());
189 return encode(
value) | (~mask_in_place() & original);
194 static constexpr S encode_unchecked(
T value) {
196 return (u &
mask()) << position;
203template <
typename S,
typename T,
int position,
int size,
bool sign_extend>
209 typename
std::enable_if<
210 std::is_base_of<AtomicBitFieldContainerBase, S>::value,
217template <
typename S,
typename T,
int position,
int size>
223 typename
std::enable_if<
224 std::is_base_of<AtomicBitFieldContainerBase, S>::value,
226 :
public BitField<typename S::ContainedType, T, position, size, false> {};
static void encode(uint8_t output[16], const uint32_t input[4])
void UpdateBool(bool value)
void FetchOr(typename TargetBitField::Type value)
TargetBitField::Type UpdateConditional(typename TargetBitField::Type value_to_be_set, typename TargetBitField::Type conditional_old_value)
AtomicBitFieldContainer()
void UpdateUnsynchronized(typename TargetBitField::Type value)
bool compare_exchange_weak(T old_tags, T new_tags, std::memory_order order)
NO_SANITIZE_THREAD T load_ignore_race() const
void store(T value, std::memory_order order)
void Update(typename TargetBitField::Type value)
T load(std::memory_order order) const
TargetBitField::Type Read() const
static constexpr int bitsize()
static constexpr intptr_t kNextBit
static constexpr T decode(S value)
static constexpr S update(T value, S original)
static constexpr S mask_in_place()
static constexpr S mask()
static constexpr S encode(T value)
static constexpr bool is_valid(T value)
static constexpr int shift()
constexpr intptr_t kBitsPerByte
intx_t sign_extend(int32_t x)
static constexpr uword kUwordOne
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
static DecodeResult decode(std::string path)
#define NO_SANITIZE_THREAD