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

#include <object.h>

Inheritance diagram for dart::RecordType:
dart::AbstractType dart::Instance dart::Object

Public Member Functions

virtual bool HasTypeClass () const
 
RecordTypePtr ToNullability (Nullability value, Heap::Space space) const
 
virtual classid_t type_class_id () const
 
virtual bool IsInstantiated (Genericity genericity=kAny, intptr_t num_free_fun_type_params=kAllFree) const
 
virtual bool IsEquivalent (const Instance &other, TypeEquality kind, FunctionTypeMapping *function_type_equivalence=nullptr) const
 
virtual AbstractTypePtr InstantiateFrom (const TypeArguments &instantiator_type_arguments, const TypeArguments &function_type_arguments, intptr_t num_free_fun_type_params, Heap::Space space, FunctionTypeMapping *function_type_mapping=nullptr, intptr_t num_parent_type_args_adjustment=0) const
 
virtual AbstractTypePtr UpdateFunctionTypes (intptr_t num_parent_type_args_adjustment, intptr_t num_free_fun_type_params, Heap::Space space, FunctionTypeMapping *function_type_mapping) const
 
virtual AbstractTypePtr Canonicalize (Thread *thread) const
 
virtual void EnumerateURIs (URIs *uris) const
 
virtual void PrintName (NameVisibility visibility, BaseTextBuffer *printer) const
 
virtual uword ComputeHash () const
 
bool IsSubtypeOf (const RecordType &other, Heap::Space space, FunctionTypeMapping *function_type_equivalence=nullptr) const
 
RecordShape shape () const
 
ArrayPtr field_types () const
 
AbstractTypePtr FieldTypeAt (intptr_t index) const
 
void SetFieldTypeAt (intptr_t index, const AbstractType &value) const
 
ArrayPtr GetFieldNames (Thread *thread) const
 
intptr_t NumFields () const
 
void Print (NameVisibility name_visibility, BaseTextBuffer *printer) const
 
- Public Member Functions inherited from dart::AbstractType
bool IsFinalized () const
 
void SetIsFinalized () const
 
Nullability nullability () const
 
bool IsNullable () const
 
bool IsNonNullable () const
 
bool IsStrictlyNonNullable () const
 
virtual AbstractTypePtr SetInstantiatedNullability (const TypeParameter &type_param, Heap::Space space) const
 
virtual AbstractTypePtr NormalizeFutureOrType (Heap::Space space) const
 
virtual bool HasTypeClass () const
 
virtual classid_t type_class_id () const
 
virtual ClassPtr type_class () const
 
virtual TypeArgumentsPtr arguments () const
 
virtual bool IsInstantiated (Genericity genericity=kAny, intptr_t num_free_fun_type_params=kAllFree) const
 
virtual bool CanonicalizeEquals (const Instance &other) const
 
virtual uint32_t CanonicalizeHash () const
 
virtual bool Equals (const Instance &other) const
 
virtual bool IsEquivalent (const Instance &other, TypeEquality kind, FunctionTypeMapping *function_type_equivalence=nullptr) const
 
virtual AbstractTypePtr InstantiateFrom (const TypeArguments &instantiator_type_arguments, const TypeArguments &function_type_arguments, intptr_t num_free_fun_type_params, Heap::Space space, FunctionTypeMapping *function_type_mapping=nullptr, intptr_t num_parent_type_args_adjustment=0) const
 
virtual AbstractTypePtr UpdateFunctionTypes (intptr_t num_parent_type_args_adjustment, intptr_t num_free_fun_type_params, Heap::Space space, FunctionTypeMapping *function_type_mapping) const
 
virtual InstancePtr CanonicalizeLocked (Thread *thread) const
 
virtual AbstractTypePtr Canonicalize (Thread *thread) const
 
virtual const char * NullabilitySuffix (NameVisibility name_visibility) const
 
StringPtr Name () const
 
const char * NameCString () const
 
StringPtr UserVisibleName () const
 
const char * UserVisibleNameCString () const
 
StringPtr ScrubbedName () const
 
const char * ScrubbedNameCString () const
 
virtual void PrintName (NameVisibility visibility, BaseTextBuffer *printer) const
 
virtual void EnumerateURIs (URIs *uris) const
 
uword Hash () const
 
virtual uword ComputeHash () const
 
StringPtr ClassName () const
 
bool IsDynamicType () const
 
bool IsVoidType () const
 
bool IsNullType () const
 
bool IsNeverType () const
 
bool IsSentinelType () const
 
bool IsObjectType () const
 
bool IsNullableObjectType () const
 
bool IsTopTypeForSubtyping () const
 
bool IsTopTypeForInstanceOf () const
 
bool IsBoolType () const
 
bool IsIntType () const
 
bool IsIntegerImplementationType () const
 
bool IsDoubleType () const
 
bool IsFloat32x4Type () const
 
bool IsFloat64x2Type () const
 
bool IsInt32x4Type () const
 
bool IsNumberType () const
 
bool IsSmiType () const
 
bool IsMintType () const
 
bool IsStringType () const
 
bool IsDartFunctionType () const
 
bool IsDartClosureType () const
 
bool IsDartRecordType () const
 
bool IsFfiPointerType () const
 
bool IsFutureOrType () const
 
AbstractTypePtr UnwrapFutureOr () const
 
bool IsCatchAllType () const
 
bool IsTypeClassAllowedBySpawnUri () const
 
bool IsSubtypeOf (const AbstractType &other, Heap::Space space, FunctionTypeMapping *function_type_equivalence=nullptr) const
 
uword type_test_stub_entry_point () const
 
CodePtr type_test_stub () const
 
void SetTypeTestingStub (const Code &stub) const
 
void InitializeTypeTestingStubNonAtomic (const Code &stub) const
 
void UpdateTypeTestingStubEntryPoint () const
 
- Public Member Functions inherited from dart::Instance
virtual bool OperatorEquals (const Instance &other) const
 
bool IsIdenticalTo (const Instance &other) const
 
virtual bool CanonicalizeEquals (const Instance &other) const
 
virtual uint32_t CanonicalizeHash () const
 
intptr_t SizeFromClass () const
 
InstancePtr Canonicalize (Thread *thread) const
 
virtual InstancePtr CanonicalizeLocked (Thread *thread) const
 
virtual void CanonicalizeFieldsLocked (Thread *thread) const
 
InstancePtr CopyShallowToOldSpace (Thread *thread) const
 
ObjectPtr GetField (const Field &field) const
 
void SetField (const Field &field, const Object &value) const
 
AbstractTypePtr GetType (Heap::Space space) const
 
virtual TypeArgumentsPtr GetTypeArguments () const
 
virtual void SetTypeArguments (const TypeArguments &value) const
 
bool IsInstanceOf (const AbstractType &other, const TypeArguments &other_instantiator_type_arguments, const TypeArguments &other_function_type_arguments) const
 
bool IsAssignableTo (const AbstractType &other, const TypeArguments &other_instantiator_type_arguments, const TypeArguments &other_function_type_arguments) const
 
bool IsValidNativeIndex (int index) const
 
intptr_t * NativeFieldsDataAddr () const
 
intptr_t GetNativeField (int index) const
 
void GetNativeFields (uint16_t num_fields, intptr_t *field_values) const
 
void SetNativeFields (uint16_t num_fields, const intptr_t *field_values) const
 
uint16_t NumNativeFields () const
 
void SetNativeField (int index, intptr_t value) const
 
bool IsCallable (Function *function) 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 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 Class &klass, const ExternalTypedData &kernel_buffer, const Array &type_definitions, const Array &arguments, const TypeArguments &type_arguments) const
 
virtual ObjectPtr HashCode () const
 
IntegerPtr IdentityHashCode (Thread *thread) const
 
virtual bool IsPointer () 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 InstanceSize ()
 
static RecordTypePtr New (RecordShape shape, const Array &field_types, Nullability nullability=Nullability::kNonNullable, Heap::Space space=Heap::kOld)
 
- Static Public Member Functions inherited from dart::AbstractType
static intptr_t flags_offset ()
 
static intptr_t hash_offset ()
 
static void AddURI (URIs *uris, const String &name, const String &uri)
 
static StringPtr PrintURIs (URIs *uris)
 
static bool InstantiateAndTestSubtype (AbstractType *subtype, AbstractType *supertype, const TypeArguments &instantiator_type_args, const TypeArguments &function_type_args)
 
static intptr_t type_test_stub_entry_point_offset ()
 
static intptr_t InstanceSize ()
 
static intptr_t NextFieldOffset ()
 
- Static Public Member Functions inherited from dart::Instance
static bool NullIsAssignableTo (const AbstractType &other)
 
static bool NullIsAssignableTo (const AbstractType &other, const TypeArguments &other_instantiator_type_arguments, const TypeArguments &other_function_type_arguments)
 
static ObjectPtr EvaluateCompiledExpression (Thread *thread, const Object &receiver, const Library &library, const Class &klass, const ExternalTypedData &kernel_buffer, const Array &type_definitions, const Array &param_values, const TypeArguments &type_param_values)
 
static intptr_t UnroundedSize ()
 
static intptr_t InstanceSize ()
 
static InstancePtr New (const Class &cls, Heap::Space space=Heap::kNew)
 
static InstancePtr NewAlreadyFinalized (const Class &cls, Heap::Space space=Heap::kNew)
 
static intptr_t DataOffsetFor (intptr_t cid)
 
static intptr_t ElementSizeFor (intptr_t cid)
 
static intptr_t NextFieldOffset ()
 
static intptr_t NativeFieldsOffset ()
 
- 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)
 

Friends

class Class
 
class ClassFinalizer
 
class Record
 

Additional Inherited Members

- Public Types inherited from dart::Object
enum  NameVisibility { kInternalName = 0 , kScrubbedName , kUserVisibleName }
 
enum class  NameDisambiguation { kYes , kNo }
 
using UntaggedObjectType = UntaggedObject
 
using ObjectPtrType = ObjectPtr
 
- Static Public Attributes inherited from dart::Object
static constexpr intptr_t kHashBits = 30
 
static const ClassId kClassId = kObjectCid
 
- Protected Member Functions inherited from dart::AbstractType
bool IsNullabilityEquivalent (Thread *thread, const AbstractType &other_type, TypeEquality kind) const
 
void SetHash (intptr_t value) const
 
UntaggedAbstractType::TypeState type_state () const
 
void set_flags (uint32_t value) const
 
void set_type_state (UntaggedAbstractType::TypeState value) const
 
void set_nullability (Nullability value) const
 
 HEAP_OBJECT_IMPLEMENTATION (AbstractType, Instance)
 
- Protected Member Functions inherited from dart::Instance
virtual void PrintSharedInstanceJSON (JSONObject *jsobj, bool ref, bool include_id=true) const
 
- 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 11349 of file object.h.

Member Function Documentation

◆ Canonicalize()

AbstractTypePtr dart::RecordType::Canonicalize ( Thread thread) const
virtual

Reimplemented from dart::AbstractType.

Definition at line 27557 of file object.cc.

27557 {
27559 Zone* zone = thread->zone();
27560 AbstractType& type = AbstractType::Handle(zone);
27561 if (IsCanonical()) {
27562#ifdef DEBUG
27563 // Verify that all fields are allocated in old space and are canonical.
27565 const intptr_t num_fields = NumFields();
27566 for (intptr_t i = 0; i < num_fields; ++i) {
27567 type = FieldTypeAt(i);
27568 ASSERT(type.IsOld());
27569 ASSERT(type.IsCanonical());
27570 }
27571#endif
27572 return ptr();
27573 }
27574 auto isolate_group = thread->isolate_group();
27575 ObjectStore* object_store = isolate_group->object_store();
27576 RecordType& rec = RecordType::Handle(zone);
27577 {
27578 SafepointMutexLocker ml(isolate_group->type_canonicalization_mutex());
27579 CanonicalRecordTypeSet table(zone, object_store->canonical_record_types());
27580 rec ^= table.GetOrNull(CanonicalRecordTypeKey(*this));
27581 ASSERT(object_store->canonical_record_types() == table.Release().ptr());
27582 }
27583 if (rec.IsNull()) {
27585 const intptr_t num_fields = NumFields();
27586 for (intptr_t i = 0; i < num_fields; ++i) {
27587 type = FieldTypeAt(i);
27588 if (!type.IsCanonical()) {
27589 type = type.Canonicalize(thread);
27591 }
27592 }
27593 // Check to see if the record type got added to canonical table as part
27594 // of the canonicalization of its signature types.
27595 SafepointMutexLocker ml(isolate_group->type_canonicalization_mutex());
27596 CanonicalRecordTypeSet table(zone, object_store->canonical_record_types());
27597 rec ^= table.GetOrNull(CanonicalRecordTypeKey(*this));
27598 if (rec.IsNull()) {
27599 // Add this record type into the canonical table of record types.
27600 if (this->IsNew()) {
27601 rec ^= Object::Clone(*this, Heap::kOld);
27602 } else {
27603 rec = this->ptr();
27604 }
27605 ASSERT(rec.IsOld());
27606 rec.SetCanonical(); // Mark object as being canonical.
27607 bool present = table.Insert(rec);
27608 ASSERT(!present);
27609 }
27610 object_store->set_canonical_record_types(table.Release());
27611 }
27612 return rec.ptr();
27613}
SI F table(const skcms_Curve *curve, F v)
GLenum type
bool IsFinalized() const
Definition: object.h:9053
@ kOld
Definition: heap.h:39
static ObjectPtr Clone(const Object &orig, Heap::Space space, bool load_with_relaxed_atomics=false)
Definition: object.cc:2899
ObjectPtr ptr() const
Definition: object.h:332
bool IsCanonical() const
Definition: object.h:335
bool IsNew() const
Definition: object.h:390
bool IsOld() const
Definition: object.h:391
static Object & Handle()
Definition: object.h:407
AbstractTypePtr FieldTypeAt(intptr_t index) const
Definition: object.cc:27380
intptr_t NumFields() const
Definition: object.h:13392
void SetFieldTypeAt(intptr_t index, const AbstractType &value) const
Definition: object.cc:27385
ArrayPtr field_types() const
Definition: object.h:11390
#define ASSERT(E)
UnorderedHashSet< CanonicalRecordTypeTraits > CanonicalRecordTypeSet

◆ ComputeHash()

uword dart::RecordType::ComputeHash ( ) const
virtual

Reimplemented from dart::AbstractType.

Definition at line 27541 of file object.cc.

27541 {
27543 uint32_t result = 0;
27544 result = CombineHashes(result, static_cast<uint32_t>(nullability()));
27545 result = CombineHashes(result, static_cast<uint32_t>(shape().AsInt()));
27546 AbstractType& type = AbstractType::Handle();
27547 const intptr_t num_fields = NumFields();
27548 for (intptr_t i = 0; i < num_fields; ++i) {
27549 type = FieldTypeAt(i);
27550 result = CombineHashes(result, type.Hash());
27551 }
27553 SetHash(result);
27554 return result;
27555}
void SetHash(intptr_t value) const
Definition: object.h:13386
Nullability nullability() const
Definition: object.h:9060
static constexpr intptr_t kHashBits
Definition: object.h:323
RecordShape shape() const
Definition: object.h:11388
GAsyncResult * result
uint32_t CombineHashes(uint32_t hash, uint32_t other_hash)
Definition: hash.h:12
uint32_t FinalizeHash(uint32_t hash, intptr_t hashbits=kBitsPerInt32)
Definition: hash.h:20

◆ EnumerateURIs()

void dart::RecordType::EnumerateURIs ( URIs uris) const
virtual

Reimplemented from dart::AbstractType.

Definition at line 27615 of file object.cc.

27615 {
27616 AbstractType& type = AbstractType::Handle();
27617 const intptr_t num_fields = NumFields();
27618 for (intptr_t i = 0; i < num_fields; ++i) {
27619 type = FieldTypeAt(i);
27620 type.EnumerateURIs(uris);
27621 }
27622}

◆ field_types()

ArrayPtr dart::RecordType::field_types ( ) const
inline

Definition at line 11390 of file object.h.

11390{ return untag()->field_types(); }
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

◆ FieldTypeAt()

AbstractTypePtr dart::RecordType::FieldTypeAt ( intptr_t  index) const

Definition at line 27380 of file object.cc.

27380 {
27381 const Array& field_types = Array::Handle(untag()->field_types());
27382 return AbstractType::RawCast(field_types.At(index));
27383}
static ObjectPtr RawCast(ObjectPtr obj)
Definition: object.h:325

◆ GetFieldNames()

ArrayPtr dart::RecordType::GetFieldNames ( Thread thread) const

Definition at line 27401 of file object.cc.

27401 {
27402 return shape().GetFieldNames(thread);
27403}
ArrayPtr GetFieldNames(Thread *thread) const
Definition: object.cc:27987

◆ HasTypeClass()

virtual bool dart::RecordType::HasTypeClass ( ) const
inlinevirtual

Reimplemented from dart::AbstractType.

Definition at line 11351 of file object.h.

11351{ return false; }

◆ InstanceSize()

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

Definition at line 11402 of file object.h.

11402 {
11403 return RoundedAllocationSize(sizeof(UntaggedRecordType));
11404 }
static constexpr intptr_t RoundedAllocationSize(intptr_t size)
Definition: object.h:758

◆ InstantiateFrom()

AbstractTypePtr dart::RecordType::InstantiateFrom ( const TypeArguments instantiator_type_arguments,
const TypeArguments function_type_arguments,
intptr_t  num_free_fun_type_params,
Heap::Space  space,
FunctionTypeMapping function_type_mapping = nullptr,
intptr_t  num_parent_type_args_adjustment = 0 
) const
virtual

Reimplemented from dart::AbstractType.

Definition at line 27629 of file object.cc.

27635 {
27637 Zone* zone = Thread::Current()->zone();
27638
27639 const intptr_t num_fields = NumFields();
27640 const Array& old_field_types = Array::Handle(zone, field_types());
27641 const Array& new_field_types =
27642 Array::Handle(zone, Array::New(num_fields, space));
27643 AbstractType& type = AbstractType::Handle(zone);
27644 for (intptr_t i = 0; i < num_fields; ++i) {
27645 type ^= old_field_types.At(i);
27646 if (!type.IsInstantiated()) {
27647 type = type.InstantiateFrom(
27648 instantiator_type_arguments, function_type_arguments,
27649 num_free_fun_type_params, space, function_type_mapping,
27650 num_parent_type_args_adjustment);
27651 // A returned null type indicates a failed instantiation in dead code that
27652 // must be propagated up to the caller, the optimizing compiler.
27653 if (type.IsNull()) {
27654 return RecordType::null();
27655 }
27656 }
27657 new_field_types.SetAt(i, type);
27658 }
27659
27660 const auto& rec = RecordType::Handle(
27661 zone, RecordType::New(shape(), new_field_types, nullability(), space));
27662
27663 rec.SetIsFinalized();
27664
27665 // Canonicalization is not part of instantiation.
27666 return rec.ptr();
27667}
static ArrayPtr New(intptr_t len, Heap::Space space=Heap::kNew)
Definition: object.h:10959
static ObjectPtr null()
Definition: object.h:433
static RecordTypePtr New(RecordShape shape, const Array &field_types, Nullability nullability=Nullability::kNonNullable, Heap::Space space=Heap::kOld)
Definition: object.cc:27465
Zone * zone() const
Definition: thread_state.h:37
static Thread * Current()
Definition: thread.h:362

◆ IsEquivalent()

bool dart::RecordType::IsEquivalent ( const Instance other,
TypeEquality  kind,
FunctionTypeMapping function_type_equivalence = nullptr 
) const
virtual

Reimplemented from dart::AbstractType.

Definition at line 27504 of file object.cc.

27507 {
27508 ASSERT(!IsNull());
27509 if (ptr() == other.ptr()) {
27510 return true;
27511 }
27512 if (!other.IsRecordType()) {
27513 return false;
27514 }
27515 const RecordType& other_type = RecordType::Cast(other);
27516 // Equal record types must have the same shape
27517 // (number of fields and named fields).
27518 if (shape() != other_type.shape()) {
27519 return false;
27520 }
27521 Thread* thread = Thread::Current();
27522 Zone* zone = thread->zone();
27523 if (!IsNullabilityEquivalent(thread, other_type, kind)) {
27524 return false;
27525 }
27526 // Equal record types must have equal field types.
27527 AbstractType& field_type = Type::Handle(zone);
27528 AbstractType& other_field_type = Type::Handle(zone);
27529 const intptr_t num_fields = NumFields();
27530 for (intptr_t i = 0; i < num_fields; ++i) {
27531 field_type = FieldTypeAt(i);
27532 other_field_type = other_type.FieldTypeAt(i);
27533 if (!field_type.IsEquivalent(other_field_type, kind,
27534 function_type_equivalence)) {
27535 return false;
27536 }
27537 }
27538 return true;
27539}
bool IsNullabilityEquivalent(Thread *thread, const AbstractType &other_type, TypeEquality kind) const
Definition: object.cc:21196
bool IsNull() const
Definition: object.h:363
friend class Thread
Definition: object.h:1025

◆ IsInstantiated()

bool dart::RecordType::IsInstantiated ( Genericity  genericity = kAny,
intptr_t  num_free_fun_type_params = kAllFree 
) const
virtual

Reimplemented from dart::AbstractType.

Definition at line 27448 of file object.cc.

27449 {
27450 AbstractType& type = AbstractType::Handle();
27451 const intptr_t num_fields = NumFields();
27452 for (intptr_t i = 0; i < num_fields; ++i) {
27453 type = FieldTypeAt(i);
27454 if (!type.IsInstantiated(genericity, num_free_fun_type_params)) {
27455 return false;
27456 }
27457 }
27458 return true;
27459}

◆ IsSubtypeOf()

bool dart::RecordType::IsSubtypeOf ( const RecordType other,
Heap::Space  space,
FunctionTypeMapping function_type_equivalence = nullptr 
) const

Definition at line 27708 of file object.cc.

27711 {
27712 if (ptr() == other.ptr()) {
27713 return true;
27714 }
27716 ASSERT(other.IsFinalized());
27717 const intptr_t num_fields = NumFields();
27718 if (shape() != other.shape()) {
27719 // Different number of fields or different named fields.
27720 return false;
27721 }
27722 Thread* const thread = Thread::Current();
27724 return false;
27725 }
27726 // Check subtyping of record field types.
27727 Zone* const zone = thread->zone();
27728 AbstractType& field_type = Type::Handle(zone);
27729 AbstractType& other_field_type = Type::Handle(zone);
27730 for (intptr_t i = 0; i < num_fields; ++i) {
27731 field_type = FieldTypeAt(i);
27732 other_field_type = other.FieldTypeAt(i);
27733 if (!field_type.IsSubtypeOf(other_field_type, space,
27734 function_type_equivalence)) {
27735 return false;
27736 }
27737 }
27738 return true;
27739}

◆ New()

RecordTypePtr dart::RecordType::New ( RecordShape  shape,
const Array field_types,
Nullability  nullability = Nullability::kNonNullable,
Heap::Space  space = Heap::kOld 
)
static

Definition at line 27465 of file object.cc.

27468 {
27469 Zone* Z = Thread::Current()->zone();
27470 const RecordType& result = RecordType::Handle(Z, RecordType::New(space));
27471 result.set_shape(shape);
27472 result.set_field_types(field_types);
27473 result.SetHash(0);
27474 result.set_flags(0);
27475 result.set_nullability(nullability);
27477 result.InitializeTypeTestingStubNonAtomic(
27479 return result.ptr();
27480}
#define Z
static CodePtr DefaultCodeForType(const AbstractType &type, bool lazy_specialize=true)

◆ NumFields()

intptr_t dart::RecordType::NumFields ( ) const
inline

Definition at line 13392 of file object.h.

13392 {
13393 return Array::LengthOf(field_types());
13394}
static intptr_t LengthOf(const ArrayPtr array)
Definition: object.h:10830

◆ Print()

void dart::RecordType::Print ( NameVisibility  name_visibility,
BaseTextBuffer printer 
) const

Definition at line 27405 of file object.cc.

27406 {
27407 if (IsNull()) {
27408 printer->AddString("null");
27409 return;
27410 }
27411 Thread* thread = Thread::Current();
27412 Zone* zone = thread->zone();
27413 AbstractType& type = AbstractType::Handle(zone);
27414 String& name = String::Handle(zone);
27415 const intptr_t num_fields = NumFields();
27416 const Array& field_names = Array::Handle(zone, GetFieldNames(thread));
27417 const intptr_t num_positional_fields = num_fields - field_names.Length();
27418 printer->AddString("(");
27419 for (intptr_t i = 0; i < num_fields; ++i) {
27420 if (i != 0) {
27421 printer->AddString(", ");
27422 }
27423 if (i == num_positional_fields) {
27424 printer->AddString("{");
27425 }
27426 type = FieldTypeAt(i);
27427 type.PrintName(name_visibility, printer);
27428 if (i >= num_positional_fields) {
27429 printer->AddString(" ");
27430 name ^= field_names.At(i - num_positional_fields);
27431 printer->AddString(name.ToCString());
27432 }
27433 }
27434 if (num_positional_fields < num_fields) {
27435 printer->AddString("}");
27436 }
27437 printer->AddString(")");
27438 printer->AddString(NullabilitySuffix(name_visibility));
27439}
virtual const char * NullabilitySuffix(NameVisibility name_visibility) const
Definition: object.cc:21303
ArrayPtr GetFieldNames(Thread *thread) const
Definition: object.cc:27401
const char *const name

◆ PrintName()

void dart::RecordType::PrintName ( NameVisibility  visibility,
BaseTextBuffer printer 
) const
virtual

Reimplemented from dart::AbstractType.

Definition at line 27624 of file object.cc.

27625 {
27626 RecordType::Cast(*this).Print(name_visibility, printer);
27627}

◆ SetFieldTypeAt()

void dart::RecordType::SetFieldTypeAt ( intptr_t  index,
const AbstractType value 
) const

Definition at line 27385 of file object.cc.

27386 {
27387 ASSERT(!value.IsNull());
27388 const Array& field_types = Array::Handle(untag()->field_types());
27389 field_types.SetAt(index, value);
27390}
uint8_t value

◆ shape()

RecordShape dart::RecordType::shape ( ) const
inline

Definition at line 11388 of file object.h.

11388{ return RecordShape(untag()->shape()); }

◆ ToNullability()

RecordTypePtr dart::RecordType::ToNullability ( Nullability  value,
Heap::Space  space 
) const

Definition at line 27482 of file object.cc.

27483 {
27484 if (nullability() == value) {
27485 return ptr();
27486 }
27487 // Clone record type and set new nullability.
27488 // Always cloning in old space and removing space parameter would not satisfy
27489 // currently existing requests for type instantiation in new space.
27491 Zone* Z = T->zone();
27492 AbstractType& type = RecordType::Handle(
27493 Z,
27495 if (IsFinalized()) {
27496 type.SetIsFinalized();
27497 if (IsCanonical()) {
27498 type ^= type.Canonicalize(T);
27499 }
27500 }
27501 return RecordType::Cast(type).ptr();
27502}
#define T
Definition: precompiler.cc:65

◆ type_class_id()

virtual classid_t dart::RecordType::type_class_id ( ) const
inlinevirtual

Reimplemented from dart::AbstractType.

Definition at line 11353 of file object.h.

11353{ return kIllegalCid; }
@ kIllegalCid
Definition: class_id.h:214

◆ UpdateFunctionTypes()

AbstractTypePtr dart::RecordType::UpdateFunctionTypes ( intptr_t  num_parent_type_args_adjustment,
intptr_t  num_free_fun_type_params,
Heap::Space  space,
FunctionTypeMapping function_type_mapping 
) const
virtual

Reimplemented from dart::AbstractType.

Definition at line 27669 of file object.cc.

27673 {
27675 ASSERT(num_parent_type_args_adjustment >= 0);
27676 Zone* zone = Thread::Current()->zone();
27677 const auto& types = Array::Handle(zone, field_types());
27678 Array* updated_types = nullptr;
27679 auto& type = AbstractType::Handle(zone);
27680 auto& updated = AbstractType::Handle(zone);
27681 for (intptr_t i = 0, n = NumFields(); i < n; ++i) {
27682 type ^= types.At(i);
27683 updated = type.UpdateFunctionTypes(num_parent_type_args_adjustment,
27684 num_free_fun_type_params, space,
27685 function_type_mapping);
27686 if (type.ptr() != updated.ptr()) {
27687 if (updated_types == nullptr) {
27688 updated_types = &Array::Handle(zone, Array::New(n, space));
27689 for (intptr_t j = 0; j < i; ++j) {
27690 type ^= types.At(j);
27691 updated_types->SetAt(j, type);
27692 }
27693 }
27694 }
27695 if (updated_types != nullptr) {
27696 updated_types->SetAt(i, updated);
27697 }
27698 }
27699 if (updated_types == nullptr) {
27700 return ptr();
27701 }
27702 const auto& new_rt = RecordType::Handle(
27703 zone, RecordType::New(shape(), *updated_types, nullability(), space));
27704 new_rt.SetIsFinalized();
27705 return new_rt.ptr();
27706}

Friends And Related Function Documentation

◆ Class

friend class Class
friend

Definition at line 11418 of file object.h.

◆ ClassFinalizer

friend class ClassFinalizer
friend

Definition at line 11419 of file object.h.

◆ Record

friend class Record
friend

Definition at line 11420 of file object.h.


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