Flutter Engine
The Flutter Engine
Classes | Namespaces | Macros | Functions | Variables
app_snapshot.cc File Reference
#include <memory>
#include <utility>
#include "vm/app_snapshot.h"
#include "platform/assert.h"
#include "vm/bootstrap.h"
#include "vm/bss_relocs.h"
#include "vm/canonical_tables.h"
#include "vm/class_id.h"
#include "vm/code_observers.h"
#include "vm/compiler/api/print_filter.h"
#include "vm/compiler/assembler/disassembler.h"
#include "vm/dart.h"
#include "vm/dart_entry.h"
#include "vm/dispatch_table.h"
#include "vm/flag_list.h"
#include "vm/growable_array.h"
#include "vm/heap/heap.h"
#include "vm/image_snapshot.h"
#include "vm/native_entry.h"
#include "vm/object.h"
#include "vm/object_store.h"
#include "vm/program_visitor.h"
#include "vm/raw_object_fields.h"
#include "vm/stub_code.h"
#include "vm/symbols.h"
#include "vm/timeline.h"
#include "vm/v8_snapshot_writer.h"
#include "vm/version.h"
#include "vm/zone_text_buffer.h"
#include "vm/compiler/backend/code_statistics.h"
#include "vm/compiler/backend/il_printer.h"
#include "vm/compiler/relocation.h"

Go to the source code of this file.

Classes

class  dart::SerializationCluster
 
class  dart::DeserializationCluster
 
class  dart::SerializationRoots
 
class  dart::DeserializationRoots
 
class  dart::Serializer
 
class  dart::Serializer::WritingObjectScope
 
class  dart::Deserializer
 
class  dart::Deserializer::Local
 
class  dart::ClassSerializationCluster
 
class  dart::ClassDeserializationCluster
 
class  dart::CanonicalSetSerializationCluster< SetType, HandleType, PointerType, kAllCanonicalObjectsAreIncludedIntoSet >
 
class  dart::CanonicalSetDeserializationCluster< SetType, kAllCanonicalObjectsAreIncludedIntoSet >
 
class  dart::TypeParametersSerializationCluster
 
class  dart::TypeParametersDeserializationCluster
 
class  dart::TypeArgumentsSerializationCluster
 
class  dart::TypeArgumentsDeserializationCluster
 
class  dart::PatchClassSerializationCluster
 
class  dart::PatchClassDeserializationCluster
 
class  dart::FunctionSerializationCluster
 
class  dart::FunctionDeserializationCluster
 
class  dart::ClosureDataSerializationCluster
 
class  dart::ClosureDataDeserializationCluster
 
class  dart::FfiTrampolineDataSerializationCluster
 
class  dart::FfiTrampolineDataDeserializationCluster
 
class  dart::FieldSerializationCluster
 
class  dart::FieldDeserializationCluster
 
class  dart::ScriptSerializationCluster
 
class  dart::ScriptDeserializationCluster
 
class  dart::LibrarySerializationCluster
 
class  dart::LibraryDeserializationCluster
 
class  dart::NamespaceSerializationCluster
 
class  dart::NamespaceDeserializationCluster
 
class  dart::KernelProgramInfoSerializationCluster
 
class  dart::KernelProgramInfoDeserializationCluster
 
class  dart::CodeSerializationCluster
 
struct  dart::CodeSerializationCluster::CodeOrderInfo
 
class  dart::CodeDeserializationCluster
 
class  dart::ObjectPoolSerializationCluster
 
class  dart::ObjectPoolDeserializationCluster
 
class  dart::PcDescriptorsSerializationCluster
 
class  dart::PcDescriptorsDeserializationCluster
 
class  dart::CodeSourceMapSerializationCluster
 
class  dart::CodeSourceMapDeserializationCluster
 
class  dart::CompressedStackMapsSerializationCluster
 
class  dart::CompressedStackMapsDeserializationCluster
 
class  dart::RODataSerializationCluster
 
class  dart::RODataDeserializationCluster
 
class  dart::ExceptionHandlersSerializationCluster
 
class  dart::ExceptionHandlersDeserializationCluster
 
class  dart::ContextSerializationCluster
 
class  dart::ContextDeserializationCluster
 
class  dart::ContextScopeSerializationCluster
 
class  dart::ContextScopeDeserializationCluster
 
class  dart::UnlinkedCallSerializationCluster
 
class  dart::UnlinkedCallDeserializationCluster
 
class  dart::ICDataSerializationCluster
 
class  dart::ICDataDeserializationCluster
 
class  dart::MegamorphicCacheSerializationCluster
 
class  dart::MegamorphicCacheDeserializationCluster
 
class  dart::SubtypeTestCacheSerializationCluster
 
class  dart::SubtypeTestCacheDeserializationCluster
 
class  dart::LoadingUnitSerializationCluster
 
class  dart::LoadingUnitDeserializationCluster
 
class  dart::LanguageErrorSerializationCluster
 
class  dart::LanguageErrorDeserializationCluster
 
class  dart::UnhandledExceptionSerializationCluster
 
class  dart::UnhandledExceptionDeserializationCluster
 
class  dart::InstanceSerializationCluster
 
class  dart::AbstractInstanceDeserializationCluster
 
class  dart::InstanceDeserializationCluster
 
class  dart::LibraryPrefixSerializationCluster
 
class  dart::LibraryPrefixDeserializationCluster
 
class  dart::TypeSerializationCluster
 
class  dart::TypeDeserializationCluster
 
class  dart::FunctionTypeSerializationCluster
 
class  dart::FunctionTypeDeserializationCluster
 
class  dart::RecordTypeSerializationCluster
 
class  dart::RecordTypeDeserializationCluster
 
class  dart::TypeParameterSerializationCluster
 
class  dart::TypeParameterDeserializationCluster
 
class  dart::ClosureSerializationCluster
 
class  dart::ClosureDeserializationCluster
 
class  dart::MintSerializationCluster
 
class  dart::MintDeserializationCluster
 
class  dart::DoubleSerializationCluster
 
class  dart::DoubleDeserializationCluster
 
class  dart::Simd128SerializationCluster
 
class  dart::Simd128DeserializationCluster
 
class  dart::GrowableObjectArraySerializationCluster
 
class  dart::GrowableObjectArrayDeserializationCluster
 
class  dart::RecordSerializationCluster
 
class  dart::RecordDeserializationCluster
 
class  dart::TypedDataSerializationCluster
 
class  dart::TypedDataDeserializationCluster
 
class  dart::TypedDataViewSerializationCluster
 
class  dart::TypedDataViewDeserializationCluster
 
class  dart::ExternalTypedDataSerializationCluster
 
class  dart::ExternalTypedDataDeserializationCluster
 
class  dart::DeltaEncodedTypedDataSerializationCluster
 
class  dart::DeltaEncodedTypedDataDeserializationCluster
 
class  dart::StackTraceSerializationCluster
 
class  dart::StackTraceDeserializationCluster
 
class  dart::RegExpSerializationCluster
 
class  dart::RegExpDeserializationCluster
 
class  dart::WeakPropertySerializationCluster
 
class  dart::WeakPropertyDeserializationCluster
 
class  dart::MapSerializationCluster
 
class  dart::MapDeserializationCluster
 
class  dart::SetSerializationCluster
 
class  dart::SetDeserializationCluster
 
class  dart::ArraySerializationCluster
 
class  dart::ArrayDeserializationCluster
 
class  dart::WeakArraySerializationCluster
 
class  dart::WeakArrayDeserializationCluster
 
class  dart::StringSerializationCluster
 
class  dart::StringDeserializationCluster
 
class  dart::FakeSerializationCluster
 
class  dart::VMSerializationRoots
 
class  dart::VMDeserializationRoots
 
class  dart::ProgramSerializationRoots
 
class  dart::ProgramDeserializationRoots
 
class  dart::UnitSerializationRoots
 
class  dart::UnitDeserializationRoots
 
class  dart::HeapLocker
 

Namespaces

namespace  dart
 

Macros

#define AutoTraceObject(obj)    Serializer::WritingObjectScope scope_##__COUNTER__(s, name(), obj, nullptr)
 
#define AutoTraceObjectName(obj, str)    Serializer::WritingObjectScope scope_##__COUNTER__(s, name(), obj, str)
 
#define WriteFieldValue(field, value)   s->WritePropertyRef(value, #field);
 
#define WriteFromTo(obj, ...)   s->WriteFromTo(obj, ##__VA_ARGS__);
 
#define PushFromTo(obj, ...)   s->PushFromTo(obj, ##__VA_ARGS__);
 
#define WriteField(obj, field)   s->WritePropertyRef(obj->untag()->field, #field)
 
#define WriteCompressedField(obj, name)    s->WritePropertyRef(obj->untag()->name(), #name "_")
 
#define DECLARE_OBJECT_STORE_FIELD(Type, Name)   #Name,
 
#define RESET_ROOT_LIST(V)
 
#define ONLY_IN_AOT(code)
 
#define SAVE_AND_RESET_ROOT(name, Type, init)
 
#define ONLY_IN_AOT(code)
 
#define RESTORE_ROOT(name, Type, init)    object_store_->set_##name(saved_##name##_);
 
#define ONLY_IN_AOT(code)   code
 
#define DECLARE_FIELD(name, Type, init)   Type& saved_##name##_ = Type::Handle();
 
#define CASE_FFI_CID(name)   case kFfi##name##Cid:
 
#define CID_CLUSTER(Type)    reinterpret_cast<Type##SerializationCluster*>(clusters_by_cid_[k##Type##Cid])
 
#define ADD_CANONICAL_NEXT(cid)
 
#define ADD_NON_CANONICAL_NEXT(cid)
 
#define CASE_FFI_CID(name)   case kFfi##name##Cid:
 
#define SET_FLAG(name)
 
#define CHECK_FLAG(name, mode)
 
#define SET_P(name, T, DV, C)   SET_FLAG(name)
 
#define SET_OR_CHECK_R(name, PV, T, DV, C)   SET_FLAG(name)
 
#define SET_OR_CHECK_C(name, PV, T, DV, C)   SET_FLAG(name)
 
#define SET_OR_CHECK_D(name, T, DV, C)   CHECK_FLAG(name, "non-debug mode")
 

Functions

 dart::DEFINE_FLAG (bool, print_cluster_information, false, "Print information about clusters written to snapshot")
 
 dart::COMPILE_ASSERT (kUnreachableReference==WeakTable::kNoValue)
 
static constexpr bool dart::IsAllocatedReference (intptr_t ref)
 
static constexpr bool dart::IsArtificialReference (intptr_t ref)
 
static constexpr bool dart::IsReachableReference (intptr_t ref)
 
static UnboxedFieldBitmap dart::CalculateTargetUnboxedFieldsBitmap (Serializer *s, intptr_t class_id)
 
template<bool need_entry_point_for_non_discarded>
static DART_FORCE_INLINE CodePtr dart::GetCodeAndEntryPointByIndex (const Deserializer *d, intptr_t code_index, uword *entry_point)
 
static int dart::CompareClusters (SerializationCluster *const *a, SerializationCluster *const *b)
 

Variables

static constexpr intptr_t dart::kUnreachableReference = 0
 
static constexpr intptr_t dart::kFirstReference = 1
 
static constexpr intptr_t dart::kUnallocatedReference = -1
 
static const char *const dart::kObjectStoreFieldNames []
 

Macro Definition Documentation

◆ ADD_CANONICAL_NEXT

#define ADD_CANONICAL_NEXT (   cid)
Value:
if (auto const cluster = canonical_clusters_by_cid_[cid]) { \
clusters.Add(cluster); \
canonical_clusters_by_cid_[cid] = nullptr; \
}
const intptr_t cid

◆ ADD_NON_CANONICAL_NEXT

#define ADD_NON_CANONICAL_NEXT (   cid)
Value:
if (auto const cluster = clusters_by_cid_[cid]) { \
clusters.Add(cluster); \
clusters_by_cid_[cid] = nullptr; \
}

◆ AutoTraceObject

#define AutoTraceObject (   obj)     Serializer::WritingObjectScope scope_##__COUNTER__(s, name(), obj, nullptr)

Definition at line 649 of file app_snapshot.cc.

◆ AutoTraceObjectName

#define AutoTraceObjectName (   obj,
  str 
)     Serializer::WritingObjectScope scope_##__COUNTER__(s, name(), obj, str)

Definition at line 652 of file app_snapshot.cc.

◆ CASE_FFI_CID [1/2]

#define CASE_FFI_CID (   name)    case kFfi##name##Cid:

◆ CASE_FFI_CID [2/2]

#define CASE_FFI_CID (   name)    case kFfi##name##Cid:

◆ CHECK_FLAG

#define CHECK_FLAG (   name,
  mode 
)
Value:
if (strncmp(cursor, #name, end - cursor) == 0) { \
if (!FLAG_##name) { \
return header_reader.BuildError("Flag " #name \
" is true in snapshot, " \
"but " #name \
" is always false in " mode); \
} \
cursor = end; \
continue; \
} \
if (strncmp(cursor, "no-" #name, end - cursor) == 0) { \
if (FLAG_##name) { \
return header_reader.BuildError("Flag " #name \
" is false in snapshot, " \
"but " #name \
" is always true in " mode); \
} \
cursor = end; \
continue; \
}
glong glong end
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32
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 mode
Definition: switches.h:228

◆ CID_CLUSTER

#define CID_CLUSTER (   Type)     reinterpret_cast<Type##SerializationCluster*>(clusters_by_cid_[k##Type##Cid])

Definition at line 8549 of file app_snapshot.cc.

◆ DECLARE_FIELD

#define DECLARE_FIELD (   name,
  Type,
  init 
)    Type& saved_##name##_ = Type::Handle();

Definition at line 7178 of file app_snapshot.cc.

◆ DECLARE_OBJECT_STORE_FIELD

#define DECLARE_OBJECT_STORE_FIELD (   Type,
  Name 
)    #Name,

◆ ONLY_IN_AOT [1/3]

#define ONLY_IN_AOT (   code)
Value:
if (snapshot_kind_ == Snapshot::kFullAOT) { \
code \
}

Definition at line 7177 of file app_snapshot.cc.

◆ ONLY_IN_AOT [2/3]

#define ONLY_IN_AOT (   code)
Value:
if (snapshot_kind_ == Snapshot::kFullAOT) { \
code \
}

Definition at line 7177 of file app_snapshot.cc.

◆ ONLY_IN_AOT [3/3]

#define ONLY_IN_AOT (   code)    code

Definition at line 7177 of file app_snapshot.cc.

◆ PushFromTo

#define PushFromTo (   obj,
  ... 
)    s->PushFromTo(obj, ##__VA_ARGS__);

Definition at line 659 of file app_snapshot.cc.

◆ RESET_ROOT_LIST

#define RESET_ROOT_LIST (   V)
Value:
V(symbol_table, WeakArray, HashTables::New<CanonicalStringSet>(4)) \
V(canonical_types, Array, HashTables::New<CanonicalTypeSet>(4)) \
V(canonical_function_types, Array, \
HashTables::New<CanonicalFunctionTypeSet>(4)) \
V(canonical_record_types, Array, HashTables::New<CanonicalRecordTypeSet>(4)) \
V(canonical_type_arguments, Array, \
HashTables::New<CanonicalTypeArgumentsSet>(4)) \
V(canonical_type_parameters, Array, \
HashTables::New<CanonicalTypeParameterSet>(4)) \
ONLY_IN_PRODUCT(ONLY_IN_AOT( \
V(closure_functions, GrowableObjectArray, GrowableObjectArray::null()))) \
ONLY_IN_AOT(V(closure_functions_table, Array, Array::null())) \
ONLY_IN_AOT(V(canonicalized_stack_map_entries, CompressedStackMaps, \
CompressedStackMaps::null()))
#define ONLY_IN_AOT(code)
#define V(name)
Definition: raw_object.h:125

Definition at line 7039 of file app_snapshot.cc.

◆ RESTORE_ROOT

#define RESTORE_ROOT (   name,
  Type,
  init 
)     object_store_->set_##name(saved_##name##_);

◆ SAVE_AND_RESET_ROOT

#define SAVE_AND_RESET_ROOT (   name,
  Type,
  init 
)
Value:
do { \
saved_##name##_ = object_store->name(); \
object_store->set_##name(Type::Handle(init)); \
} while (0);
static bool init()

◆ SET_FLAG

#define SET_FLAG (   name)
Value:
if (strncmp(cursor, #name, end - cursor) == 0) { \
FLAG_##name = true; \
cursor = end; \
continue; \
} \
if (strncmp(cursor, "no-" #name, end - cursor) == 0) { \
FLAG_##name = false; \
cursor = end; \
continue; \
}

◆ SET_OR_CHECK_C

#define SET_OR_CHECK_C (   name,
  PV,
  T,
  DV,
  C 
)    SET_FLAG(name)

◆ SET_OR_CHECK_D

#define SET_OR_CHECK_D (   name,
  T,
  DV,
  C 
)    CHECK_FLAG(name, "non-debug mode")

◆ SET_OR_CHECK_R

#define SET_OR_CHECK_R (   name,
  PV,
  T,
  DV,
  C 
)    SET_FLAG(name)

◆ SET_P

#define SET_P (   name,
  T,
  DV,
  C 
)    SET_FLAG(name)

◆ WriteCompressedField

#define WriteCompressedField (   obj,
  name 
)     s->WritePropertyRef(obj->untag()->name(), #name "_")

Definition at line 662 of file app_snapshot.cc.

◆ WriteField

#define WriteField (   obj,
  field 
)    s->WritePropertyRef(obj->untag()->field, #field)

Definition at line 661 of file app_snapshot.cc.

◆ WriteFieldValue

#define WriteFieldValue (   field,
  value 
)    s->WritePropertyRef(value, #field);

Definition at line 655 of file app_snapshot.cc.

◆ WriteFromTo

#define WriteFromTo (   obj,
  ... 
)    s->WriteFromTo(obj, ##__VA_ARGS__);

Definition at line 657 of file app_snapshot.cc.