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

#include <object.h>

Inheritance diagram for dart::LoadingUnit:
dart::Object

Public Member Functions

 COMPILE_ASSERT (kIllegalId==WeakTable::kNoValue)
 
LoadingUnitPtr parent () const
 
ArrayPtr base_objects () const
 
void set_base_objects (const Array &value) const
 
intptr_t id () const
 
bool loaded () const
 
void set_loaded (bool value) const
 
bool load_outstanding () const
 
void set_load_outstanding () const
 
const uint8_t * instructions_image () const
 
void set_instructions_image (const uint8_t *value) const
 
bool has_instructions_image () const
 
ObjectPtr IssueLoad () const
 
ObjectPtr CompleteLoad (const String &error_message, bool transient_error) const
 
- Public Member Functions inherited from dart::Object
virtual ~Object ()
 
ObjectPtr ptr () const
 
void operator= (ObjectPtr value)
 
bool IsCanonical () const
 
void SetCanonical () const
 
void ClearCanonical () const
 
bool IsImmutable () const
 
void SetImmutable () const
 
void ClearImmutable () const
 
intptr_t GetClassId () const
 
ClassPtr clazz () const
 
 CLASS_LIST_FOR_HANDLES (DEFINE_CLASS_TESTER)
 
bool IsNull () const
 
virtual const char * ToCString () const
 
void PrintJSON (JSONStream *stream, bool ref=true) const
 
virtual void PrintJSONImpl (JSONStream *stream, bool ref) const
 
void PrintImplementationFields (JSONStream *stream) const
 
virtual void PrintImplementationFieldsImpl (const JSONArray &jsarr_fields) const
 
virtual const char * JSONType () const
 
virtual StringPtr DictionaryName () const
 
bool IsNew () const
 
bool IsOld () const
 
bool InVMIsolateHeap () const
 
void Print () const
 

Static Public Member Functions

static LoadingUnitPtr New (intptr_t id, const LoadingUnit &parent)
 
static intptr_t InstanceSize ()
 
static intptr_t LoadingUnitOf (const Function &function)
 
static intptr_t LoadingUnitOf (const Code &code)
 
- Static Public Member Functions inherited from dart::Object
static ObjectPtr RawCast (ObjectPtr obj)
 
static constexpr bool ContainsCompressedPointers ()
 
static intptr_t tags_offset ()
 
static ObjectHandle ()
 
static ObjectHandle (Zone *zone)
 
static ObjectHandle (ObjectPtr ptr)
 
static ObjectHandle (Zone *zone, ObjectPtr ptr)
 
static ObjectZoneHandle ()
 
static ObjectZoneHandle (Zone *zone)
 
static ObjectZoneHandle (ObjectPtr ptr)
 
static ObjectZoneHandle (Zone *zone, ObjectPtr ptr)
 
static ObjectReadOnlyHandle ()
 
static ObjectPtr null ()
 
static void set_vm_isolate_snapshot_object_table (const Array &table)
 
static ClassPtr class_class ()
 
static ClassPtr dynamic_class ()
 
static ClassPtr void_class ()
 
static ClassPtr type_parameters_class ()
 
static ClassPtr type_arguments_class ()
 
static ClassPtr patch_class_class ()
 
static ClassPtr function_class ()
 
static ClassPtr closure_data_class ()
 
static ClassPtr ffi_trampoline_data_class ()
 
static ClassPtr field_class ()
 
static ClassPtr script_class ()
 
static ClassPtr library_class ()
 
static ClassPtr namespace_class ()
 
static ClassPtr kernel_program_info_class ()
 
static ClassPtr code_class ()
 
static ClassPtr instructions_class ()
 
static ClassPtr instructions_section_class ()
 
static ClassPtr instructions_table_class ()
 
static ClassPtr object_pool_class ()
 
static ClassPtr pc_descriptors_class ()
 
static ClassPtr code_source_map_class ()
 
static ClassPtr compressed_stackmaps_class ()
 
static ClassPtr var_descriptors_class ()
 
static ClassPtr exception_handlers_class ()
 
static ClassPtr context_class ()
 
static ClassPtr context_scope_class ()
 
static ClassPtr sentinel_class ()
 
static ClassPtr api_error_class ()
 
static ClassPtr language_error_class ()
 
static ClassPtr unhandled_exception_class ()
 
static ClassPtr unwind_error_class ()
 
static ClassPtr singletargetcache_class ()
 
static ClassPtr unlinkedcall_class ()
 
static ClassPtr monomorphicsmiablecall_class ()
 
static ClassPtr icdata_class ()
 
static ClassPtr megamorphic_cache_class ()
 
static ClassPtr subtypetestcache_class ()
 
static ClassPtr loadingunit_class ()
 
static ClassPtr weak_serialization_reference_class ()
 
static ClassPtr weak_array_class ()
 
static void InitNullAndBool (IsolateGroup *isolate_group)
 
static void Init (IsolateGroup *isolate_group)
 
static void InitVtables ()
 
static void FinishInit (IsolateGroup *isolate_group)
 
static void FinalizeVMIsolate (IsolateGroup *isolate_group)
 
static void FinalizeReadOnlyObject (ObjectPtr object)
 
static void Cleanup ()
 
static ErrorPtr Init (IsolateGroup *isolate_group, const uint8_t *kernel_buffer, intptr_t kernel_buffer_size)
 
static void MakeUnusedSpaceTraversable (const Object &obj, intptr_t original_size, intptr_t used_size)
 
static intptr_t InstanceSize ()
 
template<class FakeObject >
static void VerifyBuiltinVtable (intptr_t cid)
 
static void VerifyBuiltinVtables ()
 
static bool ShouldHaveImmutabilityBitSet (classid_t class_id)
 

Static Public Attributes

static constexpr intptr_t kIllegalId = 0
 
static constexpr intptr_t kRootId = 1
 
- Static Public Attributes inherited from dart::Object
static constexpr intptr_t kHashBits = 30
 
static const ClassId kClassId = kObjectCid
 

Friends

class Class
 

Additional Inherited Members

- Public Types inherited from dart::Object
enum  NameVisibility { kInternalName = 0 , kScrubbedName , kUserVisibleName }
 
enum class  NameDisambiguation { kYes , kNo }
 
using UntaggedObjectType = UntaggedObject
 
using ObjectPtrType = ObjectPtr
 
- Protected Member Functions inherited from dart::Object
 Object ()
 
uword raw_value () const
 
void setPtr (ObjectPtr value, intptr_t default_cid)
 
void CheckHandle () const
 
cpp_vtable vtable () const
 
void set_vtable (cpp_vtable value)
 
bool Contains (uword addr) const
 
template<typename type , std::memory_order order = std::memory_order_relaxed>
type LoadPointer (type const *addr) const
 
template<typename type , std::memory_order order = std::memory_order_relaxed>
void StorePointer (type const *addr, type value) const
 
template<typename type , typename compressed_type , std::memory_order order = std::memory_order_relaxed>
void StoreCompressedPointer (compressed_type const *addr, type value) const
 
template<typename type >
void StorePointerUnaligned (type const *addr, type value, Thread *thread) const
 
void StoreSmi (SmiPtr const *addr, SmiPtr value) const
 
template<typename FieldType >
void StoreSimd128 (const FieldType *addr, simd128_value_t value) const
 
template<typename FieldType >
FieldType LoadNonPointer (const FieldType *addr) const
 
template<typename FieldType , std::memory_order order>
FieldType LoadNonPointer (const FieldType *addr) const
 
template<typename FieldType , typename ValueType >
void StoreNonPointer (const FieldType *addr, ValueType value) const
 
template<typename FieldType , typename ValueType , std::memory_order order>
void StoreNonPointer (const FieldType *addr, ValueType value) const
 
template<typename FieldType >
FieldType * UnsafeMutableNonPointer (const FieldType *addr) const
 
 CLASS_LIST (STORE_NON_POINTER_ILLEGAL_TYPE)
 
void UnimplementedMethod () const
 
void AddCommonObjectProperties (JSONObject *jsobj, const char *protocol_type, bool ref) const
 
- Static Protected Member Functions inherited from dart::Object
static DART_NOINLINE ObjectHandleImpl (Zone *zone, ObjectPtr ptr, intptr_t default_cid)
 
static DART_NOINLINE ObjectZoneHandleImpl (Zone *zone, ObjectPtr ptr, intptr_t default_cid)
 
static DART_NOINLINE ObjectReadOnlyHandleImpl (intptr_t cid)
 
static ObjectPtr Allocate (intptr_t cls_id, intptr_t size, Heap::Space space, bool compressed, uword ptr_field_start_offset, uword ptr_field_end_offset)
 
template<typename T >
static DART_FORCE_INLINE T::ObjectPtrType Allocate (Heap::Space space)
 
template<typename T >
static DART_FORCE_INLINE T::ObjectPtrType Allocate (Heap::Space space, intptr_t elements)
 
template<typename T >
static DART_FORCE_INLINE T::ObjectPtrType AllocateVariant (intptr_t class_id, Heap::Space space)
 
template<typename T >
static DART_FORCE_INLINE T::ObjectPtrType AllocateVariant (intptr_t class_id, Heap::Space space, intptr_t elements)
 
static constexpr intptr_t RoundedAllocationSize (intptr_t size)
 
static ObjectPtr Clone (const Object &orig, Heap::Space space, bool load_with_relaxed_atomics=false)
 
template<typename T >
static DART_FORCE_INLINE uword from_offset ()
 
template<typename T >
static DART_FORCE_INLINE uword to_offset (intptr_t length=0)
 
- Protected Attributes inherited from dart::Object
ObjectPtr ptr_
 

Detailed Description

Definition at line 7965 of file object.h.

Member Function Documentation

◆ base_objects()

ArrayPtr dart::LoadingUnit::base_objects ( ) const
inline

Definition at line 7982 of file object.h.

7982{ return untag()->base_objects(); }
raw_obj untag() -> num_entries()) VARIABLE_COMPRESSED_VISITOR(Array, Smi::Value(raw_obj->untag() ->length())) VARIABLE_COMPRESSED_VISITOR(TypedData, TypedData::ElementSizeInBytes(raw_obj->GetClassId()) *Smi::Value(raw_obj->untag() ->length())) VARIABLE_COMPRESSED_VISITOR(Record, RecordShape(raw_obj->untag() ->shape()).num_fields()) VARIABLE_NULL_VISITOR(CompressedStackMaps, CompressedStackMaps::PayloadSizeOf(raw_obj)) VARIABLE_NULL_VISITOR(OneByteString, Smi::Value(raw_obj->untag() ->length())) VARIABLE_NULL_VISITOR(TwoByteString, Smi::Value(raw_obj->untag() ->length())) intptr_t UntaggedField::VisitFieldPointers(FieldPtr raw_obj, ObjectPointerVisitor *visitor)
Definition: raw_object.cc:558

◆ COMPILE_ASSERT()

dart::LoadingUnit::COMPILE_ASSERT ( kIllegalId  = =WeakTable::kNoValue)

◆ CompleteLoad()

ObjectPtr dart::LoadingUnit::CompleteLoad ( const String error_message,
bool  transient_error 
) const

Definition at line 19713 of file object.cc.

19714 {
19715 set_loaded(error_message.IsNull());
19716
19717 const Library& lib = Library::Handle(Library::CoreLibrary());
19718 const String& sel = String::Handle(String::New("_completeLoads"));
19719 const Function& func = Function::Handle(lib.LookupFunctionAllowPrivate(sel));
19720 ASSERT(!func.IsNull());
19721 const Array& args = Array::Handle(Array::New(3));
19722 args.SetAt(0, Smi::Handle(Smi::New(id())));
19723 args.SetAt(1, error_message);
19724 args.SetAt(2, Bool::Get(transient_error));
19725 return DartEntry::InvokeFunction(func, args);
19726}
static ArrayPtr New(intptr_t len, Heap::Space space=Heap::kNew)
Definition: object.h:10959
static const Bool & Get(bool value)
Definition: object.h:10801
static ObjectPtr InvokeFunction(const Function &function, const Array &arguments)
Definition: dart_entry.cc:31
static LibraryPtr CoreLibrary()
Definition: object.cc:14787
void set_loaded(bool value) const
Definition: object.h:7995
static Object & Handle()
Definition: object.h:407
static SmiPtr New(intptr_t value)
Definition: object.h:10006
static StringPtr New(const char *cstr, Heap::Space space=Heap::kNew)
Definition: object.cc:23698
#define ASSERT(E)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args

◆ has_instructions_image()

bool dart::LoadingUnit::has_instructions_image ( ) const
inline

Definition at line 8036 of file object.h.

8036 {
8037 return loaded() && instructions_image() != nullptr;
8038 }
bool loaded() const
Definition: object.h:7990
const uint8_t * instructions_image() const
Definition: object.h:8027

◆ id()

intptr_t dart::LoadingUnit::id ( ) const
inline

Definition at line 7985 of file object.h.

7985 {
7986 return untag()->packed_fields_.Read<UntaggedLoadingUnit::IdBits>();
7987 }

◆ InstanceSize()

static intptr_t dart::LoadingUnit::InstanceSize ( )
inlinestatic

Definition at line 7973 of file object.h.

7973 {
7974 return RoundedAllocationSize(sizeof(UntaggedLoadingUnit));
7975 }
static constexpr intptr_t RoundedAllocationSize(intptr_t size)
Definition: object.h:758

◆ instructions_image()

const uint8_t * dart::LoadingUnit::instructions_image ( ) const
inline

Definition at line 8027 of file object.h.

8027 {
8028 // The instructions image should only be accessed if the load succeeded.
8029 ASSERT(loaded());
8030 return untag()->instructions_image_;
8031 }

◆ IssueLoad()

ObjectPtr dart::LoadingUnit::IssueLoad ( ) const

Definition at line 19708 of file object.cc.

19708 {
19711}
static Isolate * Current()
Definition: isolate.h:986
ObjectPtr CallDeferredLoadHandler(intptr_t id)
Definition: isolate.cc:1941
void set_load_outstanding() const
Definition: object.h:8013

◆ load_outstanding()

bool dart::LoadingUnit::load_outstanding ( ) const
inline

Definition at line 8009 of file object.h.

8009 {
8010 return untag()->packed_fields_.Read<UntaggedLoadingUnit::LoadStateBits>() ==
8011 UntaggedLoadingUnit::kLoadOutstanding;
8012 }

◆ loaded()

bool dart::LoadingUnit::loaded ( ) const
inline

Definition at line 7990 of file object.h.

7990 {
7991 return untag()->packed_fields_.Read<UntaggedLoadingUnit::LoadStateBits>() ==
7992 UntaggedLoadingUnit::kLoaded;
7993 }

◆ LoadingUnitOf() [1/2]

intptr_t dart::LoadingUnit::LoadingUnitOf ( const Code code)
static

Definition at line 19750 of file object.cc.

19750 {
19751 if (code.IsStubCode() || code.IsTypeTestStubCode() ||
19752 code.IsAllocationStubCode()) {
19753 return LoadingUnit::kRootId;
19754 } else {
19755 Thread* thread = Thread::Current();
19760
19761 Class& cls = thread->ClassHandle();
19762 Library& lib = thread->LibraryHandle();
19763 LoadingUnit& unit = thread->LoadingUnitHandle();
19764 Function& func = thread->FunctionHandle();
19765
19766 if (code.IsFunctionCode()) {
19767 func ^= code.function();
19768 cls = func.Owner();
19769 lib = cls.library();
19770 unit = lib.loading_unit();
19771 ASSERT(!unit.IsNull());
19772 return unit.id();
19773 } else {
19774 UNREACHABLE();
19776 }
19777 }
19778}
#define UNREACHABLE()
Definition: assert.h:248
static constexpr intptr_t kIllegalId
Definition: object.h:7967
static constexpr intptr_t kRootId
Definition: object.h:7969
friend class Class
Definition: object.h:8046
friend class Thread
Definition: object.h:1025
static Thread * Current()
Definition: thread.h:362
#define REUSABLE_CLASS_HANDLESCOPE(thread)
#define REUSABLE_LOADING_UNIT_HANDLESCOPE(thread)
#define REUSABLE_FUNCTION_HANDLESCOPE(thread)
#define REUSABLE_LIBRARY_HANDLESCOPE(thread)

◆ LoadingUnitOf() [2/2]

intptr_t dart::LoadingUnit::LoadingUnitOf ( const Function function)
static

Definition at line 19730 of file object.cc.

19730 {
19731 Thread* thread = Thread::Current();
19735
19736 Class& cls = thread->ClassHandle();
19737 Library& lib = thread->LibraryHandle();
19738 LoadingUnit& unit = thread->LoadingUnitHandle();
19739
19740 cls = function.Owner();
19741 lib = cls.library();
19742 unit = lib.loading_unit();
19743 if (unit.IsNull()) {
19744 FATAL("Unable to find loading unit of %s (class %s, library %s)",
19745 function.ToFullyQualifiedCString(), cls.ToCString(), lib.ToCString());
19746 }
19747 return unit.id();
19748}
#define FATAL(error)
Dart_NativeFunction function
Definition: fuchsia.cc:51

◆ New()

LoadingUnitPtr dart::LoadingUnit::New ( intptr_t  id,
const LoadingUnit parent 
)
static

Definition at line 19688 of file object.cc.

19688 {
19690 // LoadingUnit objects are long living objects, allocate them in the
19691 // old generation.
19692 auto result = Object::Allocate<LoadingUnit>(Heap::kOld);
19693 NoSafepointScope scope;
19695 result->untag()->packed_fields_.Update<UntaggedLoadingUnit::IdBits>(id);
19696 result->untag()->set_parent(parent.ptr());
19697 return result;
19698}
static constexpr int bitsize()
Definition: bitfield.h:162
@ kOld
Definition: heap.h:39
intptr_t id() const
Definition: object.h:7985
LoadingUnitPtr parent() const
Definition: object.h:7980
static ClassPtr loadingunit_class()
Definition: object.h:566
static ObjectPtr null()
Definition: object.h:433
static bool IsInt(intptr_t N, T value)
Definition: utils.h:313
GAsyncResult * result

◆ parent()

LoadingUnitPtr dart::LoadingUnit::parent ( ) const
inline

Definition at line 7980 of file object.h.

7980{ return untag()->parent(); }

◆ set_base_objects()

void dart::LoadingUnit::set_base_objects ( const Array value) const

Definition at line 19700 of file object.cc.

19700 {
19701 untag()->set_base_objects(value.ptr());
19702}
uint8_t value

◆ set_instructions_image()

void dart::LoadingUnit::set_instructions_image ( const uint8_t *  value) const
inline

Definition at line 8032 of file object.h.

8032 {
8034 StoreNonPointer(&untag()->instructions_image_, value);
8035 }
bool load_outstanding() const
Definition: object.h:8009
void StoreNonPointer(const FieldType *addr, ValueType value) const
Definition: object.h:819

◆ set_load_outstanding()

void dart::LoadingUnit::set_load_outstanding ( ) const
inline

Definition at line 8013 of file object.h.

8013 {
8014 auto const previous = UntaggedLoadingUnit::kNotLoaded;
8016 untag()->packed_fields_.Read<UntaggedLoadingUnit::LoadStateBits>(),
8017 previous);
8018 auto const expected = UntaggedLoadingUnit::kLoadOutstanding;
8019 auto const got = untag()
8020 ->packed_fields_
8021 .UpdateConditional<UntaggedLoadingUnit::LoadStateBits>(
8022 expected, previous);
8023 // Check that we're in the expected state afterwards.
8024 ASSERT_EQUAL(got, expected);
8025 }
#define ASSERT_EQUAL(expected, actual)
Definition: assert.h:309

◆ set_loaded()

void dart::LoadingUnit::set_loaded ( bool  value) const
inline

Definition at line 7995 of file object.h.

7995 {
7997 auto const expected =
7998 value ? UntaggedLoadingUnit::kLoaded : UntaggedLoadingUnit::kNotLoaded;
7999 auto const got = untag()
8000 ->packed_fields_
8001 .UpdateConditional<UntaggedLoadingUnit::LoadStateBits>(
8002 expected, UntaggedLoadingUnit::kLoadOutstanding);
8003 // Check that we're in the expected state afterwards.
8004 ASSERT_EQUAL(got, expected);
8005 }

Friends And Related Function Documentation

◆ Class

friend class Class
friend

Definition at line 8046 of file object.h.

Member Data Documentation

◆ kIllegalId

constexpr intptr_t dart::LoadingUnit::kIllegalId = 0
staticconstexpr

Definition at line 7967 of file object.h.

◆ kRootId

constexpr intptr_t dart::LoadingUnit::kRootId = 1
staticconstexpr

Definition at line 7969 of file object.h.


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