Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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 7936 of file object.h.

Member Function Documentation

◆ base_objects()

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

Definition at line 7953 of file object.h.

7953{ 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)

◆ 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 19763 of file object.cc.

19764 {
19765 set_loaded(error_message.IsNull());
19766
19767 const Library& lib = Library::Handle(Library::CoreLibrary());
19768 const String& sel = String::Handle(String::New("_completeLoads"));
19769 const Function& func = Function::Handle(lib.LookupFunctionAllowPrivate(sel));
19770 ASSERT(!func.IsNull());
19771 const Array& args = Array::Handle(Array::New(3));
19772 args.SetAt(0, Smi::Handle(Smi::New(id())));
19773 args.SetAt(1, error_message);
19774 args.SetAt(2, Bool::Get(transient_error));
19775 return DartEntry::InvokeFunction(func, args);
19776}
static ArrayPtr New(intptr_t len, Heap::Space space=Heap::kNew)
Definition object.h:10933
static const Bool & Get(bool value)
Definition object.h:10780
static ObjectPtr InvokeFunction(const Function &function, const Array &arguments)
Definition dart_entry.cc:31
static LibraryPtr CoreLibrary()
Definition object.cc:14834
void set_loaded(bool value) const
Definition object.h:7966
static Object & Handle()
Definition object.h:407
static SmiPtr New(intptr_t value)
Definition object.h:9985
static StringPtr New(const char *cstr, Heap::Space space=Heap::kNew)
Definition object.cc:23777
#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 8007 of file object.h.

8007 {
8008 return loaded() && instructions_image() != nullptr;
8009 }
bool loaded() const
Definition object.h:7961
const uint8_t * instructions_image() const
Definition object.h:7998

◆ id()

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

Definition at line 7956 of file object.h.

7956 {
7957 return untag()->packed_fields_.Read<UntaggedLoadingUnit::IdBits>();
7958 }

◆ InstanceSize()

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

Definition at line 7944 of file object.h.

7944 {
7945 return RoundedAllocationSize(sizeof(UntaggedLoadingUnit));
7946 }
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 7998 of file object.h.

7998 {
7999 // The instructions image should only be accessed if the load succeeded.
8000 ASSERT(loaded());
8001 return untag()->instructions_image_;
8002 }

◆ IssueLoad()

ObjectPtr dart::LoadingUnit::IssueLoad ( ) const

Definition at line 19758 of file object.cc.

19758 {
19761}
static Isolate * Current()
Definition isolate.h:939
ObjectPtr CallDeferredLoadHandler(intptr_t id)
Definition isolate.cc:1905
void set_load_outstanding() const
Definition object.h:7984

◆ load_outstanding()

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

Definition at line 7980 of file object.h.

7980 {
7981 return untag()->packed_fields_.Read<UntaggedLoadingUnit::LoadStateBits>() ==
7982 UntaggedLoadingUnit::kLoadOutstanding;
7983 }

◆ loaded()

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

Definition at line 7961 of file object.h.

7961 {
7962 return untag()->packed_fields_.Read<UntaggedLoadingUnit::LoadStateBits>() ==
7963 UntaggedLoadingUnit::kLoaded;
7964 }

◆ LoadingUnitOf() [1/2]

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

Definition at line 19800 of file object.cc.

19800 {
19801 if (code.IsStubCode() || code.IsTypeTestStubCode() ||
19802 code.IsAllocationStubCode()) {
19803 return LoadingUnit::kRootId;
19804 } else {
19805 Thread* thread = Thread::Current();
19810
19811 Class& cls = thread->ClassHandle();
19812 Library& lib = thread->LibraryHandle();
19813 LoadingUnit& unit = thread->LoadingUnitHandle();
19814 Function& func = thread->FunctionHandle();
19815
19816 if (code.IsFunctionCode()) {
19817 func ^= code.function();
19818 cls = func.Owner();
19819 lib = cls.library();
19820 unit = lib.loading_unit();
19821 ASSERT(!unit.IsNull());
19822 return unit.id();
19823 } else {
19824 UNREACHABLE();
19826 }
19827 }
19828}
#define UNREACHABLE()
Definition assert.h:248
static constexpr intptr_t kIllegalId
Definition object.h:7938
static constexpr intptr_t kRootId
Definition object.h:7940
friend class Class
Definition object.h:8017
friend class Thread
Definition object.h:1025
static Thread * Current()
Definition thread.h:361
#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 19780 of file object.cc.

19780 {
19781 Thread* thread = Thread::Current();
19785
19786 Class& cls = thread->ClassHandle();
19787 Library& lib = thread->LibraryHandle();
19788 LoadingUnit& unit = thread->LoadingUnitHandle();
19789
19790 cls = function.Owner();
19791 lib = cls.library();
19792 unit = lib.loading_unit();
19793 if (unit.IsNull()) {
19794 FATAL("Unable to find loading unit of %s (class %s, library %s)",
19795 function.ToFullyQualifiedCString(), cls.ToCString(), lib.ToCString());
19796 }
19797 return unit.id();
19798}
#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 19738 of file object.cc.

19738 {
19740 // LoadingUnit objects are long living objects, allocate them in the
19741 // old generation.
19742 auto result = Object::Allocate<LoadingUnit>(Heap::kOld);
19743 NoSafepointScope scope;
19745 result->untag()->packed_fields_.Update<UntaggedLoadingUnit::IdBits>(id);
19746 result->untag()->set_parent(parent.ptr());
19747 return result;
19748}
static constexpr int bitsize()
Definition bitfield.h:164
@ kOld
Definition heap.h:39
intptr_t id() const
Definition object.h:7956
LoadingUnitPtr parent() const
Definition object.h:7951
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:298
GAsyncResult * result

◆ parent()

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

Definition at line 7951 of file object.h.

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

◆ set_base_objects()

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

Definition at line 19750 of file object.cc.

19750 {
19751 untag()->set_base_objects(value.ptr());
19752}
uint8_t value

◆ set_instructions_image()

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

Definition at line 8003 of file object.h.

8003 {
8005 StoreNonPointer(&untag()->instructions_image_, value);
8006 }
bool load_outstanding() const
Definition object.h:7980
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 7984 of file object.h.

7984 {
7985 auto const previous = UntaggedLoadingUnit::kNotLoaded;
7987 untag()->packed_fields_.Read<UntaggedLoadingUnit::LoadStateBits>(),
7988 previous);
7989 auto const expected = UntaggedLoadingUnit::kLoadOutstanding;
7990 auto const got = untag()
7991 ->packed_fields_
7992 .UpdateConditional<UntaggedLoadingUnit::LoadStateBits>(
7993 expected, previous);
7994 // Check that we're in the expected state afterwards.
7995 ASSERT_EQUAL(got, expected);
7996 }
#define ASSERT_EQUAL(expected, actual)
Definition assert.h:309

◆ set_loaded()

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

Definition at line 7966 of file object.h.

7966 {
7968 auto const expected =
7969 value ? UntaggedLoadingUnit::kLoaded : UntaggedLoadingUnit::kNotLoaded;
7970 auto const got = untag()
7971 ->packed_fields_
7972 .UpdateConditional<UntaggedLoadingUnit::LoadStateBits>(
7973 expected, UntaggedLoadingUnit::kLoadOutstanding);
7974 // Check that we're in the expected state afterwards.
7975 ASSERT_EQUAL(got, expected);
7976 }

Friends And Related Symbol Documentation

◆ Class

friend class Class
friend

Definition at line 8017 of file object.h.

Member Data Documentation

◆ kIllegalId

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

Definition at line 7938 of file object.h.

◆ kRootId

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

Definition at line 7940 of file object.h.


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