Flutter Engine
The Flutter Engine
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
 
void set_is_dynamically_extendable (bool value) const
 
bool is_dynamically_extendable () const
 
void set_has_dynamically_extendable_subtypes (bool value) const
 
bool has_dynamically_extendable_subtypes () const
 
- Public Member Functions inherited from dart::Object
virtual ~Object ()
 
ObjectPtr ptr () const
 
void operator= (ObjectPtr value)
 
bool IsCanonical () const
 
void SetCanonical () const
 
void ClearCanonical () const
 
bool IsImmutable () const
 
void SetImmutable () const
 
void ClearImmutable () const
 
intptr_t GetClassId () const
 
ClassPtr clazz () const
 
 CLASS_LIST_FOR_HANDLES (DEFINE_CLASS_TESTER)
 
bool IsNull () const
 
virtual const char * ToCString () const
 
void PrintJSON (JSONStream *stream, bool ref=true) const
 
virtual void PrintJSONImpl (JSONStream *stream, bool ref) const
 
void PrintImplementationFields (JSONStream *stream) const
 
virtual void PrintImplementationFieldsImpl (const JSONArray &jsarr_fields) const
 
virtual const char * JSONType () const
 
virtual StringPtr DictionaryName () const
 
bool IsNew () const
 
bool IsOld () const
 
bool InVMIsolateHeap () const
 
void Print () const
 

Static Public Member Functions

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

Member Enumeration Documentation

◆ InvocationDispatcherEntry

Enumerator
kInvocationDispatcherName 
kInvocationDispatcherArgsDesc 
kInvocationDispatcherFunction 
kInvocationDispatcherEntrySize 

Definition at line 1135 of file object.h.

Member Function Documentation

◆ AddDirectImplementor()

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

Definition at line 5746 of file object.cc.

5747 {
5748 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5750 ASSERT(!implementor.IsNull());
5751 GrowableObjectArray& direct_implementors =
5753 if (direct_implementors.IsNull()) {
5755 untag()->set_direct_implementors(direct_implementors.ptr());
5756 }
5757#if defined(DEBUG)
5758 // Verify that the same class is not added twice.
5759 // The only exception is mixins: when mixin application is transformed,
5760 // mixin is added to the end of interfaces list and may be duplicated:
5761 // class X = A with B implements B;
5762 // This is rare and harmless.
5763 if (!is_mixin) {
5764 for (intptr_t i = 0; i < direct_implementors.Length(); i++) {
5765 ASSERT(direct_implementors.At(i) != implementor.ptr());
5766 }
5767 }
5768#endif
5769 direct_implementors.Add(implementor, Heap::kOld);
5770}
GrowableObjectArrayPtr direct_implementors() const
Definition: object.h:1520
bool is_implemented() const
Definition: object.h:1692
static GrowableObjectArrayPtr New(Heap::Space space=Heap::kNew)
Definition: object.h:11144
@ kOld
Definition: heap.h:39
static IsolateGroup * Current()
Definition: isolate.h:539
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)
Definition: raw_object.cc:558

◆ AddDirectSubclass()

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

Definition at line 5778 of file object.cc.

5778 {
5779 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5780 ASSERT(!subclass.IsNull());
5781 ASSERT(subclass.SuperClass() == ptr());
5782 // Do not keep track of the direct subclasses of class Object.
5784 GrowableObjectArray& direct_subclasses =
5786 if (direct_subclasses.IsNull()) {
5788 untag()->set_direct_subclasses(direct_subclasses.ptr());
5789 }
5790#if defined(DEBUG)
5791 // Verify that the same class is not added twice.
5792 for (intptr_t i = 0; i < direct_subclasses.Length(); i++) {
5793 ASSERT(direct_subclasses.At(i) != subclass.ptr());
5794 }
5795#endif
5796 direct_subclasses.Add(subclass, Heap::kOld);
5797}
GrowableObjectArrayPtr direct_subclasses() const
Definition: object.h:1537
bool IsObjectClass() const
Definition: object.h:1565
ObjectPtr ptr() const
Definition: object.h:332

◆ AddField()

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

Definition at line 5002 of file object.cc.

5002 {
5003#if defined(DEBUG)
5004 Thread* thread = Thread::Current();
5005 ASSERT(thread->isolate_group()->program_lock()->IsCurrentThreadWriter());
5006#endif
5007 const Array& arr = Array::Handle(fields());
5008 const Array& new_arr = Array::Handle(Array::Grow(arr, arr.Length() + 1));
5009 new_arr.SetAt(arr.Length(), field);
5010 SetFields(new_arr);
5011}
static ArrayPtr Grow(const Array &source, intptr_t new_length, Heap::Space space=Heap::kNew)
Definition: object.cc:24853
void SetFields(const Array &value) const
Definition: object.cc:4984
ArrayPtr fields() const
Definition: object.h:1615
friend class Thread
Definition: object.h:1025
static Thread * Current()
Definition: thread.h:362

◆ AddFields()

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

Definition at line 5013 of file object.cc.

5013 {
5014#if defined(DEBUG)
5015 Thread* thread = Thread::Current();
5016 ASSERT(thread->isolate_group()->program_lock()->IsCurrentThreadWriter());
5017#endif
5018 const intptr_t num_new_fields = new_fields.length();
5019 if (num_new_fields == 0) return;
5020 const Array& arr = Array::Handle(fields());
5021 const intptr_t num_old_fields = arr.Length();
5022 const Array& new_arr = Array::Handle(
5023 Array::Grow(arr, num_old_fields + num_new_fields, Heap::kOld));
5024 for (intptr_t i = 0; i < num_new_fields; i++) {
5025 new_arr.SetAt(i + num_old_fields, *new_fields.At(i));
5026 }
5027 SetFields(new_arr);
5028}

◆ AddFunction()

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

Definition at line 3296 of file object.cc.

3296 {
3297#if defined(DEBUG)
3298 Thread* thread = Thread::Current();
3299 ASSERT(thread->IsDartMutatorThread());
3300 ASSERT(thread->isolate_group()->program_lock()->IsCurrentThreadWriter());
3301 ASSERT(!is_finalized() ||
3302 FunctionType::Handle(function.signature()).IsFinalized());
3303#endif
3304 const Array& arr = Array::Handle(functions());
3305 const Array& new_array =
3306 Array::Handle(Array::Grow(arr, arr.Length() + 1, Heap::kOld));
3307 new_array.SetAt(arr.Length(), function);
3308 set_functions(new_array);
3309 // Add to hash table, if any.
3310 const intptr_t new_len = new_array.Length();
3311 if (new_len == kFunctionLookupHashThreshold) {
3312 // Transition to using hash table.
3313 SetFunctions(new_array);
3314 } else if (new_len > kFunctionLookupHashThreshold) {
3315 ClassFunctionsSet set(untag()->functions_hash_table());
3316 set.Insert(function);
3317 untag()->set_functions_hash_table(set.Release().ptr());
3318 }
3319}
void SetFunctions(const Array &value) const
Definition: object.cc:3264
bool is_finalized() const
Definition: object.h:1723
ArrayPtr functions() const
Definition: object.h:1646
Dart_NativeFunction function
Definition: fuchsia.cc:51
UnorderedHashSet< ClassFunctionsTraits > ClassFunctionsSet
Definition: object.cc:3262
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 3831 of file object.cc.

3833 {
3834 auto thread = Thread::Current();
3835 ASSERT(thread->isolate_group()->program_lock()->IsCurrentThreadWriter());
3836
3837 ASSERT(target_name.ptr() == dispatcher.name());
3838
3839 DispatcherSet dispatchers(invocation_dispatcher_cache() ==
3840 Array::empty_array().ptr()
3841 ? HashTables::New<DispatcherSet>(4, Heap::kOld)
3842 : invocation_dispatcher_cache());
3843 dispatchers.Insert(dispatcher);
3844 set_invocation_dispatcher_cache(dispatchers.Release());
3845}
UnorderedHashSet< DispatcherTraits, AcqRelStorageTraits > DispatcherSet

◆ allocation_stub()

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

Definition at line 1800 of file object.h.

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

◆ can_be_future()

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

Definition at line 2188 of file object.h.

2188{ return CanBeFutureBit::decode(state_bits()); }
static DecodeResult decode(std::string path)
Definition: png_codec.cpp:124

◆ 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:10830
intptr_t NumTypeParameters() const
Definition: object.h:1344
bool is_declaration_loaded() const
Definition: object.h:1703
bool is_const() const
Definition: object.h:1745
bool is_deeply_immutable() const
Definition: object.h:2174
ArrayPtr constants() const
Definition: object.cc:5806
uint16_t num_native_fields() const
Definition: object.h:1788
ArrayPtr OffsetToFieldMap(ClassTable *class_table=nullptr) const
Definition: object.cc:3183
bool is_prefinalized() const
Definition: object.h:1738
bool is_enum_class() const
Definition: object.h:1720
bool is_allocate_finalized() const
Definition: object.h:1732
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 1699 of file object.h.

1699 {
1700 return ClassLoadingBits::decode(state_bits());
1701 }

◆ constants()

ArrayPtr dart::Class::constants ( ) const

Definition at line 5806 of file object.cc.

5806 {
5807 return untag()->constants();
5808}

◆ 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:5810

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

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

◆ declaration_type_offset()

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

Definition at line 1315 of file object.h.

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

◆ DeclarationType()

TypePtr dart::Class::DeclarationType ( ) const

Definition at line 5827 of file object.cc.

5827 {
5829 if (IsNullClass()) {
5830 return Type::NullType();
5831 }
5832 if (IsDynamicClass()) {
5833 return Type::DynamicType();
5834 }
5835 if (IsVoidClass()) {
5836 return Type::VoidType();
5837 }
5838 if (declaration_type() != Type::null()) {
5839 return declaration_type();
5840 }
5841 {
5842 auto thread = Thread::Current();
5843 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
5844 if (declaration_type() != Type::null()) {
5845 return declaration_type();
5846 }
5847 // For efficiency, the runtimeType intrinsic returns the type cached by
5848 // DeclarationType without checking its nullability. Therefore, we
5849 // consistently cache the kNonNullable version of the type.
5850 // The exception is type Null which is stored as kNullable.
5851 TypeArguments& type_args = TypeArguments::Handle();
5852 const intptr_t num_type_params = NumTypeParameters();
5853 if (num_type_params > 0) {
5854 type_args = TypeArguments::New(num_type_params);
5855 TypeParameter& type_param = TypeParameter::Handle();
5856 for (intptr_t i = 0; i < num_type_params; i++) {
5857 type_param = TypeParameterAt(i);
5858 type_args.SetTypeAt(i, type_param);
5859 }
5860 }
5861 Type& type =
5864 set_declaration_type(type);
5865 return type.ptr();
5866 }
5867}
GLenum type
static AbstractTypePtr FinalizeType(const AbstractType &type, FinalizationKind finalization=kCanonicalize)
bool IsDynamicClass() const
Definition: object.h:1556
bool IsVoidClass() const
Definition: object.h:1559
bool IsNullClass() const
Definition: object.h:1553
TypeParameterPtr TypeParameterAt(intptr_t index, Nullability nullability=Nullability::kNonNullable) const
Definition: object.cc:3689
static TypeArgumentsPtr New(intptr_t len, Heap::Space space=Heap::kOld)
Definition: object.cc:7675
static TypePtr VoidType()
static TypePtr NullType()
static TypePtr DynamicType()
static TypePtr New(const Class &clazz, const TypeArguments &arguments, Nullability nullability=Nullability::kNonNullable, Heap::Space space=Heap::kOld)

◆ DefaultTypeArguments()

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

Definition at line 3658 of file object.cc.

3658 {
3660 return Object::empty_type_arguments().ptr();
3661 }
3662 return TypeParameters::Handle(zone, type_parameters()).defaults();
3663}
TypeParametersPtr type_parameters() const
Definition: object.h:1338

◆ dependent_code()

WeakArrayPtr dart::Class::dependent_code ( ) const

Definition at line 4420 of file object.cc.

4420 {
4422 IsolateGroup::Current()->program_lock()->IsCurrentThreadReader());
4423 return untag()->dependent_code();
4424}
#define DEBUG_ASSERT(cond)
Definition: assert.h:321

◆ DictionaryName()

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

Reimplemented from dart::Object.

Definition at line 1270 of file object.h.

1270{ return Name(); }
StringPtr Name() const
Definition: object.cc:2977

◆ direct_implementors()

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

Definition at line 1520 of file object.h.

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

◆ direct_implementors_unsafe()

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

Definition at line 1525 of file object.h.

1525 {
1526 return untag()->direct_implementors();
1527 }

◆ direct_subclasses()

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

Definition at line 1537 of file object.h.

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

◆ direct_subclasses_unsafe()

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

Definition at line 1542 of file object.h.

1542 {
1543 return untag()->direct_subclasses();
1544 }

◆ DisableAllCHAOptimizedCode()

void dart::Class::DisableAllCHAOptimizedCode ( )

Definition at line 4416 of file object.cc.

4416 {
4418}
void DisableCHAOptimizedCode(const Class &subclass)
Definition: object.cc:4402

◆ DisableAllocationStub()

void dart::Class::DisableAllocationStub ( ) const

Definition at line 5879 of file object.cc.

5879 {
5880#if defined(DART_PRECOMPILED_RUNTIME)
5881 UNREACHABLE();
5882#else
5883 {
5884 const Code& existing_stub = Code::Handle(allocation_stub());
5885 if (existing_stub.IsNull()) {
5886 return;
5887 }
5888 }
5889 auto thread = Thread::Current();
5890 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
5891 const Code& existing_stub = Code::Handle(allocation_stub());
5892 if (existing_stub.IsNull()) {
5893 return;
5894 }
5895 ASSERT(!existing_stub.IsDisabled());
5896 // Change the stub so that the next caller will regenerate the stub.
5897 existing_stub.DisableStubCode(NumTypeParameters() > 0);
5898 // Disassociate the existing stub from class.
5899 untag()->set_allocation_stub(Code::null());
5900#endif // defined(DART_PRECOMPILED_RUNTIME)
5901}
#define UNREACHABLE()
Definition: assert.h:248
CodePtr allocation_stub() const
Definition: object.h:1800

◆ DisableCHAImplementorUsers()

void dart::Class::DisableCHAImplementorUsers ( )
inline

Definition at line 1917 of file object.h.

void DisableAllCHAOptimizedCode()
Definition: object.cc:4416

◆ DisableCHAOptimizedCode()

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

Definition at line 4402 of file object.cc.

4402 {
4404 IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
4405 CHACodeArray a(*this);
4406 if (FLAG_trace_deoptimization && a.HasCodes()) {
4407 if (subclass.IsNull()) {
4408 THR_Print("Deopt for CHA (all)\n");
4409 } else {
4410 THR_Print("Deopt for CHA (new subclass %s)\n", subclass.ToCString());
4411 }
4412 }
4413 a.DisableCode(/*are_mutators_stopped=*/false);
4414}
#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 1291 of file object.h.

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

◆ EnsureDeclarationLoaded()

void dart::Class::EnsureDeclarationLoaded ( ) const

Definition at line 4913 of file object.cc.

4913 {
4914 if (!is_declaration_loaded()) {
4915#if defined(DART_PRECOMPILED_RUNTIME)
4916 UNREACHABLE();
4917#else
4918 FATAL("Unable to use class %s which is not loaded yet.", ToCString());
4919#endif
4920 }
4921}
#define FATAL(error)

◆ EnsureIsAllocateFinalized()

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

Definition at line 4954 of file object.cc.

4954 {
4955 ASSERT(!IsNull());
4956 if (is_allocate_finalized()) {
4957 return Error::null();
4958 }
4959 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
4960 if (is_allocate_finalized()) {
4961 return Error::null();
4962 }
4963 ASSERT(thread != nullptr);
4964 Error& error = Error::Handle(thread->zone(), EnsureIsFinalized(thread));
4965 if (!error.IsNull()) {
4966 ASSERT(thread == Thread::Current());
4967 if (thread->long_jump_base() != nullptr) {
4969 UNREACHABLE();
4970 }
4971 }
4972 // May be allocate-finalized recursively during EnsureIsFinalized.
4973 if (is_allocate_finalized()) {
4974 return Error::null();
4975 }
4976#if defined(DART_PRECOMPILED_RUNTIME)
4977 UNREACHABLE();
4978#else
4980#endif // defined(DART_PRECOMPILED_RUNTIME)
4981 return error.ptr();
4982}
static ErrorPtr AllocateFinalizeClass(const Class &cls)
ErrorPtr EnsureIsFinalized(Thread *thread) const
Definition: object.cc:4924
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 4924 of file object.cc.

4924 {
4925 ASSERT(!IsNull());
4926 if (is_finalized()) {
4927 return Error::null();
4928 }
4929#if defined(DART_PRECOMPILED_RUNTIME)
4930 UNREACHABLE();
4931 return Error::null();
4932#else
4933 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
4934 if (is_finalized()) {
4935 return Error::null();
4936 }
4937 LeaveCompilerScope ncs(thread);
4938 ASSERT(thread != nullptr);
4939 const Error& error =
4940 Error::Handle(thread->zone(), ClassFinalizer::LoadClassMembers(*this));
4941 if (!error.IsNull()) {
4942 ASSERT(thread == Thread::Current());
4943 if (thread->long_jump_base() != nullptr) {
4945 UNREACHABLE();
4946 }
4947 }
4948 return error.ptr();
4949#endif // defined(DART_PRECOMPILED_RUNTIME)
4950}
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 4821 of file object.cc.

4825 {
4826 auto thread = Thread::Current();
4827 const auto& library = Library::Handle(thread->zone(), this->library());
4829 thread, Instance::null_object(), library, *this, kernel_buffer,
4830 type_definitions, arguments, type_arguments);
4831}
LibraryPtr library() const
Definition: object.h:1333
ObjectPtr EvaluateCompiledExpression(const Class &klass, const ExternalTypedData &kernel_buffer, const Array &type_definitions, const Array &arguments, const TypeArguments &type_arguments) const
Definition: object.cc:4833

◆ FieldFromIndex()

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

Definition at line 5051 of file object.cc.

5051 {
5052 Array& fields = Array::Handle(this->fields());
5053 if ((idx < 0) || (idx >= fields.Length())) {
5054 return Field::null();
5055 }
5056 return Field::RawCast(fields.At(idx));
5057}

◆ fields()

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

Definition at line 1615 of file object.h.

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

◆ Finalize()

void dart::Class::Finalize ( ) const

Definition at line 4307 of file object.cc.

4307 {
4308 auto thread = Thread::Current();
4309 auto isolate_group = thread->isolate_group();
4310 ASSERT(!thread->isolate_group()->all_classes_finalized());
4311 ASSERT(!is_finalized());
4312 // Prefinalized classes have a VM internal representation and no Dart fields.
4313 // Their instance size is precomputed and field offsets are known.
4314 if (!is_prefinalized()) {
4315 // Compute offsets of instance fields, instance size and bitmap for unboxed
4316 // fields.
4317 const auto host_bitmap = CalculateFieldOffsets();
4318 if (ptr() == isolate_group->class_table()->At(id())) {
4319 if (!ClassTable::IsTopLevelCid(id())) {
4320 // Unless class is top-level, which don't get instantiated,
4321 // sets the new size in the class table.
4322 isolate_group->class_table()->UpdateClassSize(id(), ptr());
4323 isolate_group->class_table()->SetUnboxedFieldsMapAt(id(), host_bitmap);
4324 }
4325 }
4326 }
4327
4328#if defined(DEBUG)
4329 if (is_const()) {
4330 // Double-check that all fields are final (CFE should guarantee that if it
4331 // marks the class as having a constant constructor).
4332 auto Z = thread->zone();
4333 const auto& super_class = Class::Handle(Z, SuperClass());
4334 ASSERT(super_class.IsNull() || super_class.is_const());
4335 const auto& fields = Array::Handle(Z, this->fields());
4336 auto& field = Field::Handle(Z);
4337 for (intptr_t i = 0; i < fields.Length(); ++i) {
4338 field ^= fields.At(i);
4339 ASSERT(field.is_static() || field.is_final());
4340 }
4341 }
4342#endif
4343
4345}
#define Z
static bool IsTopLevelCid(intptr_t cid)
Definition: class_table.h:496
void set_is_finalized() const
Definition: object.cc:5714
ClassPtr SuperClass(ClassTable *class_table=nullptr) const
Definition: object.cc:3665

◆ FindFieldIndex()

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

Definition at line 5030 of file object.cc.

5030 {
5031 Thread* thread = Thread::Current();
5032 if (EnsureIsFinalized(thread) != Error::null()) {
5033 return -1;
5034 }
5037 Array& fields = thread->ArrayHandle();
5038 Field& field = thread->FieldHandle();
5039 fields = this->fields();
5040 ASSERT(!fields.IsNull());
5041 for (intptr_t i = 0, n = fields.Length(); i < n; ++i) {
5042 field ^= fields.At(i);
5043 if (needle.ptr() == field.ptr()) {
5044 return i;
5045 }
5046 }
5047 // Not found.
5048 return -1;
5049}
#define REUSABLE_ARRAY_HANDLESCOPE(thread)
#define REUSABLE_FIELD_HANDLESCOPE(thread)

◆ FindFunctionIndex()

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

Definition at line 3321 of file object.cc.

3321 {
3322 Thread* thread = Thread::Current();
3323 if (EnsureIsFinalized(thread) != Error::null()) {
3324 return -1;
3325 }
3328 Array& funcs = thread->ArrayHandle();
3329 Function& function = thread->FunctionHandle();
3330 funcs = current_functions();
3331 ASSERT(!funcs.IsNull());
3332 const intptr_t len = funcs.Length();
3333 for (intptr_t i = 0; i < len; i++) {
3334 function ^= funcs.At(i);
3335 if (needle.ptr() == function.ptr()) {
3336 return i;
3337 }
3338 }
3339 // No function found.
3340 return -1;
3341}
ArrayPtr current_functions() const
Definition: object.h:1641
#define REUSABLE_FUNCTION_HANDLESCOPE(thread)

◆ FindImplicitClosureFunctionIndex()

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

Definition at line 3364 of file object.cc.

3364 {
3365 Thread* thread = Thread::Current();
3366 if (EnsureIsFinalized(thread) != Error::null()) {
3367 return -1;
3368 }
3371 Array& funcs = thread->ArrayHandle();
3372 Function& function = thread->FunctionHandle();
3373 funcs = current_functions();
3374 ASSERT(!funcs.IsNull());
3375 Function& implicit_closure = Function::Handle(thread->zone());
3376 const intptr_t len = funcs.Length();
3377 for (intptr_t i = 0; i < len; i++) {
3378 function ^= funcs.At(i);
3379 implicit_closure = function.implicit_closure_function();
3380 if (implicit_closure.IsNull()) {
3381 // Skip non-implicit closure functions.
3382 continue;
3383 }
3384 if (needle.ptr() == implicit_closure.ptr()) {
3385 return i;
3386 }
3387 }
3388 // No function found.
3389 return -1;
3390}

◆ FindInstantiationOf() [1/4]

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

Definition at line 1468 of file object.h.

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

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

12678 {
12679 ASSERT(cls.is_type_finalized());
12680 if (cls.ptr() == ptr()) {
12681 return true; // Found instantiation.
12682 }
12683
12684 Class& cls2 = Class::Handle(zone);
12685 Type& super = Type::Handle(zone, super_type());
12686 if (!super.IsNull() && !super.IsObjectType()) {
12687 cls2 = super.type_class();
12688 if (path != nullptr) {
12689 path->Add(&super);
12690 }
12691 if (cls2.FindInstantiationOf(zone, cls, path,
12692 consider_only_super_classes)) {
12693 return true; // Found instantiation.
12694 }
12695 if (path != nullptr) {
12696 path->RemoveLast();
12697 }
12698 }
12699
12700 if (!consider_only_super_classes) {
12701 Array& super_interfaces = Array::Handle(zone, interfaces());
12702 for (intptr_t i = 0; i < super_interfaces.Length(); i++) {
12703 super ^= super_interfaces.At(i);
12704 cls2 = super.type_class();
12705 if (path != nullptr) {
12706 path->Add(&super);
12707 }
12708 if (cls2.FindInstantiationOf(zone, cls, path)) {
12709 return true; // Found instantiation.
12710 }
12711 if (path != nullptr) {
12712 path->RemoveLast();
12713 }
12714 }
12715 }
12716
12717 return false; // Not found.
12718}
TypePtr super_type() const
Definition: object.h:1431
ArrayPtr interfaces() const
Definition: object.h:1447
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 1491 of file object.h.

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

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

12723 {
12724 return FindInstantiationOf(zone, Class::Handle(zone, type.type_class()), path,
12725 consider_only_super_classes);
12726}

◆ FindInvocationDispatcherFunctionIndex()

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

Definition at line 3392 of file object.cc.

3393 {
3394 Thread* thread = Thread::Current();
3395 if (EnsureIsFinalized(thread) != Error::null()) {
3396 return -1;
3397 }
3400 Array& funcs = thread->ArrayHandle();
3401 Object& object = thread->ObjectHandle();
3402 funcs = invocation_dispatcher_cache();
3403 ASSERT(!funcs.IsNull());
3404 const intptr_t len = funcs.Length();
3405 for (intptr_t i = 0; i < len; i++) {
3406 object = funcs.At(i);
3407 // The invocation_dispatcher_cache is a table with some entries that
3408 // are functions.
3409 if (object.IsFunction()) {
3410 if (Function::Cast(object).ptr() == needle.ptr()) {
3411 return i;
3412 }
3413 }
3414 }
3415 // No function found.
3416 return -1;
3417}
friend class Object
Definition: object.h:2239
#define REUSABLE_OBJECT_HANDLESCOPE(thread)

◆ FunctionFromIndex()

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

Definition at line 3343 of file object.cc.

3343 {
3344 const Array& funcs = Array::Handle(current_functions());
3345 if ((idx < 0) || (idx >= funcs.Length())) {
3346 return Function::null();
3347 }
3348 Function& func = Function::Handle();
3349 func ^= funcs.At(idx);
3350 ASSERT(!func.IsNull());
3351 return func.ptr();
3352}

◆ functions()

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

Definition at line 1646 of file object.h.

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

◆ GetClassId()

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

Definition at line 1591 of file object.h.

1591 {
1592 NoSafepointScope no_safepoint;
1593 return cls->untag()->id_;
1594 }

◆ GetDeclarationInstanceTypeArguments()

TypeArgumentsPtr dart::Class::GetDeclarationInstanceTypeArguments ( ) const

Definition at line 3476 of file object.cc.

3476 {
3477 const intptr_t num_type_arguments = NumTypeArguments();
3478 if (num_type_arguments == 0) {
3479 return TypeArguments::null();
3480 }
3481 if (declaration_instance_type_arguments() != TypeArguments::null()) {
3482 return declaration_instance_type_arguments();
3483 }
3484 Thread* thread = Thread::Current();
3485 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
3486 if (declaration_instance_type_arguments() != TypeArguments::null()) {
3487 return declaration_instance_type_arguments();
3488 }
3489 Zone* zone = thread->zone();
3490 auto& args = TypeArguments::Handle(zone);
3491 auto& type = AbstractType::Handle(zone);
3492 const intptr_t num_type_parameters = NumTypeParameters(thread);
3493 if (num_type_arguments == num_type_parameters) {
3495 args = Type::Cast(type).arguments();
3496 } else {
3497 type = super_type();
3498 const auto& super_args = TypeArguments::Handle(
3499 zone, Type::Cast(type).GetInstanceTypeArguments(thread));
3500 if ((num_type_parameters == 0) ||
3501 (!super_args.IsNull() && (super_args.Length() == num_type_arguments))) {
3502 args = super_args.ptr();
3503 } else {
3504 args = TypeArguments::New(num_type_arguments);
3505 const intptr_t offset = num_type_arguments - num_type_parameters;
3506 for (intptr_t i = 0; i < offset; ++i) {
3507 type = super_args.TypeAtNullSafe(i);
3508 args.SetTypeAt(i, type);
3509 }
3511 const auto& decl_args =
3512 TypeArguments::Handle(zone, Type::Cast(type).arguments());
3513 for (intptr_t i = 0; i < num_type_parameters; ++i) {
3514 type = decl_args.TypeAt(i);
3515 args.SetTypeAt(offset + i, type);
3516 }
3517 }
3518 }
3519 args = args.Canonicalize(thread);
3520 set_declaration_instance_type_arguments(args);
3521 return args.ptr();
3522}
intptr_t NumTypeArguments() const
Definition: object.cc:3640
TypePtr DeclarationType() const
Definition: object.cc:5827
TypeArgumentsPtr GetInstanceTypeArguments(Thread *thread, const TypeArguments &type_arguments, bool canonicalize=true) const
Definition: object.cc:3524
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
SeparatedVector2 offset

◆ GetInstanceTypeArguments()

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

Definition at line 3524 of file object.cc.

3527 {
3528 const intptr_t num_type_arguments = NumTypeArguments();
3529 if (num_type_arguments == 0) {
3530 return TypeArguments::null();
3531 }
3532 Zone* zone = thread->zone();
3533 auto& args = TypeArguments::Handle(zone);
3534 const intptr_t num_type_parameters = NumTypeParameters(thread);
3535 ASSERT(type_arguments.IsNull() ||
3536 type_arguments.Length() == num_type_parameters);
3537 if (num_type_arguments == num_type_parameters) {
3538 args = type_arguments.ptr();
3539 } else {
3541 if (num_type_parameters == 0) {
3542 return args.ptr();
3543 }
3544 args = args.InstantiateFrom(
3546 zone, type_arguments.ToInstantiatorTypeArguments(thread, *this)),
3547 Object::null_type_arguments(), kAllFree, Heap::kOld);
3548 }
3549 if (canonicalize) {
3550 args = args.Canonicalize(thread);
3551 }
3552 return args.ptr();
3553}
TypeArgumentsPtr GetDeclarationInstanceTypeArguments() const
Definition: object.cc:3476
@ kAllFree
Definition: object.h:2940

◆ GetInstantiationOf() [1/2]

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

Definition at line 12728 of file object.cc.

12728 {
12729 if (ptr() == cls.ptr()) {
12730 return DeclarationType();
12731 }
12732 if (FindInstantiationOf(zone, cls, /*consider_only_super_classes=*/true)) {
12733 // Since [cls] is a superclass of [this], use [cls]'s declaration type.
12734 return cls.DeclarationType();
12735 }
12736 const auto& decl_type = Type::Handle(zone, DeclarationType());
12737 GrowableArray<const Type*> path(zone, 0);
12738 if (!FindInstantiationOf(zone, cls, &path)) {
12739 return Type::null();
12740 }
12741 Thread* thread = Thread::Current();
12742 ASSERT(!path.is_empty());
12743 auto& calculated_type = Type::Handle(zone, decl_type.ptr());
12744 auto& calculated_type_class =
12745 Class::Handle(zone, calculated_type.type_class());
12746 auto& calculated_type_args =
12747 TypeArguments::Handle(zone, calculated_type.arguments());
12748 calculated_type_args = calculated_type_args.ToInstantiatorTypeArguments(
12749 thread, calculated_type_class);
12750 for (auto* const type : path) {
12751 calculated_type ^= type->ptr();
12752 if (!calculated_type.IsInstantiated()) {
12753 calculated_type ^= calculated_type.InstantiateFrom(
12754 calculated_type_args, Object::null_type_arguments(), kAllFree,
12755 Heap::kNew);
12756 }
12757 calculated_type_class = calculated_type.type_class();
12758 calculated_type_args = calculated_type.arguments();
12759 calculated_type_args = calculated_type_args.ToInstantiatorTypeArguments(
12760 thread, calculated_type_class);
12761 }
12762 ASSERT_EQUAL(calculated_type.type_class_id(), cls.id());
12763 return calculated_type.ptr();
12764}
#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 12766 of file object.cc.

12766 {
12767 return GetInstantiationOf(zone, Class::Handle(zone, type.type_class()));
12768}
TypePtr GetInstantiationOf(Zone *zone, const Class &cls) const
Definition: object.cc:12728

◆ GetInvocationDispatcher()

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

Definition at line 3847 of file object.cc.

3850 {
3851 ASSERT(kind == UntaggedFunction::kNoSuchMethodDispatcher ||
3852 kind == UntaggedFunction::kInvokeFieldDispatcher ||
3853 kind == UntaggedFunction::kDynamicInvocationForwarder);
3854 auto thread = Thread::Current();
3855 auto Z = thread->zone();
3856 auto& function = Function::Handle(Z);
3857
3858 // First we'll try to find it without using locks.
3859 DispatcherKey key(target_name, args_desc, kind);
3860 if (invocation_dispatcher_cache() != Array::empty_array().ptr()) {
3861 DispatcherSet dispatchers(Z, invocation_dispatcher_cache());
3862 function ^= dispatchers.GetOrNull(key);
3863 dispatchers.Release();
3864 }
3865 if (!function.IsNull() || !create_if_absent) {
3866 return function.ptr();
3867 }
3868
3869 // If we failed to find it and possibly need to create it, use a write lock.
3870 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
3871
3872 // Try to find it again & return if it was added in the meantime.
3873 if (invocation_dispatcher_cache() != Array::empty_array().ptr()) {
3874 DispatcherSet dispatchers(Z, invocation_dispatcher_cache());
3875 function ^= dispatchers.GetOrNull(key);
3876 dispatchers.Release();
3877 }
3878 if (!function.IsNull()) return function.ptr();
3879
3880 // Otherwise create it & add it.
3881 function = CreateInvocationDispatcher(target_name, args_desc, kind);
3882 AddInvocationDispatcher(target_name, args_desc, function);
3883 return function.ptr();
3884}
void AddInvocationDispatcher(const String &target_name, const Array &args_desc, const Function &dispatcher) const
Definition: object.cc:3831

◆ GetRecordFieldGetter()

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

Definition at line 4078 of file object.cc.

4078 {
4080 ASSERT(Field::IsGetterName(getter_name));
4081 Thread* thread = Thread::Current();
4082 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
4083 Function& result = Function::Handle(thread->zone(),
4084 LookupDynamicFunctionUnsafe(getter_name));
4085 if (result.IsNull()) {
4086 result = CreateRecordFieldGetter(getter_name);
4087 }
4088 ASSERT(result.kind() == UntaggedFunction::kRecordFieldGetter);
4089 return result.ptr();
4090}
bool IsRecordClass() const
Definition: object.h:1583
FunctionPtr LookupDynamicFunctionUnsafe(const String &name) const
Definition: object.cc:6129
static bool IsGetterName(const String &function_name)
Definition: object.cc:11831
GAsyncResult * result

◆ has_dynamically_extendable_subtypes()

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

Definition at line 2196 of file object.h.

2196 {
2198 }

◆ has_pragma()

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

Definition at line 2159 of file object.h.

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

◆ HasCompressedPointers()

bool dart::Class::HasCompressedPointers ( ) const

Definition at line 2946 of file object.cc.

2946 {
2947 const intptr_t cid = id();
2948 switch (cid) {
2949 case kByteBufferCid:
2951#define HANDLE_CASE(clazz) \
2952 case k##clazz##Cid: \
2953 return dart::clazz::ContainsCompressedPointers();
2955#undef HANDLE_CASE
2956#define HANDLE_CASE(clazz) \
2957 case kTypedData##clazz##Cid: \
2958 return dart::TypedData::ContainsCompressedPointers(); \
2959 case kTypedData##clazz##ViewCid: \
2960 case kUnmodifiableTypedData##clazz##ViewCid: \
2961 return dart::TypedDataView::ContainsCompressedPointers(); \
2962 case kExternalTypedData##clazz##Cid: \
2963 return dart::ExternalTypedData::ContainsCompressedPointers();
2965#undef HANDLE_CASE
2966 default:
2967 if (cid >= kNumPredefinedCids) {
2969 }
2970 }
2971 FATAL("Unsupported class for compressed pointers translation: %s (id=%" Pd
2972 ", kNumPredefinedCids=%" Pd ")\n",
2974 return false;
2975}
#define CLASS_LIST_TYPED_DATA(V)
Definition: class_id.h:137
static constexpr bool ContainsCompressedPointers()
Definition: object.h:11859
intptr_t id() const
Definition: object.h:1233
static constexpr bool ContainsCompressedPointers()
Definition: object.h:329
CLASS_LIST(STORE_NON_POINTER_ILLEGAL_TYPE)
@ 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 5597 of file object.cc.

5597 {
5598 return Class::Hash(ptr());
5599}
uint32_t Hash() const
Definition: object.cc:5597

◆ Hash() [2/2]

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

Definition at line 5600 of file object.cc.

5600 {
5601 return String::HashRawSymbol(obj.untag()->name());
5602}
static uword HashRawSymbol(const StringPtr symbol)
Definition: object.h:10247

◆ HasInstanceFields()

bool dart::Class::HasInstanceFields ( ) const

Definition at line 3211 of file object.cc.

3211 {
3212 const Array& field_array = Array::Handle(fields());
3213 Field& field = Field::Handle();
3214 for (intptr_t i = 0; i < field_array.Length(); ++i) {
3215 field ^= field_array.At(i);
3216 if (!field.is_static()) {
3217 return true;
3218 }
3219 }
3220 return false;
3221}

◆ host_instance_size() [1/2]

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

Definition at line 1143 of file object.h.

1143 {
1145 return (untag()->host_instance_size_in_words_ * kCompressedWordSize);
1146 }
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 1156 of file object.h.

1156 {
1157 return (clazz->untag()->host_instance_size_in_words_ * kCompressedWordSize);
1158 }
ClassPtr clazz() const
Definition: object.h:13218

◆ host_instance_size_in_words()

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

Definition at line 1943 of file object.h.

1943 {
1944 return cls->untag()->host_instance_size_in_words_;
1945 }

◆ host_next_field_offset()

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

Definition at line 1190 of file object.h.

1190 {
1191 return untag()->host_next_field_offset_in_words_ * kCompressedWordSize;
1192 }

◆ host_next_field_offset_in_words()

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

Definition at line 1955 of file object.h.

1955 {
1956 return cls->untag()->host_next_field_offset_in_words_;
1957 }

◆ host_type_arguments_field_offset()

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

Definition at line 1375 of file object.h.

1375 {
1377 if (untag()->host_type_arguments_field_offset_in_words_ ==
1379 return kNoTypeArguments;
1380 }
1381 return untag()->host_type_arguments_field_offset_in_words_ *
1383 }
bool is_type_finalized() const
Definition: object.h:1709
static constexpr intptr_t kNoTypeArguments
Definition: object.h:1374

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

1967 {
1968 return cls->untag()->host_type_arguments_field_offset_in_words_;
1969 }

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

1426 {
1427 return OFFSET_OF(UntaggedClass, host_type_arguments_field_offset_in_words_);
1428 }

◆ id()

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

Definition at line 1233 of file object.h.

1233{ return untag()->id_; }

◆ id_offset()

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

Definition at line 1238 of file object.h.

1238{ return OFFSET_OF(UntaggedClass, id_); }

◆ implementor_cid()

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

Definition at line 1245 of file object.h.

1245{ return untag()->implementor_cid_; }

◆ ImplicitClosureFunctionFromIndex()

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

Definition at line 3354 of file object.cc.

3354 {
3355 Function& func = Function::Handle(FunctionFromIndex(idx));
3356 if (func.IsNull() || !func.HasImplicitClosureFunction()) {
3357 return Function::null();
3358 }
3359 func = func.ImplicitClosureFunction();
3360 ASSERT(!func.IsNull());
3361 return func.ptr();
3362}
FunctionPtr FunctionFromIndex(intptr_t idx) const
Definition: object.cc:3343

◆ InjectCIDFields()

bool dart::Class::InjectCIDFields ( ) const

Definition at line 5059 of file object.cc.

5059 {
5060 if (library() != Library::InternalLibrary() ||
5061 Name() != Symbols::ClassID().ptr()) {
5062 return false;
5063 }
5064
5065 auto thread = Thread::Current();
5066 auto isolate_group = thread->isolate_group();
5067 auto zone = thread->zone();
5068 Field& field = Field::Handle(zone);
5069 Smi& value = Smi::Handle(zone);
5070 String& field_name = String::Handle(zone);
5071
5072 // clang-format off
5073 static const struct {
5074 const char* const field_name;
5075 const intptr_t cid;
5076 } cid_fields[] = {
5077#define CLASS_LIST_WITH_NULL(V) \
5078 V(Null) \
5079 CLASS_LIST_NO_OBJECT(V)
5080#define ADD_SET_FIELD(clazz) \
5081 {"cid" #clazz, k##clazz##Cid},
5083#undef ADD_SET_FIELD
5084#undef CLASS_LIST_WITH_NULL
5085#define ADD_SET_FIELD(clazz) \
5086 {"cid" #clazz, kTypedData##clazz##Cid}, \
5087 {"cid" #clazz "View", kTypedData##clazz##ViewCid}, \
5088 {"cidExternal" #clazz, kExternalTypedData##clazz##Cid}, \
5089 {"cidUnmodifiable" #clazz "View", kUnmodifiableTypedData##clazz##ViewCid}, \
5090 CLASS_LIST_TYPED_DATA(ADD_SET_FIELD)
5091#undef ADD_SET_FIELD
5092 // Used in const hashing to determine whether we're dealing with a
5093 // user-defined const. See lib/_internal/vm/lib/compact_hash.dart.
5094 {"numPredefinedCids", kNumPredefinedCids},
5095 };
5096 // clang-format on
5097
5098 const AbstractType& field_type = Type::Handle(zone, Type::IntType());
5099 for (size_t i = 0; i < ARRAY_SIZE(cid_fields); i++) {
5100 field_name = Symbols::New(thread, cid_fields[i].field_name);
5101 field = Field::New(field_name, /* is_static = */ true,
5102 /* is_final = */ false,
5103 /* is_const = */ true,
5104 /* is_reflectable = */ false,
5105 /* is_late = */ false, *this, field_type,
5107 value = Smi::New(cid_fields[i].cid);
5108 isolate_group->RegisterStaticField(field, value);
5109 AddField(field);
5110 }
5111
5112 return true;
5113}
void AddField(const Field &field) const
Definition: object.cc:5002
friend class AbstractType
Definition: object.h:2237
static LibraryPtr InternalLibrary()
Definition: object.cc:14803
static SmiPtr New(intptr_t value)
Definition: object.h:10006
static StringPtr New(Thread *thread, const char *cstr)
Definition: symbols.h:723
static const TokenPosition kMinSource
static TypePtr IntType()
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 6485 of file object.cc.

6486 {
6487 ASSERT(constant.IsCanonical());
6488 ASSERT(this->ptr() == constant.clazz());
6489 Instance& canonical_value = Instance::Handle(zone);
6490 if (this->constants() == Array::null()) {
6492 HashTables::New<CanonicalInstancesSet>(128, Heap::kOld));
6493 canonical_value ^= constants.InsertNewOrGet(CanonicalInstanceKey(constant));
6494 this->set_constants(constants.Release());
6495 } else {
6497 this->constants());
6498 canonical_value ^= constants.InsertNewOrGet(CanonicalInstanceKey(constant));
6499 this->set_constants(constants.Release());
6500 }
6501 return canonical_value.ptr();
6502}
friend class Instance
Definition: object.h:2238
UnorderedHashSet< CanonicalInstanceTraits > CanonicalInstancesSet

◆ InstanceSize()

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

Definition at line 1685 of file object.h.

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

◆ interfaces()

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

Definition at line 1447 of file object.h.

1447 {
1449 return untag()->interfaces();
1450 }

◆ InvocationDispatcherFunctionFromIndex()

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

Definition at line 3419 of file object.cc.

3419 {
3420 Thread* thread = Thread::Current();
3423 Array& dispatcher_cache = thread->ArrayHandle();
3424 Object& object = thread->ObjectHandle();
3425 dispatcher_cache = invocation_dispatcher_cache();
3426 object = dispatcher_cache.At(idx);
3427 if (!object.IsFunction()) {
3428 return Function::null();
3429 }
3430 return Function::Cast(object).ptr();
3431}

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

4688 {
4689 Thread* thread = Thread::Current();
4690 Zone* zone = thread->zone();
4692
4693 // We don't pass any explicit type arguments, which will be understood as
4694 // using dynamic for any function type arguments by lower layers.
4695 const int kTypeArgsLen = 0;
4696 const Array& args_descriptor_array = Array::Handle(
4697 zone, ArgumentsDescriptor::NewBoxed(kTypeArgsLen, args.Length(),
4698 arg_names, Heap::kNew));
4699 ArgumentsDescriptor args_descriptor(args_descriptor_array);
4700
4701 Function& function =
4703
4704 if (!function.IsNull() && check_is_entrypoint) {
4705 CHECK_ERROR(function.VerifyCallEntryPoint());
4706 }
4707
4708 if (function.IsNull()) {
4709 // Didn't find a method: try to find a getter and invoke call on its result.
4710 const Object& getter_result = Object::Handle(
4711 zone, InvokeGetter(function_name, false, respect_reflectable,
4712 check_is_entrypoint));
4713 if (getter_result.ptr() != Object::sentinel().ptr()) {
4714 if (check_is_entrypoint) {
4716 }
4717 const auto& call_args_descriptor_array = Array::Handle(
4718 zone, ArgumentsDescriptor::NewBoxed(args_descriptor.TypeArgsLen(),
4719 args_descriptor.Count() + 1,
4720 arg_names, Heap::kNew));
4721 const auto& call_args = Array::Handle(
4722 zone,
4723 CreateCallableArgumentsFromStatic(zone, Instance::Cast(getter_result),
4724 args, arg_names, args_descriptor));
4725 return DartEntry::InvokeClosure(thread, call_args,
4726 call_args_descriptor_array);
4727 }
4728 }
4729
4730 if (function.IsNull() ||
4731 !function.AreValidArguments(args_descriptor, nullptr) ||
4732 (respect_reflectable && !function.is_reflectable())) {
4733 return ThrowNoSuchMethod(
4734 AbstractType::Handle(zone, RareType()), function_name, args, arg_names,
4736 }
4737 // This is a static function, so we pass an empty instantiator tav.
4738 ASSERT(function.is_static());
4739 ObjectPtr type_error = function.DoArgumentTypesMatch(
4740 args, args_descriptor, Object::empty_type_arguments());
4741 if (type_error != Error::null()) {
4742 return type_error;
4743 }
4744 return DartEntry::InvokeFunction(function, args, args_descriptor_array);
4745}
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:4517
FunctionPtr LookupStaticFunction(const String &name) const
Definition: object.cc:6137
TypePtr RareType() const
Definition: object.cc:3036
static ObjectPtr InvokeClosure(Thread *thread, const Array &arguments)
Definition: dart_entry.cc:282
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:4652
DART_WARN_UNUSED_RESULT ErrorPtr EntryPointFieldInvocationError(const String &getter_name)
Definition: object.cc:27196
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(error)
Definition: object.cc:134

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

4520 {
4521 Thread* thread = Thread::Current();
4522 Zone* zone = thread->zone();
4523
4525
4526 // Note static fields do not have implicit getters.
4527 const Field& field = Field::Handle(zone, LookupStaticField(getter_name));
4528
4529 if (!field.IsNull() && check_is_entrypoint) {
4530 CHECK_ERROR(field.VerifyEntryPoint(EntryPointPragma::kGetterOnly));
4531 }
4532
4533 if (field.IsNull() || field.IsUninitialized()) {
4534 const String& internal_getter_name =
4535 String::Handle(zone, Field::GetterName(getter_name));
4536 Function& getter =
4537 Function::Handle(zone, LookupStaticFunction(internal_getter_name));
4538
4539 if (field.IsNull() && !getter.IsNull() && check_is_entrypoint) {
4540 CHECK_ERROR(getter.VerifyCallEntryPoint());
4541 }
4542
4543 if (getter.IsNull() || (respect_reflectable && !getter.is_reflectable())) {
4544 if (getter.IsNull()) {
4545 getter = LookupStaticFunction(getter_name);
4546 if (!getter.IsNull()) {
4547 if (check_is_entrypoint) {
4548 CHECK_ERROR(getter.VerifyClosurizedEntryPoint());
4549 }
4550 if (getter.SafeToClosurize()) {
4551 // Looking for a getter but found a regular method: closurize it.
4552 const Function& closure_function =
4553 Function::Handle(zone, getter.ImplicitClosureFunction());
4554 return closure_function.ImplicitStaticClosure();
4555 }
4556 }
4557 }
4558 if (throw_nsm_if_absent) {
4559 return ThrowNoSuchMethod(
4560 AbstractType::Handle(zone, RareType()), getter_name,
4561 Object::null_array(), Object::null_array(),
4563 }
4564 // Fall through case: Indicate that we didn't find any function or field
4565 // using a special null instance. This is different from a field being
4566 // null. Callers make sure that this null does not leak into Dartland.
4567 return Object::sentinel().ptr();
4568 }
4569
4570 // Invoke the getter and return the result.
4571 return DartEntry::InvokeFunction(getter, Object::empty_array());
4572 }
4573
4574 return field.StaticValue();
4575}
FieldPtr LookupStaticField(const String &name) const
Definition: object.cc:6348
static StringPtr GetterName(const String &field_name)
Definition: object.cc:11792

◆ InvokeSetter()

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

Definition at line 4577 of file object.cc.

4580 {
4581 Thread* thread = Thread::Current();
4582 Zone* zone = thread->zone();
4583
4585
4586 // Check for real fields and user-defined setters.
4587 const Field& field = Field::Handle(zone, LookupStaticField(setter_name));
4588 const String& internal_setter_name =
4589 String::Handle(zone, Field::SetterName(setter_name));
4590
4591 if (!field.IsNull() && check_is_entrypoint) {
4592 CHECK_ERROR(field.VerifyEntryPoint(EntryPointPragma::kSetterOnly));
4593 }
4594
4595 AbstractType& parameter_type = AbstractType::Handle(zone);
4596 if (field.IsNull()) {
4597 const Function& setter =
4598 Function::Handle(zone, LookupStaticFunction(internal_setter_name));
4599 if (!setter.IsNull() && check_is_entrypoint) {
4600 CHECK_ERROR(setter.VerifyCallEntryPoint());
4601 }
4602 const int kNumArgs = 1;
4603 const Array& args = Array::Handle(zone, Array::New(kNumArgs));
4604 args.SetAt(0, value);
4605 if (setter.IsNull() || (respect_reflectable && !setter.is_reflectable())) {
4607 internal_setter_name, args, Object::null_array(),
4610 }
4611 parameter_type = setter.ParameterTypeAt(0);
4612 if (!value.RuntimeTypeIsSubtypeOf(parameter_type,
4613 Object::null_type_arguments(),
4614 Object::null_type_arguments())) {
4615 const String& argument_name =
4616 String::Handle(zone, setter.ParameterNameAt(0));
4617 return ThrowTypeError(setter.token_pos(), value, parameter_type,
4618 argument_name);
4619 }
4620 // Invoke the setter and return the result.
4621 return DartEntry::InvokeFunction(setter, args);
4622 }
4623
4624 if (field.is_final() || (respect_reflectable && !field.is_reflectable())) {
4625 const int kNumArgs = 1;
4626 const Array& args = Array::Handle(zone, Array::New(kNumArgs));
4627 args.SetAt(0, value);
4629 internal_setter_name, args, Object::null_array(),
4632 }
4633
4634 parameter_type = field.type();
4635 if (!value.RuntimeTypeIsSubtypeOf(parameter_type,
4636 Object::null_type_arguments(),
4637 Object::null_type_arguments())) {
4638 const String& argument_name = String::Handle(zone, field.name());
4639 return ThrowTypeError(field.token_pos(), value, parameter_type,
4640 argument_name);
4641 }
4642 field.SetStaticValue(value);
4643 return value.ptr();
4644}
static ArrayPtr New(intptr_t len, Heap::Space space=Heap::kNew)
Definition: object.h:10959
static StringPtr SetterName(const String &field_name)
Definition: object.cc:11804
static ObjectPtr ThrowTypeError(const TokenPosition token_pos, const Instance &src_value, const AbstractType &dst_type, const String &dst_name)
Definition: object.cc:4496

◆ is_abstract()

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

Definition at line 1696 of file object.h.

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

◆ is_allocate_finalized()

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

Definition at line 1732 of file object.h.

1732 {
1733 return ClassFinalizedBits::decode(state_bits()) ==
1735 }

◆ is_allocated()

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

Definition at line 1781 of file object.h.

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

◆ is_base_class()

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

Definition at line 1765 of file object.h.

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

◆ is_const()

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

Definition at line 1745 of file object.h.

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

◆ is_declaration_loaded()

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

Definition at line 1703 of file object.h.

1703 {
1705 }
UntaggedClass::ClassLoadingState class_loading_state() const
Definition: object.h:1699

◆ is_deeply_immutable()

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

Definition at line 2174 of file object.h.

2174 {
2175 return IsDeeplyImmutableBit::decode(state_bits());
2176 }

◆ is_dynamically_extendable()

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

Definition at line 2191 of file object.h.

2191 {
2192 return IsDynamicallyExtendableBit::decode(state_bits());
2193 }

◆ is_enum_class()

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

Definition at line 1720 of file object.h.

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

◆ is_fields_marked_nullable()

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

Definition at line 1776 of file object.h.

1776 {
1777 return FieldsMarkedNullableBit::decode(state_bits());
1778 }

◆ is_final()

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

Definition at line 1773 of file object.h.

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

◆ is_finalized()

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

Definition at line 1723 of file object.h.

1723 {
1724 return ClassFinalizedBits::decode(state_bits()) ==
1726 ClassFinalizedBits::decode(state_bits()) ==
1728 }

◆ is_future_subtype()

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

Definition at line 2182 of file object.h.

2182 {
2184 return IsFutureSubtypeBit::decode(state_bits());
2185 }

◆ is_implemented()

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

Definition at line 1692 of file object.h.

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

◆ is_interface_class()

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

Definition at line 1768 of file object.h.

1768 {
1769 return InterfaceClassBit::decode(state_bits());
1770 }

◆ is_isolate_unsendable()

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

Definition at line 2163 of file object.h.

2163 {
2164 ASSERT(is_finalized()); // This bit is initialized in class finalizer.
2165 return IsIsolateUnsendableBit::decode(state_bits());
2166 }

◆ is_isolate_unsendable_due_to_pragma()

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

Definition at line 2169 of file object.h.

2169 {
2170 return IsIsolateUnsendableDueToPragmaBit::decode(state_bits());
2171 }

◆ is_loaded()

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

Definition at line 1785 of file object.h.

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

◆ is_mixin_class()

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

Definition at line 1762 of file object.h.

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

◆ is_prefinalized()

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

Definition at line 1738 of file object.h.

1738 {
1739 return ClassFinalizedBits::decode(state_bits()) ==
1741 }

◆ is_sealed()

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

Definition at line 1759 of file object.h.

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

◆ is_synthesized_class()

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

Definition at line 1714 of file object.h.

1714 {
1715 return SynthesizedClassBit::decode(state_bits());
1716 }

◆ is_transformed_mixin_application()

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

Definition at line 1754 of file object.h.

1754 {
1755 return TransformedMixinApplicationBit::decode(state_bits());
1756 }

◆ is_type_finalized()

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

Definition at line 1709 of file object.h.

◆ is_valid_id()

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

Definition at line 1230 of file object.h.

1230 {
1232 }
static constexpr bool is_valid(ClassIdTagType value)
Definition: bitfield.h:146

◆ IsClosureClass() [1/2]

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

Definition at line 1577 of file object.h.

1577{ return id() == kClosureCid; }

◆ IsClosureClass() [2/2]

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

Definition at line 1578 of file object.h.

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

◆ IsDartFunctionClass()

bool dart::Class::IsDartFunctionClass ( ) const

Definition at line 5903 of file object.cc.

5903 {
5904 return ptr() == Type::Handle(Type::DartFunctionType()).type_class();
5905}
static TypePtr DartFunctionType()

◆ IsDeeplyImmutable()

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

Definition at line 2177 of file object.h.

2177 {
2178 return IsDeeplyImmutableBit::decode(clazz->untag()->state_bits_);
2179 }

◆ IsDynamicClass()

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

Definition at line 1556 of file object.h.

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

◆ IsFutureClass()

bool dart::Class::IsFutureClass ( ) const

Definition at line 5907 of file object.cc.

5907 {
5908 // Looking up future_class in the object store would not work, because
5909 // this function is called during class finalization, before the object store
5910 // field would be initialized by InitKnownObjects().
5911 return (Name() == Symbols::Future().ptr()) &&
5913}
static LibraryPtr AsyncLibrary()
Definition: object.cc:14779

◆ IsFutureOrClass()

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

Definition at line 1574 of file object.h.

1574{ return id() == kFutureOrCid; }

◆ IsGeneric()

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

Definition at line 1358 of file object.h.

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

◆ IsInFullSnapshot() [1/2]

bool dart::Class::IsInFullSnapshot ( ) const

Definition at line 3030 of file object.cc.

3030 {
3031 NoSafepointScope no_safepoint;
3033 untag()->library()->untag()->flags_);
3034}

◆ IsInFullSnapshot() [2/2]

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

Definition at line 1585 of file object.h.

1585 {
1586 NoSafepointScope no_safepoint;
1588 cls->untag()->library()->untag()->flags_);
1589 }

◆ IsIsolateUnsendable()

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

Definition at line 1795 of file object.h.

1795 {
1796 return IsIsolateUnsendableBit::decode(clazz->untag()->state_bits_);
1797 }

◆ IsNeverClass()

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

Definition at line 1562 of file object.h.

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

◆ IsNullClass()

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

Definition at line 1553 of file object.h.

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

◆ IsObjectClass()

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

Definition at line 1565 of file object.h.

1565{ return id() == kInstanceCid; }

◆ IsPrivate()

bool dart::Class::IsPrivate ( ) const

Definition at line 6125 of file object.cc.

6125 {
6127}
static bool IsPrivate(const String &name)
Definition: object.cc:14619

◆ IsRecordClass()

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

Definition at line 1583 of file object.h.

1583{ 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 5920 of file object.cc.

5925 {
5926 TRACE_TYPE_CHECKS_VERBOSE(" Class::IsSubtypeOf(%s %s, %s)\n",
5927 cls.ToCString(), type_arguments.ToCString(),
5928 other.ToCString());
5929 // This function does not support Null, Never, dynamic, or void as type T0.
5930 classid_t this_cid = cls.id();
5931 ASSERT(this_cid != kNullCid && this_cid != kNeverCid &&
5932 this_cid != kDynamicCid && this_cid != kVoidCid);
5933 ASSERT(type_arguments.IsNull() ||
5934 (type_arguments.Length() >= cls.NumTypeArguments()));
5935 // Type T1 must have a type class (e.g. not a type param or a function type).
5936 ASSERT(other.HasTypeClass());
5937 const classid_t other_cid = other.type_class_id();
5938 if (other_cid == kDynamicCid || other_cid == kVoidCid) {
5939 TRACE_TYPE_CHECKS_VERBOSE(" - result: true (right is top)\n");
5940 return true;
5941 }
5942 // Left nullable:
5943 // if T0 is S0? then:
5944 // T0 <: T1 iff S0 <: T1 and Null <: T1
5945 if ((nullability == Nullability::kNullable) &&
5947 TRACE_TYPE_CHECKS_VERBOSE(" - result: false (nullability)\n");
5948 return false;
5949 }
5950
5951 // Right Object.
5952 if (other_cid == kObjectCid) {
5953 TRACE_TYPE_CHECKS_VERBOSE(" - result: true (right is Object)\n");
5954 return true;
5955 }
5956
5957 Thread* thread = Thread::Current();
5958 Zone* zone = thread->zone();
5959 const Class& other_class = Class::Handle(zone, other.type_class());
5960 const TypeArguments& other_type_arguments =
5961 TypeArguments::Handle(zone, other.arguments());
5962 // Use the 'this_class' object as if it was the receiver of this method, but
5963 // instead of recursing, reset it to the super class and loop.
5964 Class& this_class = Class::Handle(zone, cls.ptr());
5965 while (true) {
5966 // Apply additional subtyping rules if T0 or T1 are 'FutureOr'.
5967
5968 // Left FutureOr:
5969 // if T0 is FutureOr<S0> then:
5970 // T0 <: T1 iff Future<S0> <: T1 and S0 <: T1
5971 if (this_cid == kFutureOrCid) {
5972 // Check Future<S0> <: T1.
5973 ObjectStore* object_store = IsolateGroup::Current()->object_store();
5974 const Class& future_class =
5975 Class::Handle(zone, object_store->future_class());
5976 ASSERT(!future_class.IsNull() && future_class.NumTypeParameters() == 1 &&
5977 this_class.NumTypeParameters() == 1);
5978 ASSERT(type_arguments.IsNull() || type_arguments.Length() >= 1);
5979 if (Class::IsSubtypeOf(future_class, type_arguments,
5980 Nullability::kNonNullable, other, space,
5981 function_type_equivalence)) {
5982 // Check S0 <: T1.
5983 const AbstractType& type_arg =
5984 AbstractType::Handle(zone, type_arguments.TypeAtNullSafe(0));
5985 if (type_arg.IsSubtypeOf(other, space, function_type_equivalence)) {
5986 TRACE_TYPE_CHECKS_VERBOSE(" - result: true (left is FutureOr)\n");
5987 return true;
5988 }
5989 }
5990 }
5991
5992 // Right FutureOr:
5993 // if T1 is FutureOr<S1> then:
5994 // T0 <: T1 iff any of the following hold:
5995 // either T0 <: Future<S1>
5996 // or T0 <: S1
5997 // or T0 is X0 and X0 has bound S0 and S0 <: T1 (checked elsewhere)
5998 if (other_cid == kFutureOrCid) {
5999 const AbstractType& other_type_arg =
6000 AbstractType::Handle(zone, other_type_arguments.TypeAtNullSafe(0));
6001 // Check if S1 is a top type.
6002 if (other_type_arg.IsTopTypeForSubtyping()) {
6004 " - result: true (right is FutureOr top)\n");
6005 return true;
6006 }
6007 // Check T0 <: Future<S1> when T0 is Future<S0>.
6008 if (this_class.IsFutureClass()) {
6009 const AbstractType& type_arg =
6010 AbstractType::Handle(zone, type_arguments.TypeAtNullSafe(0));
6011 // If T0 is Future<S0>, then T0 <: Future<S1>, iff S0 <: S1.
6012 if (type_arg.IsSubtypeOf(other_type_arg, space,
6013 function_type_equivalence)) {
6015 " - result: true (left is Future, right is FutureOr)\n");
6016 return true;
6017 }
6018 }
6019 // Check T0 <: Future<S1> when T0 is FutureOr<S0> is already done.
6020 // Check T0 <: S1.
6021 if (other_type_arg.HasTypeClass() &&
6022 Class::IsSubtypeOf(this_class, type_arguments, nullability,
6023 other_type_arg, space,
6024 function_type_equivalence)) {
6026 " - result: true (right is FutureOr, subtype of arg)\n");
6027 return true;
6028 }
6029 }
6030
6031 // Check for reflexivity.
6032 if (this_class.ptr() == other_class.ptr()) {
6033 const intptr_t num_type_params = this_class.NumTypeParameters();
6034 if (num_type_params == 0) {
6036 " - result: true (same non-generic class)\n");
6037 return true;
6038 }
6039 // Check for covariance.
6040 if (other_type_arguments.IsNull()) {
6042 " - result: true (same class, dynamic type args)\n");
6043 return true;
6044 }
6045 const intptr_t num_type_args = this_class.NumTypeArguments();
6046 const intptr_t from_index = num_type_args - num_type_params;
6047 ASSERT(other_type_arguments.Length() == num_type_params);
6049 AbstractType& other_type = AbstractType::Handle(zone);
6050 for (intptr_t i = 0; i < num_type_params; ++i) {
6051 type = type_arguments.TypeAtNullSafe(from_index + i);
6052 other_type = other_type_arguments.TypeAt(i);
6053 ASSERT(!type.IsNull() && !other_type.IsNull());
6054 if (!type.IsSubtypeOf(other_type, space, function_type_equivalence)) {
6056 " - result: false (same class, type args mismatch)\n");
6057 return false;
6058 }
6059 }
6061 " - result: true (same class, matching type args)\n");
6062 return true;
6063 }
6064
6065 // _Closure <: Function
6066 if (this_class.IsClosureClass() && other_class.IsDartFunctionClass()) {
6068 " - result: true (left is closure, right is Function)\n");
6069 return true;
6070 }
6071
6072 // Check for 'direct super type' specified in the implements clause
6073 // and check for transitivity at the same time.
6074 Array& interfaces = Array::Handle(zone, this_class.interfaces());
6075 Type& interface = Type::Handle(zone);
6076 Class& interface_class = Class::Handle(zone);
6077 TypeArguments& interface_args = TypeArguments::Handle(zone);
6078 for (intptr_t i = 0; i < interfaces.Length(); i++) {
6079 interface ^= interfaces.At(i);
6080 ASSERT(interface.IsFinalized());
6081 interface_class = interface.type_class();
6082 interface_args = interface.arguments();
6083 if (!interface_args.IsNull() && !interface_args.IsInstantiated()) {
6084 // This type class implements an interface that is parameterized with
6085 // generic type(s), e.g. it implements List<T>.
6086 // The uninstantiated type T must be instantiated using the type
6087 // parameters of this type before performing the type test.
6088 // The type arguments of this type that are referred to by the type
6089 // parameters of the interface are at the end of the type vector,
6090 // after the type arguments of the super type of this type.
6091 // The index of the type parameters is adjusted upon finalization.
6092 interface_args = interface_args.InstantiateFrom(
6093 type_arguments, Object::null_type_arguments(), kNoneFree, space);
6094 }
6095 interface_args = interface_class.GetInstanceTypeArguments(
6096 thread, interface_args, /*canonicalize=*/false);
6097 // In Dart 2, implementing Function has no meaning.
6098 // TODO(regis): Can we encounter and skip Object as well?
6099 if (interface_class.IsDartFunctionClass()) {
6100 continue;
6101 }
6102 if (Class::IsSubtypeOf(interface_class, interface_args,
6103 Nullability::kNonNullable, other, space,
6104 function_type_equivalence)) {
6105 TRACE_TYPE_CHECKS_VERBOSE(" - result: true (interface found)\n");
6106 return true;
6107 }
6108 }
6109 // "Recurse" up the class hierarchy until we have reached the top.
6110 this_class = this_class.SuperClass();
6111 if (this_class.IsNull()) {
6112 TRACE_TYPE_CHECKS_VERBOSE(" - result: false (supertype not found)\n");
6113 return false;
6114 }
6115 this_cid = this_class.id();
6116 }
6117 UNREACHABLE();
6118 return false;
6119}
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:5920
static bool NullIsAssignableTo(const AbstractType &other)
Definition: object.cc:20674
ObjectStore * object_store() const
Definition: isolate.h:510
int32_t classid_t
Definition: globals.h:524
@ kVoidCid
Definition: class_id.h:254
@ kNoneFree
Definition: object.h:2926
#define TRACE_TYPE_CHECKS_VERBOSE(format,...)
Definition: object.cc:226

◆ IsTopLevel()

bool dart::Class::IsTopLevel ( ) const

Definition at line 6121 of file object.cc.

6121 {
6122 return Name() == Symbols::TopLevel().ptr();
6123}

◆ IsVoidClass()

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

Definition at line 1559 of file object.h.

1559{ return id() == kVoidCid; }

◆ kernel_offset()

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

Definition at line 1804 of file object.h.

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

◆ KernelProgramInfo()

KernelProgramInfoPtr dart::Class::KernelProgramInfo ( ) const

Definition at line 5560 of file object.cc.

5560 {
5561 const auto& lib = Library::Handle(library());
5562 return lib.kernel_program_info();
5563}

◆ library()

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

Definition at line 1333 of file object.h.

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

◆ LookupCanonicalInstance()

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

Definition at line 6472 of file object.cc.

6473 {
6474 ASSERT(this->ptr() == value.clazz());
6476 Instance& canonical_value = Instance::Handle(zone);
6477 if (this->constants() != Array::null()) {
6479 canonical_value ^= constants.GetOrNull(CanonicalInstanceKey(value));
6480 this->set_constants(constants.Release());
6481 }
6482 return canonical_value.ptr();
6483}

◆ LookupConstructor()

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

Definition at line 6147 of file object.cc.

6147 {
6148 Thread* thread = Thread::Current();
6149 SafepointReadRwLocker ml(thread, thread->isolate_group()->program_lock());
6150 return LookupFunctionReadLocked(name, kConstructor);
6151}
FunctionPtr LookupFunctionReadLocked(const String &name) const
Definition: object.cc:6171

◆ LookupConstructorAllowPrivate()

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

Definition at line 6153 of file object.cc.

6153 {
6154 return LookupFunctionAllowPrivate(name, kConstructor);
6155}
FunctionPtr LookupFunctionAllowPrivate(const String &name) const
Definition: object.cc:6167

◆ LookupDynamicFunctionAllowPrivate()

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

Definition at line 6133 of file object.cc.

6133 {
6134 return LookupFunctionAllowPrivate(name, kInstance);
6135}

◆ LookupDynamicFunctionUnsafe()

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

Definition at line 6129 of file object.cc.

6129 {
6130 return LookupFunctionReadLocked(name, kInstance);
6131}

◆ LookupFactory()

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

Definition at line 6157 of file object.cc.

6157 {
6158 Thread* thread = Thread::Current();
6159 SafepointReadRwLocker ml(thread, thread->isolate_group()->program_lock());
6160 return LookupFunctionReadLocked(name, kFactory);
6161}

◆ LookupFactoryAllowPrivate()

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

Definition at line 6163 of file object.cc.

6163 {
6164 return LookupFunctionAllowPrivate(name, kFactory);
6165}

◆ LookupField()

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

Definition at line 6352 of file object.cc.

6352 {
6353 return LookupField(name, kAny);
6354}
FieldPtr LookupField(const String &name) const
Definition: object.cc:6352

◆ LookupFieldAllowPrivate()

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

Definition at line 6403 of file object.cc.

6404 {
6405 ASSERT(!IsNull());
6406 // Use slow string compare, ignoring privacy name mangling.
6407 Thread* thread = Thread::Current();
6408 if (EnsureIsFinalized(thread) != Error::null()) {
6409 return Field::null();
6410 }
6414 Array& flds = thread->ArrayHandle();
6415 flds = fields();
6416 ASSERT(!flds.IsNull());
6417 intptr_t len = flds.Length();
6418 Field& field = thread->FieldHandle();
6419 String& field_name = thread->StringHandle();
6420 for (intptr_t i = 0; i < len; i++) {
6421 field ^= flds.At(i);
6422 field_name = field.name();
6423 if (field.is_static() && instance_only) {
6424 // If we only care about instance fields, skip statics.
6425 continue;
6426 }
6427 if (String::EqualsIgnoringPrivateKey(field_name, name)) {
6428 return field.ptr();
6429 }
6430 }
6431 return Field::null();
6432}
static bool EqualsIgnoringPrivateKey(const String &str1, const String &str2)
Definition: object.cc:24299
#define REUSABLE_STRING_HANDLESCOPE(thread)

◆ LookupFunctionAllowPrivate()

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

Definition at line 6167 of file object.cc.

6167 {
6168 return LookupFunctionAllowPrivate(name, kAny);
6169}

◆ LookupFunctionReadLocked()

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

Definition at line 6171 of file object.cc.

6171 {
6172 return LookupFunctionReadLocked(name, kAny);
6173}

◆ LookupGetterFunction()

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

Definition at line 6308 of file object.cc.

6308 {
6309 return LookupAccessorFunction(kGetterPrefix, kGetterPrefixLength, name);
6310}
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 6344 of file object.cc.

6344 {
6345 return LookupField(name, kInstance);
6346}

◆ LookupInstanceFieldAllowPrivate()

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

Definition at line 6434 of file object.cc.

6434 {
6435 Field& field = Field::Handle(LookupFieldAllowPrivate(name, true));
6436 if (!field.IsNull() && !field.is_static()) {
6437 return field.ptr();
6438 }
6439 return Field::null();
6440}
FieldPtr LookupFieldAllowPrivate(const String &name, bool instance_only=false) const
Definition: object.cc:6403

◆ LookupSetterFunction()

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

Definition at line 6312 of file object.cc.

6312 {
6313 return LookupAccessorFunction(kSetterPrefix, kSetterPrefixLength, name);
6314}
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 6348 of file object.cc.

6348 {
6349 return LookupField(name, kStatic);
6350}

◆ LookupStaticFieldAllowPrivate()

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

Definition at line 6442 of file object.cc.

6442 {
6444 if (!field.IsNull() && field.is_static()) {
6445 return field.ptr();
6446 }
6447 return Field::null();
6448}

◆ LookupStaticFunction()

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

Definition at line 6137 of file object.cc.

6137 {
6138 Thread* thread = Thread::Current();
6139 SafepointReadRwLocker ml(thread, thread->isolate_group()->program_lock());
6140 return LookupFunctionReadLocked(name, kStatic);
6141}

◆ LookupStaticFunctionAllowPrivate()

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

Definition at line 6143 of file object.cc.

6143 {
6144 return LookupFunctionAllowPrivate(name, kStatic);
6145}

◆ 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:3702
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:167

◆ Mixin()

ClassPtr dart::Class::Mixin ( ) const

Definition at line 3020 of file object.cc.

3020 {
3022 const Array& interfaces = Array::Handle(this->interfaces());
3023 const Type& mixin_type =
3025 return mixin_type.type_class();
3026 }
3027 return ptr();
3028}
bool is_transformed_mixin_application() const
Definition: object.h:1754

◆ Name()

StringPtr dart::Class::Name ( ) const

Definition at line 2977 of file object.cc.

2977 {
2978 return untag()->name();
2979}

◆ NameCString()

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

Definition at line 3006 of file object.cc.

3006 {
3007 switch (name_visibility) {
3009 return String::Handle(Name()).ToCString();
3011 return ScrubbedNameCString();
3013 return UserVisibleNameCString();
3014 default:
3015 UNREACHABLE();
3016 return nullptr;
3017 }
3018}
const char * ScrubbedNameCString() const
Definition: object.cc:2985
const char * UserVisibleNameCString() const
Definition: object.cc:2998
@ 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 5161 of file object.cc.

5165 {
5166 Class& result =
5167 Class::Handle(NewCommon<Instance, RTN::Instance>(kIllegalCid));
5168 result.set_library(lib);
5169 result.set_name(name);
5170 result.set_script(script);
5171 NOT_IN_PRECOMPILED(result.set_token_pos(token_pos));
5172
5173 // The size gets initialized to 0. Once the class gets finalized the class
5174 // finalizer will set the correct size.
5175 ASSERT(!result.is_finalized() && !result.is_prefinalized());
5176 result.set_instance_size_in_words(0, 0);
5177
5178 if (register_class) {
5180 }
5181 return result.ptr();
5182}
TokenPosition token_pos() const
Definition: object.h:1279
ScriptPtr script() const
Definition: object.h:1272
void RegisterClass(const Class &cls)
Definition: isolate.cc:769
@ 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 3053 of file object.cc.

3053 {
3055 const auto& result = Class::Handle(Object::Allocate<Class>(Heap::kOld));
3056 Object::VerifyBuiltinVtable<FakeObject>(FakeObject::kClassId);
3057 NOT_IN_PRECOMPILED(result.set_token_pos(TokenPosition::kNoSource));
3058 NOT_IN_PRECOMPILED(result.set_end_token_pos(TokenPosition::kNoSource));
3059 result.set_instance_size(FakeObject::InstanceSize(),
3061 TargetFakeObject::InstanceSize()));
3062 result.set_type_arguments_field_offset_in_words(kNoTypeArguments,
3064 const intptr_t host_next_field_offset = FakeObject::NextFieldOffset();
3065 const intptr_t target_next_field_offset = TargetFakeObject::NextFieldOffset();
3066 result.set_next_field_offset(host_next_field_offset,
3068 COMPILE_ASSERT((FakeObject::kClassId != kInstanceCid));
3069 result.set_id(FakeObject::kClassId);
3070 NOT_IN_PRECOMPILED(result.set_implementor_cid(kIllegalCid));
3071 result.set_num_type_arguments_unsafe(0);
3072 result.set_num_native_fields(0);
3073 result.set_state_bits(0);
3074 if (IsInternalOnlyClassId(FakeObject::kClassId) ||
3075 (FakeObject::kClassId == kTypeArgumentsCid)) {
3076 // VM internal classes are done. There is no finalization needed or
3077 // possible in this case.
3078 result.set_is_declaration_loaded();
3079 result.set_is_type_finalized();
3080 result.set_is_allocate_finalized();
3081 } else if (FakeObject::kClassId != kClosureCid) {
3082 // VM backed classes are almost ready: run checks and resolve class
3083 // references, but do not recompute size.
3084 result.set_is_prefinalized();
3085 }
3086 if (FakeObject::kClassId < kNumPredefinedCids &&
3087 IsDeeplyImmutableCid(FakeObject::kClassId)) {
3088 result.set_is_deeply_immutable(true);
3089 }
3090 NOT_IN_PRECOMPILED(result.set_kernel_offset(0));
3091 result.InitEmptyFields();
3092 if (register_class) {
3093 isolate_group->class_table()->Register(result);
3094 }
3095 return result.ptr();
3096}
intptr_t host_next_field_offset() const
Definition: object.h:1190
intptr_t target_next_field_offset() const
Definition: object.h:1193
static ClassPtr class_class()
Definition: object.h:513
static const word kNoTypeArguments
Definition: runtime_api.h:486
intptr_t RoundedAllocationSize(intptr_t size)
Definition: runtime_api.h:333
bool IsInternalOnlyClassId(intptr_t index)
Definition: class_id.h:299
bool IsDeeplyImmutableCid(intptr_t predefined_cid)
Definition: class_id.h:485
COMPILE_ASSERT(kUnreachableReference==WeakTable::kNoValue)

◆ NewExternalTypedDataClass()

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

Definition at line 5318 of file object.cc.

5319 {
5324 Class& result = Class::Handle(New<ExternalTypedData, RTN::ExternalTypedData>(
5325 class_id, isolate_group, /*register_class=*/false));
5326
5328 const intptr_t target_next_field_offset =
5329 RTN::ExternalTypedData::NextFieldOffset();
5331 result.set_next_field_offset(host_next_field_offset,
5333 result.set_is_prefinalized();
5334 isolate_group->class_table()->Register(result);
5335 return result.ptr();
5336}
intptr_t target_instance_size() const
Definition: object.h:1147
intptr_t host_instance_size() const
Definition: object.h:1143
static intptr_t InstanceSize()
Definition: object.h:11740
static intptr_t NextFieldOffset()
Definition: object.h:8355
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 5189 of file object.cc.

5191 {
5192 Class& cls = Class::Handle(library.LookupClass(name));
5193 if (cls.IsNull()) {
5194 cls = New(library, name, Script::Handle(), TokenPosition::kNoSource);
5195 cls.SetFields(Object::empty_array());
5196 cls.SetFunctions(Object::empty_array());
5197 // Set super class to Object.
5198 cls.set_super_type(Type::Handle(Type::ObjectType()));
5199 // Compute instance size. First word contains a pointer to a properly
5200 // sized typed array once the first native field has been set.
5201 const intptr_t host_instance_size =
5202 sizeof(UntaggedInstance) + kCompressedWordSize;
5203#if defined(DART_PRECOMPILER)
5204 const intptr_t target_instance_size =
5207#else
5208 const intptr_t target_instance_size =
5209 sizeof(UntaggedInstance) + compiler::target::kCompressedWordSize;
5210#endif
5211 cls.set_instance_size(
5214 cls.set_next_field_offset(host_instance_size, target_instance_size);
5215 cls.set_num_native_fields(field_count);
5216 cls.set_is_allocate_finalized();
5217 // The signature of the constructor yet to be added to this class will have
5218 // to be finalized explicitly, since the class is prematurely marked as
5219 // 'is_allocate_finalized' and finalization of member types will not occur.
5220 cls.set_is_declaration_loaded();
5221 cls.set_is_type_finalized();
5222 cls.set_is_synthesized_class();
5223 cls.set_is_isolate_unsendable(true);
5224 NOT_IN_PRECOMPILED(cls.set_implementor_cid(kDynamicCid));
5225 library.AddClass(cls);
5226 return cls.ptr();
5227 } else {
5228 return Class::null();
5229 }
5230}
static ClassPtr New(IsolateGroup *isolate_group, bool register_class=true)
Definition: object.cc:3053
static TypePtr ObjectType()
static constexpr intptr_t kCompressedWordSize
Definition: runtime_api.h:286

◆ NewPointerClass()

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

Definition at line 5338 of file object.cc.

5339 {
5340 ASSERT(IsFfiPointerClassId(class_id));
5342 intptr_t target_instance_size =
5344 Class& result = Class::Handle(New<Pointer, RTN::Pointer>(
5345 class_id, isolate_group, /*register_class=*/false));
5347 result.set_type_arguments_field_offset(Pointer::type_arguments_offset(),
5349
5351 const intptr_t target_next_field_offset = RTN::Pointer::NextFieldOffset();
5352
5353 result.set_next_field_offset(host_next_field_offset,
5355 result.set_is_prefinalized();
5356 isolate_group->class_table()->Register(result);
5357 return result.ptr();
5358}
static intptr_t type_arguments_offset()
Definition: object.h:11902
static intptr_t InstanceSize()
Definition: object.h:11887
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 5232 of file object.cc.

5232 {
5234 if (class_id == kOneByteStringCid) {
5238 } else {
5239 ASSERT(class_id == kTwoByteStringCid);
5243 }
5244 Class& result = Class::Handle(New<String, RTN::String>(
5245 class_id, isolate_group, /*register_class=*/false));
5247
5249 const intptr_t target_next_field_offset = RTN::String::NextFieldOffset();
5250 result.set_next_field_offset(host_next_field_offset,
5252 result.set_is_prefinalized();
5253 ASSERT(IsDeeplyImmutableCid(class_id));
5254 result.set_is_deeply_immutable(true);
5255 isolate_group->class_table()->Register(result);
5256 return result.ptr();
5257}
static intptr_t InstanceSize()
Definition: object.h:10564
static intptr_t InstanceSize()
Definition: object.h:10704

◆ NewTypedDataClass()

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

Definition at line 5259 of file object.cc.

5260 {
5261 ASSERT(IsTypedDataClassId(class_id));
5263 const intptr_t target_instance_size =
5265 Class& result = Class::Handle(New<TypedData, RTN::TypedData>(
5266 class_id, isolate_group, /*register_class=*/false));
5268
5270 const intptr_t target_next_field_offset = RTN::TypedData::NextFieldOffset();
5271 result.set_next_field_offset(host_next_field_offset,
5273 result.set_is_prefinalized();
5274 isolate_group->class_table()->Register(result);
5275 return result.ptr();
5276}
static intptr_t InstanceSize()
Definition: object.h:11673
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 5278 of file object.cc.

5279 {
5280 ASSERT(IsTypedDataViewClassId(class_id));
5284 Class& result = Class::Handle(New<TypedDataView, RTN::TypedDataView>(
5285 class_id, isolate_group, /*register_class=*/false));
5287
5289 const intptr_t target_next_field_offset =
5290 RTN::TypedDataView::NextFieldOffset();
5291 result.set_next_field_offset(host_next_field_offset,
5293 result.set_is_prefinalized();
5294 isolate_group->class_table()->Register(result);
5295 return result.ptr();
5296}
static intptr_t InstanceSize()
Definition: object.h:11793
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 5298 of file object.cc.

5299 {
5304 Class& result = Class::Handle(New<TypedDataView, RTN::TypedDataView>(
5305 class_id, isolate_group, /*register_class=*/false));
5307
5309 const intptr_t target_next_field_offset =
5310 RTN::TypedDataView::NextFieldOffset();
5311 result.set_next_field_offset(host_next_field_offset,
5313 result.set_is_prefinalized();
5314 isolate_group->class_table()->Register(result);
5315 return result.ptr();
5316}
bool IsUnmodifiableTypedDataViewClassId(intptr_t index)
Definition: class_id.h:453

◆ NoteImplementor()

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

Definition at line 5580 of file object.cc.

5580 {
5581 ASSERT(!implementor.is_abstract());
5582 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5583 if (implementor_cid() == kDynamicCid) {
5584 return false;
5585 } else if (implementor_cid() == implementor.id()) {
5586 return false;
5587 } else if (implementor_cid() == kIllegalCid) {
5588 set_implementor_cid(implementor.id());
5589 return true; // None -> One
5590 } else {
5591 set_implementor_cid(kDynamicCid);
5592 return true; // One -> Many
5593 }
5594}
intptr_t implementor_cid() const
Definition: object.h:1245

◆ num_native_fields()

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

Definition at line 1788 of file object.h.

1788{ return untag()->num_native_fields_; }

◆ num_type_arguments_offset()

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

Definition at line 1252 of file object.h.

1252 {
1253 return OFFSET_OF(UntaggedClass, num_type_arguments_);
1254 }

◆ NumNativeFieldsOf()

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

Definition at line 1792 of file object.h.

1792 {
1793 return clazz->untag()->num_native_fields_;
1794 }

◆ NumTypeArguments()

intptr_t dart::Class::NumTypeArguments ( ) const

Definition at line 3640 of file object.cc.

3640 {
3641 // Return cached value if already calculated.
3642 intptr_t num_type_args = num_type_arguments();
3643 if (num_type_args != kUnknownNumTypeArguments) {
3644 return num_type_args;
3645 }
3646
3647#if defined(DART_PRECOMPILED_RUNTIME)
3648 UNREACHABLE();
3649 return 0;
3650#else
3651 num_type_args = ComputeNumTypeArguments();
3652 ASSERT(num_type_args != kUnknownNumTypeArguments);
3653 set_num_type_arguments(num_type_args);
3654 return num_type_args;
3655#endif // defined(DART_PRECOMPILED_RUNTIME)
3656}
void set_num_type_arguments(intptr_t value) const
Definition: object.cc:3109

◆ NumTypeParameters() [1/2]

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

Definition at line 1344 of file object.h.

1344 {
1346 }

◆ NumTypeParameters() [2/2]

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

Definition at line 3555 of file object.cc.

3555 {
3556 if (!is_declaration_loaded()) {
3558 const intptr_t cid = id();
3559 if ((cid == kArrayCid) || (cid == kImmutableArrayCid) ||
3560 (cid == kGrowableObjectArrayCid)) {
3561 return 1; // List's type parameter may not have been parsed yet.
3562 }
3563 return 0;
3564 }
3566 return 0;
3567 }
3569 TypeParameters& type_params = thread->TypeParametersHandle();
3570 type_params = type_parameters();
3571 return type_params.Length();
3572}
#define REUSABLE_TYPE_PARAMETERS_HANDLESCOPE(thread)

◆ OffsetToFieldMap()

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

Definition at line 3183 of file object.cc.

3184 {
3186 if (untag()->offset_in_words_to_field<std::memory_order_acquire>() ==
3187 Array::null()) {
3188 // Even if multiple threads are calling this concurrently, all of them would
3189 // compute the same array, so we intentionally don't acquire any locks here.
3190 const intptr_t length = untag()->host_instance_size_in_words_;
3191 const Array& array = Array::Handle(Array::New(length, Heap::kOld));
3192 Class& cls = Class::Handle(this->ptr());
3193 Array& fields = Array::Handle();
3194 Field& f = Field::Handle();
3195 while (!cls.IsNull()) {
3196 fields = cls.fields();
3197 for (intptr_t i = 0; i < fields.Length(); ++i) {
3198 f ^= fields.At(i);
3199 if (f.is_instance()) {
3200 array.SetAt(f.HostOffset() >> kCompressedWordSizeLog2, f);
3201 }
3202 }
3203 cls = cls.SuperClass(class_table);
3204 }
3205 untag()->set_offset_in_words_to_field<std::memory_order_release>(
3206 array.ptr());
3207 }
3208 return untag()->offset_in_words_to_field<std::memory_order_acquire>();
3209}
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:5560

◆ RareType()

TypePtr dart::Class::RareType ( ) const

Definition at line 3036 of file object.cc.

3036 {
3037 if (!IsGeneric()) {
3038 return DeclarationType();
3039 }
3041 Thread* const thread = Thread::Current();
3042 Zone* const zone = thread->zone();
3043 const auto& inst_to_bounds =
3045 ASSERT(inst_to_bounds.ptr() != Object::empty_type_arguments().ptr());
3046 auto& type = Type::Handle(
3047 zone, Type::New(*this, inst_to_bounds, Nullability::kNonNullable));
3049 return type.ptr();
3050}
TypeArgumentsPtr DefaultTypeArguments(Zone *zone) const
Definition: object.cc:3658
bool IsGeneric() const
Definition: object.h:1358

◆ RegisterCHACode()

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

Definition at line 4390 of file object.cc.

4390 {
4391 if (FLAG_trace_cha) {
4392 THR_Print("RegisterCHACode '%s' depends on class '%s'\n",
4393 Function::Handle(code.function()).ToQualifiedCString(),
4394 ToCString());
4395 }
4396 DEBUG_ASSERT(IsMutatorOrAtDeoptSafepoint());
4397 ASSERT(code.is_optimized());
4398 CHACodeArray a(*this);
4399 a.Register(code);
4400}

◆ script()

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

Definition at line 1272 of file object.h.

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

◆ ScrubbedName()

StringPtr dart::Class::ScrubbedName ( ) const

Definition at line 2981 of file object.cc.

2981 {
2983}

◆ ScrubbedNameCString()

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

Definition at line 2985 of file object.cc.

2985 {
2987}
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 5870 of file object.cc.

5870 {
5871 // Never clear the stub as it may still be a target, but will be GC-d if
5872 // not referenced.
5873 ASSERT(!value.IsNull());
5875 untag()->set_allocation_stub(value.ptr());
5876}

◆ set_can_be_future()

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

Definition at line 3154 of file object.cc.

3154 {
3155 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
3156 set_state_bits(CanBeFutureBit::update(value, state_bits()));
3157}

◆ set_constants()

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

Definition at line 5810 of file object.cc.

5810 {
5811 untag()->set_constants(value.ptr());
5812}

◆ set_dependent_code()

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

Definition at line 4426 of file object.cc.

4426 {
4428 IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
4429 untag()->set_dependent_code(array.ptr());
4430}

◆ set_direct_implementors()

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

Definition at line 5772 of file object.cc.

5773 {
5774 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5775 untag()->set_direct_implementors(implementors.ptr());
5776}

◆ set_direct_subclasses()

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

Definition at line 5799 of file object.cc.

5799 {
5800 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5801 untag()->set_direct_subclasses(subclasses.ptr());
5802}

◆ set_end_token_pos()

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

Definition at line 5570 of file object.cc.

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

◆ set_has_dynamically_extendable_subtypes()

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

Definition at line 3164 of file object.cc.

3164 {
3165 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
3166 set_state_bits(
3167 HasDynamicallyExtendableSubtypesBit::update(value, state_bits()));
3168}

◆ set_has_pragma()

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

Definition at line 3129 of file object.cc.

3129 {
3130 set_state_bits(HasPragmaBit::update(value, state_bits()));
3131}

◆ set_id()

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

Definition at line 1234 of file object.h.

1234 {
1236 StoreNonPointer(&untag()->id_, value);
1237 }
static float max(float r, float g, float b)
Definition: hsl.cpp:49

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

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

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

1175 {
1176 ASSERT(
1178 StoreNonPointer(&untag()->host_instance_size_in_words_, host_value);
1179#if defined(DART_PRECOMPILER)
1180 ASSERT(
1183 StoreNonPointer(&untag()->target_instance_size_in_words_, target_value);
1184#else
1185 // Could be different only during cross-compilation.
1186 ASSERT_EQUAL(host_value, target_value);
1187#endif // defined(DART_PRECOMPILER)
1188 }
static constexpr bool IsAligned(T x, uintptr_t alignment, uintptr_t offset=0)
Definition: utils.h:92
static constexpr intptr_t kObjectAlignment
Definition: runtime_api.h:313
static constexpr intptr_t kObjectAlignment

◆ set_interfaces()

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

Definition at line 5739 of file object.cc.

5739 {
5740 ASSERT(!value.IsNull());
5741 untag()->set_interfaces(value.ptr());
5742}

◆ set_is_abstract()

void dart::Class::set_is_abstract ( ) const

Definition at line 5622 of file object.cc.

5622 {
5623 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5624 set_state_bits(AbstractBit::update(true, state_bits()));
5625}

◆ set_is_allocate_finalized()

void dart::Class::set_is_allocate_finalized ( ) const

Definition at line 5725 of file object.cc.

5725 {
5726 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5728 set_state_bits(ClassFinalizedBits::update(UntaggedClass::kAllocateFinalized,
5729 state_bits()));
5730}

◆ set_is_allocated()

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

Definition at line 5700 of file object.cc.

5700 {
5701 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5703}
void set_is_allocated_unsafe(bool value) const
Definition: object.cc:5705

◆ set_is_allocated_unsafe()

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

Definition at line 5705 of file object.cc.

5705 {
5706 set_state_bits(IsAllocatedBit::update(value, state_bits()));
5707}

◆ set_is_base_class()

void dart::Class::set_is_base_class ( ) const

Definition at line 5680 of file object.cc.

5680 {
5681 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5682 set_state_bits(BaseClassBit::update(true, state_bits()));
5683}

◆ set_is_const()

void dart::Class::set_is_const ( ) const

Definition at line 5660 of file object.cc.

5660 {
5661 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5662 set_state_bits(ConstBit::update(true, state_bits()));
5663}

◆ set_is_declaration_loaded()

void dart::Class::set_is_declaration_loaded ( ) const

Definition at line 5627 of file object.cc.

5627 {
5628 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5630}
void set_is_declaration_loaded_unsafe() const
Definition: object.cc:5632

◆ set_is_declaration_loaded_unsafe()

void dart::Class::set_is_declaration_loaded_unsafe ( ) const

Definition at line 5632 of file object.cc.

5632 {
5634 set_state_bits(ClassLoadingBits::update(UntaggedClass::kDeclarationLoaded,
5635 state_bits()));
5636}

◆ set_is_deeply_immutable()

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

Definition at line 3144 of file object.cc.

3144 {
3145 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
3146 set_state_bits(IsDeeplyImmutableBit::update(value, state_bits()));
3147}

◆ set_is_dynamically_extendable()

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

Definition at line 3159 of file object.cc.

3159 {
3160 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
3161 set_state_bits(IsDynamicallyExtendableBit::update(value, state_bits()));
3162}

◆ set_is_enum_class()

void dart::Class::set_is_enum_class ( ) const

Definition at line 5655 of file object.cc.

5655 {
5656 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5657 set_state_bits(EnumBit::update(true, state_bits()));
5658}

◆ set_is_fields_marked_nullable()

void dart::Class::set_is_fields_marked_nullable ( ) const

Definition at line 5695 of file object.cc.

5695 {
5696 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5697 set_state_bits(FieldsMarkedNullableBit::update(true, state_bits()));
5698}

◆ set_is_final()

void dart::Class::set_is_final ( ) const

Definition at line 5690 of file object.cc.

5690 {
5691 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5692 set_state_bits(FinalBit::update(true, state_bits()));
5693}

◆ set_is_finalized()

void dart::Class::set_is_finalized ( ) const

Definition at line 5714 of file object.cc.

5714 {
5715 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5716 ASSERT(!is_finalized());
5718}
void set_is_finalized_unsafe() const
Definition: object.cc:5720

◆ set_is_finalized_unsafe()

void dart::Class::set_is_finalized_unsafe ( ) const

Definition at line 5720 of file object.cc.

5720 {
5721 set_state_bits(
5722 ClassFinalizedBits::update(UntaggedClass::kFinalized, state_bits()));
5723}

◆ set_is_future_subtype()

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

Definition at line 3149 of file object.cc.

3149 {
3150 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
3151 set_state_bits(IsFutureSubtypeBit::update(value, state_bits()));
3152}

◆ set_is_implemented()

void dart::Class::set_is_implemented ( ) const

Definition at line 5613 of file object.cc.

5613 {
5614 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5616}
void set_is_implemented_unsafe() const
Definition: object.cc:5618

◆ set_is_implemented_unsafe()

void dart::Class::set_is_implemented_unsafe ( ) const

Definition at line 5618 of file object.cc.

5618 {
5619 set_state_bits(ImplementedBit::update(true, state_bits()));
5620}

◆ set_is_interface_class()

void dart::Class::set_is_interface_class ( ) const

Definition at line 5685 of file object.cc.

5685 {
5686 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5687 set_state_bits(InterfaceClassBit::update(true, state_bits()));
5688}

◆ set_is_isolate_unsendable()

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

Definition at line 3133 of file object.cc.

3133 {
3134 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
3135 set_state_bits(IsIsolateUnsendableBit::update(value, state_bits()));
3136}

◆ set_is_isolate_unsendable_due_to_pragma()

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

Definition at line 3138 of file object.cc.

3138 {
3139 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
3140 set_state_bits(
3141 IsIsolateUnsendableDueToPragmaBit::update(value, state_bits()));
3142}

◆ set_is_loaded()

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

Definition at line 5709 of file object.cc.

5709 {
5710 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5711 set_state_bits(IsLoadedBit::update(value, state_bits()));
5712}

◆ set_is_mixin_class()

void dart::Class::set_is_mixin_class ( ) const

Definition at line 5675 of file object.cc.

5675 {
5676 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5677 set_state_bits(MixinClassBit::update(true, state_bits()));
5678}

◆ set_is_prefinalized()

void dart::Class::set_is_prefinalized ( ) const

Definition at line 5732 of file object.cc.

5732 {
5733 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5734 ASSERT(!is_finalized());
5735 set_state_bits(
5736 ClassFinalizedBits::update(UntaggedClass::kPreFinalized, state_bits()));
5737}

◆ set_is_sealed()

void dart::Class::set_is_sealed ( ) const

Definition at line 5670 of file object.cc.

5670 {
5671 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5672 set_state_bits(SealedBit::update(true, state_bits()));
5673}

◆ set_is_synthesized_class()

void dart::Class::set_is_synthesized_class ( ) const

Definition at line 5646 of file object.cc.

5646 {
5647 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5649}
void set_is_synthesized_class_unsafe() const
Definition: object.cc:5651

◆ set_is_synthesized_class_unsafe()

void dart::Class::set_is_synthesized_class_unsafe ( ) const

Definition at line 5651 of file object.cc.

5651 {
5652 set_state_bits(SynthesizedClassBit::update(true, state_bits()));
5653}

◆ set_is_transformed_mixin_application()

void dart::Class::set_is_transformed_mixin_application ( ) const

Definition at line 5665 of file object.cc.

5665 {
5666 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5667 set_state_bits(TransformedMixinApplicationBit::update(true, state_bits()));
5668}

◆ set_is_type_finalized()

void dart::Class::set_is_type_finalized ( ) const

Definition at line 5638 of file object.cc.

5638 {
5639 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
5642 set_state_bits(
5643 ClassLoadingBits::update(UntaggedClass::kTypeFinalized, state_bits()));
5644}

◆ set_kernel_offset()

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

Definition at line 1812 of file object.h.

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

◆ set_library()

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

Definition at line 3438 of file object.cc.

3438 {
3439 untag()->set_library(value.ptr());
3440}

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

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

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

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

◆ set_num_native_fields()

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

Definition at line 1789 of file object.h.

1789 {
1790 StoreNonPointer(&untag()->num_native_fields_, value);
1791 }

◆ set_num_type_arguments()

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

Definition at line 3109 of file object.cc.

3109 {
3110#if defined(DART_PRECOMPILED_RUNTIME)
3111 UNREACHABLE();
3112#else
3113 if (!Utils::IsInt(16, value)) {
3115 }
3116 // We allow concurrent calculation of the number of type arguments. If two
3117 // threads perform this operation it doesn't matter which one wins.
3118 DEBUG_ONLY(intptr_t old_value = num_type_arguments());
3119 DEBUG_ASSERT(old_value == kUnknownNumTypeArguments || old_value == value);
3120 StoreNonPointer<int16_t, int16_t, std::memory_order_relaxed>(
3121 &untag()->num_type_arguments_, value);
3122#endif // defined(DART_PRECOMPILED_RUNTIME)
3123}
static bool IsInt(intptr_t N, T value)
Definition: utils.h:313
static void ReportTooManyTypeArguments(const Class &cls)
Definition: object.cc:3099
#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 3125 of file object.cc.

3125 {
3126 StoreNonPointer(&untag()->num_type_arguments_, value);
3127}

◆ set_script()

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

Definition at line 5555 of file object.cc.

5555 {
5556 untag()->set_script(value.ptr());
5557}

◆ set_super_type()

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

Definition at line 3684 of file object.cc.

3684 {
3685 ASSERT(value.IsNull() || !value.IsDynamicType());
3686 untag()->set_super_type(value.ptr());
3687}

◆ set_token_pos()

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

Definition at line 5565 of file object.cc.

5565 {
5567 StoreNonPointer(&untag()->token_pos_, token_pos);
5568}

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

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

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

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

◆ set_type_parameters()

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

Definition at line 3442 of file object.cc.

3442 {
3443 ASSERT((num_type_arguments() == kUnknownNumTypeArguments) ||
3444 is_prefinalized());
3445 untag()->set_type_parameters(value.ptr());
3446}

◆ SetFields()

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

Definition at line 4984 of file object.cc.

4984 {
4985 ASSERT(!value.IsNull());
4986#if defined(DEBUG)
4987 Thread* thread = Thread::Current();
4988 ASSERT(thread->isolate_group()->program_lock()->IsCurrentThreadWriter());
4989 // Verify that all the fields in the array have this class as owner.
4990 Field& field = Field::Handle();
4991 intptr_t len = value.Length();
4992 for (intptr_t i = 0; i < len; i++) {
4993 field ^= value.At(i);
4994 ASSERT(field.IsOriginal());
4995 ASSERT(field.Owner() == ptr());
4996 }
4997#endif
4998 // The value of static fields is already initialized to null.
4999 set_fields(value);
5000}

◆ SetFunctions()

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

Definition at line 3264 of file object.cc.

3264 {
3265 ASSERT(!value.IsNull());
3266 const intptr_t len = value.Length();
3267#if defined(DEBUG)
3268 Thread* thread = Thread::Current();
3269 ASSERT(thread->isolate_group()->program_lock()->IsCurrentThreadWriter());
3270 if (is_finalized()) {
3271 Function& function = Function::Handle();
3272 FunctionType& signature = FunctionType::Handle();
3273 for (intptr_t i = 0; i < len; ++i) {
3274 function ^= value.At(i);
3275 signature = function.signature();
3276 ASSERT(signature.IsFinalized());
3277 }
3278 }
3279#endif
3280 set_functions(value);
3281 if (len >= kFunctionLookupHashThreshold) {
3282 ClassFunctionsSet set(HashTables::New<ClassFunctionsSet>(len, Heap::kOld));
3283 Function& func = Function::Handle();
3284 for (intptr_t i = 0; i < len; ++i) {
3285 func ^= value.At(i);
3286 // Verify that all the functions in the array have this class as owner.
3287 ASSERT(func.Owner() == ptr());
3288 set.Insert(func);
3289 }
3290 untag()->set_functions_hash_table(set.Release().ptr());
3291 } else {
3292 untag()->set_functions_hash_table(Array::null());
3293 }
3294}

◆ SetTraceAllocation()

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

Definition at line 4443 of file object.cc.

4443 {
4444#ifndef PRODUCT
4445 auto isolate_group = IsolateGroup::Current();
4446 const bool changed = trace_allocation != this->TraceAllocation(isolate_group);
4447 if (changed) {
4448 auto class_table = isolate_group->class_table();
4449 class_table->SetTraceAllocationFor(id(), trace_allocation);
4450#ifdef TARGET_ARCH_IA32
4452#endif
4453 }
4454#else
4455 UNREACHABLE();
4456#endif
4457}
bool TraceAllocation(IsolateGroup *isolate_group) const
Definition: object.cc:4434
void DisableAllocationStub() const
Definition: object.cc:5879

◆ SetUserVisibleNameInClassTable()

void dart::Class::SetUserVisibleNameInClassTable ( )

Definition at line 5383 of file object.cc.

5383 {
5384 IsolateGroup* isolate_group = IsolateGroup::Current();
5385 auto class_table = isolate_group->class_table();
5386 if (class_table->UserVisibleNameFor(id()) == nullptr) {
5387 String& name = String::Handle(UserVisibleName());
5388 class_table->SetUserVisibleNameFor(id(), name.ToMallocCString());
5389 }
5390}
StringPtr UserVisibleName() const
Definition: object.cc:2989

◆ SourceFingerprint()

int32_t dart::Class::SourceFingerprint ( ) const

Definition at line 5604 of file object.cc.

5604 {
5605#if !defined(DART_PRECOMPILED_RUNTIME)
5607 *this);
5608#else
5609 return 0;
5610#endif // !defined(DART_PRECOMPILED_RUNTIME)
5611}
static uint32_t CalculateClassFingerprint(const Class &klass)

◆ super_type()

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

Definition at line 1431 of file object.h.

1431 {
1433 return untag()->super_type();
1434 }

◆ super_type_offset()

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

Definition at line 1436 of file object.h.

1436 {
1437 return OFFSET_OF(UntaggedClass, super_type_);
1438 }

◆ SuperClass()

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

Definition at line 3665 of file object.cc.

3665 {
3666 Thread* thread = Thread::Current();
3667 Zone* zone = thread->zone();
3668 if (class_table == nullptr) {
3669 class_table = thread->isolate_group()->class_table();
3670 }
3671
3672 if (super_type() == AbstractType::null()) {
3673 if (id() == kTypeArgumentsCid) {
3674 // Pretend TypeArguments objects are Dart instances.
3675 return class_table->At(kInstanceCid);
3676 }
3677 return Class::null();
3678 }
3679 const AbstractType& sup_type = AbstractType::Handle(zone, super_type());
3680 const intptr_t type_class_id = sup_type.type_class_id();
3681 return class_table->At(type_class_id);
3682}

◆ target_instance_size() [1/2]

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

Definition at line 1147 of file object.h.

1147 {
1149#if defined(DART_PRECOMPILER)
1150 return (untag()->target_instance_size_in_words_ *
1152#else
1153 return host_instance_size();
1154#endif // defined(DART_PRECOMPILER)
1155 }

◆ target_instance_size() [2/2]

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

Definition at line 1159 of file object.h.

1159 {
1160#if defined(DART_PRECOMPILER)
1161 return (clazz->untag()->target_instance_size_in_words_ *
1163#else
1164 return host_instance_size(clazz);
1165#endif // defined(DART_PRECOMPILER)
1166 }

◆ target_instance_size_in_words()

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

Definition at line 1947 of file object.h.

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

◆ target_next_field_offset()

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

Definition at line 1193 of file object.h.

1193 {
1194#if defined(DART_PRECOMPILER)
1195 return untag()->target_next_field_offset_in_words_ *
1197#else
1198 return host_next_field_offset();
1199#endif // defined(DART_PRECOMPILER)
1200 }

◆ target_next_field_offset_in_words()

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

Definition at line 1959 of file object.h.

1959 {
1960#if defined(DART_PRECOMPILER)
1961 return cls->untag()->target_next_field_offset_in_words_;
1962#else
1964#endif // defined(DART_PRECOMPILER)
1965 }
static int32_t host_next_field_offset_in_words(const ClassPtr cls)
Definition: object.h:1955

◆ target_type_arguments_field_offset()

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

Definition at line 1384 of file object.h.

1384 {
1385#if defined(DART_PRECOMPILER)
1387 if (untag()->target_type_arguments_field_offset_in_words_ ==
1390 }
1391 return untag()->target_type_arguments_field_offset_in_words_ *
1393#else
1395#endif // defined(DART_PRECOMPILER)
1396 }
intptr_t host_type_arguments_field_offset() const
Definition: object.h:1375

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

1972 {
1973#if defined(DART_PRECOMPILER)
1974 return cls->untag()->target_type_arguments_field_offset_in_words_;
1975#else
1977#endif // defined(DART_PRECOMPILER)
1978 }
static int32_t host_type_arguments_field_offset_in_words(const ClassPtr cls)
Definition: object.h:1967

◆ token_pos()

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

Definition at line 1279 of file object.h.

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

◆ TraceAllocation()

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

Definition at line 4434 of file object.cc.

4434 {
4435#ifndef PRODUCT
4436 auto class_table = isolate_group->class_table();
4437 return class_table->ShouldTraceAllocationFor(id());
4438#else
4439 return false;
4440#endif
4441}

◆ type_parameters()

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

Definition at line 1338 of file object.h.

1338 {
1340 return untag()->type_parameters();
1341 }

◆ TypeParameterAt()

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

Definition at line 3689 of file object.cc.

3690 {
3691 ASSERT(index >= 0 && index < NumTypeParameters());
3692 TypeParameter& type_param =
3693 TypeParameter::Handle(TypeParameter::New(*this, 0, index, nullability));
3694 // Finalize type parameter only if its declaring class is
3695 // finalized and available in the current class table.
3696 if (is_type_finalized() && (type_param.parameterized_class() == ptr())) {
3697 type_param ^= ClassFinalizer::FinalizeType(type_param);
3698 }
3699 return type_param.ptr();
3700}

◆ UnboxedFieldSizeInBytesByCid()

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

Definition at line 3702 of file object.cc.

3702 {
3703 switch (cid) {
3704 case kDoubleCid:
3705 return sizeof(UntaggedDouble::value_);
3706 case kFloat32x4Cid:
3707 return sizeof(UntaggedFloat32x4::value_);
3708 case kFloat64x2Cid:
3709 return sizeof(UntaggedFloat64x2::value_);
3710 default:
3711 return sizeof(UntaggedMint::value_);
3712 }
3713}

◆ UserVisibleName()

StringPtr dart::Class::UserVisibleName ( ) const

Definition at line 2989 of file object.cc.

2989 {
2990#if !defined(PRODUCT)
2991 ASSERT(untag()->user_name() != String::null());
2992 return untag()->user_name();
2993#endif // !defined(PRODUCT)
2994 // No caching in PRODUCT, regenerate.
2995 return Symbols::New(Thread::Current(), GenerateUserVisibleName());
2996}

◆ UserVisibleNameCString()

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

Definition at line 2998 of file object.cc.

2998 {
2999#if !defined(PRODUCT)
3000 ASSERT(untag()->user_name() != String::null());
3001 return String::Handle(untag()->user_name()).ToCString();
3002#endif // !defined(PRODUCT)
3003 return GenerateUserVisibleName(); // No caching in PRODUCT, regenerate.
3004}

◆ VerifyEntryPoint()

ErrorPtr dart::Class::VerifyEntryPoint ( ) const

Definition at line 27370 of file object.cc.

27370 {
27371 if (!FLAG_verify_entry_points) return Error::null();
27372 const Library& lib = Library::Handle(library());
27373 if (!lib.IsNull()) {
27374 return dart::VerifyEntryPoint(lib, *this, *this, {});
27375 } else {
27376 return Error::null();
27377 }
27378}
DART_WARN_UNUSED_RESULT ErrorPtr VerifyEntryPoint(const Library &lib, const Object &member, const Object &annotated, std::initializer_list< EntryPointPragma > allowed_kinds)
Definition: object.cc:27151

Friends And Related Function Documentation

◆ AbstractType

friend class AbstractType
friend

Definition at line 2237 of file object.h.

◆ ClassFinalizer

friend class ClassFinalizer
friend

Definition at line 2244 of file object.h.

◆ Instance

friend class Instance
friend

Definition at line 2238 of file object.h.

◆ Intrinsifier

friend class Intrinsifier
friend

Definition at line 2241 of file object.h.

◆ Object

friend class Object
friend

Definition at line 2239 of file object.h.

◆ Precompiler

friend class Precompiler
friend

Definition at line 2243 of file object.h.

◆ ProgramWalker

friend class ProgramWalker
friend

Definition at line 2242 of file object.h.

◆ Type

friend class Type
friend

Definition at line 2240 of file object.h.

Member Data Documentation

◆ kNoTypeArguments

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

Definition at line 1374 of file object.h.


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