Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
dart::Class Class Reference

#include <object.h>

Inheritance diagram for dart::Class:
dart::Object

Public Types

enum  InvocationDispatcherEntry { kInvocationDispatcherName , kInvocationDispatcherArgsDesc , kInvocationDispatcherFunction , kInvocationDispatcherEntrySize }
 
- Public Types inherited from dart::Object
enum  NameVisibility { kInternalName = 0 , kScrubbedName , kUserVisibleName }
 
enum class  NameDisambiguation { kYes , kNo }
 
using UntaggedObjectType = UntaggedObject
 
using ObjectPtrType = ObjectPtr
 

Public Member Functions

bool HasCompressedPointers () const
 
intptr_t host_instance_size () const
 
intptr_t target_instance_size () const
 
void set_instance_size (intptr_t host_value_in_bytes, intptr_t target_value_in_bytes) const
 
void set_instance_size_in_words (intptr_t host_value, intptr_t target_value) const
 
intptr_t host_next_field_offset () const
 
intptr_t target_next_field_offset () const
 
void set_next_field_offset (intptr_t host_value_in_bytes, intptr_t target_value_in_bytes) const
 
void set_next_field_offset_in_words (intptr_t host_value, intptr_t target_value) const
 
intptr_t id () const
 
void set_id (intptr_t value) const
 
intptr_t implementor_cid () const
 
bool NoteImplementor (const Class &implementor) const
 
StringPtr Name () const
 
StringPtr ScrubbedName () const
 
const char * ScrubbedNameCString () const
 
StringPtr UserVisibleName () const
 
const char * UserVisibleNameCString () const
 
const char * NameCString (NameVisibility name_visibility) const
 
ClassPtr Mixin () const
 
bool IsInFullSnapshot () const
 
virtual StringPtr DictionaryName () const
 
ScriptPtr script () const
 
void set_script (const Script &value) const
 
KernelProgramInfoPtr KernelProgramInfo () const
 
TokenPosition token_pos () const
 
void set_token_pos (TokenPosition value) const
 
TokenPosition end_token_pos () const
 
void set_end_token_pos (TokenPosition value) const
 
uint32_t Hash () const
 
int32_t SourceFingerprint () const
 
TypePtr RareType () const
 
TypePtr DeclarationType () const
 
TypeArgumentsPtr GetDeclarationInstanceTypeArguments () const
 
TypeArgumentsPtr GetInstanceTypeArguments (Thread *thread, const TypeArguments &type_arguments, bool canonicalize=true) const
 
LibraryPtr library () const
 
void set_library (const Library &value) const
 
TypeParametersPtr type_parameters () const
 
void set_type_parameters (const TypeParameters &value) const
 
intptr_t NumTypeParameters (Thread *thread) const
 
intptr_t NumTypeParameters () const
 
TypeParameterPtr TypeParameterAt (intptr_t index, Nullability nullability=Nullability::kNonNullable) const
 
intptr_t NumTypeArguments () const
 
bool IsGeneric () const
 
TypeArgumentsPtr DefaultTypeArguments (Zone *zone) const
 
intptr_t host_type_arguments_field_offset () const
 
intptr_t target_type_arguments_field_offset () const
 
void set_type_arguments_field_offset (intptr_t host_value_in_bytes, intptr_t target_value_in_bytes) const
 
void set_type_arguments_field_offset_in_words (intptr_t host_value, intptr_t target_value) const
 
TypePtr super_type () const
 
void set_super_type (const Type &value) const
 
ClassPtr SuperClass (ClassTable *class_table=nullptr) const
 
ArrayPtr interfaces () const
 
void set_interfaces (const Array &value) const
 
bool FindInstantiationOf (Zone *zone, const Class &cls, GrowableArray< const Type * > *path, bool consider_only_super_classes=false) const
 
bool FindInstantiationOf (Zone *zone, const Class &cls, bool consider_only_super_classes=false) const
 
bool FindInstantiationOf (Zone *zone, const Type &type, GrowableArray< const Type * > *path, bool consider_only_super_classes=false) const
 
bool FindInstantiationOf (Zone *zone, const Type &type, bool consider_only_super_classes=false) const
 
TypePtr GetInstantiationOf (Zone *zone, const Class &cls) const
 
TypePtr GetInstantiationOf (Zone *zone, const Type &type) const
 
GrowableObjectArrayPtr direct_implementors () const
 
GrowableObjectArrayPtr direct_implementors_unsafe () const
 
void set_direct_implementors (const GrowableObjectArray &implementors) const
 
void AddDirectImplementor (const Class &subclass, bool is_mixin) const
 
GrowableObjectArrayPtr direct_subclasses () const
 
GrowableObjectArrayPtr direct_subclasses_unsafe () const
 
void set_direct_subclasses (const GrowableObjectArray &subclasses) const
 
void AddDirectSubclass (const Class &subclass) const
 
bool IsNullClass () const
 
bool IsDynamicClass () const
 
bool IsVoidClass () const
 
bool IsNeverClass () const
 
bool IsObjectClass () const
 
bool IsDartFunctionClass () const
 
bool IsFutureClass () const
 
bool IsFutureOrClass () const
 
bool IsClosureClass () const
 
bool IsRecordClass () const
 
bool IsTopLevel () const
 
bool IsPrivate () const
 
DART_WARN_UNUSED_RESULT ErrorPtr VerifyEntryPoint () const
 
ArrayPtr fields () const
 
void SetFields (const Array &value) const
 
void AddField (const Field &field) const
 
void AddFields (const GrowableArray< const Field * > &fields) const
 
intptr_t FindFieldIndex (const Field &needle) const
 
FieldPtr FieldFromIndex (intptr_t idx) const
 
bool InjectCIDFields () const
 
ArrayPtr OffsetToFieldMap (ClassTable *class_table=nullptr) const
 
bool HasInstanceFields () const
 
ArrayPtr current_functions () const
 
ArrayPtr functions () const
 
void SetFunctions (const Array &value) const
 
void AddFunction (const Function &function) const
 
intptr_t FindFunctionIndex (const Function &needle) const
 
FunctionPtr FunctionFromIndex (intptr_t idx) const
 
intptr_t FindImplicitClosureFunctionIndex (const Function &needle) const
 
FunctionPtr ImplicitClosureFunctionFromIndex (intptr_t idx) const
 
FunctionPtr LookupFunctionReadLocked (const String &name) const
 
FunctionPtr LookupDynamicFunctionUnsafe (const String &name) const
 
FunctionPtr LookupDynamicFunctionAllowPrivate (const String &name) const
 
FunctionPtr LookupStaticFunction (const String &name) const
 
FunctionPtr LookupStaticFunctionAllowPrivate (const String &name) const
 
FunctionPtr LookupConstructor (const String &name) const
 
FunctionPtr LookupConstructorAllowPrivate (const String &name) const
 
FunctionPtr LookupFactory (const String &name) const
 
FunctionPtr LookupFactoryAllowPrivate (const String &name) const
 
FunctionPtr LookupFunctionAllowPrivate (const String &name) const
 
FunctionPtr LookupGetterFunction (const String &name) const
 
FunctionPtr LookupSetterFunction (const String &name) const
 
FieldPtr LookupInstanceField (const String &name) const
 
FieldPtr LookupStaticField (const String &name) const
 
FieldPtr LookupField (const String &name) const
 
FieldPtr LookupFieldAllowPrivate (const String &name, bool instance_only=false) const
 
FieldPtr LookupInstanceFieldAllowPrivate (const String &name) const
 
FieldPtr LookupStaticFieldAllowPrivate (const String &name) const
 
InstancePtr LookupCanonicalInstance (Zone *zone, const Instance &value) const
 
InstancePtr InsertCanonicalConstant (Zone *zone, const Instance &constant) const
 
bool is_implemented () const
 
void set_is_implemented () const
 
void set_is_implemented_unsafe () const
 
bool is_abstract () const
 
void set_is_abstract () const
 
UntaggedClass::ClassLoadingState class_loading_state () const
 
bool is_declaration_loaded () const
 
void set_is_declaration_loaded () const
 
void set_is_declaration_loaded_unsafe () const
 
bool is_type_finalized () const
 
void set_is_type_finalized () const
 
bool is_synthesized_class () const
 
void set_is_synthesized_class () const
 
void set_is_synthesized_class_unsafe () const
 
bool is_enum_class () const
 
void set_is_enum_class () const
 
bool is_finalized () const
 
void set_is_finalized () const
 
void set_is_finalized_unsafe () const
 
bool is_allocate_finalized () const
 
void set_is_allocate_finalized () const
 
bool is_prefinalized () const
 
void set_is_prefinalized () const
 
bool is_const () const
 
void set_is_const () const
 
bool is_transformed_mixin_application () const
 
void set_is_transformed_mixin_application () const
 
bool is_sealed () const
 
void set_is_sealed () const
 
bool is_mixin_class () const
 
void set_is_mixin_class () const
 
bool is_base_class () const
 
void set_is_base_class () const
 
bool is_interface_class () const
 
void set_is_interface_class () const
 
bool is_final () const
 
void set_is_final () const
 
bool is_fields_marked_nullable () const
 
void set_is_fields_marked_nullable () const
 
bool is_allocated () const
 
void set_is_allocated (bool value) const
 
void set_is_allocated_unsafe (bool value) const
 
bool is_loaded () const
 
void set_is_loaded (bool value) const
 
uint16_t num_native_fields () const
 
void set_num_native_fields (uint16_t value) const
 
CodePtr allocation_stub () const
 
void set_allocation_stub (const Code &value) const
 
intptr_t kernel_offset () const
 
void set_kernel_offset (intptr_t value) const
 
void DisableAllocationStub () const
 
ArrayPtr constants () const
 
void set_constants (const Array &value) const
 
intptr_t FindInvocationDispatcherFunctionIndex (const Function &needle) const
 
FunctionPtr InvocationDispatcherFunctionFromIndex (intptr_t idx) const
 
FunctionPtr GetInvocationDispatcher (const String &target_name, const Array &args_desc, UntaggedFunction::Kind kind, bool create_if_absent) const
 
FunctionPtr GetRecordFieldGetter (const String &getter_name) const
 
void Finalize () const
 
ObjectPtr Invoke (const String &selector, const Array &arguments, const Array &argument_names, bool respect_reflectable=true, bool check_is_entrypoint=false) const
 
ObjectPtr InvokeGetter (const String &selector, bool throw_nsm_if_absent, bool respect_reflectable=true, bool check_is_entrypoint=false) const
 
ObjectPtr InvokeSetter (const String &selector, const Instance &argument, bool respect_reflectable=true, bool check_is_entrypoint=false) const
 
ObjectPtr EvaluateCompiledExpression (const ExternalTypedData &kernel_buffer, const Array &type_definitions, const Array &param_values, const TypeArguments &type_param_values) const
 
void EnsureDeclarationLoaded () const
 
ErrorPtr EnsureIsFinalized (Thread *thread) const
 
ErrorPtr EnsureIsAllocateFinalized (Thread *thread) const
 
void RegisterCHACode (const Code &code)
 
void DisableCHAOptimizedCode (const Class &subclass)
 
void DisableAllCHAOptimizedCode ()
 
void DisableCHAImplementorUsers ()
 
WeakArrayPtr dependent_code () const
 
void set_dependent_code (const WeakArray &array) const
 
bool TraceAllocation (IsolateGroup *isolate_group) const
 
void SetTraceAllocation (bool trace_allocation) const
 
void CopyStaticFieldValues (ProgramReloadContext *reload_context, const Class &old_cls) const
 
void PatchFieldsAndFunctions () const
 
void MigrateImplicitStaticClosures (ProgramReloadContext *context, const Class &new_cls) const
 
void CopyCanonicalConstants (const Class &old_cls) const
 
void CopyDeclarationType (const Class &old_cls) const
 
void CheckReload (const Class &replacement, ProgramReloadContext *context) const
 
void AddInvocationDispatcher (const String &target_name, const Array &args_desc, const Function &dispatcher) const
 
void MarkFieldBoxedDuringReload (ClassTable *class_table, const Field &field) const
 
void SetUserVisibleNameInClassTable ()
 
void set_num_type_arguments (intptr_t value) const
 
void set_num_type_arguments_unsafe (intptr_t value) const
 
bool has_pragma () const
 
void set_has_pragma (bool value) const
 
void set_is_isolate_unsendable (bool value) const
 
bool is_isolate_unsendable () const
 
void set_is_isolate_unsendable_due_to_pragma (bool value) const
 
bool is_isolate_unsendable_due_to_pragma () const
 
void set_is_deeply_immutable (bool value) const
 
bool is_deeply_immutable () const
 
void set_is_future_subtype (bool value) const
 
bool is_future_subtype () const
 
void set_can_be_future (bool value) const
 
bool can_be_future () 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
 
bool IsNew () const
 
bool IsOld () const
 
bool InVMIsolateHeap () const
 
void Print () const
 

Static Public Member Functions

static intptr_t host_instance_size (ClassPtr clazz)
 
static intptr_t target_instance_size (ClassPtr clazz)
 
static bool is_valid_id (intptr_t value)
 
static intptr_t id_offset ()
 
static intptr_t num_type_arguments_offset ()
 
static uint32_t Hash (ClassPtr)
 
static intptr_t declaration_type_offset ()
 
static intptr_t host_type_arguments_field_offset_in_words_offset ()
 
static intptr_t super_type_offset ()
 
static bool IsClosureClass (ClassPtr cls)
 
static bool IsInFullSnapshot (ClassPtr cls)
 
static intptr_t GetClassId (ClassPtr cls)
 
static bool IsSubtypeOf (const Class &cls, const TypeArguments &type_arguments, Nullability nullability, const AbstractType &other, Heap::Space space, FunctionTypeMapping *function_type_equivalence=nullptr)
 
static intptr_t InstanceSize ()
 
static uint16_t NumNativeFieldsOf (ClassPtr clazz)
 
static bool IsIsolateUnsendable (ClassPtr clazz)
 
template<class FakeObject , class TargetFakeObject >
static ClassPtr New (IsolateGroup *isolate_group, bool register_class=true)
 
static ClassPtr New (const Library &lib, const String &name, const Script &script, TokenPosition token_pos, bool register_class=true)
 
static ClassPtr NewNativeWrapper (const Library &library, const String &name, int num_fields)
 
static ClassPtr NewStringClass (intptr_t class_id, IsolateGroup *isolate_group)
 
static ClassPtr NewTypedDataClass (intptr_t class_id, IsolateGroup *isolate_group)
 
static ClassPtr NewTypedDataViewClass (intptr_t class_id, IsolateGroup *isolate_group)
 
static ClassPtr NewUnmodifiableTypedDataViewClass (intptr_t class_id, IsolateGroup *isolate_group)
 
static ClassPtr NewExternalTypedDataClass (intptr_t class_id, IsolateGroup *isolate)
 
static ClassPtr NewPointerClass (intptr_t class_id, IsolateGroup *isolate_group)
 
static int32_t host_instance_size_in_words (const ClassPtr cls)
 
static int32_t target_instance_size_in_words (const ClassPtr cls)
 
static int32_t host_next_field_offset_in_words (const ClassPtr cls)
 
static int32_t target_next_field_offset_in_words (const ClassPtr cls)
 
static int32_t host_type_arguments_field_offset_in_words (const ClassPtr cls)
 
static int32_t target_type_arguments_field_offset_in_words (const ClassPtr cls)
 
static intptr_t UnboxedFieldSizeInBytesByCid (intptr_t cid)
 
static bool IsDeeplyImmutable (ClassPtr clazz)
 
- 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 kNoTypeArguments = -1
 
- Static Public Attributes inherited from dart::Object
static constexpr intptr_t kHashBits = 30
 
static const ClassId kClassId = kObjectCid
 

Friends

class AbstractType
 
class Instance
 
class Object
 
class Type
 
class Intrinsifier
 
class ProgramWalker
 
class Precompiler
 
class ClassFinalizer
 

Additional Inherited Members

- 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 1135 of file object.h.

Member Enumeration Documentation

◆ InvocationDispatcherEntry

Enumerator
kInvocationDispatcherName 
kInvocationDispatcherArgsDesc 
kInvocationDispatcherFunction 
kInvocationDispatcherEntrySize 

Definition at line 1137 of file object.h.

Member Function Documentation

◆ AddDirectImplementor()

void dart::Class::AddDirectImplementor ( const Class subclass,
bool  is_mixin 
) const

Definition at line 5801 of file object.cc.

5802 {
5803 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5805 ASSERT(!implementor.IsNull());
5806 GrowableObjectArray& direct_implementors =
5808 if (direct_implementors.IsNull()) {
5810 untag()->set_direct_implementors(direct_implementors.ptr());
5811 }
5812#if defined(DEBUG)
5813 // Verify that the same class is not added twice.
5814 // The only exception is mixins: when mixin application is transformed,
5815 // mixin is added to the end of interfaces list and may be duplicated:
5816 // class X = A with B implements B;
5817 // This is rare and harmless.
5818 if (!is_mixin) {
5819 for (intptr_t i = 0; i < direct_implementors.Length(); i++) {
5820 ASSERT(direct_implementors.At(i) != implementor.ptr());
5821 }
5822 }
5823#endif
5824 direct_implementors.Add(implementor, Heap::kOld);
5825}
GrowableObjectArrayPtr direct_implementors() const
Definition object.h:1522
bool is_implemented() const
Definition object.h:1694
static GrowableObjectArrayPtr New(Heap::Space space=Heap::kNew)
Definition object.h:11118
@ kOld
Definition heap.h:39
static IsolateGroup * Current()
Definition isolate.h:534
static Object & Handle()
Definition object.h:407
#define ASSERT(E)
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)

◆ AddDirectSubclass()

void dart::Class::AddDirectSubclass ( const Class subclass) const

Definition at line 5833 of file object.cc.

5833 {
5834 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5835 ASSERT(!subclass.IsNull());
5836 ASSERT(subclass.SuperClass() == ptr());
5837 // Do not keep track of the direct subclasses of class Object.
5839 GrowableObjectArray& direct_subclasses =
5841 if (direct_subclasses.IsNull()) {
5843 untag()->set_direct_subclasses(direct_subclasses.ptr());
5844 }
5845#if defined(DEBUG)
5846 // Verify that the same class is not added twice.
5847 for (intptr_t i = 0; i < direct_subclasses.Length(); i++) {
5848 ASSERT(direct_subclasses.At(i) != subclass.ptr());
5849 }
5850#endif
5851 direct_subclasses.Add(subclass, Heap::kOld);
5852}
GrowableObjectArrayPtr direct_subclasses() const
Definition object.h:1539
bool IsObjectClass() const
Definition object.h:1567
ObjectPtr ptr() const
Definition object.h:332

◆ AddField()

void dart::Class::AddField ( const Field field) const

Definition at line 5057 of file object.cc.

5057 {
5058#if defined(DEBUG)
5059 Thread* thread = Thread::Current();
5060 ASSERT(thread->isolate_group()->program_lock()->IsCurrentThreadWriter());
5061#endif
5062 const Array& arr = Array::Handle(fields());
5063 const Array& new_arr = Array::Handle(Array::Grow(arr, arr.Length() + 1));
5064 new_arr.SetAt(arr.Length(), field);
5065 SetFields(new_arr);
5066}
static ArrayPtr Grow(const Array &source, intptr_t new_length, Heap::Space space=Heap::kNew)
Definition object.cc:24932
void SetFields(const Array &value) const
Definition object.cc:5039
ArrayPtr fields() const
Definition object.h:1617
friend class Thread
Definition object.h:1025
static Thread * Current()
Definition thread.h:361

◆ AddFields()

void dart::Class::AddFields ( const GrowableArray< const Field * > &  fields) const

Definition at line 5068 of file object.cc.

5068 {
5069#if defined(DEBUG)
5070 Thread* thread = Thread::Current();
5071 ASSERT(thread->isolate_group()->program_lock()->IsCurrentThreadWriter());
5072#endif
5073 const intptr_t num_new_fields = new_fields.length();
5074 if (num_new_fields == 0) return;
5075 const Array& arr = Array::Handle(fields());
5076 const intptr_t num_old_fields = arr.Length();
5077 const Array& new_arr = Array::Handle(
5078 Array::Grow(arr, num_old_fields + num_new_fields, Heap::kOld));
5079 for (intptr_t i = 0; i < num_new_fields; i++) {
5080 new_arr.SetAt(i + num_old_fields, *new_fields.At(i));
5081 }
5082 SetFields(new_arr);
5083}

◆ AddFunction()

void dart::Class::AddFunction ( const Function function) const

Definition at line 3346 of file object.cc.

3346 {
3347#if defined(DEBUG)
3348 Thread* thread = Thread::Current();
3349 ASSERT(thread->IsDartMutatorThread());
3350 ASSERT(thread->isolate_group()->program_lock()->IsCurrentThreadWriter());
3351 ASSERT(!is_finalized() ||
3352 FunctionType::Handle(function.signature()).IsFinalized());
3353#endif
3354 const Array& arr = Array::Handle(functions());
3355 const Array& new_array =
3356 Array::Handle(Array::Grow(arr, arr.Length() + 1, Heap::kOld));
3357 new_array.SetAt(arr.Length(), function);
3358 set_functions(new_array);
3359 // Add to hash table, if any.
3360 const intptr_t new_len = new_array.Length();
3361 if (new_len == kFunctionLookupHashThreshold) {
3362 // Transition to using hash table.
3363 SetFunctions(new_array);
3364 } else if (new_len > kFunctionLookupHashThreshold) {
3365 ClassFunctionsSet set(untag()->functions_hash_table());
3366 set.Insert(function);
3367 untag()->set_functions_hash_table(set.Release().ptr());
3368 }
3369}
void SetFunctions(const Array &value) const
Definition object.cc:3314
bool is_finalized() const
Definition object.h:1725
ArrayPtr functions() const
Definition object.h:1648
Dart_NativeFunction function
Definition fuchsia.cc:51
UnorderedHashSet< ClassFunctionsTraits > ClassFunctionsSet
Definition object.cc:3312
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not set
Definition switches.h:76

◆ AddInvocationDispatcher()

void dart::Class::AddInvocationDispatcher ( const String target_name,
const Array args_desc,
const Function dispatcher 
) const

Definition at line 3881 of file object.cc.

3883 {
3884 auto thread = Thread::Current();
3885 ASSERT(thread->isolate_group()->program_lock()->IsCurrentThreadWriter());
3886
3887 ASSERT(target_name.ptr() == dispatcher.name());
3888
3889 DispatcherSet dispatchers(invocation_dispatcher_cache() ==
3890 Array::empty_array().ptr()
3891 ? HashTables::New<DispatcherSet>(4, Heap::kOld)
3892 : invocation_dispatcher_cache());
3893 dispatchers.Insert(dispatcher);
3894 set_invocation_dispatcher_cache(dispatchers.Release());
3895}
UnorderedHashSet< DispatcherTraits, AcqRelStorageTraits > DispatcherSet

◆ allocation_stub()

CodePtr dart::Class::allocation_stub ( ) const
inline

Definition at line 1802 of file object.h.

1802{ return untag()->allocation_stub(); }

◆ can_be_future()

bool dart::Class::can_be_future ( ) const
inline

Definition at line 2178 of file object.h.

2178{ return CanBeFutureBit::decode(state_bits()); }
static constexpr bool decode(uint32_t value)
Definition bitfield.h:173

◆ CheckReload()

void dart::Class::CheckReload ( const Class replacement,
ProgramReloadContext context 
) const

Definition at line 477 of file object_reload.cc.

478 {
479 ASSERT(ProgramReloadContext::IsSameClass(*this, replacement));
480
481 if (!is_declaration_loaded()) {
482 // The old class hasn't been used in any meaningful way, so the VM is okay
483 // with any change.
484 return;
485 }
486
487 // Ensure is_enum_class etc have been set.
488 replacement.EnsureDeclarationLoaded();
489
490 // Class cannot change enum property.
491 if (is_enum_class() != replacement.is_enum_class()) {
492 context->group_reload_context()->AddReasonForCancelling(
493 new (context->zone())
494 EnumClassConflict(context->zone(), *this, replacement));
495 return;
496 }
497
498 if (is_finalized()) {
499 // Make sure the declaration types parameter count matches for the two
500 // classes.
501 // ex. class A<int,B> {} cannot be replace with class A<B> {}.
502 auto group_context = context->group_reload_context();
503 if (NumTypeParameters() != replacement.NumTypeParameters()) {
504 group_context->AddReasonForCancelling(
505 new (context->zone())
506 TypeParametersChanged(context->zone(), *this, replacement));
507 return;
508 }
509 }
510
512 auto thread = Thread::Current();
513
514 // Ensure the replacement class is also finalized.
515 const Error& error = Error::Handle(
516 is_allocate_finalized() ? replacement.EnsureIsAllocateFinalized(thread)
517 : replacement.EnsureIsFinalized(thread));
518 if (!error.IsNull()) {
519 context->group_reload_context()->AddReasonForCancelling(
520 new (context->zone())
521 EnsureFinalizedError(context->zone(), *this, replacement, error));
522 return; // No reason to check other properties.
523 }
524 ASSERT(replacement.is_finalized());
525 TIR_Print("Finalized replacement class for %s\n", ToCString());
526 }
527
528 if (is_deeply_immutable() != replacement.is_deeply_immutable()) {
529 context->group_reload_context()->AddReasonForCancelling(
530 new (context->zone())
531 DeeplyImmutableChange(context->zone(), *this, replacement));
532 return; // No reason to check other properties.
533 }
534
535 if (is_finalized() && is_const() && (constants() != Array::null()) &&
536 (Array::LengthOf(constants()) > 0)) {
537 // Consts can't become non-consts.
538 if (!replacement.is_const()) {
539 context->group_reload_context()->AddReasonForCancelling(
540 new (context->zone())
541 ConstToNonConstClass(context->zone(), *this, replacement));
542 return;
543 }
544
545 // Consts can't lose fields.
546 bool field_removed = false;
547 const Array& old_fields = Array::Handle(
548 OffsetToFieldMap(IsolateGroup::Current()->heap_walk_class_table()));
549 const Array& new_fields = Array::Handle(replacement.OffsetToFieldMap());
550 if (new_fields.Length() < old_fields.Length()) {
551 field_removed = true;
552 } else {
553 Field& old_field = Field::Handle();
554 Field& new_field = Field::Handle();
555 String& old_name = String::Handle();
556 String& new_name = String::Handle();
557 for (intptr_t i = 0, n = old_fields.Length(); i < n; i++) {
558 old_field ^= old_fields.At(i);
559 new_field ^= new_fields.At(i);
560 if (old_field.IsNull()) {
561 continue;
562 }
563 if (new_field.IsNull()) {
564 field_removed = true;
565 break;
566 }
567 old_name = old_field.name();
568 new_name = new_field.name();
569 if (!old_name.Equals(new_name)) {
570 field_removed = true;
571 break;
572 }
573 }
574 }
575 if (field_removed) {
576 context->group_reload_context()->AddReasonForCancelling(
577 new (context->zone())
578 ConstClassFieldRemoved(context->zone(), *this, replacement));
579 return;
580 }
581 }
582
583 // Native field count cannot change.
584 if (num_native_fields() != replacement.num_native_fields()) {
585 context->group_reload_context()->AddReasonForCancelling(
586 new (context->zone())
587 NativeFieldsConflict(context->zone(), *this, replacement));
588 return;
589 }
590
591 // Just checking.
592 ASSERT(is_enum_class() == replacement.is_enum_class());
593 ASSERT(num_native_fields() == replacement.num_native_fields());
594
595 if (is_finalized()) {
596 if (!CanReloadFinalized(replacement, context)) return;
597 }
598 if (is_prefinalized()) {
599 if (!CanReloadPreFinalized(replacement, context)) return;
600 }
601 TIR_Print("Class `%s` can be reloaded (%" Pd " and %" Pd ")\n", ToCString(),
602 id(), replacement.id());
603}
static intptr_t LengthOf(const ArrayPtr array)
Definition object.h:10809
intptr_t NumTypeParameters() const
Definition object.h:1346
bool is_declaration_loaded() const
Definition object.h:1705
bool is_const() const
Definition object.h:1747
bool is_deeply_immutable() const
Definition object.h:2164
ArrayPtr constants() const
Definition object.cc:5861
uint16_t num_native_fields() const
Definition object.h:1790
ArrayPtr OffsetToFieldMap(ClassTable *class_table=nullptr) const
Definition object.cc:3233
ErrorPtr EnsureIsFinalized(Thread *thread) const
Definition object.cc:4979
bool is_prefinalized() const
Definition object.h:1740
bool is_enum_class() const
Definition object.h:1722
bool is_allocate_finalized() const
Definition object.h:1734
static ObjectPtr null()
Definition object.h:433
virtual const char * ToCString() const
Definition object.h:366
static bool IsSameClass(const Class &a, const Class &b)
const uint8_t uint32_t uint32_t GError ** error
#define TIR_Print(format,...)
#define Pd
Definition globals.h:408

◆ class_loading_state()

UntaggedClass::ClassLoadingState dart::Class::class_loading_state ( ) const
inline

Definition at line 1701 of file object.h.

1701 {
1702 return ClassLoadingBits::decode(state_bits());
1703 }

◆ constants()

ArrayPtr dart::Class::constants ( ) const

Definition at line 5861 of file object.cc.

5861 {
5862 return untag()->constants();
5863}

◆ CopyCanonicalConstants()

void dart::Class::CopyCanonicalConstants ( const Class old_cls) const

Definition at line 229 of file object_reload.cc.

229 {
230#if defined(DEBUG)
231 {
232 // Class has no canonical constants allocated.
233 const Array& my_constants = Array::Handle(constants());
234 ASSERT(my_constants.IsNull() || my_constants.Length() == 0);
235 }
236#endif // defined(DEBUG).
237 // Copy old constants into new class.
238 const Array& old_constants = Array::Handle(old_cls.constants());
239 if (old_constants.IsNull() || old_constants.Length() == 0) {
240 return;
241 }
242 TIR_Print("Copied %" Pd " canonical constants for class `%s`\n",
243 old_constants.Length(), ToCString());
244 set_constants(old_constants);
245}
void set_constants(const Array &value) const
Definition object.cc:5865

◆ CopyDeclarationType()

void dart::Class::CopyDeclarationType ( const Class old_cls) const

Definition at line 247 of file object_reload.cc.

247 {
248 const Type& old_declaration_type = Type::Handle(old_cls.declaration_type());
249 if (old_declaration_type.IsNull()) {
250 return;
251 }
252 set_declaration_type(old_declaration_type);
253}

◆ CopyStaticFieldValues()

void dart::Class::CopyStaticFieldValues ( ProgramReloadContext reload_context,
const Class old_cls 
) const

Definition at line 194 of file object_reload.cc.

195 {
196 const Array& old_field_list = Array::Handle(old_cls.fields());
197 Field& old_field = Field::Handle();
198 String& old_name = String::Handle();
199
200 const Array& field_list = Array::Handle(fields());
201 Field& field = Field::Handle();
202 String& name = String::Handle();
203
204 for (intptr_t i = 0; i < field_list.Length(); i++) {
205 field = Field::RawCast(field_list.At(i));
206 name = field.name();
207 // Find the corresponding old field, if it exists, and migrate
208 // over the field value.
209 for (intptr_t j = 0; j < old_field_list.Length(); j++) {
210 old_field = Field::RawCast(old_field_list.At(j));
211 old_name = old_field.name();
212 if (name.Equals(old_name)) {
213 if (field.is_static()) {
214 // We only copy values if requested and if the field is not a const
215 // field. We let const fields be updated with a reload.
216 if (!field.is_const()) {
217 // Make new field point to the old field value so that both
218 // old and new code see and update same value.
219 reload_context->isolate_group()->FreeStaticField(field);
220 field.set_field_id_unsafe(old_field.field_id());
221 }
222 reload_context->AddStaticFieldMapping(old_field, field);
223 }
224 }
225 }
226 }
227}
static ObjectPtr RawCast(ObjectPtr obj)
Definition object.h:325
const char *const name

◆ current_functions()

ArrayPtr dart::Class::current_functions ( ) const
inline

Definition at line 1643 of file object.h.

1643 {
1644 // We rely on the fact that any loads from the array are dependent loads
1645 // and avoid the load-acquire barrier here.
1646 return untag()->functions();
1647 }

◆ declaration_type_offset()

static intptr_t dart::Class::declaration_type_offset ( )
inlinestatic

Definition at line 1317 of file object.h.

1317 {
1318 return OFFSET_OF(UntaggedClass, declaration_type_);
1319 }
#define OFFSET_OF(type, field)
Definition globals.h:138

◆ DeclarationType()

TypePtr dart::Class::DeclarationType ( ) const

Definition at line 5882 of file object.cc.

5882 {
5884 if (IsNullClass()) {
5885 return Type::NullType();
5886 }
5887 if (IsDynamicClass()) {
5888 return Type::DynamicType();
5889 }
5890 if (IsVoidClass()) {
5891 return Type::VoidType();
5892 }
5893 if (declaration_type() != Type::null()) {
5894 return declaration_type();
5895 }
5896 {
5897 auto thread = Thread::Current();
5898 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
5899 if (declaration_type() != Type::null()) {
5900 return declaration_type();
5901 }
5902 // For efficiency, the runtimeType intrinsic returns the type cached by
5903 // DeclarationType without checking its nullability. Therefore, we
5904 // consistently cache the kNonNullable version of the type.
5905 // The exception is type Null which is stored as kNullable.
5906 TypeArguments& type_args = TypeArguments::Handle();
5907 const intptr_t num_type_params = NumTypeParameters();
5908 if (num_type_params > 0) {
5909 type_args = TypeArguments::New(num_type_params);
5910 TypeParameter& type_param = TypeParameter::Handle();
5911 for (intptr_t i = 0; i < num_type_params; i++) {
5912 type_param = TypeParameterAt(i);
5913 type_args.SetTypeAt(i, type_param);
5914 }
5915 }
5916 Type& type =
5919 set_declaration_type(type);
5920 return type.ptr();
5921 }
5922}
static AbstractTypePtr FinalizeType(const AbstractType &type, FinalizationKind finalization=kCanonicalize)
bool IsDynamicClass() const
Definition object.h:1558
bool IsVoidClass() const
Definition object.h:1561
bool IsNullClass() const
Definition object.h:1555
TypeParameterPtr TypeParameterAt(intptr_t index, Nullability nullability=Nullability::kNonNullable) const
Definition object.cc:3739
static TypeArgumentsPtr New(intptr_t len, Heap::Space space=Heap::kOld)
Definition object.cc:7733
static TypePtr VoidType()
Definition object.cc:21870
static TypePtr New(const Class &clazz, const TypeArguments &arguments, Nullability nullability=Nullability::kLegacy, Heap::Space space=Heap::kOld)
Definition object.cc:22492
static TypePtr DynamicType()
Definition object.cc:21866
static TypePtr NullType()
Definition object.cc:21862

◆ DefaultTypeArguments()

TypeArgumentsPtr dart::Class::DefaultTypeArguments ( Zone zone) const

Definition at line 3708 of file object.cc.

3708 {
3710 return Object::empty_type_arguments().ptr();
3711 }
3712 return TypeParameters::Handle(zone, type_parameters()).defaults();
3713}
TypeParametersPtr type_parameters() const
Definition object.h:1340

◆ dependent_code()

WeakArrayPtr dart::Class::dependent_code ( ) const

Definition at line 4475 of file object.cc.

4475 {
4477 IsolateGroup::Current()->program_lock()->IsCurrentThreadReader());
4478 return untag()->dependent_code();
4479}
#define DEBUG_ASSERT(cond)
Definition assert.h:321

◆ DictionaryName()

virtual StringPtr dart::Class::DictionaryName ( ) const
inlinevirtual

Reimplemented from dart::Object.

Definition at line 1272 of file object.h.

1272{ return Name(); }
StringPtr Name() const
Definition object.cc:3038

◆ direct_implementors()

GrowableObjectArrayPtr dart::Class::direct_implementors ( ) const
inline

Definition at line 1522 of file object.h.

1522 {
1524 IsolateGroup::Current()->program_lock()->IsCurrentThreadReader());
1525 return untag()->direct_implementors();
1526 }

◆ direct_implementors_unsafe()

GrowableObjectArrayPtr dart::Class::direct_implementors_unsafe ( ) const
inline

Definition at line 1527 of file object.h.

1527 {
1528 return untag()->direct_implementors();
1529 }

◆ direct_subclasses()

GrowableObjectArrayPtr dart::Class::direct_subclasses ( ) const
inline

Definition at line 1539 of file object.h.

1539 {
1541 IsolateGroup::Current()->program_lock()->IsCurrentThreadReader());
1542 return direct_subclasses_unsafe();
1543 }
GrowableObjectArrayPtr direct_subclasses_unsafe() const
Definition object.h:1544

◆ direct_subclasses_unsafe()

GrowableObjectArrayPtr dart::Class::direct_subclasses_unsafe ( ) const
inline

Definition at line 1544 of file object.h.

1544 {
1545 return untag()->direct_subclasses();
1546 }

◆ DisableAllCHAOptimizedCode()

void dart::Class::DisableAllCHAOptimizedCode ( )

Definition at line 4471 of file object.cc.

4471 {
4473}
void DisableCHAOptimizedCode(const Class &subclass)
Definition object.cc:4457

◆ DisableAllocationStub()

void dart::Class::DisableAllocationStub ( ) const

Definition at line 5934 of file object.cc.

5934 {
5935#if defined(DART_PRECOMPILED_RUNTIME)
5936 UNREACHABLE();
5937#else
5938 {
5939 const Code& existing_stub = Code::Handle(allocation_stub());
5940 if (existing_stub.IsNull()) {
5941 return;
5942 }
5943 }
5944 auto thread = Thread::Current();
5945 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
5946 const Code& existing_stub = Code::Handle(allocation_stub());
5947 if (existing_stub.IsNull()) {
5948 return;
5949 }
5950 ASSERT(!existing_stub.IsDisabled());
5951 // Change the stub so that the next caller will regenerate the stub.
5952 existing_stub.DisableStubCode(NumTypeParameters() > 0);
5953 // Disassociate the existing stub from class.
5954 untag()->set_allocation_stub(Code::null());
5955#endif // defined(DART_PRECOMPILED_RUNTIME)
5956}
#define UNREACHABLE()
Definition assert.h:248
CodePtr allocation_stub() const
Definition object.h:1802

◆ DisableCHAImplementorUsers()

void dart::Class::DisableCHAImplementorUsers ( )
inline

Definition at line 1919 of file object.h.

void DisableAllCHAOptimizedCode()
Definition object.cc:4471

◆ DisableCHAOptimizedCode()

void dart::Class::DisableCHAOptimizedCode ( const Class subclass)

Definition at line 4457 of file object.cc.

4457 {
4459 IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
4460 CHACodeArray a(*this);
4461 if (FLAG_trace_deoptimization && a.HasCodes()) {
4462 if (subclass.IsNull()) {
4463 THR_Print("Deopt for CHA (all)\n");
4464 } else {
4465 THR_Print("Deopt for CHA (new subclass %s)\n", subclass.ToCString());
4466 }
4467 }
4468 a.DisableCode(/*are_mutators_stopped=*/false);
4469}
#define THR_Print(format,...)
Definition log.h:20
struct MyStruct a[10]

◆ end_token_pos()

TokenPosition dart::Class::end_token_pos ( ) const
inline

Definition at line 1293 of file object.h.

1293 {
1294#if defined(DART_PRECOMPILED_RUNTIME)
1295 return TokenPosition::kNoSource;
1296#else
1297 return untag()->end_token_pos_;
1298#endif // defined(DART_PRECOMPILED_RUNTIME)
1299 }

◆ EnsureDeclarationLoaded()

void dart::Class::EnsureDeclarationLoaded ( ) const

Definition at line 4968 of file object.cc.

4968 {
4969 if (!is_declaration_loaded()) {
4970#if defined(DART_PRECOMPILED_RUNTIME)
4971 UNREACHABLE();
4972#else
4973 FATAL("Unable to use class %s which is not loaded yet.", ToCString());
4974#endif
4975 }
4976}
#define FATAL(error)

◆ EnsureIsAllocateFinalized()

ErrorPtr dart::Class::EnsureIsAllocateFinalized ( Thread thread) const

Definition at line 5009 of file object.cc.

5009 {
5010 ASSERT(!IsNull());
5011 if (is_allocate_finalized()) {
5012 return Error::null();
5013 }
5014 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
5015 if (is_allocate_finalized()) {
5016 return Error::null();
5017 }
5018 ASSERT(thread != nullptr);
5019 Error& error = Error::Handle(thread->zone(), EnsureIsFinalized(thread));
5020 if (!error.IsNull()) {
5021 ASSERT(thread == Thread::Current());
5022 if (thread->long_jump_base() != nullptr) {
5024 UNREACHABLE();
5025 }
5026 }
5027 // May be allocate-finalized recursively during EnsureIsFinalized.
5028 if (is_allocate_finalized()) {
5029 return Error::null();
5030 }
5031#if defined(DART_PRECOMPILED_RUNTIME)
5032 UNREACHABLE();
5033#else
5035#endif // defined(DART_PRECOMPILED_RUNTIME)
5036 return error.ptr();
5037}
static ErrorPtr AllocateFinalizeClass(const Class &cls)
bool IsNull() const
Definition object.h:363
static DART_NORETURN void LongJump(const Error &error)
Definition report.cc:86

◆ EnsureIsFinalized()

ErrorPtr dart::Class::EnsureIsFinalized ( Thread thread) const

Definition at line 4979 of file object.cc.

4979 {
4980 ASSERT(!IsNull());
4981 if (is_finalized()) {
4982 return Error::null();
4983 }
4984#if defined(DART_PRECOMPILED_RUNTIME)
4985 UNREACHABLE();
4986 return Error::null();
4987#else
4988 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
4989 if (is_finalized()) {
4990 return Error::null();
4991 }
4992 LeaveCompilerScope ncs(thread);
4993 ASSERT(thread != nullptr);
4994 const Error& error =
4995 Error::Handle(thread->zone(), ClassFinalizer::LoadClassMembers(*this));
4996 if (!error.IsNull()) {
4997 ASSERT(thread == Thread::Current());
4998 if (thread->long_jump_base() != nullptr) {
5000 UNREACHABLE();
5001 }
5002 }
5003 return error.ptr();
5004#endif // defined(DART_PRECOMPILED_RUNTIME)
5005}
static ErrorPtr LoadClassMembers(const Class &cls)

◆ EvaluateCompiledExpression()

ObjectPtr dart::Class::EvaluateCompiledExpression ( const ExternalTypedData kernel_buffer,
const Array type_definitions,
const Array param_values,
const TypeArguments type_param_values 
) const

Definition at line 4876 of file object.cc.

4880 {
4881 auto thread = Thread::Current();
4882 const auto& library = Library::Handle(thread->zone(), this->library());
4884 thread, Instance::null_object(), library, *this, kernel_buffer,
4885 type_definitions, arguments, type_arguments);
4886}
LibraryPtr library() const
Definition object.h:1335
ObjectPtr EvaluateCompiledExpression(const Class &klass, const ExternalTypedData &kernel_buffer, const Array &type_definitions, const Array &arguments, const TypeArguments &type_arguments) const
Definition object.cc:4888

◆ FieldFromIndex()

FieldPtr dart::Class::FieldFromIndex ( intptr_t  idx) const

Definition at line 5106 of file object.cc.

5106 {
5107 Array& fields = Array::Handle(this->fields());
5108 if ((idx < 0) || (idx >= fields.Length())) {
5109 return Field::null();
5110 }
5111 return Field::RawCast(fields.At(idx));
5112}

◆ fields()

ArrayPtr dart::Class::fields ( ) const
inline

Definition at line 1617 of file object.h.

1617 {
1618 // We rely on the fact that any loads from the array are dependent loads
1619 // and avoid the load-acquire barrier here.
1620 return untag()->fields();
1621 }

◆ Finalize()

void dart::Class::Finalize ( ) const

Definition at line 4362 of file object.cc.

4362 {
4363 auto thread = Thread::Current();
4364 auto isolate_group = thread->isolate_group();
4365 ASSERT(!thread->isolate_group()->all_classes_finalized());
4366 ASSERT(!is_finalized());
4367 // Prefinalized classes have a VM internal representation and no Dart fields.
4368 // Their instance size is precomputed and field offsets are known.
4369 if (!is_prefinalized()) {
4370 // Compute offsets of instance fields, instance size and bitmap for unboxed
4371 // fields.
4372 const auto host_bitmap = CalculateFieldOffsets();
4373 if (ptr() == isolate_group->class_table()->At(id())) {
4374 if (!ClassTable::IsTopLevelCid(id())) {
4375 // Unless class is top-level, which don't get instantiated,
4376 // sets the new size in the class table.
4377 isolate_group->class_table()->UpdateClassSize(id(), ptr());
4378 isolate_group->class_table()->SetUnboxedFieldsMapAt(id(), host_bitmap);
4379 }
4380 }
4381 }
4382
4383#if defined(DEBUG)
4384 if (is_const()) {
4385 // Double-check that all fields are final (CFE should guarantee that if it
4386 // marks the class as having a constant constructor).
4387 auto Z = thread->zone();
4388 const auto& super_class = Class::Handle(Z, SuperClass());
4389 ASSERT(super_class.IsNull() || super_class.is_const());
4390 const auto& fields = Array::Handle(Z, this->fields());
4391 auto& field = Field::Handle(Z);
4392 for (intptr_t i = 0; i < fields.Length(); ++i) {
4393 field ^= fields.At(i);
4394 ASSERT(field.is_static() || field.is_final());
4395 }
4396 }
4397#endif
4398
4400}
#define Z
static bool IsTopLevelCid(intptr_t cid)
void set_is_finalized() const
Definition object.cc:5769
ClassPtr SuperClass(ClassTable *class_table=nullptr) const
Definition object.cc:3715

◆ FindFieldIndex()

intptr_t dart::Class::FindFieldIndex ( const Field needle) const

Definition at line 5085 of file object.cc.

5085 {
5086 Thread* thread = Thread::Current();
5087 if (EnsureIsFinalized(thread) != Error::null()) {
5088 return -1;
5089 }
5092 Array& fields = thread->ArrayHandle();
5093 Field& field = thread->FieldHandle();
5094 fields = this->fields();
5095 ASSERT(!fields.IsNull());
5096 for (intptr_t i = 0, n = fields.Length(); i < n; ++i) {
5097 field ^= fields.At(i);
5098 if (needle.ptr() == field.ptr()) {
5099 return i;
5100 }
5101 }
5102 // Not found.
5103 return -1;
5104}
#define REUSABLE_ARRAY_HANDLESCOPE(thread)
#define REUSABLE_FIELD_HANDLESCOPE(thread)

◆ FindFunctionIndex()

intptr_t dart::Class::FindFunctionIndex ( const Function needle) const

Definition at line 3371 of file object.cc.

3371 {
3372 Thread* thread = Thread::Current();
3373 if (EnsureIsFinalized(thread) != Error::null()) {
3374 return -1;
3375 }
3378 Array& funcs = thread->ArrayHandle();
3379 Function& function = thread->FunctionHandle();
3380 funcs = current_functions();
3381 ASSERT(!funcs.IsNull());
3382 const intptr_t len = funcs.Length();
3383 for (intptr_t i = 0; i < len; i++) {
3384 function ^= funcs.At(i);
3385 if (needle.ptr() == function.ptr()) {
3386 return i;
3387 }
3388 }
3389 // No function found.
3390 return -1;
3391}
ArrayPtr current_functions() const
Definition object.h:1643
#define REUSABLE_FUNCTION_HANDLESCOPE(thread)

◆ FindImplicitClosureFunctionIndex()

intptr_t dart::Class::FindImplicitClosureFunctionIndex ( const Function needle) const

Definition at line 3414 of file object.cc.

3414 {
3415 Thread* thread = Thread::Current();
3416 if (EnsureIsFinalized(thread) != Error::null()) {
3417 return -1;
3418 }
3421 Array& funcs = thread->ArrayHandle();
3422 Function& function = thread->FunctionHandle();
3423 funcs = current_functions();
3424 ASSERT(!funcs.IsNull());
3425 Function& implicit_closure = Function::Handle(thread->zone());
3426 const intptr_t len = funcs.Length();
3427 for (intptr_t i = 0; i < len; i++) {
3428 function ^= funcs.At(i);
3429 implicit_closure = function.implicit_closure_function();
3430 if (implicit_closure.IsNull()) {
3431 // Skip non-implicit closure functions.
3432 continue;
3433 }
3434 if (needle.ptr() == implicit_closure.ptr()) {
3435 return i;
3436 }
3437 }
3438 // No function found.
3439 return -1;
3440}

◆ FindInstantiationOf() [1/4]

bool dart::Class::FindInstantiationOf ( Zone zone,
const Class cls,
bool  consider_only_super_classes = false 
) const
inline

Definition at line 1470 of file object.h.

1472 {
1473 return FindInstantiationOf(zone, cls, /*path=*/nullptr,
1474 consider_only_super_classes);
1475 }
bool FindInstantiationOf(Zone *zone, const Class &cls, GrowableArray< const Type * > *path, bool consider_only_super_classes=false) const
Definition object.cc:12723

◆ FindInstantiationOf() [2/4]

bool dart::Class::FindInstantiationOf ( Zone zone,
const Class cls,
GrowableArray< const Type * > *  path,
bool  consider_only_super_classes = false 
) const

Definition at line 12723 of file object.cc.

12726 {
12727 ASSERT(cls.is_type_finalized());
12728 if (cls.ptr() == ptr()) {
12729 return true; // Found instantiation.
12730 }
12731
12732 Class& cls2 = Class::Handle(zone);
12733 Type& super = Type::Handle(zone, super_type());
12734 if (!super.IsNull() && !super.IsObjectType()) {
12735 cls2 = super.type_class();
12736 if (path != nullptr) {
12737 path->Add(&super);
12738 }
12739 if (cls2.FindInstantiationOf(zone, cls, path,
12740 consider_only_super_classes)) {
12741 return true; // Found instantiation.
12742 }
12743 if (path != nullptr) {
12744 path->RemoveLast();
12745 }
12746 }
12747
12748 if (!consider_only_super_classes) {
12749 Array& super_interfaces = Array::Handle(zone, interfaces());
12750 for (intptr_t i = 0; i < super_interfaces.Length(); i++) {
12751 super ^= super_interfaces.At(i);
12752 cls2 = super.type_class();
12753 if (path != nullptr) {
12754 path->Add(&super);
12755 }
12756 if (cls2.FindInstantiationOf(zone, cls, path)) {
12757 return true; // Found instantiation.
12758 }
12759 if (path != nullptr) {
12760 path->RemoveLast();
12761 }
12762 }
12763 }
12764
12765 return false; // Not found.
12766}
TypePtr super_type() const
Definition object.h:1433
ArrayPtr interfaces() const
Definition object.h:1449
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition switches.h:57

◆ FindInstantiationOf() [3/4]

bool dart::Class::FindInstantiationOf ( Zone zone,
const Type type,
bool  consider_only_super_classes = false 
) const
inline

Definition at line 1493 of file object.h.

1495 {
1496 return FindInstantiationOf(zone, type, /*path=*/nullptr,
1497 consider_only_super_classes);
1498 }

◆ FindInstantiationOf() [4/4]

bool dart::Class::FindInstantiationOf ( Zone zone,
const Type type,
GrowableArray< const Type * > *  path,
bool  consider_only_super_classes = false 
) const

Definition at line 12768 of file object.cc.

12771 {
12772 return FindInstantiationOf(zone, Class::Handle(zone, type.type_class()), path,
12773 consider_only_super_classes);
12774}

◆ FindInvocationDispatcherFunctionIndex()

intptr_t dart::Class::FindInvocationDispatcherFunctionIndex ( const Function needle) const

Definition at line 3442 of file object.cc.

3443 {
3444 Thread* thread = Thread::Current();
3445 if (EnsureIsFinalized(thread) != Error::null()) {
3446 return -1;
3447 }
3450 Array& funcs = thread->ArrayHandle();
3451 Object& object = thread->ObjectHandle();
3452 funcs = invocation_dispatcher_cache();
3453 ASSERT(!funcs.IsNull());
3454 const intptr_t len = funcs.Length();
3455 for (intptr_t i = 0; i < len; i++) {
3456 object = funcs.At(i);
3457 // The invocation_dispatcher_cache is a table with some entries that
3458 // are functions.
3459 if (object.IsFunction()) {
3460 if (Function::Cast(object).ptr() == needle.ptr()) {
3461 return i;
3462 }
3463 }
3464 }
3465 // No function found.
3466 return -1;
3467}
friend class Object
Definition object.h:2219
#define REUSABLE_OBJECT_HANDLESCOPE(thread)

◆ FunctionFromIndex()

FunctionPtr dart::Class::FunctionFromIndex ( intptr_t  idx) const

Definition at line 3393 of file object.cc.

3393 {
3394 const Array& funcs = Array::Handle(current_functions());
3395 if ((idx < 0) || (idx >= funcs.Length())) {
3396 return Function::null();
3397 }
3398 Function& func = Function::Handle();
3399 func ^= funcs.At(idx);
3400 ASSERT(!func.IsNull());
3401 return func.ptr();
3402}

◆ functions()

ArrayPtr dart::Class::functions ( ) const
inline

Definition at line 1648 of file object.h.

1648 {
1650 IsolateGroup::Current()->program_lock()->IsCurrentThreadReader());
1651 return current_functions();
1652 }

◆ GetClassId()

static intptr_t dart::Class::GetClassId ( ClassPtr  cls)
inlinestatic

Definition at line 1593 of file object.h.

1593 {
1594 NoSafepointScope no_safepoint;
1595 return cls->untag()->id_;
1596 }

◆ GetDeclarationInstanceTypeArguments()

TypeArgumentsPtr dart::Class::GetDeclarationInstanceTypeArguments ( ) const

Definition at line 3526 of file object.cc.

3526 {
3527 const intptr_t num_type_arguments = NumTypeArguments();
3528 if (num_type_arguments == 0) {
3529 return TypeArguments::null();
3530 }
3531 if (declaration_instance_type_arguments() != TypeArguments::null()) {
3532 return declaration_instance_type_arguments();
3533 }
3534 Thread* thread = Thread::Current();
3535 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
3536 if (declaration_instance_type_arguments() != TypeArguments::null()) {
3537 return declaration_instance_type_arguments();
3538 }
3539 Zone* zone = thread->zone();
3540 auto& args = TypeArguments::Handle(zone);
3541 auto& type = AbstractType::Handle(zone);
3542 const intptr_t num_type_parameters = NumTypeParameters(thread);
3543 if (num_type_arguments == num_type_parameters) {
3545 args = Type::Cast(type).arguments();
3546 } else {
3547 type = super_type();
3548 const auto& super_args = TypeArguments::Handle(
3549 zone, Type::Cast(type).GetInstanceTypeArguments(thread));
3550 if ((num_type_parameters == 0) ||
3551 (!super_args.IsNull() && (super_args.Length() == num_type_arguments))) {
3552 args = super_args.ptr();
3553 } else {
3554 args = TypeArguments::New(num_type_arguments);
3555 const intptr_t offset = num_type_arguments - num_type_parameters;
3556 for (intptr_t i = 0; i < offset; ++i) {
3557 type = super_args.TypeAtNullSafe(i);
3558 args.SetTypeAt(i, type);
3559 }
3561 const auto& decl_args =
3562 TypeArguments::Handle(zone, Type::Cast(type).arguments());
3563 for (intptr_t i = 0; i < num_type_parameters; ++i) {
3564 type = decl_args.TypeAt(i);
3565 args.SetTypeAt(offset + i, type);
3566 }
3567 }
3568 }
3569 args = args.Canonicalize(thread);
3570 set_declaration_instance_type_arguments(args);
3571 return args.ptr();
3572}
intptr_t NumTypeArguments() const
Definition object.cc:3690
TypePtr DeclarationType() const
Definition object.cc:5882
TypeArgumentsPtr GetInstanceTypeArguments(Thread *thread, const TypeArguments &type_arguments, bool canonicalize=true) const
Definition object.cc:3574
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
Point offset

◆ GetInstanceTypeArguments()

TypeArgumentsPtr dart::Class::GetInstanceTypeArguments ( Thread thread,
const TypeArguments type_arguments,
bool  canonicalize = true 
) const

Definition at line 3574 of file object.cc.

3577 {
3578 const intptr_t num_type_arguments = NumTypeArguments();
3579 if (num_type_arguments == 0) {
3580 return TypeArguments::null();
3581 }
3582 Zone* zone = thread->zone();
3583 auto& args = TypeArguments::Handle(zone);
3584 const intptr_t num_type_parameters = NumTypeParameters(thread);
3585 ASSERT(type_arguments.IsNull() ||
3586 type_arguments.Length() == num_type_parameters);
3587 if (num_type_arguments == num_type_parameters) {
3588 args = type_arguments.ptr();
3589 } else {
3591 if (num_type_parameters == 0) {
3592 return args.ptr();
3593 }
3594 args = args.InstantiateFrom(
3596 zone, type_arguments.ToInstantiatorTypeArguments(thread, *this)),
3597 Object::null_type_arguments(), kAllFree, Heap::kOld);
3598 }
3599 if (canonicalize) {
3600 args = args.Canonicalize(thread);
3601 }
3602 return args.ptr();
3603}
TypeArgumentsPtr GetDeclarationInstanceTypeArguments() const
Definition object.cc:3526
@ kAllFree
Definition object.h:2920

◆ GetInstantiationOf() [1/2]

TypePtr dart::Class::GetInstantiationOf ( Zone zone,
const Class cls 
) const

Definition at line 12776 of file object.cc.

12776 {
12777 if (ptr() == cls.ptr()) {
12778 return DeclarationType();
12779 }
12780 if (FindInstantiationOf(zone, cls, /*consider_only_super_classes=*/true)) {
12781 // Since [cls] is a superclass of [this], use [cls]'s declaration type.
12782 return cls.DeclarationType();
12783 }
12784 const auto& decl_type = Type::Handle(zone, DeclarationType());
12785 GrowableArray<const Type*> path(zone, 0);
12786 if (!FindInstantiationOf(zone, cls, &path)) {
12787 return Type::null();
12788 }
12789 Thread* thread = Thread::Current();
12790 ASSERT(!path.is_empty());
12791 auto& calculated_type = Type::Handle(zone, decl_type.ptr());
12792 auto& calculated_type_class =
12793 Class::Handle(zone, calculated_type.type_class());
12794 auto& calculated_type_args =
12795 TypeArguments::Handle(zone, calculated_type.arguments());
12796 calculated_type_args = calculated_type_args.ToInstantiatorTypeArguments(
12797 thread, calculated_type_class);
12798 for (auto* const type : path) {
12799 calculated_type ^= type->ptr();
12800 if (!calculated_type.IsInstantiated()) {
12801 calculated_type ^= calculated_type.InstantiateFrom(
12802 calculated_type_args, Object::null_type_arguments(), kAllFree,
12803 Heap::kNew);
12804 }
12805 calculated_type_class = calculated_type.type_class();
12806 calculated_type_args = calculated_type.arguments();
12807 calculated_type_args = calculated_type_args.ToInstantiatorTypeArguments(
12808 thread, calculated_type_class);
12809 }
12810 ASSERT_EQUAL(calculated_type.type_class_id(), cls.id());
12811 return calculated_type.ptr();
12812}
#define ASSERT_EQUAL(expected, actual)
Definition assert.h:309
@ kNew
Definition heap.h:38

◆ GetInstantiationOf() [2/2]

TypePtr dart::Class::GetInstantiationOf ( Zone zone,
const Type type 
) const

Definition at line 12814 of file object.cc.

12814 {
12815 return GetInstantiationOf(zone, Class::Handle(zone, type.type_class()));
12816}
TypePtr GetInstantiationOf(Zone *zone, const Class &cls) const
Definition object.cc:12776

◆ GetInvocationDispatcher()

FunctionPtr dart::Class::GetInvocationDispatcher ( const String target_name,
const Array args_desc,
UntaggedFunction::Kind  kind,
bool  create_if_absent 
) const

Definition at line 3897 of file object.cc.

3900 {
3901 ASSERT(kind == UntaggedFunction::kNoSuchMethodDispatcher ||
3902 kind == UntaggedFunction::kInvokeFieldDispatcher ||
3903 kind == UntaggedFunction::kDynamicInvocationForwarder);
3904 auto thread = Thread::Current();
3905 auto Z = thread->zone();
3906 auto& function = Function::Handle(Z);
3907
3908 // First we'll try to find it without using locks.
3909 DispatcherKey key(target_name, args_desc, kind);
3910 if (invocation_dispatcher_cache() != Array::empty_array().ptr()) {
3911 DispatcherSet dispatchers(Z, invocation_dispatcher_cache());
3912 function ^= dispatchers.GetOrNull(key);
3913 dispatchers.Release();
3914 }
3915 if (!function.IsNull() || !create_if_absent) {
3916 return function.ptr();
3917 }
3918
3919 // If we failed to find it and possibly need to create it, use a write lock.
3920 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
3921
3922 // Try to find it again & return if it was added in the meantime.
3923 if (invocation_dispatcher_cache() != Array::empty_array().ptr()) {
3924 DispatcherSet dispatchers(Z, invocation_dispatcher_cache());
3925 function ^= dispatchers.GetOrNull(key);
3926 dispatchers.Release();
3927 }
3928 if (!function.IsNull()) return function.ptr();
3929
3930 // Otherwise create it & add it.
3931 function = CreateInvocationDispatcher(target_name, args_desc, kind);
3932 AddInvocationDispatcher(target_name, args_desc, function);
3933 return function.ptr();
3934}
void AddInvocationDispatcher(const String &target_name, const Array &args_desc, const Function &dispatcher) const
Definition object.cc:3881

◆ GetRecordFieldGetter()

FunctionPtr dart::Class::GetRecordFieldGetter ( const String getter_name) const

Definition at line 4128 of file object.cc.

4128 {
4130 ASSERT(Field::IsGetterName(getter_name));
4131 Thread* thread = Thread::Current();
4132 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
4133 Function& result = Function::Handle(thread->zone(),
4134 LookupDynamicFunctionUnsafe(getter_name));
4135 if (result.IsNull()) {
4136 result = CreateRecordFieldGetter(getter_name);
4137 }
4138 ASSERT(result.kind() == UntaggedFunction::kRecordFieldGetter);
4139 return result.ptr();
4140}
bool IsRecordClass() const
Definition object.h:1585
FunctionPtr LookupDynamicFunctionUnsafe(const String &name) const
Definition object.cc:6184
static bool IsGetterName(const String &function_name)
Definition object.cc:11882
GAsyncResult * result

◆ has_pragma()

bool dart::Class::has_pragma ( ) const
inline

Definition at line 2149 of file object.h.

2149{ return HasPragmaBit::decode(state_bits()); }

◆ HasCompressedPointers()

bool dart::Class::HasCompressedPointers ( ) const

Definition at line 3007 of file object.cc.

3007 {
3008 const intptr_t cid = id();
3009 switch (cid) {
3010 case kByteBufferCid:
3012#define HANDLE_CASE(clazz) \
3013 case k##clazz##Cid: \
3014 return dart::clazz::ContainsCompressedPointers();
3016#undef HANDLE_CASE
3017#define HANDLE_CASE(clazz) \
3018 case kTypedData##clazz##Cid: \
3019 return dart::TypedData::ContainsCompressedPointers(); \
3020 case kTypedData##clazz##ViewCid: \
3021 case kUnmodifiableTypedData##clazz##ViewCid: \
3022 return dart::TypedDataView::ContainsCompressedPointers(); \
3023 case kExternalTypedData##clazz##Cid: \
3024 return dart::ExternalTypedData::ContainsCompressedPointers();
3026#undef HANDLE_CASE
3027 default:
3028 if (cid >= kNumPredefinedCids) {
3030 }
3031 }
3032 FATAL("Unsupported class for compressed pointers translation: %s (id=%" Pd
3033 ", kNumPredefinedCids=%" Pd ")\n",
3035 return false;
3036}
#define CLASS_LIST_TYPED_DATA(V)
Definition class_id.h:137
#define CLASS_LIST(V)
Definition class_id.h:208
static constexpr bool ContainsCompressedPointers()
Definition object.h:11833
intptr_t id() const
Definition object.h:1235
static constexpr bool ContainsCompressedPointers()
Definition object.h:329
@ kNumPredefinedCids
Definition class_id.h:257
@ kByteBufferCid
Definition class_id.h:247
const intptr_t cid
#define HANDLE_CASE(clazz)

◆ Hash() [1/2]

uint32_t dart::Class::Hash ( ) const

Definition at line 5652 of file object.cc.

5652 {
5653 return Class::Hash(ptr());
5654}
uint32_t Hash() const
Definition object.cc:5652

◆ Hash() [2/2]

uint32_t dart::Class::Hash ( ClassPtr  obj)
static

Definition at line 5655 of file object.cc.

5655 {
5656 return String::HashRawSymbol(obj.untag()->name());
5657}
static uword HashRawSymbol(const StringPtr symbol)
Definition object.h:10226

◆ HasInstanceFields()

bool dart::Class::HasInstanceFields ( ) const

Definition at line 3261 of file object.cc.

3261 {
3262 const Array& field_array = Array::Handle(fields());
3263 Field& field = Field::Handle();
3264 for (intptr_t i = 0; i < field_array.Length(); ++i) {
3265 field ^= field_array.At(i);
3266 if (!field.is_static()) {
3267 return true;
3268 }
3269 }
3270 return false;
3271}

◆ host_instance_size() [1/2]

intptr_t dart::Class::host_instance_size ( ) const
inline

Definition at line 1145 of file object.h.

1145 {
1147 return (untag()->host_instance_size_in_words_ * kCompressedWordSize);
1148 }
static constexpr intptr_t kCompressedWordSize
Definition globals.h:42

◆ host_instance_size() [2/2]

static intptr_t dart::Class::host_instance_size ( ClassPtr  clazz)
inlinestatic

Definition at line 1158 of file object.h.

1158 {
1159 return (clazz->untag()->host_instance_size_in_words_ * kCompressedWordSize);
1160 }
ClassPtr clazz() const
Definition object.h:13192

◆ host_instance_size_in_words()

static int32_t dart::Class::host_instance_size_in_words ( const ClassPtr  cls)
inlinestatic

Definition at line 1945 of file object.h.

1945 {
1946 return cls->untag()->host_instance_size_in_words_;
1947 }

◆ host_next_field_offset()

intptr_t dart::Class::host_next_field_offset ( ) const
inline

Definition at line 1192 of file object.h.

1192 {
1193 return untag()->host_next_field_offset_in_words_ * kCompressedWordSize;
1194 }

◆ host_next_field_offset_in_words()

static int32_t dart::Class::host_next_field_offset_in_words ( const ClassPtr  cls)
inlinestatic

Definition at line 1957 of file object.h.

1957 {
1958 return cls->untag()->host_next_field_offset_in_words_;
1959 }

◆ host_type_arguments_field_offset()

intptr_t dart::Class::host_type_arguments_field_offset ( ) const
inline

Definition at line 1377 of file object.h.

1377 {
1379 if (untag()->host_type_arguments_field_offset_in_words_ ==
1381 return kNoTypeArguments;
1382 }
1383 return untag()->host_type_arguments_field_offset_in_words_ *
1385 }
bool is_type_finalized() const
Definition object.h:1711
static constexpr intptr_t kNoTypeArguments
Definition object.h:1376

◆ host_type_arguments_field_offset_in_words()

static int32_t dart::Class::host_type_arguments_field_offset_in_words ( const ClassPtr  cls)
inlinestatic

Definition at line 1969 of file object.h.

1969 {
1970 return cls->untag()->host_type_arguments_field_offset_in_words_;
1971 }

◆ host_type_arguments_field_offset_in_words_offset()

static intptr_t dart::Class::host_type_arguments_field_offset_in_words_offset ( )
inlinestatic

Definition at line 1428 of file object.h.

1428 {
1429 return OFFSET_OF(UntaggedClass, host_type_arguments_field_offset_in_words_);
1430 }

◆ id()

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

Definition at line 1235 of file object.h.

1235{ return untag()->id_; }

◆ id_offset()

static intptr_t dart::Class::id_offset ( )
inlinestatic

Definition at line 1240 of file object.h.

1240{ return OFFSET_OF(UntaggedClass, id_); }

◆ implementor_cid()

intptr_t dart::Class::implementor_cid ( ) const
inline

Definition at line 1247 of file object.h.

1247{ return untag()->implementor_cid_; }

◆ ImplicitClosureFunctionFromIndex()

FunctionPtr dart::Class::ImplicitClosureFunctionFromIndex ( intptr_t  idx) const

Definition at line 3404 of file object.cc.

3404 {
3405 Function& func = Function::Handle(FunctionFromIndex(idx));
3406 if (func.IsNull() || !func.HasImplicitClosureFunction()) {
3407 return Function::null();
3408 }
3409 func = func.ImplicitClosureFunction();
3410 ASSERT(!func.IsNull());
3411 return func.ptr();
3412}
FunctionPtr FunctionFromIndex(intptr_t idx) const
Definition object.cc:3393

◆ InjectCIDFields()

bool dart::Class::InjectCIDFields ( ) const

Definition at line 5114 of file object.cc.

5114 {
5115 if (library() != Library::InternalLibrary() ||
5116 Name() != Symbols::ClassID().ptr()) {
5117 return false;
5118 }
5119
5120 auto thread = Thread::Current();
5121 auto isolate_group = thread->isolate_group();
5122 auto zone = thread->zone();
5123 Field& field = Field::Handle(zone);
5124 Smi& value = Smi::Handle(zone);
5125 String& field_name = String::Handle(zone);
5126
5127 // clang-format off
5128 static const struct {
5129 const char* const field_name;
5130 const intptr_t cid;
5131 } cid_fields[] = {
5132#define CLASS_LIST_WITH_NULL(V) \
5133 V(Null) \
5134 CLASS_LIST_NO_OBJECT(V)
5135#define ADD_SET_FIELD(clazz) \
5136 {"cid" #clazz, k##clazz##Cid},
5138#undef ADD_SET_FIELD
5139#undef CLASS_LIST_WITH_NULL
5140#define ADD_SET_FIELD(clazz) \
5141 {"cid" #clazz, kTypedData##clazz##Cid}, \
5142 {"cid" #clazz "View", kTypedData##clazz##ViewCid}, \
5143 {"cidExternal" #clazz, kExternalTypedData##clazz##Cid}, \
5144 {"cidUnmodifiable" #clazz "View", kUnmodifiableTypedData##clazz##ViewCid}, \
5145 CLASS_LIST_TYPED_DATA(ADD_SET_FIELD)
5146#undef ADD_SET_FIELD
5147 // Used in const hashing to determine whether we're dealing with a
5148 // user-defined const. See lib/_internal/vm/lib/compact_hash.dart.
5149 {"numPredefinedCids", kNumPredefinedCids},
5150 };
5151 // clang-format on
5152
5153 const AbstractType& field_type = Type::Handle(zone, Type::IntType());
5154 for (size_t i = 0; i < ARRAY_SIZE(cid_fields); i++) {
5155 field_name = Symbols::New(thread, cid_fields[i].field_name);
5156 field = Field::New(field_name, /* is_static = */ true,
5157 /* is_final = */ false,
5158 /* is_const = */ true,
5159 /* is_reflectable = */ false,
5160 /* is_late = */ false, *this, field_type,
5162 value = Smi::New(cid_fields[i].cid);
5163 isolate_group->RegisterStaticField(field, value);
5164 AddField(field);
5165 }
5166
5167 return true;
5168}
void AddField(const Field &field) const
Definition object.cc:5057
friend class AbstractType
Definition object.h:2217
static LibraryPtr InternalLibrary()
Definition object.cc:14850
static SmiPtr New(intptr_t value)
Definition object.h:9985
static StringPtr New(Thread *thread, const char *cstr)
Definition symbols.h:722
static const TokenPosition kMinSource
static TypePtr IntType()
Definition object.cc:21886
uint8_t value
#define ARRAY_SIZE(array)
Definition globals.h:72
#define CLASS_LIST_WITH_NULL(V)
#define ADD_SET_FIELD(clazz)

◆ InsertCanonicalConstant()

InstancePtr dart::Class::InsertCanonicalConstant ( Zone zone,
const Instance constant 
) const

Definition at line 6540 of file object.cc.

6541 {
6542 ASSERT(constant.IsCanonical());
6543 ASSERT(this->ptr() == constant.clazz());
6544 Instance& canonical_value = Instance::Handle(zone);
6545 if (this->constants() == Array::null()) {
6547 HashTables::New<CanonicalInstancesSet>(128, Heap::kOld));
6548 canonical_value ^= constants.InsertNewOrGet(CanonicalInstanceKey(constant));
6549 this->set_constants(constants.Release());
6550 } else {
6552 this->constants());
6553 canonical_value ^= constants.InsertNewOrGet(CanonicalInstanceKey(constant));
6554 this->set_constants(constants.Release());
6555 }
6556 return canonical_value.ptr();
6557}
friend class Instance
Definition object.h:2218
UnorderedHashSet< CanonicalInstanceTraits > CanonicalInstancesSet

◆ InstanceSize()

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

Definition at line 1687 of file object.h.

1687 {
1688 return RoundedAllocationSize(sizeof(UntaggedClass));
1689 }
static constexpr intptr_t RoundedAllocationSize(intptr_t size)
Definition object.h:758

◆ interfaces()

ArrayPtr dart::Class::interfaces ( ) const
inline

Definition at line 1449 of file object.h.

1449 {
1451 return untag()->interfaces();
1452 }

◆ InvocationDispatcherFunctionFromIndex()

FunctionPtr dart::Class::InvocationDispatcherFunctionFromIndex ( intptr_t  idx) const

Definition at line 3469 of file object.cc.

3469 {
3470 Thread* thread = Thread::Current();
3473 Array& dispatcher_cache = thread->ArrayHandle();
3474 Object& object = thread->ObjectHandle();
3475 dispatcher_cache = invocation_dispatcher_cache();
3476 object = dispatcher_cache.At(idx);
3477 if (!object.IsFunction()) {
3478 return Function::null();
3479 }
3480 return Function::Cast(object).ptr();
3481}

◆ Invoke()

ObjectPtr dart::Class::Invoke ( const String selector,
const Array arguments,
const Array argument_names,
bool  respect_reflectable = true,
bool  check_is_entrypoint = false 
) const

Definition at line 4739 of file object.cc.

4743 {
4744 Thread* thread = Thread::Current();
4745 Zone* zone = thread->zone();
4747
4748 // We don't pass any explicit type arguments, which will be understood as
4749 // using dynamic for any function type arguments by lower layers.
4750 const int kTypeArgsLen = 0;
4751 const Array& args_descriptor_array = Array::Handle(
4752 zone, ArgumentsDescriptor::NewBoxed(kTypeArgsLen, args.Length(),
4753 arg_names, Heap::kNew));
4754 ArgumentsDescriptor args_descriptor(args_descriptor_array);
4755
4756 Function& function =
4758
4759 if (!function.IsNull() && check_is_entrypoint) {
4760 CHECK_ERROR(function.VerifyCallEntryPoint());
4761 }
4762
4763 if (function.IsNull()) {
4764 // Didn't find a method: try to find a getter and invoke call on its result.
4765 const Object& getter_result = Object::Handle(
4766 zone, InvokeGetter(function_name, false, respect_reflectable,
4767 check_is_entrypoint));
4768 if (getter_result.ptr() != Object::sentinel().ptr()) {
4769 if (check_is_entrypoint) {
4771 }
4772 const auto& call_args_descriptor_array = Array::Handle(
4773 zone, ArgumentsDescriptor::NewBoxed(args_descriptor.TypeArgsLen(),
4774 args_descriptor.Count() + 1,
4775 arg_names, Heap::kNew));
4776 const auto& call_args = Array::Handle(
4777 zone,
4778 CreateCallableArgumentsFromStatic(zone, Instance::Cast(getter_result),
4779 args, arg_names, args_descriptor));
4780 return DartEntry::InvokeClosure(thread, call_args,
4781 call_args_descriptor_array);
4782 }
4783 }
4784
4785 if (function.IsNull() ||
4786 !function.AreValidArguments(args_descriptor, nullptr) ||
4787 (respect_reflectable && !function.is_reflectable())) {
4788 return ThrowNoSuchMethod(
4789 AbstractType::Handle(zone, RareType()), function_name, args, arg_names,
4791 }
4792 // This is a static function, so we pass an empty instantiator tav.
4793 ASSERT(function.is_static());
4794 ObjectPtr type_error = function.DoArgumentTypesMatch(
4795 args, args_descriptor, Object::empty_type_arguments());
4796 if (type_error != Error::null()) {
4797 return type_error;
4798 }
4799 return DartEntry::InvokeFunction(function, args, args_descriptor_array);
4800}
static ArrayPtr NewBoxed(intptr_t type_args_len, intptr_t num_arguments, const Array &optional_arguments_names, Heap::Space space=Heap::kOld)
Definition dart_entry.h:83
ObjectPtr InvokeGetter(const String &selector, bool throw_nsm_if_absent, bool respect_reflectable=true, bool check_is_entrypoint=false) const
Definition object.cc:4572
FunctionPtr LookupStaticFunction(const String &name) const
Definition object.cc:6192
TypePtr RareType() const
Definition object.cc:3097
static ObjectPtr InvokeClosure(Thread *thread, const Array &arguments)
static ObjectPtr InvokeFunction(const Function &function, const Array &arguments)
Definition dart_entry.cc:31
static ArrayPtr CreateCallableArgumentsFromStatic(Zone *zone, const Instance &receiver, const Array &static_args, const Array &arg_names, const ArgumentsDescriptor &static_args_descriptor)
Definition object.cc:4707
DART_WARN_UNUSED_RESULT ErrorPtr EntryPointFieldInvocationError(const String &getter_name)
Definition object.cc:27272
static void ThrowNoSuchMethod(const Instance &receiver, const String &function_name, const Array &arguments, const Array &argument_names, const InvocationMirror::Level level, const InvocationMirror::Kind kind)
Definition mirrors.cc:49
const char *const function_name
#define CHECK_ERROR(value, message)

◆ InvokeGetter()

ObjectPtr dart::Class::InvokeGetter ( const String selector,
bool  throw_nsm_if_absent,
bool  respect_reflectable = true,
bool  check_is_entrypoint = false 
) const

Definition at line 4572 of file object.cc.

4575 {
4576 Thread* thread = Thread::Current();
4577 Zone* zone = thread->zone();
4578
4580
4581 // Note static fields do not have implicit getters.
4582 const Field& field = Field::Handle(zone, LookupStaticField(getter_name));
4583
4584 if (!field.IsNull() && check_is_entrypoint) {
4585 CHECK_ERROR(field.VerifyEntryPoint(EntryPointPragma::kGetterOnly));
4586 }
4587
4588 if (field.IsNull() || field.IsUninitialized()) {
4589 const String& internal_getter_name =
4590 String::Handle(zone, Field::GetterName(getter_name));
4591 Function& getter =
4592 Function::Handle(zone, LookupStaticFunction(internal_getter_name));
4593
4594 if (field.IsNull() && !getter.IsNull() && check_is_entrypoint) {
4595 CHECK_ERROR(getter.VerifyCallEntryPoint());
4596 }
4597
4598 if (getter.IsNull() || (respect_reflectable && !getter.is_reflectable())) {
4599 if (getter.IsNull()) {
4600 getter = LookupStaticFunction(getter_name);
4601 if (!getter.IsNull()) {
4602 if (check_is_entrypoint) {
4603 CHECK_ERROR(getter.VerifyClosurizedEntryPoint());
4604 }
4605 if (getter.SafeToClosurize()) {
4606 // Looking for a getter but found a regular method: closurize it.
4607 const Function& closure_function =
4608 Function::Handle(zone, getter.ImplicitClosureFunction());
4609 return closure_function.ImplicitStaticClosure();
4610 }
4611 }
4612 }
4613 if (throw_nsm_if_absent) {
4614 return ThrowNoSuchMethod(
4615 AbstractType::Handle(zone, RareType()), getter_name,
4616 Object::null_array(), Object::null_array(),
4618 }
4619 // Fall through case: Indicate that we didn't find any function or field
4620 // using a special null instance. This is different from a field being
4621 // null. Callers make sure that this null does not leak into Dartland.
4622 return Object::sentinel().ptr();
4623 }
4624
4625 // Invoke the getter and return the result.
4626 return DartEntry::InvokeFunction(getter, Object::empty_array());
4627 }
4628
4629 return field.StaticValue();
4630}
FieldPtr LookupStaticField(const String &name) const
Definition object.cc:6403
static StringPtr GetterName(const String &field_name)
Definition object.cc:11843

◆ InvokeSetter()

ObjectPtr dart::Class::InvokeSetter ( const String selector,
const Instance argument,
bool  respect_reflectable = true,
bool  check_is_entrypoint = false 
) const

Definition at line 4632 of file object.cc.

4635 {
4636 Thread* thread = Thread::Current();
4637 Zone* zone = thread->zone();
4638
4640
4641 // Check for real fields and user-defined setters.
4642 const Field& field = Field::Handle(zone, LookupStaticField(setter_name));
4643 const String& internal_setter_name =
4644 String::Handle(zone, Field::SetterName(setter_name));
4645
4646 if (!field.IsNull() && check_is_entrypoint) {
4647 CHECK_ERROR(field.VerifyEntryPoint(EntryPointPragma::kSetterOnly));
4648 }
4649
4650 AbstractType& parameter_type = AbstractType::Handle(zone);
4651 if (field.IsNull()) {
4652 const Function& setter =
4653 Function::Handle(zone, LookupStaticFunction(internal_setter_name));
4654 if (!setter.IsNull() && check_is_entrypoint) {
4655 CHECK_ERROR(setter.VerifyCallEntryPoint());
4656 }
4657 const int kNumArgs = 1;
4658 const Array& args = Array::Handle(zone, Array::New(kNumArgs));
4659 args.SetAt(0, value);
4660 if (setter.IsNull() || (respect_reflectable && !setter.is_reflectable())) {
4662 internal_setter_name, args, Object::null_array(),
4665 }
4666 parameter_type = setter.ParameterTypeAt(0);
4667 if (!value.RuntimeTypeIsSubtypeOf(parameter_type,
4668 Object::null_type_arguments(),
4669 Object::null_type_arguments())) {
4670 const String& argument_name =
4671 String::Handle(zone, setter.ParameterNameAt(0));
4672 return ThrowTypeError(setter.token_pos(), value, parameter_type,
4673 argument_name);
4674 }
4675 // Invoke the setter and return the result.
4676 return DartEntry::InvokeFunction(setter, args);
4677 }
4678
4679 if (field.is_final() || (respect_reflectable && !field.is_reflectable())) {
4680 const int kNumArgs = 1;
4681 const Array& args = Array::Handle(zone, Array::New(kNumArgs));
4682 args.SetAt(0, value);
4684 internal_setter_name, args, Object::null_array(),
4687 }
4688
4689 parameter_type = field.type();
4690 if (!value.RuntimeTypeIsSubtypeOf(parameter_type,
4691 Object::null_type_arguments(),
4692 Object::null_type_arguments())) {
4693 const String& argument_name = String::Handle(zone, field.name());
4694 return ThrowTypeError(field.token_pos(), value, parameter_type,
4695 argument_name);
4696 }
4697 field.SetStaticValue(value);
4698 return value.ptr();
4699}
static ArrayPtr New(intptr_t len, Heap::Space space=Heap::kNew)
Definition object.h:10933
static StringPtr SetterName(const String &field_name)
Definition object.cc:11855
static ObjectPtr ThrowTypeError(const TokenPosition token_pos, const Instance &src_value, const AbstractType &dst_type, const String &dst_name)
Definition object.cc:4551

◆ is_abstract()

bool dart::Class::is_abstract ( ) const
inline

Definition at line 1698 of file object.h.

1698{ return AbstractBit::decode(state_bits()); }

◆ is_allocate_finalized()

bool dart::Class::is_allocate_finalized ( ) const
inline

Definition at line 1734 of file object.h.

1734 {
1735 return ClassFinalizedBits::decode(state_bits()) ==
1737 }

◆ is_allocated()

bool dart::Class::is_allocated ( ) const
inline

Definition at line 1783 of file object.h.

1783{ return IsAllocatedBit::decode(state_bits()); }

◆ is_base_class()

bool dart::Class::is_base_class ( ) const
inline

Definition at line 1767 of file object.h.

1767{ return BaseClassBit::decode(state_bits()); }

◆ is_const()

bool dart::Class::is_const ( ) const
inline

Definition at line 1747 of file object.h.

1747{ return ConstBit::decode(state_bits()); }

◆ is_declaration_loaded()

bool dart::Class::is_declaration_loaded ( ) const
inline

Definition at line 1705 of file object.h.

1705 {
1707 }
UntaggedClass::ClassLoadingState class_loading_state() const
Definition object.h:1701

◆ is_deeply_immutable()

bool dart::Class::is_deeply_immutable ( ) const
inline

Definition at line 2164 of file object.h.

2164 {
2165 return IsDeeplyImmutableBit::decode(state_bits());
2166 }

◆ is_enum_class()

bool dart::Class::is_enum_class ( ) const
inline

Definition at line 1722 of file object.h.

1722{ return EnumBit::decode(state_bits()); }

◆ is_fields_marked_nullable()

bool dart::Class::is_fields_marked_nullable ( ) const
inline

Definition at line 1778 of file object.h.

1778 {
1779 return FieldsMarkedNullableBit::decode(state_bits());
1780 }

◆ is_final()

bool dart::Class::is_final ( ) const
inline

Definition at line 1775 of file object.h.

1775{ return FinalBit::decode(state_bits()); }

◆ is_finalized()

bool dart::Class::is_finalized ( ) const
inline

Definition at line 1725 of file object.h.

1725 {
1726 return ClassFinalizedBits::decode(state_bits()) ==
1728 ClassFinalizedBits::decode(state_bits()) ==
1730 }

◆ is_future_subtype()

bool dart::Class::is_future_subtype ( ) const
inline

Definition at line 2172 of file object.h.

2172 {
2174 return IsFutureSubtypeBit::decode(state_bits());
2175 }

◆ is_implemented()

bool dart::Class::is_implemented ( ) const
inline

Definition at line 1694 of file object.h.

1694{ return ImplementedBit::decode(state_bits()); }

◆ is_interface_class()

bool dart::Class::is_interface_class ( ) const
inline

Definition at line 1770 of file object.h.

1770 {
1771 return InterfaceClassBit::decode(state_bits());
1772 }

◆ is_isolate_unsendable()

bool dart::Class::is_isolate_unsendable ( ) const
inline

Definition at line 2153 of file object.h.

2153 {
2154 ASSERT(is_finalized()); // This bit is initialized in class finalizer.
2155 return IsIsolateUnsendableBit::decode(state_bits());
2156 }

◆ is_isolate_unsendable_due_to_pragma()

bool dart::Class::is_isolate_unsendable_due_to_pragma ( ) const
inline

Definition at line 2159 of file object.h.

2159 {
2160 return IsIsolateUnsendableDueToPragmaBit::decode(state_bits());
2161 }

◆ is_loaded()

bool dart::Class::is_loaded ( ) const
inline

Definition at line 1787 of file object.h.

1787{ return IsLoadedBit::decode(state_bits()); }

◆ is_mixin_class()

bool dart::Class::is_mixin_class ( ) const
inline

Definition at line 1764 of file object.h.

1764{ return MixinClassBit::decode(state_bits()); }

◆ is_prefinalized()

bool dart::Class::is_prefinalized ( ) const
inline

Definition at line 1740 of file object.h.

1740 {
1741 return ClassFinalizedBits::decode(state_bits()) ==
1743 }

◆ is_sealed()

bool dart::Class::is_sealed ( ) const
inline

Definition at line 1761 of file object.h.

1761{ return SealedBit::decode(state_bits()); }

◆ is_synthesized_class()

bool dart::Class::is_synthesized_class ( ) const
inline

Definition at line 1716 of file object.h.

1716 {
1717 return SynthesizedClassBit::decode(state_bits());
1718 }

◆ is_transformed_mixin_application()

bool dart::Class::is_transformed_mixin_application ( ) const
inline

Definition at line 1756 of file object.h.

1756 {
1757 return TransformedMixinApplicationBit::decode(state_bits());
1758 }

◆ is_type_finalized()

bool dart::Class::is_type_finalized ( ) const
inline

Definition at line 1711 of file object.h.

◆ is_valid_id()

static bool dart::Class::is_valid_id ( intptr_t  value)
inlinestatic

Definition at line 1232 of file object.h.

1232 {
1234 }

◆ IsClosureClass() [1/2]

bool dart::Class::IsClosureClass ( ) const
inline

Definition at line 1579 of file object.h.

1579{ return id() == kClosureCid; }

◆ IsClosureClass() [2/2]

static bool dart::Class::IsClosureClass ( ClassPtr  cls)
inlinestatic

Definition at line 1580 of file object.h.

1580 {
1581 return GetClassId(cls) == kClosureCid;
1582 }
intptr_t GetClassId() const
Definition object.h:341

◆ IsDartFunctionClass()

bool dart::Class::IsDartFunctionClass ( ) const

Definition at line 5958 of file object.cc.

5958 {
5959 return ptr() == Type::Handle(Type::DartFunctionType()).type_class();
5960}
static TypePtr DartFunctionType()
Definition object.cc:21938

◆ IsDeeplyImmutable()

static bool dart::Class::IsDeeplyImmutable ( ClassPtr  clazz)
inlinestatic

Definition at line 2167 of file object.h.

2167 {
2168 return IsDeeplyImmutableBit::decode(clazz->untag()->state_bits_);
2169 }

◆ IsDynamicClass()

bool dart::Class::IsDynamicClass ( ) const
inline

Definition at line 1558 of file object.h.

1558{ return id() == kDynamicCid; }
@ kDynamicCid
Definition class_id.h:253

◆ IsFutureClass()

bool dart::Class::IsFutureClass ( ) const

Definition at line 5962 of file object.cc.

5962 {
5963 // Looking up future_class in the object store would not work, because
5964 // this function is called during class finalization, before the object store
5965 // field would be initialized by InitKnownObjects().
5966 return (Name() == Symbols::Future().ptr()) &&
5968}
static LibraryPtr AsyncLibrary()
Definition object.cc:14826

◆ IsFutureOrClass()

bool dart::Class::IsFutureOrClass ( ) const
inline

Definition at line 1576 of file object.h.

1576{ return id() == kFutureOrCid; }

◆ IsGeneric()

bool dart::Class::IsGeneric ( ) const
inline

Definition at line 1360 of file object.h.

1360 {
1361 // If the declaration is not loaded, fall back onto NumTypeParameters.
1362 if (!is_declaration_loaded()) {
1363 return NumTypeParameters(Thread::Current()) > 0;
1364 }
1365 return type_parameters() != Object::null();
1366 }

◆ IsInFullSnapshot() [1/2]

bool dart::Class::IsInFullSnapshot ( ) const

Definition at line 3091 of file object.cc.

3091 {
3092 NoSafepointScope no_safepoint;
3094 untag()->library()->untag()->flags_);
3095}

◆ IsInFullSnapshot() [2/2]

static bool dart::Class::IsInFullSnapshot ( ClassPtr  cls)
inlinestatic

Definition at line 1587 of file object.h.

1587 {
1588 NoSafepointScope no_safepoint;
1590 cls->untag()->library()->untag()->flags_);
1591 }

◆ IsIsolateUnsendable()

static bool dart::Class::IsIsolateUnsendable ( ClassPtr  clazz)
inlinestatic

Definition at line 1797 of file object.h.

1797 {
1798 return IsIsolateUnsendableBit::decode(clazz->untag()->state_bits_);
1799 }

◆ IsNeverClass()

bool dart::Class::IsNeverClass ( ) const
inline

Definition at line 1564 of file object.h.

1564{ return id() == kNeverCid; }
@ kNeverCid
Definition class_id.h:255

◆ IsNullClass()

bool dart::Class::IsNullClass ( ) const
inline

Definition at line 1555 of file object.h.

1555{ return id() == kNullCid; }
@ kNullCid
Definition class_id.h:252

◆ IsObjectClass()

bool dart::Class::IsObjectClass ( ) const
inline

Definition at line 1567 of file object.h.

1567{ return id() == kInstanceCid; }

◆ IsPrivate()

bool dart::Class::IsPrivate ( ) const

Definition at line 6180 of file object.cc.

6180 {
6182}
static bool IsPrivate(const String &name)
Definition object.cc:14666

◆ IsRecordClass()

bool dart::Class::IsRecordClass ( ) const
inline

Definition at line 1585 of file object.h.

1585{ return id() == kRecordCid; }

◆ IsSubtypeOf()

bool dart::Class::IsSubtypeOf ( const Class cls,
const TypeArguments type_arguments,
Nullability  nullability,
const AbstractType other,
Heap::Space  space,
FunctionTypeMapping function_type_equivalence = nullptr 
)
static

Definition at line 5975 of file object.cc.

5980 {
5981 TRACE_TYPE_CHECKS_VERBOSE(" Class::IsSubtypeOf(%s %s, %s)\n",
5982 cls.ToCString(), type_arguments.ToCString(),
5983 other.ToCString());
5984 // This function does not support Null, Never, dynamic, or void as type T0.
5985 classid_t this_cid = cls.id();
5986 ASSERT(this_cid != kNullCid && this_cid != kNeverCid &&
5987 this_cid != kDynamicCid && this_cid != kVoidCid);
5988 ASSERT(type_arguments.IsNull() ||
5989 (type_arguments.Length() >= cls.NumTypeArguments()));
5990 // Type T1 must have a type class (e.g. not a type param or a function type).
5991 ASSERT(other.HasTypeClass());
5992 const classid_t other_cid = other.type_class_id();
5993 if (other_cid == kDynamicCid || other_cid == kVoidCid) {
5994 TRACE_TYPE_CHECKS_VERBOSE(" - result: true (right is top)\n");
5995 return true;
5996 }
5997 // Left nullable:
5998 // if T0 is S0? then:
5999 // T0 <: T1 iff S0 <: T1 and Null <: T1
6000 if ((nullability == Nullability::kNullable) &&
6002 TRACE_TYPE_CHECKS_VERBOSE(" - result: false (nullability)\n");
6003 return false;
6004 }
6005
6006 // Right Object.
6007 if (other_cid == kObjectCid) {
6008 TRACE_TYPE_CHECKS_VERBOSE(" - result: true (right is Object)\n");
6009 return true;
6010 }
6011
6012 Thread* thread = Thread::Current();
6013 Zone* zone = thread->zone();
6014 const Class& other_class = Class::Handle(zone, other.type_class());
6015 const TypeArguments& other_type_arguments =
6016 TypeArguments::Handle(zone, other.arguments());
6017 // Use the 'this_class' object as if it was the receiver of this method, but
6018 // instead of recursing, reset it to the super class and loop.
6019 Class& this_class = Class::Handle(zone, cls.ptr());
6020 while (true) {
6021 // Apply additional subtyping rules if T0 or T1 are 'FutureOr'.
6022
6023 // Left FutureOr:
6024 // if T0 is FutureOr<S0> then:
6025 // T0 <: T1 iff Future<S0> <: T1 and S0 <: T1
6026 if (this_cid == kFutureOrCid) {
6027 // Check Future<S0> <: T1.
6028 ObjectStore* object_store = IsolateGroup::Current()->object_store();
6029 const Class& future_class =
6030 Class::Handle(zone, object_store->future_class());
6031 ASSERT(!future_class.IsNull() && future_class.NumTypeParameters() == 1 &&
6032 this_class.NumTypeParameters() == 1);
6033 ASSERT(type_arguments.IsNull() || type_arguments.Length() >= 1);
6034 if (Class::IsSubtypeOf(future_class, type_arguments,
6035 Nullability::kNonNullable, other, space,
6036 function_type_equivalence)) {
6037 // Check S0 <: T1.
6038 const AbstractType& type_arg =
6039 AbstractType::Handle(zone, type_arguments.TypeAtNullSafe(0));
6040 if (type_arg.IsSubtypeOf(other, space, function_type_equivalence)) {
6041 TRACE_TYPE_CHECKS_VERBOSE(" - result: true (left is FutureOr)\n");
6042 return true;
6043 }
6044 }
6045 }
6046
6047 // Right FutureOr:
6048 // if T1 is FutureOr<S1> then:
6049 // T0 <: T1 iff any of the following hold:
6050 // either T0 <: Future<S1>
6051 // or T0 <: S1
6052 // or T0 is X0 and X0 has bound S0 and S0 <: T1 (checked elsewhere)
6053 if (other_cid == kFutureOrCid) {
6054 const AbstractType& other_type_arg =
6055 AbstractType::Handle(zone, other_type_arguments.TypeAtNullSafe(0));
6056 // Check if S1 is a top type.
6057 if (other_type_arg.IsTopTypeForSubtyping()) {
6059 " - result: true (right is FutureOr top)\n");
6060 return true;
6061 }
6062 // Check T0 <: Future<S1> when T0 is Future<S0>.
6063 if (this_class.IsFutureClass()) {
6064 const AbstractType& type_arg =
6065 AbstractType::Handle(zone, type_arguments.TypeAtNullSafe(0));
6066 // If T0 is Future<S0>, then T0 <: Future<S1>, iff S0 <: S1.
6067 if (type_arg.IsSubtypeOf(other_type_arg, space,
6068 function_type_equivalence)) {
6070 " - result: true (left is Future, right is FutureOr)\n");
6071 return true;
6072 }
6073 }
6074 // Check T0 <: Future<S1> when T0 is FutureOr<S0> is already done.
6075 // Check T0 <: S1.
6076 if (other_type_arg.HasTypeClass() &&
6077 Class::IsSubtypeOf(this_class, type_arguments, nullability,
6078 other_type_arg, space,
6079 function_type_equivalence)) {
6081 " - result: true (right is FutureOr, subtype of arg)\n");
6082 return true;
6083 }
6084 }
6085
6086 // Check for reflexivity.
6087 if (this_class.ptr() == other_class.ptr()) {
6088 const intptr_t num_type_params = this_class.NumTypeParameters();
6089 if (num_type_params == 0) {
6091 " - result: true (same non-generic class)\n");
6092 return true;
6093 }
6094 // Check for covariance.
6095 if (other_type_arguments.IsNull()) {
6097 " - result: true (same class, dynamic type args)\n");
6098 return true;
6099 }
6100 const intptr_t num_type_args = this_class.NumTypeArguments();
6101 const intptr_t from_index = num_type_args - num_type_params;
6102 ASSERT(other_type_arguments.Length() == num_type_params);
6104 AbstractType& other_type = AbstractType::Handle(zone);
6105 for (intptr_t i = 0; i < num_type_params; ++i) {
6106 type = type_arguments.TypeAtNullSafe(from_index + i);
6107 other_type = other_type_arguments.TypeAt(i);
6108 ASSERT(!type.IsNull() && !other_type.IsNull());
6109 if (!type.IsSubtypeOf(other_type, space, function_type_equivalence)) {
6111 " - result: false (same class, type args mismatch)\n");
6112 return false;
6113 }
6114 }
6116 " - result: true (same class, matching type args)\n");
6117 return true;
6118 }
6119
6120 // _Closure <: Function
6121 if (this_class.IsClosureClass() && other_class.IsDartFunctionClass()) {
6123 " - result: true (left is closure, right is Function)\n");
6124 return true;
6125 }
6126
6127 // Check for 'direct super type' specified in the implements clause
6128 // and check for transitivity at the same time.
6129 Array& interfaces = Array::Handle(zone, this_class.interfaces());
6130 Type& interface = Type::Handle(zone);
6131 Class& interface_class = Class::Handle(zone);
6132 TypeArguments& interface_args = TypeArguments::Handle(zone);
6133 for (intptr_t i = 0; i < interfaces.Length(); i++) {
6134 interface ^= interfaces.At(i);
6135 ASSERT(interface.IsFinalized());
6136 interface_class = interface.type_class();
6137 interface_args = interface.arguments();
6138 if (!interface_args.IsNull() && !interface_args.IsInstantiated()) {
6139 // This type class implements an interface that is parameterized with
6140 // generic type(s), e.g. it implements List<T>.
6141 // The uninstantiated type T must be instantiated using the type
6142 // parameters of this type before performing the type test.
6143 // The type arguments of this type that are referred to by the type
6144 // parameters of the interface are at the end of the type vector,
6145 // after the type arguments of the super type of this type.
6146 // The index of the type parameters is adjusted upon finalization.
6147 interface_args = interface_args.InstantiateFrom(
6148 type_arguments, Object::null_type_arguments(), kNoneFree, space);
6149 }
6150 interface_args = interface_class.GetInstanceTypeArguments(
6151 thread, interface_args, /*canonicalize=*/false);
6152 // In Dart 2, implementing Function has no meaning.
6153 // TODO(regis): Can we encounter and skip Object as well?
6154 if (interface_class.IsDartFunctionClass()) {
6155 continue;
6156 }
6157 if (Class::IsSubtypeOf(interface_class, interface_args,
6158 Nullability::kNonNullable, other, space,
6159 function_type_equivalence)) {
6160 TRACE_TYPE_CHECKS_VERBOSE(" - result: true (interface found)\n");
6161 return true;
6162 }
6163 }
6164 // "Recurse" up the class hierarchy until we have reached the top.
6165 this_class = this_class.SuperClass();
6166 if (this_class.IsNull()) {
6167 TRACE_TYPE_CHECKS_VERBOSE(" - result: false (supertype not found)\n");
6168 return false;
6169 }
6170 this_cid = this_class.id();
6171 }
6172 UNREACHABLE();
6173 return false;
6174}
static bool IsSubtypeOf(const Class &cls, const TypeArguments &type_arguments, Nullability nullability, const AbstractType &other, Heap::Space space, FunctionTypeMapping *function_type_equivalence=nullptr)
Definition object.cc:5975
static bool NullIsAssignableTo(const AbstractType &other)
Definition object.cc:20715
ObjectStore * object_store() const
Definition isolate.h:505
int32_t classid_t
Definition globals.h:524
@ kVoidCid
Definition class_id.h:254
@ kNoneFree
Definition object.h:2906
#define TRACE_TYPE_CHECKS_VERBOSE(format,...)
Definition object.cc:226

◆ IsTopLevel()

bool dart::Class::IsTopLevel ( ) const

Definition at line 6176 of file object.cc.

6176 {
6177 return Name() == Symbols::TopLevel().ptr();
6178}

◆ IsVoidClass()

bool dart::Class::IsVoidClass ( ) const
inline

Definition at line 1561 of file object.h.

1561{ return id() == kVoidCid; }

◆ kernel_offset()

intptr_t dart::Class::kernel_offset ( ) const
inline

Definition at line 1806 of file object.h.

1806 {
1807#if defined(DART_PRECOMPILED_RUNTIME)
1808 return 0;
1809#else
1810 return untag()->kernel_offset_;
1811#endif
1812 }

◆ KernelProgramInfo()

KernelProgramInfoPtr dart::Class::KernelProgramInfo ( ) const

Definition at line 5615 of file object.cc.

5615 {
5616 const auto& lib = Library::Handle(library());
5617 return lib.kernel_program_info();
5618}

◆ library()

LibraryPtr dart::Class::library ( ) const
inline

Definition at line 1335 of file object.h.

1335{ return untag()->library(); }

◆ LookupCanonicalInstance()

InstancePtr dart::Class::LookupCanonicalInstance ( Zone zone,
const Instance value 
) const

Definition at line 6527 of file object.cc.

6528 {
6529 ASSERT(this->ptr() == value.clazz());
6531 Instance& canonical_value = Instance::Handle(zone);
6532 if (this->constants() != Array::null()) {
6534 canonical_value ^= constants.GetOrNull(CanonicalInstanceKey(value));
6535 this->set_constants(constants.Release());
6536 }
6537 return canonical_value.ptr();
6538}

◆ LookupConstructor()

FunctionPtr dart::Class::LookupConstructor ( const String name) const

Definition at line 6202 of file object.cc.

6202 {
6203 Thread* thread = Thread::Current();
6204 SafepointReadRwLocker ml(thread, thread->isolate_group()->program_lock());
6205 return LookupFunctionReadLocked(name, kConstructor);
6206}
FunctionPtr LookupFunctionReadLocked(const String &name) const
Definition object.cc:6226

◆ LookupConstructorAllowPrivate()

FunctionPtr dart::Class::LookupConstructorAllowPrivate ( const String name) const

Definition at line 6208 of file object.cc.

6208 {
6209 return LookupFunctionAllowPrivate(name, kConstructor);
6210}
FunctionPtr LookupFunctionAllowPrivate(const String &name) const
Definition object.cc:6222

◆ LookupDynamicFunctionAllowPrivate()

FunctionPtr dart::Class::LookupDynamicFunctionAllowPrivate ( const String name) const

Definition at line 6188 of file object.cc.

6188 {
6189 return LookupFunctionAllowPrivate(name, kInstance);
6190}

◆ LookupDynamicFunctionUnsafe()

FunctionPtr dart::Class::LookupDynamicFunctionUnsafe ( const String name) const

Definition at line 6184 of file object.cc.

6184 {
6185 return LookupFunctionReadLocked(name, kInstance);
6186}

◆ LookupFactory()

FunctionPtr dart::Class::LookupFactory ( const String name) const

Definition at line 6212 of file object.cc.

6212 {
6213 Thread* thread = Thread::Current();
6214 SafepointReadRwLocker ml(thread, thread->isolate_group()->program_lock());
6215 return LookupFunctionReadLocked(name, kFactory);
6216}

◆ LookupFactoryAllowPrivate()

FunctionPtr dart::Class::LookupFactoryAllowPrivate ( const String name) const

Definition at line 6218 of file object.cc.

6218 {
6219 return LookupFunctionAllowPrivate(name, kFactory);
6220}

◆ LookupField()

FieldPtr dart::Class::LookupField ( const String name) const

Definition at line 6407 of file object.cc.

6407 {
6408 return LookupField(name, kAny);
6409}
FieldPtr LookupField(const String &name) const
Definition object.cc:6407

◆ LookupFieldAllowPrivate()

FieldPtr dart::Class::LookupFieldAllowPrivate ( const String name,
bool  instance_only = false 
) const

Definition at line 6458 of file object.cc.

6459 {
6460 ASSERT(!IsNull());
6461 // Use slow string compare, ignoring privacy name mangling.
6462 Thread* thread = Thread::Current();
6463 if (EnsureIsFinalized(thread) != Error::null()) {
6464 return Field::null();
6465 }
6469 Array& flds = thread->ArrayHandle();
6470 flds = fields();
6471 ASSERT(!flds.IsNull());
6472 intptr_t len = flds.Length();
6473 Field& field = thread->FieldHandle();
6474 String& field_name = thread->StringHandle();
6475 for (intptr_t i = 0; i < len; i++) {
6476 field ^= flds.At(i);
6477 field_name = field.name();
6478 if (field.is_static() && instance_only) {
6479 // If we only care about instance fields, skip statics.
6480 continue;
6481 }
6482 if (String::EqualsIgnoringPrivateKey(field_name, name)) {
6483 return field.ptr();
6484 }
6485 }
6486 return Field::null();
6487}
static bool EqualsIgnoringPrivateKey(const String &str1, const String &str2)
Definition object.cc:24378
#define REUSABLE_STRING_HANDLESCOPE(thread)

◆ LookupFunctionAllowPrivate()

FunctionPtr dart::Class::LookupFunctionAllowPrivate ( const String name) const

Definition at line 6222 of file object.cc.

6222 {
6223 return LookupFunctionAllowPrivate(name, kAny);
6224}

◆ LookupFunctionReadLocked()

FunctionPtr dart::Class::LookupFunctionReadLocked ( const String name) const

Definition at line 6226 of file object.cc.

6226 {
6227 return LookupFunctionReadLocked(name, kAny);
6228}

◆ LookupGetterFunction()

FunctionPtr dart::Class::LookupGetterFunction ( const String name) const

Definition at line 6363 of file object.cc.

6363 {
6364 return LookupAccessorFunction(kGetterPrefix, kGetterPrefixLength, name);
6365}
static const intptr_t kGetterPrefixLength
Definition object.cc:116
static const char *const kGetterPrefix
Definition object.cc:115

◆ LookupInstanceField()

FieldPtr dart::Class::LookupInstanceField ( const String name) const

Definition at line 6399 of file object.cc.

6399 {
6400 return LookupField(name, kInstance);
6401}

◆ LookupInstanceFieldAllowPrivate()

FieldPtr dart::Class::LookupInstanceFieldAllowPrivate ( const String name) const

Definition at line 6489 of file object.cc.

6489 {
6490 Field& field = Field::Handle(LookupFieldAllowPrivate(name, true));
6491 if (!field.IsNull() && !field.is_static()) {
6492 return field.ptr();
6493 }
6494 return Field::null();
6495}
FieldPtr LookupFieldAllowPrivate(const String &name, bool instance_only=false) const
Definition object.cc:6458

◆ LookupSetterFunction()

FunctionPtr dart::Class::LookupSetterFunction ( const String name) const

Definition at line 6367 of file object.cc.

6367 {
6368 return LookupAccessorFunction(kSetterPrefix, kSetterPrefixLength, name);
6369}
static const intptr_t kSetterPrefixLength
Definition object.cc:118
static const char *const kSetterPrefix
Definition object.cc:117

◆ LookupStaticField()

FieldPtr dart::Class::LookupStaticField ( const String name) const

Definition at line 6403 of file object.cc.

6403 {
6404 return LookupField(name, kStatic);
6405}

◆ LookupStaticFieldAllowPrivate()

FieldPtr dart::Class::LookupStaticFieldAllowPrivate ( const String name) const

Definition at line 6497 of file object.cc.

6497 {
6499 if (!field.IsNull() && field.is_static()) {
6500 return field.ptr();
6501 }
6502 return Field::null();
6503}

◆ LookupStaticFunction()

FunctionPtr dart::Class::LookupStaticFunction ( const String name) const

Definition at line 6192 of file object.cc.

6192 {
6193 Thread* thread = Thread::Current();
6194 SafepointReadRwLocker ml(thread, thread->isolate_group()->program_lock());
6195 return LookupFunctionReadLocked(name, kStatic);
6196}

◆ LookupStaticFunctionAllowPrivate()

FunctionPtr dart::Class::LookupStaticFunctionAllowPrivate ( const String name) const

Definition at line 6198 of file object.cc.

6198 {
6199 return LookupFunctionAllowPrivate(name, kStatic);
6200}

◆ MarkFieldBoxedDuringReload()

void dart::Class::MarkFieldBoxedDuringReload ( ClassTable class_table,
const Field field 
) const

Definition at line 605 of file object_reload.cc.

606 {
607 if (!field.is_unboxed()) {
608 return;
609 }
610
611 field.set_is_unboxed_unsafe(false);
612
613 // Make sure to update the bitmap used for scanning.
614 auto unboxed_fields_map = class_table->GetUnboxedFieldsMapAt(id());
615 const auto start_index = field.HostOffset() >> kCompressedWordSizeLog2;
616 const auto end_index =
617 start_index + (Class::UnboxedFieldSizeInBytesByCid(field.guarded_cid()) >>
619 ASSERT(unboxed_fields_map.Get(start_index));
620 for (intptr_t i = start_index; i < end_index; i++) {
621 unboxed_fields_map.Clear(i);
622 }
623 class_table->SetUnboxedFieldsMapAt(id(), unboxed_fields_map);
624}
static intptr_t UnboxedFieldSizeInBytesByCid(intptr_t cid)
Definition object.cc:3752
static constexpr intptr_t kCompressedWordSizeLog2
Definition globals.h:43

◆ MigrateImplicitStaticClosures()

void dart::Class::MigrateImplicitStaticClosures ( ProgramReloadContext context,
const Class new_cls 
) const

Definition at line 319 of file object_reload.cc.

320 {
321 const Array& funcs = Array::Handle(current_functions());
322 Thread* thread = Thread::Current();
323 Function& old_func = Function::Handle();
324 String& selector = String::Handle();
325 Function& new_func = Function::Handle();
326 Closure& old_closure = Closure::Handle();
327 Closure& new_closure = Closure::Handle();
328 for (intptr_t i = 0; i < funcs.Length(); i++) {
329 old_func ^= funcs.At(i);
330 if (old_func.is_static() && old_func.HasImplicitClosureFunction()) {
331 selector = old_func.name();
332 new_func = Resolver::ResolveFunction(thread->zone(), new_cls, selector);
333 if (!new_func.IsNull() && new_func.is_static()) {
334 old_func = old_func.ImplicitClosureFunction();
335 old_closure = old_func.ImplicitStaticClosure();
336 new_func = new_func.ImplicitClosureFunction();
337 new_closure = new_func.ImplicitStaticClosure();
338 if (old_closure.IsCanonical()) {
339 new_closure.SetCanonical();
340 }
341 irc->AddBecomeMapping(old_closure, new_closure);
342 }
343 }
344 }
345}
friend class Closure
Definition object.h:1019
static FunctionPtr ResolveFunction(Zone *zone, const Class &receiver_class, const String &function_name)
Definition resolver.cc:180

◆ Mixin()

ClassPtr dart::Class::Mixin ( ) const

Definition at line 3081 of file object.cc.

3081 {
3083 const Array& interfaces = Array::Handle(this->interfaces());
3084 const Type& mixin_type =
3086 return mixin_type.type_class();
3087 }
3088 return ptr();
3089}
bool is_transformed_mixin_application() const
Definition object.h:1756

◆ Name()

StringPtr dart::Class::Name ( ) const

Definition at line 3038 of file object.cc.

3038 {
3039 return untag()->name();
3040}

◆ NameCString()

const char * dart::Class::NameCString ( NameVisibility  name_visibility) const

Definition at line 3067 of file object.cc.

3067 {
3068 switch (name_visibility) {
3070 return String::Handle(Name()).ToCString();
3072 return ScrubbedNameCString();
3074 return UserVisibleNameCString();
3075 default:
3076 UNREACHABLE();
3077 return nullptr;
3078 }
3079}
const char * ScrubbedNameCString() const
Definition object.cc:3046
const char * UserVisibleNameCString() const
Definition object.cc:3059
@ kUserVisibleName
Definition object.h:645
@ kInternalName
Definition object.h:622
@ kScrubbedName
Definition object.h:633

◆ New() [1/2]

ClassPtr dart::Class::New ( const Library lib,
const String name,
const Script script,
TokenPosition  token_pos,
bool  register_class = true 
)
static

Definition at line 5216 of file object.cc.

5220 {
5221 Class& result =
5222 Class::Handle(NewCommon<Instance, RTN::Instance>(kIllegalCid));
5223 result.set_library(lib);
5224 result.set_name(name);
5225 result.set_script(script);
5226 NOT_IN_PRECOMPILED(result.set_token_pos(token_pos));
5227
5228 // The size gets initialized to 0. Once the class gets finalized the class
5229 // finalizer will set the correct size.
5230 ASSERT(!result.is_finalized() && !result.is_prefinalized());
5231 result.set_instance_size_in_words(0, 0);
5232
5233 if (register_class) {
5235 }
5236 return result.ptr();
5237}
TokenPosition token_pos() const
Definition object.h:1281
ScriptPtr script() const
Definition object.h:1274
void RegisterClass(const Class &cls)
Definition isolate.cc:763
@ kIllegalCid
Definition class_id.h:214
#define NOT_IN_PRECOMPILED(code)
Definition globals.h:100

◆ New() [2/2]

template<class FakeObject , class TargetFakeObject >
ClassPtr dart::Class::New ( IsolateGroup isolate_group,
bool  register_class = true 
)
static

Definition at line 3114 of file object.cc.

3114 {
3116 const auto& result = Class::Handle(Object::Allocate<Class>(Heap::kOld));
3117 Object::VerifyBuiltinVtable<FakeObject>(FakeObject::kClassId);
3118 NOT_IN_PRECOMPILED(result.set_token_pos(TokenPosition::kNoSource));
3119 NOT_IN_PRECOMPILED(result.set_end_token_pos(TokenPosition::kNoSource));
3120 result.set_instance_size(FakeObject::InstanceSize(),
3121 compiler::target::RoundedAllocationSize(
3122 TargetFakeObject::InstanceSize()));
3123 result.set_type_arguments_field_offset_in_words(kNoTypeArguments,
3124 RTN::Class::kNoTypeArguments);
3125 const intptr_t host_next_field_offset = FakeObject::NextFieldOffset();
3126 const intptr_t target_next_field_offset = TargetFakeObject::NextFieldOffset();
3127 result.set_next_field_offset(host_next_field_offset,
3129 COMPILE_ASSERT((FakeObject::kClassId != kInstanceCid));
3130 result.set_id(FakeObject::kClassId);
3131 NOT_IN_PRECOMPILED(result.set_implementor_cid(kIllegalCid));
3132 result.set_num_type_arguments_unsafe(0);
3133 result.set_num_native_fields(0);
3134 result.set_state_bits(0);
3135 if (IsInternalOnlyClassId(FakeObject::kClassId) ||
3136 (FakeObject::kClassId == kTypeArgumentsCid)) {
3137 // VM internal classes are done. There is no finalization needed or
3138 // possible in this case.
3139 result.set_is_declaration_loaded();
3140 result.set_is_type_finalized();
3141 result.set_is_allocate_finalized();
3142 } else if (FakeObject::kClassId != kClosureCid) {
3143 // VM backed classes are almost ready: run checks and resolve class
3144 // references, but do not recompute size.
3145 result.set_is_prefinalized();
3146 }
3147 if (FakeObject::kClassId < kNumPredefinedCids &&
3148 IsDeeplyImmutableCid(FakeObject::kClassId)) {
3149 result.set_is_deeply_immutable(true);
3150 }
3151 NOT_IN_PRECOMPILED(result.set_kernel_offset(0));
3152 result.InitEmptyFields();
3153 if (register_class) {
3154 isolate_group->class_table()->Register(result);
3155 }
3156 return result.ptr();
3157}
#define COMPILE_ASSERT(expr)
Definition assert.h:339
intptr_t host_next_field_offset() const
Definition object.h:1192
intptr_t target_next_field_offset() const
Definition object.h:1195
static ClassPtr class_class()
Definition object.h:513
bool IsInternalOnlyClassId(intptr_t index)
Definition class_id.h:299
bool IsDeeplyImmutableCid(intptr_t predefined_cid)
Definition class_id.h:485

◆ NewExternalTypedDataClass()

ClassPtr dart::Class::NewExternalTypedDataClass ( intptr_t  class_id,
IsolateGroup isolate 
)
static

Definition at line 5373 of file object.cc.

5374 {
5377 const intptr_t target_instance_size = compiler::target::RoundedAllocationSize(
5378 RTN::ExternalTypedData::InstanceSize());
5379 Class& result = Class::Handle(New<ExternalTypedData, RTN::ExternalTypedData>(
5380 class_id, isolate_group, /*register_class=*/false));
5381
5382 const intptr_t host_next_field_offset = ExternalTypedData::NextFieldOffset();
5383 const intptr_t target_next_field_offset =
5384 RTN::ExternalTypedData::NextFieldOffset();
5386 result.set_next_field_offset(host_next_field_offset,
5388 result.set_is_prefinalized();
5389 isolate_group->class_table()->Register(result);
5390 return result.ptr();
5391}
intptr_t target_instance_size() const
Definition object.h:1149
intptr_t host_instance_size() const
Definition object.h:1145
static intptr_t InstanceSize()
Definition object.h:11714
bool IsExternalTypedDataClassId(intptr_t index)
Definition class_id.h:447

◆ NewNativeWrapper()

ClassPtr dart::Class::NewNativeWrapper ( const Library library,
const String name,
int  num_fields 
)
static

Definition at line 5244 of file object.cc.

5246 {
5247 Class& cls = Class::Handle(library.LookupClass(name));
5248 if (cls.IsNull()) {
5249 cls = New(library, name, Script::Handle(), TokenPosition::kNoSource);
5250 cls.SetFields(Object::empty_array());
5251 cls.SetFunctions(Object::empty_array());
5252 // Set super class to Object.
5253 cls.set_super_type(Type::Handle(Type::ObjectType()));
5254 // Compute instance size. First word contains a pointer to a properly
5255 // sized typed array once the first native field has been set.
5256 const intptr_t host_instance_size =
5257 sizeof(UntaggedInstance) + kCompressedWordSize;
5258#if defined(DART_PRECOMPILER)
5259 const intptr_t target_instance_size =
5260 compiler::target::Instance::InstanceSize() +
5261 compiler::target::kCompressedWordSize;
5262#else
5263 const intptr_t target_instance_size =
5264 sizeof(UntaggedInstance) + compiler::target::kCompressedWordSize;
5265#endif
5266 cls.set_instance_size(
5268 compiler::target::RoundedAllocationSize(target_instance_size));
5269 cls.set_next_field_offset(host_instance_size, target_instance_size);
5270 cls.set_num_native_fields(field_count);
5271 cls.set_is_allocate_finalized();
5272 // The signature of the constructor yet to be added to this class will have
5273 // to be finalized explicitly, since the class is prematurely marked as
5274 // 'is_allocate_finalized' and finalization of member types will not occur.
5275 cls.set_is_declaration_loaded();
5276 cls.set_is_type_finalized();
5277 cls.set_is_synthesized_class();
5278 cls.set_is_isolate_unsendable(true);
5279 NOT_IN_PRECOMPILED(cls.set_implementor_cid(kDynamicCid));
5280 library.AddClass(cls);
5281 return cls.ptr();
5282 } else {
5283 return Class::null();
5284 }
5285}
static ClassPtr New(IsolateGroup *isolate_group, bool register_class=true)
Definition object.cc:3114
static TypePtr ObjectType()
Definition object.cc:21878

◆ NewPointerClass()

ClassPtr dart::Class::NewPointerClass ( intptr_t  class_id,
IsolateGroup isolate_group 
)
static

Definition at line 5393 of file object.cc.

5394 {
5395 ASSERT(IsFfiPointerClassId(class_id));
5397 intptr_t target_instance_size =
5398 compiler::target::RoundedAllocationSize(RTN::Pointer::InstanceSize());
5399 Class& result = Class::Handle(New<Pointer, RTN::Pointer>(
5400 class_id, isolate_group, /*register_class=*/false));
5402 result.set_type_arguments_field_offset(Pointer::type_arguments_offset(),
5403 RTN::Pointer::type_arguments_offset());
5404
5405 const intptr_t host_next_field_offset = Pointer::NextFieldOffset();
5406 const intptr_t target_next_field_offset = RTN::Pointer::NextFieldOffset();
5407
5408 result.set_next_field_offset(host_next_field_offset,
5410 result.set_is_prefinalized();
5411 isolate_group->class_table()->Register(result);
5412 return result.ptr();
5413}
static intptr_t type_arguments_offset()
Definition object.h:11876
static intptr_t InstanceSize()
Definition object.h:11861
bool IsFfiPointerClassId(intptr_t index)
Definition class_id.h:541

◆ NewStringClass()

ClassPtr dart::Class::NewStringClass ( intptr_t  class_id,
IsolateGroup isolate_group 
)
static

Definition at line 5287 of file object.cc.

5287 {
5289 if (class_id == kOneByteStringCid) {
5291 target_instance_size = compiler::target::RoundedAllocationSize(
5292 RTN::OneByteString::InstanceSize());
5293 } else {
5294 ASSERT(class_id == kTwoByteStringCid);
5296 target_instance_size = compiler::target::RoundedAllocationSize(
5297 RTN::TwoByteString::InstanceSize());
5298 }
5299 Class& result = Class::Handle(New<String, RTN::String>(
5300 class_id, isolate_group, /*register_class=*/false));
5302
5303 const intptr_t host_next_field_offset = String::NextFieldOffset();
5304 const intptr_t target_next_field_offset = RTN::String::NextFieldOffset();
5305 result.set_next_field_offset(host_next_field_offset,
5307 result.set_is_prefinalized();
5308 ASSERT(IsDeeplyImmutableCid(class_id));
5309 result.set_is_deeply_immutable(true);
5310 isolate_group->class_table()->Register(result);
5311 return result.ptr();
5312}
static intptr_t InstanceSize()
Definition object.h:10543
static intptr_t InstanceSize()
Definition object.h:10683

◆ NewTypedDataClass()

ClassPtr dart::Class::NewTypedDataClass ( intptr_t  class_id,
IsolateGroup isolate_group 
)
static

Definition at line 5314 of file object.cc.

5315 {
5316 ASSERT(IsTypedDataClassId(class_id));
5318 const intptr_t target_instance_size =
5319 compiler::target::RoundedAllocationSize(RTN::TypedData::InstanceSize());
5320 Class& result = Class::Handle(New<TypedData, RTN::TypedData>(
5321 class_id, isolate_group, /*register_class=*/false));
5323
5324 const intptr_t host_next_field_offset = TypedData::NextFieldOffset();
5325 const intptr_t target_next_field_offset = RTN::TypedData::NextFieldOffset();
5326 result.set_next_field_offset(host_next_field_offset,
5328 result.set_is_prefinalized();
5329 isolate_group->class_table()->Register(result);
5330 return result.ptr();
5331}
static intptr_t InstanceSize()
Definition object.h:11647
bool IsTypedDataClassId(intptr_t index)
Definition class_id.h:433

◆ NewTypedDataViewClass()

ClassPtr dart::Class::NewTypedDataViewClass ( intptr_t  class_id,
IsolateGroup isolate_group 
)
static

Definition at line 5333 of file object.cc.

5334 {
5335 ASSERT(IsTypedDataViewClassId(class_id));
5337 const intptr_t target_instance_size = compiler::target::RoundedAllocationSize(
5338 RTN::TypedDataView::InstanceSize());
5339 Class& result = Class::Handle(New<TypedDataView, RTN::TypedDataView>(
5340 class_id, isolate_group, /*register_class=*/false));
5342
5343 const intptr_t host_next_field_offset = TypedDataView::NextFieldOffset();
5344 const intptr_t target_next_field_offset =
5345 RTN::TypedDataView::NextFieldOffset();
5346 result.set_next_field_offset(host_next_field_offset,
5348 result.set_is_prefinalized();
5349 isolate_group->class_table()->Register(result);
5350 return result.ptr();
5351}
static intptr_t InstanceSize()
Definition object.h:11767
bool IsTypedDataViewClassId(intptr_t index)
Definition class_id.h:439

◆ NewUnmodifiableTypedDataViewClass()

ClassPtr dart::Class::NewUnmodifiableTypedDataViewClass ( intptr_t  class_id,
IsolateGroup isolate_group 
)
static

Definition at line 5353 of file object.cc.

5354 {
5357 const intptr_t target_instance_size = compiler::target::RoundedAllocationSize(
5358 RTN::TypedDataView::InstanceSize());
5359 Class& result = Class::Handle(New<TypedDataView, RTN::TypedDataView>(
5360 class_id, isolate_group, /*register_class=*/false));
5362
5363 const intptr_t host_next_field_offset = TypedDataView::NextFieldOffset();
5364 const intptr_t target_next_field_offset =
5365 RTN::TypedDataView::NextFieldOffset();
5366 result.set_next_field_offset(host_next_field_offset,
5368 result.set_is_prefinalized();
5369 isolate_group->class_table()->Register(result);
5370 return result.ptr();
5371}
bool IsUnmodifiableTypedDataViewClassId(intptr_t index)
Definition class_id.h:453

◆ NoteImplementor()

bool dart::Class::NoteImplementor ( const Class implementor) const

Definition at line 5635 of file object.cc.

5635 {
5636 ASSERT(!implementor.is_abstract());
5637 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5638 if (implementor_cid() == kDynamicCid) {
5639 return false;
5640 } else if (implementor_cid() == implementor.id()) {
5641 return false;
5642 } else if (implementor_cid() == kIllegalCid) {
5643 set_implementor_cid(implementor.id());
5644 return true; // None -> One
5645 } else {
5646 set_implementor_cid(kDynamicCid);
5647 return true; // One -> Many
5648 }
5649}
intptr_t implementor_cid() const
Definition object.h:1247

◆ num_native_fields()

uint16_t dart::Class::num_native_fields ( ) const
inline

Definition at line 1790 of file object.h.

1790{ return untag()->num_native_fields_; }

◆ num_type_arguments_offset()

static intptr_t dart::Class::num_type_arguments_offset ( )
inlinestatic

Definition at line 1254 of file object.h.

1254 {
1255 return OFFSET_OF(UntaggedClass, num_type_arguments_);
1256 }

◆ NumNativeFieldsOf()

static uint16_t dart::Class::NumNativeFieldsOf ( ClassPtr  clazz)
inlinestatic

Definition at line 1794 of file object.h.

1794 {
1795 return clazz->untag()->num_native_fields_;
1796 }

◆ NumTypeArguments()

intptr_t dart::Class::NumTypeArguments ( ) const

Definition at line 3690 of file object.cc.

3690 {
3691 // Return cached value if already calculated.
3692 intptr_t num_type_args = num_type_arguments();
3693 if (num_type_args != kUnknownNumTypeArguments) {
3694 return num_type_args;
3695 }
3696
3697#if defined(DART_PRECOMPILED_RUNTIME)
3698 UNREACHABLE();
3699 return 0;
3700#else
3701 num_type_args = ComputeNumTypeArguments();
3702 ASSERT(num_type_args != kUnknownNumTypeArguments);
3703 set_num_type_arguments(num_type_args);
3704 return num_type_args;
3705#endif // defined(DART_PRECOMPILED_RUNTIME)
3706}
void set_num_type_arguments(intptr_t value) const
Definition object.cc:3170

◆ NumTypeParameters() [1/2]

intptr_t dart::Class::NumTypeParameters ( ) const
inline

Definition at line 1346 of file object.h.

1346 {
1348 }

◆ NumTypeParameters() [2/2]

intptr_t dart::Class::NumTypeParameters ( Thread thread) const

Definition at line 3605 of file object.cc.

3605 {
3606 if (!is_declaration_loaded()) {
3608 const intptr_t cid = id();
3609 if ((cid == kArrayCid) || (cid == kImmutableArrayCid) ||
3610 (cid == kGrowableObjectArrayCid)) {
3611 return 1; // List's type parameter may not have been parsed yet.
3612 }
3613 return 0;
3614 }
3616 return 0;
3617 }
3619 TypeParameters& type_params = thread->TypeParametersHandle();
3620 type_params = type_parameters();
3621 return type_params.Length();
3622}
#define REUSABLE_TYPE_PARAMETERS_HANDLESCOPE(thread)

◆ OffsetToFieldMap()

ArrayPtr dart::Class::OffsetToFieldMap ( ClassTable class_table = nullptr) const

Definition at line 3233 of file object.cc.

3234 {
3236 if (untag()->offset_in_words_to_field<std::memory_order_acquire>() ==
3237 Array::null()) {
3238 // Even if multiple threads are calling this concurrently, all of them would
3239 // compute the same array, so we intentionally don't acquire any locks here.
3240 const intptr_t length = untag()->host_instance_size_in_words_;
3241 const Array& array = Array::Handle(Array::New(length, Heap::kOld));
3242 Class& cls = Class::Handle(this->ptr());
3243 Array& fields = Array::Handle();
3244 Field& f = Field::Handle();
3245 while (!cls.IsNull()) {
3246 fields = cls.fields();
3247 for (intptr_t i = 0; i < fields.Length(); ++i) {
3248 f ^= fields.At(i);
3249 if (f.is_instance()) {
3250 array.SetAt(f.HostOffset() >> kCompressedWordSizeLog2, f);
3251 }
3252 }
3253 cls = cls.SuperClass(class_table);
3254 }
3255 untag()->set_offset_in_words_to_field<std::memory_order_release>(
3256 array.ptr());
3257 }
3258 return untag()->offset_in_words_to_field<std::memory_order_acquire>();
3259}
size_t length

◆ PatchFieldsAndFunctions()

void dart::Class::PatchFieldsAndFunctions ( ) const

Definition at line 270 of file object_reload.cc.

270 {
271 // Move all old functions and fields to a patch class so that they
272 // still refer to their original script.
273 const auto& kernel_info = KernelProgramInfo::Handle(KernelProgramInfo());
274 const PatchClass& patch = PatchClass::Handle(
275 PatchClass::New(*this, kernel_info, Script::Handle(script())));
276 ASSERT(!patch.IsNull());
277 const Library& lib = Library::Handle(library());
278 patch.set_kernel_library_index(lib.kernel_library_index());
279
280 const Array& funcs = Array::Handle(current_functions());
281 Function& func = Function::Handle();
282 Object& owner = Object::Handle();
283 for (intptr_t i = 0; i < funcs.Length(); i++) {
284 func = Function::RawCast(funcs.At(i));
285 if ((func.token_pos() == TokenPosition::kMinSource) ||
286 func.IsClosureFunction()) {
287 // Eval functions do not need to have their script updated.
288 //
289 // Closure functions refer to the parent's script which we can
290 // rely on being updated for us, if necessary.
291 continue;
292 }
293
294 // If the source for this function is already patched, leave it alone.
295 owner = func.RawOwner();
296 ASSERT(!owner.IsNull());
297 if (!owner.IsPatchClass()) {
298 ASSERT(owner.ptr() == this->ptr());
299 func.set_owner(patch);
300 }
301 }
302
303 Thread* thread = Thread::Current();
304 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
305 const Array& field_list = Array::Handle(fields());
306 Field& field = Field::Handle();
307 for (intptr_t i = 0; i < field_list.Length(); i++) {
308 field = Field::RawCast(field_list.At(i));
309 owner = field.RawOwner();
310 ASSERT(!owner.IsNull());
311 if (!owner.IsPatchClass()) {
312 ASSERT(owner.ptr() == this->ptr());
313 field.set_owner(patch);
314 }
315 field.ForceDynamicGuardedCidAndLength();
316 }
317}
KernelProgramInfoPtr KernelProgramInfo() const
Definition object.cc:5615

◆ RareType()

TypePtr dart::Class::RareType ( ) const

Definition at line 3097 of file object.cc.

3097 {
3098 if (!IsGeneric()) {
3099 return DeclarationType();
3100 }
3102 Thread* const thread = Thread::Current();
3103 Zone* const zone = thread->zone();
3104 const auto& inst_to_bounds =
3106 ASSERT(inst_to_bounds.ptr() != Object::empty_type_arguments().ptr());
3107 auto& type = Type::Handle(
3108 zone, Type::New(*this, inst_to_bounds, Nullability::kNonNullable));
3110 return type.ptr();
3111}
TypeArgumentsPtr DefaultTypeArguments(Zone *zone) const
Definition object.cc:3708
bool IsGeneric() const
Definition object.h:1360

◆ RegisterCHACode()

void dart::Class::RegisterCHACode ( const Code code)

Definition at line 4445 of file object.cc.

4445 {
4446 if (FLAG_trace_cha) {
4447 THR_Print("RegisterCHACode '%s' depends on class '%s'\n",
4448 Function::Handle(code.function()).ToQualifiedCString(),
4449 ToCString());
4450 }
4451 DEBUG_ASSERT(IsMutatorOrAtDeoptSafepoint());
4452 ASSERT(code.is_optimized());
4453 CHACodeArray a(*this);
4454 a.Register(code);
4455}

◆ script()

ScriptPtr dart::Class::script ( ) const
inline

Definition at line 1274 of file object.h.

1274{ return untag()->script(); }

◆ ScrubbedName()

StringPtr dart::Class::ScrubbedName ( ) const

Definition at line 3042 of file object.cc.

3042 {
3044}

◆ ScrubbedNameCString()

const char * dart::Class::ScrubbedNameCString ( ) const

Definition at line 3046 of file object.cc.

3046 {
3048}
static const char * ScrubName(const String &name, bool is_extension=false)
Definition object.cc:287

◆ set_allocation_stub()

void dart::Class::set_allocation_stub ( const Code value) const

Definition at line 5925 of file object.cc.

5925 {
5926 // Never clear the stub as it may still be a target, but will be GC-d if
5927 // not referenced.
5928 ASSERT(!value.IsNull());
5930 untag()->set_allocation_stub(value.ptr());
5931}

◆ set_can_be_future()

void dart::Class::set_can_be_future ( bool  value) const

Definition at line 3215 of file object.cc.

3215 {
3216 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
3217 set_state_bits(CanBeFutureBit::update(value, state_bits()));
3218}
static constexpr uint32_t update(bool value, uint32_t original)
Definition bitfield.h:190

◆ set_constants()

void dart::Class::set_constants ( const Array value) const

Definition at line 5865 of file object.cc.

5865 {
5866 untag()->set_constants(value.ptr());
5867}

◆ set_dependent_code()

void dart::Class::set_dependent_code ( const WeakArray array) const

Definition at line 4481 of file object.cc.

4481 {
4483 IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
4484 untag()->set_dependent_code(array.ptr());
4485}

◆ set_direct_implementors()

void dart::Class::set_direct_implementors ( const GrowableObjectArray implementors) const

Definition at line 5827 of file object.cc.

5828 {
5829 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5830 untag()->set_direct_implementors(implementors.ptr());
5831}

◆ set_direct_subclasses()

void dart::Class::set_direct_subclasses ( const GrowableObjectArray subclasses) const

Definition at line 5854 of file object.cc.

5854 {
5855 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5856 untag()->set_direct_subclasses(subclasses.ptr());
5857}

◆ set_end_token_pos()

void dart::Class::set_end_token_pos ( TokenPosition  value) const

Definition at line 5625 of file object.cc.

5625 {
5627 StoreNonPointer(&untag()->end_token_pos_, token_pos);
5628}
void StoreNonPointer(const FieldType *addr, ValueType value) const
Definition object.h:819
bool IsClassifying() const

◆ set_has_pragma()

void dart::Class::set_has_pragma ( bool  value) const

Definition at line 3190 of file object.cc.

3190 {
3191 set_state_bits(HasPragmaBit::update(value, state_bits()));
3192}

◆ set_id()

void dart::Class::set_id ( intptr_t  value) const
inline

Definition at line 1236 of file object.h.

1236 {
1237 ASSERT(value >= 0 && value < std::numeric_limits<classid_t>::max());
1238 StoreNonPointer(&untag()->id_, value);
1239 }

◆ set_instance_size()

void dart::Class::set_instance_size ( intptr_t  host_value_in_bytes,
intptr_t  target_value_in_bytes 
) const
inline

Definition at line 1169 of file object.h.

1170 {
1173 host_value_in_bytes / kCompressedWordSize,
1174 target_value_in_bytes / compiler::target::kCompressedWordSize);
1175 }
void set_instance_size_in_words(intptr_t host_value, intptr_t target_value) const
Definition object.h:1176

◆ set_instance_size_in_words()

void dart::Class::set_instance_size_in_words ( intptr_t  host_value,
intptr_t  target_value 
) const
inline

Definition at line 1176 of file object.h.

1177 {
1178 ASSERT(
1180 StoreNonPointer(&untag()->host_instance_size_in_words_, host_value);
1181#if defined(DART_PRECOMPILER)
1182 ASSERT(
1183 Utils::IsAligned((target_value * compiler::target::kCompressedWordSize),
1184 compiler::target::kObjectAlignment));
1185 StoreNonPointer(&untag()->target_instance_size_in_words_, target_value);
1186#else
1187 // Could be different only during cross-compilation.
1188 ASSERT_EQUAL(host_value, target_value);
1189#endif // defined(DART_PRECOMPILER)
1190 }
static constexpr bool IsAligned(T x, uintptr_t alignment, uintptr_t offset=0)
Definition utils.h:77
static constexpr intptr_t kObjectAlignment

◆ set_interfaces()

void dart::Class::set_interfaces ( const Array value) const

Definition at line 5794 of file object.cc.

5794 {
5795 ASSERT(!value.IsNull());
5796 untag()->set_interfaces(value.ptr());
5797}

◆ set_is_abstract()

void dart::Class::set_is_abstract ( ) const

Definition at line 5677 of file object.cc.

5677 {
5678 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5679 set_state_bits(AbstractBit::update(true, state_bits()));
5680}

◆ set_is_allocate_finalized()

void dart::Class::set_is_allocate_finalized ( ) const

Definition at line 5780 of file object.cc.

5780 {
5781 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5784 state_bits()));
5785}

◆ set_is_allocated()

void dart::Class::set_is_allocated ( bool  value) const

Definition at line 5755 of file object.cc.

5755 {
5756 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5758}
void set_is_allocated_unsafe(bool value) const
Definition object.cc:5760

◆ set_is_allocated_unsafe()

void dart::Class::set_is_allocated_unsafe ( bool  value) const

Definition at line 5760 of file object.cc.

5760 {
5761 set_state_bits(IsAllocatedBit::update(value, state_bits()));
5762}

◆ set_is_base_class()

void dart::Class::set_is_base_class ( ) const

Definition at line 5735 of file object.cc.

5735 {
5736 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5737 set_state_bits(BaseClassBit::update(true, state_bits()));
5738}

◆ set_is_const()

void dart::Class::set_is_const ( ) const

Definition at line 5715 of file object.cc.

5715 {
5716 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5717 set_state_bits(ConstBit::update(true, state_bits()));
5718}

◆ set_is_declaration_loaded()

void dart::Class::set_is_declaration_loaded ( ) const

Definition at line 5682 of file object.cc.

5682 {
5683 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5685}
void set_is_declaration_loaded_unsafe() const
Definition object.cc:5687

◆ set_is_declaration_loaded_unsafe()

void dart::Class::set_is_declaration_loaded_unsafe ( ) const

Definition at line 5687 of file object.cc.

5687 {
5690 state_bits()));
5691}

◆ set_is_deeply_immutable()

void dart::Class::set_is_deeply_immutable ( bool  value) const

Definition at line 3205 of file object.cc.

3205 {
3206 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
3207 set_state_bits(IsDeeplyImmutableBit::update(value, state_bits()));
3208}

◆ set_is_enum_class()

void dart::Class::set_is_enum_class ( ) const

Definition at line 5710 of file object.cc.

5710 {
5711 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5712 set_state_bits(EnumBit::update(true, state_bits()));
5713}

◆ set_is_fields_marked_nullable()

void dart::Class::set_is_fields_marked_nullable ( ) const

Definition at line 5750 of file object.cc.

5750 {
5751 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5752 set_state_bits(FieldsMarkedNullableBit::update(true, state_bits()));
5753}

◆ set_is_final()

void dart::Class::set_is_final ( ) const

Definition at line 5745 of file object.cc.

5745 {
5746 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5747 set_state_bits(FinalBit::update(true, state_bits()));
5748}

◆ set_is_finalized()

void dart::Class::set_is_finalized ( ) const

Definition at line 5769 of file object.cc.

5769 {
5770 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5771 ASSERT(!is_finalized());
5773}
void set_is_finalized_unsafe() const
Definition object.cc:5775

◆ set_is_finalized_unsafe()

void dart::Class::set_is_finalized_unsafe ( ) const

Definition at line 5775 of file object.cc.

5775 {
5776 set_state_bits(
5778}

◆ set_is_future_subtype()

void dart::Class::set_is_future_subtype ( bool  value) const

Definition at line 3210 of file object.cc.

3210 {
3211 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
3212 set_state_bits(IsFutureSubtypeBit::update(value, state_bits()));
3213}

◆ set_is_implemented()

void dart::Class::set_is_implemented ( ) const

Definition at line 5668 of file object.cc.

5668 {
5669 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5671}
void set_is_implemented_unsafe() const
Definition object.cc:5673

◆ set_is_implemented_unsafe()

void dart::Class::set_is_implemented_unsafe ( ) const

Definition at line 5673 of file object.cc.

5673 {
5674 set_state_bits(ImplementedBit::update(true, state_bits()));
5675}

◆ set_is_interface_class()

void dart::Class::set_is_interface_class ( ) const

Definition at line 5740 of file object.cc.

5740 {
5741 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5742 set_state_bits(InterfaceClassBit::update(true, state_bits()));
5743}

◆ set_is_isolate_unsendable()

void dart::Class::set_is_isolate_unsendable ( bool  value) const

Definition at line 3194 of file object.cc.

3194 {
3195 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
3196 set_state_bits(IsIsolateUnsendableBit::update(value, state_bits()));
3197}

◆ set_is_isolate_unsendable_due_to_pragma()

void dart::Class::set_is_isolate_unsendable_due_to_pragma ( bool  value) const

Definition at line 3199 of file object.cc.

3199 {
3200 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
3201 set_state_bits(
3202 IsIsolateUnsendableDueToPragmaBit::update(value, state_bits()));
3203}

◆ set_is_loaded()

void dart::Class::set_is_loaded ( bool  value) const

Definition at line 5764 of file object.cc.

5764 {
5765 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5766 set_state_bits(IsLoadedBit::update(value, state_bits()));
5767}

◆ set_is_mixin_class()

void dart::Class::set_is_mixin_class ( ) const

Definition at line 5730 of file object.cc.

5730 {
5731 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5732 set_state_bits(MixinClassBit::update(true, state_bits()));
5733}

◆ set_is_prefinalized()

void dart::Class::set_is_prefinalized ( ) const

Definition at line 5787 of file object.cc.

5787 {
5788 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5789 ASSERT(!is_finalized());
5790 set_state_bits(
5792}

◆ set_is_sealed()

void dart::Class::set_is_sealed ( ) const

Definition at line 5725 of file object.cc.

5725 {
5726 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5727 set_state_bits(SealedBit::update(true, state_bits()));
5728}

◆ set_is_synthesized_class()

void dart::Class::set_is_synthesized_class ( ) const

Definition at line 5701 of file object.cc.

5701 {
5702 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5704}
void set_is_synthesized_class_unsafe() const
Definition object.cc:5706

◆ set_is_synthesized_class_unsafe()

void dart::Class::set_is_synthesized_class_unsafe ( ) const

Definition at line 5706 of file object.cc.

5706 {
5707 set_state_bits(SynthesizedClassBit::update(true, state_bits()));
5708}

◆ set_is_transformed_mixin_application()

void dart::Class::set_is_transformed_mixin_application ( ) const

Definition at line 5720 of file object.cc.

5720 {
5721 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5722 set_state_bits(TransformedMixinApplicationBit::update(true, state_bits()));
5723}

◆ set_is_type_finalized()

void dart::Class::set_is_type_finalized ( ) const

Definition at line 5693 of file object.cc.

5693 {
5694 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5697 set_state_bits(
5699}

◆ set_kernel_offset()

void dart::Class::set_kernel_offset ( intptr_t  value) const
inline

Definition at line 1814 of file object.h.

1814 {
1815#if defined(DART_PRECOMPILED_RUNTIME)
1816 UNREACHABLE();
1817#else
1818 ASSERT(value >= 0);
1819 StoreNonPointer(&untag()->kernel_offset_, value);
1820#endif
1821 }

◆ set_library()

void dart::Class::set_library ( const Library value) const

Definition at line 3488 of file object.cc.

3488 {
3489 untag()->set_library(value.ptr());
3490}

◆ set_next_field_offset()

void dart::Class::set_next_field_offset ( intptr_t  host_value_in_bytes,
intptr_t  target_value_in_bytes 
) const
inline

Definition at line 1203 of file object.h.

1204 {
1206 host_value_in_bytes / kCompressedWordSize,
1207 target_value_in_bytes / compiler::target::kCompressedWordSize);
1208 }
void set_next_field_offset_in_words(intptr_t host_value, intptr_t target_value) const
Definition object.h:1209

◆ set_next_field_offset_in_words()

void dart::Class::set_next_field_offset_in_words ( intptr_t  host_value,
intptr_t  target_value 
) const
inline

Definition at line 1209 of file object.h.

1210 {
1211 // Assert that the next field offset is either negative (ie, this object
1212 // can't be extended by dart code), or rounds up to the kObjectAligned
1213 // instance size.
1214 ASSERT((host_value < 0) ||
1215 ((host_value <= untag()->host_instance_size_in_words_) &&
1216 (host_value + (kObjectAlignment / kCompressedWordSize) >
1217 untag()->host_instance_size_in_words_)));
1218 StoreNonPointer(&untag()->host_next_field_offset_in_words_, host_value);
1219#if defined(DART_PRECOMPILER)
1220 ASSERT((target_value < 0) ||
1221 ((target_value <= untag()->target_instance_size_in_words_) &&
1222 (target_value + (compiler::target::kObjectAlignment /
1223 compiler::target::kCompressedWordSize) >
1224 untag()->target_instance_size_in_words_)));
1225 StoreNonPointer(&untag()->target_next_field_offset_in_words_, target_value);
1226#else
1227 // Could be different only during cross-compilation.
1228 ASSERT_EQUAL(host_value, target_value);
1229#endif // defined(DART_PRECOMPILER)
1230 }

◆ set_num_native_fields()

void dart::Class::set_num_native_fields ( uint16_t  value) const
inline

Definition at line 1791 of file object.h.

1791 {
1792 StoreNonPointer(&untag()->num_native_fields_, value);
1793 }

◆ set_num_type_arguments()

void dart::Class::set_num_type_arguments ( intptr_t  value) const

Definition at line 3170 of file object.cc.

3170 {
3171#if defined(DART_PRECOMPILED_RUNTIME)
3172 UNREACHABLE();
3173#else
3174 if (!Utils::IsInt(16, value)) {
3176 }
3177 // We allow concurrent calculation of the number of type arguments. If two
3178 // threads perform this operation it doesn't matter which one wins.
3179 DEBUG_ONLY(intptr_t old_value = num_type_arguments());
3180 DEBUG_ASSERT(old_value == kUnknownNumTypeArguments || old_value == value);
3181 StoreNonPointer<int16_t, int16_t, std::memory_order_relaxed>(
3182 &untag()->num_type_arguments_, value);
3183#endif // defined(DART_PRECOMPILED_RUNTIME)
3184}
static bool IsInt(intptr_t N, T value)
Definition utils.h:298
static void ReportTooManyTypeArguments(const Class &cls)
Definition object.cc:3160
#define DEBUG_ONLY(code)
Definition globals.h:141

◆ set_num_type_arguments_unsafe()

void dart::Class::set_num_type_arguments_unsafe ( intptr_t  value) const

Definition at line 3186 of file object.cc.

3186 {
3187 StoreNonPointer(&untag()->num_type_arguments_, value);
3188}

◆ set_script()

void dart::Class::set_script ( const Script value) const

Definition at line 5610 of file object.cc.

5610 {
5611 untag()->set_script(value.ptr());
5612}

◆ set_super_type()

void dart::Class::set_super_type ( const Type value) const

Definition at line 3734 of file object.cc.

3734 {
3735 ASSERT(value.IsNull() || !value.IsDynamicType());
3736 untag()->set_super_type(value.ptr());
3737}

◆ set_token_pos()

void dart::Class::set_token_pos ( TokenPosition  value) const

Definition at line 5620 of file object.cc.

5620 {
5622 StoreNonPointer(&untag()->token_pos_, token_pos);
5623}

◆ set_type_arguments_field_offset()

void dart::Class::set_type_arguments_field_offset ( intptr_t  host_value_in_bytes,
intptr_t  target_value_in_bytes 
) const
inline

Definition at line 1399 of file object.h.

1400 {
1401 intptr_t host_value, target_value;
1402 if (host_value_in_bytes == kNoTypeArguments ||
1403 target_value_in_bytes == RTN::Class::kNoTypeArguments) {
1404 ASSERT(host_value_in_bytes == kNoTypeArguments &&
1405 target_value_in_bytes == RTN::Class::kNoTypeArguments);
1406 host_value = kNoTypeArguments;
1407 target_value = RTN::Class::kNoTypeArguments;
1408 } else {
1409 ASSERT(kCompressedWordSize != 0 && compiler::target::kCompressedWordSize);
1410 host_value = host_value_in_bytes / kCompressedWordSize;
1411 target_value =
1412 target_value_in_bytes / compiler::target::kCompressedWordSize;
1413 }
1414 set_type_arguments_field_offset_in_words(host_value, target_value);
1415 }
void set_type_arguments_field_offset_in_words(intptr_t host_value, intptr_t target_value) const
Definition object.h:1416

◆ set_type_arguments_field_offset_in_words()

void dart::Class::set_type_arguments_field_offset_in_words ( intptr_t  host_value,
intptr_t  target_value 
) const
inline

Definition at line 1416 of file object.h.

1417 {
1418 StoreNonPointer(&untag()->host_type_arguments_field_offset_in_words_,
1419 host_value);
1420#if defined(DART_PRECOMPILER)
1421 StoreNonPointer(&untag()->target_type_arguments_field_offset_in_words_,
1422 target_value);
1423#else
1424 // Could be different only during cross-compilation.
1425 ASSERT_EQUAL(host_value, target_value);
1426#endif // defined(DART_PRECOMPILER)
1427 }

◆ set_type_parameters()

void dart::Class::set_type_parameters ( const TypeParameters value) const

Definition at line 3492 of file object.cc.

3492 {
3493 ASSERT((num_type_arguments() == kUnknownNumTypeArguments) ||
3494 is_prefinalized());
3495 untag()->set_type_parameters(value.ptr());
3496}

◆ SetFields()

void dart::Class::SetFields ( const Array value) const

Definition at line 5039 of file object.cc.

5039 {
5040 ASSERT(!value.IsNull());
5041#if defined(DEBUG)
5042 Thread* thread = Thread::Current();
5043 ASSERT(thread->isolate_group()->program_lock()->IsCurrentThreadWriter());
5044 // Verify that all the fields in the array have this class as owner.
5045 Field& field = Field::Handle();
5046 intptr_t len = value.Length();
5047 for (intptr_t i = 0; i < len; i++) {
5048 field ^= value.At(i);
5049 ASSERT(field.IsOriginal());
5050 ASSERT(field.Owner() == ptr());
5051 }
5052#endif
5053 // The value of static fields is already initialized to null.
5054 set_fields(value);
5055}

◆ SetFunctions()

void dart::Class::SetFunctions ( const Array value) const

Definition at line 3314 of file object.cc.

3314 {
3315 ASSERT(!value.IsNull());
3316 const intptr_t len = value.Length();
3317#if defined(DEBUG)
3318 Thread* thread = Thread::Current();
3319 ASSERT(thread->isolate_group()->program_lock()->IsCurrentThreadWriter());
3320 if (is_finalized()) {
3321 Function& function = Function::Handle();
3322 FunctionType& signature = FunctionType::Handle();
3323 for (intptr_t i = 0; i < len; ++i) {
3324 function ^= value.At(i);
3325 signature = function.signature();
3326 ASSERT(signature.IsFinalized());
3327 }
3328 }
3329#endif
3330 set_functions(value);
3331 if (len >= kFunctionLookupHashThreshold) {
3332 ClassFunctionsSet set(HashTables::New<ClassFunctionsSet>(len, Heap::kOld));
3333 Function& func = Function::Handle();
3334 for (intptr_t i = 0; i < len; ++i) {
3335 func ^= value.At(i);
3336 // Verify that all the functions in the array have this class as owner.
3337 ASSERT(func.Owner() == ptr());
3338 set.Insert(func);
3339 }
3340 untag()->set_functions_hash_table(set.Release().ptr());
3341 } else {
3342 untag()->set_functions_hash_table(Array::null());
3343 }
3344}

◆ SetTraceAllocation()

void dart::Class::SetTraceAllocation ( bool  trace_allocation) const

Definition at line 4498 of file object.cc.

4498 {
4499#ifndef PRODUCT
4500 auto isolate_group = IsolateGroup::Current();
4501 const bool changed = trace_allocation != this->TraceAllocation(isolate_group);
4502 if (changed) {
4503 auto class_table = isolate_group->class_table();
4504 class_table->SetTraceAllocationFor(id(), trace_allocation);
4505#ifdef TARGET_ARCH_IA32
4507#endif
4508 }
4509#else
4510 UNREACHABLE();
4511#endif
4512}
bool TraceAllocation(IsolateGroup *isolate_group) const
Definition object.cc:4489
void DisableAllocationStub() const
Definition object.cc:5934

◆ SetUserVisibleNameInClassTable()

void dart::Class::SetUserVisibleNameInClassTable ( )

Definition at line 5438 of file object.cc.

5438 {
5439 IsolateGroup* isolate_group = IsolateGroup::Current();
5440 auto class_table = isolate_group->class_table();
5441 if (class_table->UserVisibleNameFor(id()) == nullptr) {
5442 String& name = String::Handle(UserVisibleName());
5443 class_table->SetUserVisibleNameFor(id(), name.ToMallocCString());
5444 }
5445}
StringPtr UserVisibleName() const
Definition object.cc:3050

◆ SourceFingerprint()

int32_t dart::Class::SourceFingerprint ( ) const

Definition at line 5659 of file object.cc.

5659 {
5660#if !defined(DART_PRECOMPILED_RUNTIME)
5662 *this);
5663#else
5664 return 0;
5665#endif // !defined(DART_PRECOMPILED_RUNTIME)
5666}
static uint32_t CalculateClassFingerprint(const Class &klass)

◆ super_type()

TypePtr dart::Class::super_type ( ) const
inline

Definition at line 1433 of file object.h.

1433 {
1435 return untag()->super_type();
1436 }

◆ super_type_offset()

static intptr_t dart::Class::super_type_offset ( )
inlinestatic

Definition at line 1438 of file object.h.

1438 {
1439 return OFFSET_OF(UntaggedClass, super_type_);
1440 }

◆ SuperClass()

ClassPtr dart::Class::SuperClass ( ClassTable class_table = nullptr) const

Definition at line 3715 of file object.cc.

3715 {
3716 Thread* thread = Thread::Current();
3717 Zone* zone = thread->zone();
3718 if (class_table == nullptr) {
3719 class_table = thread->isolate_group()->class_table();
3720 }
3721
3722 if (super_type() == AbstractType::null()) {
3723 if (id() == kTypeArgumentsCid) {
3724 // Pretend TypeArguments objects are Dart instances.
3725 return class_table->At(kInstanceCid);
3726 }
3727 return Class::null();
3728 }
3729 const AbstractType& sup_type = AbstractType::Handle(zone, super_type());
3730 const intptr_t type_class_id = sup_type.type_class_id();
3731 return class_table->At(type_class_id);
3732}

◆ target_instance_size() [1/2]

intptr_t dart::Class::target_instance_size ( ) const
inline

Definition at line 1149 of file object.h.

1149 {
1151#if defined(DART_PRECOMPILER)
1152 return (untag()->target_instance_size_in_words_ *
1153 compiler::target::kCompressedWordSize);
1154#else
1155 return host_instance_size();
1156#endif // defined(DART_PRECOMPILER)
1157 }

◆ target_instance_size() [2/2]

static intptr_t dart::Class::target_instance_size ( ClassPtr  clazz)
inlinestatic

Definition at line 1161 of file object.h.

1161 {
1162#if defined(DART_PRECOMPILER)
1163 return (clazz->untag()->target_instance_size_in_words_ *
1164 compiler::target::kCompressedWordSize);
1165#else
1166 return host_instance_size(clazz);
1167#endif // defined(DART_PRECOMPILER)
1168 }

◆ target_instance_size_in_words()

static int32_t dart::Class::target_instance_size_in_words ( const ClassPtr  cls)
inlinestatic

Definition at line 1949 of file object.h.

1949 {
1950#if defined(DART_PRECOMPILER)
1951 return cls->untag()->target_instance_size_in_words_;
1952#else
1953 return host_instance_size_in_words(cls);
1954#endif // defined(DART_PRECOMPILER)
1955 }
static int32_t host_instance_size_in_words(const ClassPtr cls)
Definition object.h:1945

◆ target_next_field_offset()

intptr_t dart::Class::target_next_field_offset ( ) const
inline

Definition at line 1195 of file object.h.

1195 {
1196#if defined(DART_PRECOMPILER)
1197 return untag()->target_next_field_offset_in_words_ *
1198 compiler::target::kCompressedWordSize;
1199#else
1200 return host_next_field_offset();
1201#endif // defined(DART_PRECOMPILER)
1202 }

◆ target_next_field_offset_in_words()

static int32_t dart::Class::target_next_field_offset_in_words ( const ClassPtr  cls)
inlinestatic

Definition at line 1961 of file object.h.

1961 {
1962#if defined(DART_PRECOMPILER)
1963 return cls->untag()->target_next_field_offset_in_words_;
1964#else
1966#endif // defined(DART_PRECOMPILER)
1967 }
static int32_t host_next_field_offset_in_words(const ClassPtr cls)
Definition object.h:1957

◆ target_type_arguments_field_offset()

intptr_t dart::Class::target_type_arguments_field_offset ( ) const
inline

Definition at line 1386 of file object.h.

1386 {
1387#if defined(DART_PRECOMPILER)
1389 if (untag()->target_type_arguments_field_offset_in_words_ ==
1390 compiler::target::Class::kNoTypeArguments) {
1391 return compiler::target::Class::kNoTypeArguments;
1392 }
1393 return untag()->target_type_arguments_field_offset_in_words_ *
1394 compiler::target::kCompressedWordSize;
1395#else
1397#endif // defined(DART_PRECOMPILER)
1398 }
intptr_t host_type_arguments_field_offset() const
Definition object.h:1377

◆ target_type_arguments_field_offset_in_words()

static int32_t dart::Class::target_type_arguments_field_offset_in_words ( const ClassPtr  cls)
inlinestatic

Definition at line 1973 of file object.h.

1974 {
1975#if defined(DART_PRECOMPILER)
1976 return cls->untag()->target_type_arguments_field_offset_in_words_;
1977#else
1979#endif // defined(DART_PRECOMPILER)
1980 }
static int32_t host_type_arguments_field_offset_in_words(const ClassPtr cls)
Definition object.h:1969

◆ token_pos()

TokenPosition dart::Class::token_pos ( ) const
inline

Definition at line 1281 of file object.h.

1281 {
1282#if defined(DART_PRECOMPILED_RUNTIME)
1283 return TokenPosition::kNoSource;
1284#else
1285 return untag()->token_pos_;
1286#endif // defined(DART_PRECOMPILED_RUNTIME)
1287 }

◆ TraceAllocation()

bool dart::Class::TraceAllocation ( IsolateGroup isolate_group) const

Definition at line 4489 of file object.cc.

4489 {
4490#ifndef PRODUCT
4491 auto class_table = isolate_group->class_table();
4492 return class_table->ShouldTraceAllocationFor(id());
4493#else
4494 return false;
4495#endif
4496}

◆ type_parameters()

TypeParametersPtr dart::Class::type_parameters ( ) const
inline

Definition at line 1340 of file object.h.

1340 {
1342 return untag()->type_parameters();
1343 }

◆ TypeParameterAt()

TypeParameterPtr dart::Class::TypeParameterAt ( intptr_t  index,
Nullability  nullability = Nullability::kNonNullable 
) const

Definition at line 3739 of file object.cc.

3740 {
3741 ASSERT(index >= 0 && index < NumTypeParameters());
3742 TypeParameter& type_param =
3743 TypeParameter::Handle(TypeParameter::New(*this, 0, index, nullability));
3744 // Finalize type parameter only if its declaring class is
3745 // finalized and available in the current class table.
3746 if (is_type_finalized() && (type_param.parameterized_class() == ptr())) {
3747 type_param ^= ClassFinalizer::FinalizeType(type_param);
3748 }
3749 return type_param.ptr();
3750}

◆ UnboxedFieldSizeInBytesByCid()

intptr_t dart::Class::UnboxedFieldSizeInBytesByCid ( intptr_t  cid)
static

Definition at line 3752 of file object.cc.

3752 {
3753 switch (cid) {
3754 case kDoubleCid:
3755 return sizeof(UntaggedDouble::value_);
3756 case kFloat32x4Cid:
3757 return sizeof(UntaggedFloat32x4::value_);
3758 case kFloat64x2Cid:
3759 return sizeof(UntaggedFloat64x2::value_);
3760 default:
3761 return sizeof(UntaggedMint::value_);
3762 }
3763}

◆ UserVisibleName()

StringPtr dart::Class::UserVisibleName ( ) const

Definition at line 3050 of file object.cc.

3050 {
3051#if !defined(PRODUCT)
3052 ASSERT(untag()->user_name() != String::null());
3053 return untag()->user_name();
3054#endif // !defined(PRODUCT)
3055 // No caching in PRODUCT, regenerate.
3056 return Symbols::New(Thread::Current(), GenerateUserVisibleName());
3057}

◆ UserVisibleNameCString()

const char * dart::Class::UserVisibleNameCString ( ) const

Definition at line 3059 of file object.cc.

3059 {
3060#if !defined(PRODUCT)
3061 ASSERT(untag()->user_name() != String::null());
3062 return String::Handle(untag()->user_name()).ToCString();
3063#endif // !defined(PRODUCT)
3064 return GenerateUserVisibleName(); // No caching in PRODUCT, regenerate.
3065}

◆ VerifyEntryPoint()

ErrorPtr dart::Class::VerifyEntryPoint ( ) const

Definition at line 27446 of file object.cc.

27446 {
27447 if (!FLAG_verify_entry_points) return Error::null();
27448 const Library& lib = Library::Handle(library());
27449 if (!lib.IsNull()) {
27450 return dart::VerifyEntryPoint(lib, *this, *this, {});
27451 } else {
27452 return Error::null();
27453 }
27454}
DART_WARN_UNUSED_RESULT ErrorPtr VerifyEntryPoint(const Library &lib, const Object &member, const Object &annotated, std::initializer_list< EntryPointPragma > allowed_kinds)
Definition object.cc:27227

Friends And Related Symbol Documentation

◆ AbstractType

friend class AbstractType
friend

Definition at line 2217 of file object.h.

◆ ClassFinalizer

friend class ClassFinalizer
friend

Definition at line 2224 of file object.h.

◆ Instance

friend class Instance
friend

Definition at line 2218 of file object.h.

◆ Intrinsifier

friend class Intrinsifier
friend

Definition at line 2221 of file object.h.

◆ Object

friend class Object
friend

Definition at line 2219 of file object.h.

◆ Precompiler

friend class Precompiler
friend

Definition at line 2223 of file object.h.

◆ ProgramWalker

friend class ProgramWalker
friend

Definition at line 2222 of file object.h.

◆ Type

friend class Type
friend

Definition at line 2220 of file object.h.

Member Data Documentation

◆ kNoTypeArguments

constexpr intptr_t dart::Class::kNoTypeArguments = -1
staticconstexpr

Definition at line 1376 of file object.h.


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