Flutter Engine
The Flutter Engine
|
A read-only Dart heap snapshot, or, read-executable mapping of AOT compiled Dart code. More...
#include <dart_snapshot.h>
Public Member Functions | |
bool | IsValid () const |
Determines if this snapshot contains a heap component. Since the instructions component is optional, the method does not check for its presence. Use IsValidForAOT to determine if both the heap and instructions components of the snapshot are present. More... | |
bool | IsValidForAOT () const |
Determines if this snapshot contains both the heap and instructions components. This is only useful when determining if the snapshot may be used to run AOT code. The instructions component will be absent in JIT modes. More... | |
const uint8_t * | GetDataMapping () const |
Get a pointer to the read-only mapping to the heap snapshot. More... | |
const uint8_t * | GetInstructionsMapping () const |
Get a pointer to the read-execute mapping to the instructions snapshot. More... | |
bool | IsDontNeedSafe () const |
Returns whether both the data and instructions mappings are safe to use with madvise(DONTNEED). More... | |
bool | IsNullSafetyEnabled (const fml::Mapping *application_kernel_mapping) const |
Public Member Functions inherited from fml::RefCountedThreadSafe< DartSnapshot > | |
void | Release () const |
Public Member Functions inherited from fml::internal::RefCountedThreadSafeBase | |
void | AddRef () const |
bool | HasOneRef () const |
void | AssertHasOneRef () const |
Static Public Member Functions | |
static fml::RefPtr< const DartSnapshot > | VMSnapshotFromSettings (const Settings &settings) |
From the fields present in the given settings object, infer the core snapshot. More... | |
static fml::RefPtr< const DartSnapshot > | IsolateSnapshotFromSettings (const Settings &settings) |
From the fields present in the given settings object, infer the isolate snapshot. More... | |
static fml::RefPtr< DartSnapshot > | IsolateSnapshotFromMappings (const std::shared_ptr< const fml::Mapping > &snapshot_data, const std::shared_ptr< const fml::Mapping > &snapshot_instructions) |
Create an isolate snapshot from existing fml::Mappings. More... | |
static fml::RefPtr< DartSnapshot > | VMServiceIsolateSnapshotFromSettings (const Settings &settings) |
Create an isolate snapshot specialized for launching the service isolate. Returns nullptr if no such snapshot is available. More... | |
Static Public Attributes | |
static const char * | kVMDataSymbol = "kDartVmSnapshotData" |
static const char * | kVMInstructionsSymbol = "kDartVmSnapshotInstructions" |
static const char * | kIsolateDataSymbol = "kDartIsolateSnapshotData" |
static const char * | kIsolateInstructionsSymbol |
Additional Inherited Members | |
Protected Member Functions inherited from fml::RefCountedThreadSafe< DartSnapshot > | |
RefCountedThreadSafe () | |
~RefCountedThreadSafe () | |
Protected Member Functions inherited from fml::internal::RefCountedThreadSafeBase | |
RefCountedThreadSafeBase () | |
~RefCountedThreadSafeBase () | |
bool | Release () const |
void | Adopt () |
A read-only Dart heap snapshot, or, read-executable mapping of AOT compiled Dart code.
To make Dart code startup more performant, the Flutter tools on the host snapshot the state of the Dart heap at specific points and package the same with the Flutter application. When the Dart VM on the target is configured to run AOT compiled Dart code, the tools also compile the developer's Flutter application code to target specific machine code (instructions). This class deals with the mapping of both these buffers at runtime on the target.
A Flutter application typically needs two instances of this class at runtime to run Dart code. One instance is for the VM and is called the "core snapshot". The other is the isolate and called the "isolate snapshot". Different root isolates can be launched with different isolate snapshots.
These snapshots are typically memory-mapped at runtime, or, referenced directly as symbols present in Mach or ELF binaries.
In the case of the core snapshot, the snapshot is collected when the VM shuts down. The isolate snapshot is collected when the isolate group shuts down.
Definition at line 42 of file dart_snapshot.h.
const uint8_t * flutter::DartSnapshot::GetDataMapping | ( | ) | const |
Get a pointer to the read-only mapping to the heap snapshot.
Definition at line 249 of file dart_snapshot.cc.
const uint8_t * flutter::DartSnapshot::GetInstructionsMapping | ( | ) | const |
Get a pointer to the read-execute mapping to the instructions snapshot.
Definition at line 253 of file dart_snapshot.cc.
bool flutter::DartSnapshot::IsDontNeedSafe | ( | ) | const |
Returns whether both the data and instructions mappings are safe to use with madvise(DONTNEED).
Definition at line 257 of file dart_snapshot.cc.
bool flutter::DartSnapshot::IsNullSafetyEnabled | ( | const fml::Mapping * | application_kernel_mapping | ) | const |
Definition at line 267 of file dart_snapshot.cc.
|
static |
Create an isolate snapshot from existing fml::Mappings.
[in] | snapshot_data | The mapping for the heap snapshot. |
[in] | snapshot_instructions | The mapping for the instructions snapshot. |
Definition at line 205 of file dart_snapshot.cc.
|
static |
From the fields present in the given settings object, infer the isolate snapshot.
Settings::isolate_snapshot_data
and Settings::isolate_snapshots_instr
mapping fields may be used. This specification takes precedence over all fallback search paths.[in] | settings | The settings to infer the isolate snapshot from. |
Definition at line 192 of file dart_snapshot.cc.
bool flutter::DartSnapshot::IsValid | ( | ) | const |
Determines if this snapshot contains a heap component. Since the instructions component is optional, the method does not check for its presence. Use IsValidForAOT
to determine if both the heap and instructions components of the snapshot are present.
Definition at line 241 of file dart_snapshot.cc.
bool flutter::DartSnapshot::IsValidForAOT | ( | ) | const |
Determines if this snapshot contains both the heap and instructions components. This is only useful when determining if the snapshot may be used to run AOT code. The instructions component will be absent in JIT modes.
Definition at line 245 of file dart_snapshot.cc.
|
static |
Create an isolate snapshot specialized for launching the service isolate. Returns nullptr if no such snapshot is available.
Definition at line 216 of file dart_snapshot.cc.
|
static |
From the fields present in the given settings object, infer the core snapshot.
Settings::vm_snapshot_data
and Settings::vm_snapshots_instr
mapping fields may be used. This specification takes precedence over all fallback search paths.[in] | settings | The settings to infer the core snapshot from. |
Definition at line 179 of file dart_snapshot.cc.
|
static |
The symbol name of the heap data of the isolate snapshot in a dynamic library or currently loaded process.
Definition at line 58 of file dart_snapshot.h.
|
static |
The symbol name of the instructions data of the isolate snapshot in a dynamic library or currently loaded process.
Definition at line 63 of file dart_snapshot.h.
|
static |
The symbol name of the heap data of the core snapshot in a dynamic library or currently loaded process.
Definition at line 48 of file dart_snapshot.h.
|
static |
The symbol name of the instructions data of the core snapshot in a dynamic library or currently loaded process.
Definition at line 53 of file dart_snapshot.h.