Flutter Engine
The Flutter Engine
Public Types | Static Public Member Functions | Static Public Attributes | List of all members
dart::BSS Class Reference

#include <bss_relocs.h>

Inheritance diagram for dart::BSS:
dart::AllStatic

Public Types

enum class  Relocation : intptr_t { DRT_GetFfiCallbackMetadata , DRT_ExitTemporaryIsolate , EndOfVmEntries , EndOfIsolateGroupEntries = EndOfVmEntries }
 

Static Public Member Functions

static constexpr intptr_t RelocationIndex (Relocation reloc)
 
static void Initialize (Thread *current, uword *bss, bool vm)
 
static void InitializeBSSEntry (BSS::Relocation relocation, uword new_value, uword *bss_start)
 

Static Public Attributes

static constexpr intptr_t kVmEntryCount
 
static constexpr intptr_t kIsolateGroupEntryCount
 

Detailed Description

Definition at line 13 of file bss_relocs.h.

Member Enumeration Documentation

◆ Relocation

enum class dart::BSS::Relocation : intptr_t
strong
Enumerator
DRT_GetFfiCallbackMetadata 
DRT_ExitTemporaryIsolate 
EndOfVmEntries 
EndOfIsolateGroupEntries 

Definition at line 18 of file bss_relocs.h.

18 : intptr_t {
19 DRT_GetFfiCallbackMetadata, // TODO(https://dartbug.com/52579): Remove.
20 DRT_ExitTemporaryIsolate, // TODO(https://dartbug.com/52579): Remove.
21 EndOfVmEntries,
22
23 // We don't have any isolate group specific entries at the moment.
24 EndOfIsolateGroupEntries = EndOfVmEntries,
25 };

Member Function Documentation

◆ Initialize()

void dart::BSS::Initialize ( Thread current,
uword bss,
bool  vm 
)
static

Definition at line 30 of file bss_relocs.cc.

30 {
31 // TODO(https://dartbug.com/52579): Remove.
33 reinterpret_cast<uword>(DLRT_GetFfiCallbackMetadata),
34 bss_start);
36 reinterpret_cast<uword>(DLRT_ExitTemporaryIsolate),
37 bss_start);
38}
static void InitializeBSSEntry(BSS::Relocation relocation, uword new_value, uword *bss_start)
Definition: bss_relocs.cc:12
Thread * DLRT_GetFfiCallbackMetadata(FfiCallbackMetadata::Trampoline trampoline, uword *out_entry_point, uword *out_trampoline_type)
uintptr_t uword
Definition: globals.h:501
void DLRT_ExitTemporaryIsolate()

◆ InitializeBSSEntry()

void dart::BSS::InitializeBSSEntry ( BSS::Relocation  relocation,
uword  new_value,
uword bss_start 
)
static

Definition at line 12 of file bss_relocs.cc.

14 {
15 std::atomic<uword>* slot = reinterpret_cast<std::atomic<uword>*>(
16 &bss_start[BSS::RelocationIndex(relocation)]);
17 uword old_value = slot->load(std::memory_order_relaxed);
18 // FullSnapshotReader::ReadProgramSnapshot, and thus BSS::Initialize, can
19 // get called multiple times for the same isolate in different threads, though
20 // the initialized value will be consistent and thus change only once. Avoid
21 // calling compare_exchange_strong unless we actually need to change the
22 // value, to avoid spurious read/write races by TSAN.
23 if (old_value == new_value) return;
24 if (!slot->compare_exchange_strong(old_value, new_value,
25 std::memory_order_relaxed)) {
26 RELEASE_ASSERT(old_value == new_value);
27 }
28}
#define RELEASE_ASSERT(cond)
Definition: assert.h:327
static constexpr intptr_t RelocationIndex(Relocation reloc)
Definition: bss_relocs.h:33

◆ RelocationIndex()

static constexpr intptr_t dart::BSS::RelocationIndex ( Relocation  reloc)
inlinestaticconstexpr

Definition at line 33 of file bss_relocs.h.

33 {
34 return static_cast<intptr_t>(reloc);
35 }

Member Data Documentation

◆ kIsolateGroupEntryCount

constexpr intptr_t dart::BSS::kIsolateGroupEntryCount
staticconstexpr
Initial value:

Definition at line 30 of file bss_relocs.h.

◆ kVmEntryCount

constexpr intptr_t dart::BSS::kVmEntryCount
staticconstexpr
Initial value:
=
static_cast<intptr_t>(Relocation::EndOfVmEntries)

Definition at line 27 of file bss_relocs.h.


The documentation for this class was generated from the following files: