Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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 IsLegacy () const
 
bool IsStrictlyNonNullable () const
 
virtual AbstractTypePtr SetInstantiatedNullability (const TypeParameter &type_param, Heap::Space space) const
 
virtual AbstractTypePtr NormalizeFutureOrType (Heap::Space space) const
 
virtual ClassPtr type_class () const
 
virtual TypeArgumentsPtr arguments () const
 
virtual bool CanonicalizeEquals (const Instance &other) const
 
virtual uint32_t CanonicalizeHash () const
 
virtual bool Equals (const Instance &other) const
 
virtual InstancePtr CanonicalizeLocked (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
 
uword Hash () 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
 
intptr_t SizeFromClass () const
 
InstancePtr Canonicalize (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::kLegacy, 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 11323 of file object.h.

Member Function Documentation

◆ Canonicalize()

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

Reimplemented from dart::AbstractType.

Definition at line 27639 of file object.cc.

27639 {
27641 Zone* zone = thread->zone();
27642 AbstractType& type = AbstractType::Handle(zone);
27643 if (IsCanonical()) {
27644#ifdef DEBUG
27645 // Verify that all fields are allocated in old space and are canonical.
27647 const intptr_t num_fields = NumFields();
27648 for (intptr_t i = 0; i < num_fields; ++i) {
27649 type = FieldTypeAt(i);
27650 ASSERT(type.IsOld());
27651 ASSERT(type.IsCanonical());
27652 }
27653#endif
27654 return ptr();
27655 }
27656 auto isolate_group = thread->isolate_group();
27657 ObjectStore* object_store = isolate_group->object_store();
27658 RecordType& rec = RecordType::Handle(zone);
27659 {
27660 SafepointMutexLocker ml(isolate_group->type_canonicalization_mutex());
27661 CanonicalRecordTypeSet table(zone, object_store->canonical_record_types());
27662 rec ^= table.GetOrNull(CanonicalRecordTypeKey(*this));
27663 ASSERT(object_store->canonical_record_types() == table.Release().ptr());
27664 }
27665 if (rec.IsNull()) {
27667 const intptr_t num_fields = NumFields();
27668 for (intptr_t i = 0; i < num_fields; ++i) {
27669 type = FieldTypeAt(i);
27670 if (!type.IsCanonical()) {
27671 type = type.Canonicalize(thread);
27672 SetFieldTypeAt(i, type);
27673 }
27674 }
27675 // Check to see if the record type got added to canonical table as part
27676 // of the canonicalization of its signature types.
27677 SafepointMutexLocker ml(isolate_group->type_canonicalization_mutex());
27678 CanonicalRecordTypeSet table(zone, object_store->canonical_record_types());
27679 rec ^= table.GetOrNull(CanonicalRecordTypeKey(*this));
27680 if (rec.IsNull()) {
27681 // Add this record type into the canonical table of record types.
27682 if (this->IsNew()) {
27683 rec ^= Object::Clone(*this, Heap::kOld);
27684 } else {
27685 rec = this->ptr();
27686 }
27687 ASSERT(rec.IsOld());
27688 rec.SetCanonical(); // Mark object as being canonical.
27689 bool present = table.Insert(rec);
27690 ASSERT(!present);
27691 }
27692 object_store->set_canonical_record_types(table.Release());
27693 }
27694 return rec.ptr();
27695}
SI F table(const skcms_Curve *curve, F v)
bool IsFinalized() const
Definition object.h:9030
@ kOld
Definition heap.h:39
static ObjectPtr Clone(const Object &orig, Heap::Space space, bool load_with_relaxed_atomics=false)
Definition object.cc:2960
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:27456
intptr_t NumFields() const
Definition object.h:13366
void SetFieldTypeAt(intptr_t index, const AbstractType &value) const
Definition object.cc:27461
ArrayPtr field_types() const
Definition object.h:11364
#define ASSERT(E)
UnorderedHashSet< CanonicalRecordTypeTraits > CanonicalRecordTypeSet

◆ ComputeHash()

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

Reimplemented from dart::AbstractType.

Definition at line 27617 of file object.cc.

27617 {
27619 uint32_t result = 0;
27620 // A legacy type should have the same hash as its non-nullable version to be
27621 // consistent with the definition of type equality in Dart code.
27622 Nullability type_nullability = nullability();
27623 if (type_nullability == Nullability::kLegacy) {
27624 type_nullability = Nullability::kNonNullable;
27625 }
27626 result = CombineHashes(result, static_cast<uint32_t>(type_nullability));
27627 result = CombineHashes(result, static_cast<uint32_t>(shape().AsInt()));
27628 AbstractType& type = AbstractType::Handle();
27629 const intptr_t num_fields = NumFields();
27630 for (intptr_t i = 0; i < num_fields; ++i) {
27631 type = FieldTypeAt(i);
27632 result = CombineHashes(result, type.Hash());
27633 }
27635 SetHash(result);
27636 return result;
27637}
void SetHash(intptr_t value) const
Definition object.h:13360
Nullability nullability() const
Definition object.h:9037
static constexpr intptr_t kHashBits
Definition object.h:323
RecordShape shape() const
Definition object.h:11362
GAsyncResult * result
Nullability
Definition object.h:1112
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 27697 of file object.cc.

27697 {
27698 AbstractType& type = AbstractType::Handle();
27699 const intptr_t num_fields = NumFields();
27700 for (intptr_t i = 0; i < num_fields; ++i) {
27701 type = FieldTypeAt(i);
27702 type.EnumerateURIs(uris);
27703 }
27704}

◆ field_types()

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

Definition at line 11364 of file object.h.

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

◆ FieldTypeAt()

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

Definition at line 27456 of file object.cc.

27456 {
27457 const Array& field_types = Array::Handle(untag()->field_types());
27458 return AbstractType::RawCast(field_types.At(index));
27459}
static ObjectPtr RawCast(ObjectPtr obj)
Definition object.h:325

◆ GetFieldNames()

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

Definition at line 27477 of file object.cc.

27477 {
27478 return shape().GetFieldNames(thread);
27479}
ArrayPtr GetFieldNames(Thread *thread) const
Definition object.cc:28069

◆ HasTypeClass()

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

Reimplemented from dart::AbstractType.

Definition at line 11325 of file object.h.

11325{ return false; }

◆ InstanceSize()

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

Definition at line 11376 of file object.h.

11376 {
11377 return RoundedAllocationSize(sizeof(UntaggedRecordType));
11378 }
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 27711 of file object.cc.

27717 {
27719 Zone* zone = Thread::Current()->zone();
27720
27721 const intptr_t num_fields = NumFields();
27722 const Array& old_field_types = Array::Handle(zone, field_types());
27723 const Array& new_field_types =
27724 Array::Handle(zone, Array::New(num_fields, space));
27725 AbstractType& type = AbstractType::Handle(zone);
27726 for (intptr_t i = 0; i < num_fields; ++i) {
27727 type ^= old_field_types.At(i);
27728 if (!type.IsInstantiated()) {
27729 type = type.InstantiateFrom(
27730 instantiator_type_arguments, function_type_arguments,
27731 num_free_fun_type_params, space, function_type_mapping,
27732 num_parent_type_args_adjustment);
27733 // A returned null type indicates a failed instantiation in dead code that
27734 // must be propagated up to the caller, the optimizing compiler.
27735 if (type.IsNull()) {
27736 return RecordType::null();
27737 }
27738 }
27739 new_field_types.SetAt(i, type);
27740 }
27741
27742 const auto& rec = RecordType::Handle(
27743 zone, RecordType::New(shape(), new_field_types, nullability(), space));
27744
27745 rec.SetIsFinalized();
27746
27747 // Canonicalization is not part of instantiation.
27748 return rec.ptr();
27749}
static ArrayPtr New(intptr_t len, Heap::Space space=Heap::kNew)
Definition object.h:10933
static ObjectPtr null()
Definition object.h:433
static RecordTypePtr New(RecordShape shape, const Array &field_types, Nullability nullability=Nullability::kLegacy, Heap::Space space=Heap::kOld)
Definition object.cc:27541
Zone * zone() const
static Thread * Current()
Definition thread.h:361

◆ IsEquivalent()

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

Reimplemented from dart::AbstractType.

Definition at line 27580 of file object.cc.

27583 {
27584 ASSERT(!IsNull());
27585 if (ptr() == other.ptr()) {
27586 return true;
27587 }
27588 if (!other.IsRecordType()) {
27589 return false;
27590 }
27591 const RecordType& other_type = RecordType::Cast(other);
27592 // Equal record types must have the same shape
27593 // (number of fields and named fields).
27594 if (shape() != other_type.shape()) {
27595 return false;
27596 }
27597 Thread* thread = Thread::Current();
27598 Zone* zone = thread->zone();
27599 if (!IsNullabilityEquivalent(thread, other_type, kind)) {
27600 return false;
27601 }
27602 // Equal record types must have equal field types.
27603 AbstractType& field_type = Type::Handle(zone);
27604 AbstractType& other_field_type = Type::Handle(zone);
27605 const intptr_t num_fields = NumFields();
27606 for (intptr_t i = 0; i < num_fields; ++i) {
27607 field_type = FieldTypeAt(i);
27608 other_field_type = other_type.FieldTypeAt(i);
27609 if (!field_type.IsEquivalent(other_field_type, kind,
27610 function_type_equivalence)) {
27611 return false;
27612 }
27613 }
27614 return true;
27615}
bool IsNullabilityEquivalent(Thread *thread, const AbstractType &other_type, TypeEquality kind) const
Definition object.cc:21245
bool IsNull() const
Definition object.h:363

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

27525 {
27526 AbstractType& type = AbstractType::Handle();
27527 const intptr_t num_fields = NumFields();
27528 for (intptr_t i = 0; i < num_fields; ++i) {
27529 type = FieldTypeAt(i);
27530 if (!type.IsInstantiated(genericity, num_free_fun_type_params)) {
27531 return false;
27532 }
27533 }
27534 return true;
27535}

◆ IsSubtypeOf()

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

Definition at line 27790 of file object.cc.

27793 {
27794 if (ptr() == other.ptr()) {
27795 return true;
27796 }
27798 ASSERT(other.IsFinalized());
27799 const intptr_t num_fields = NumFields();
27800 if (shape() != other.shape()) {
27801 // Different number of fields or different named fields.
27802 return false;
27803 }
27804 Thread* const thread = Thread::Current();
27806 return false;
27807 }
27808 // Check subtyping of record field types.
27809 Zone* const zone = thread->zone();
27810 AbstractType& field_type = Type::Handle(zone);
27811 AbstractType& other_field_type = Type::Handle(zone);
27812 for (intptr_t i = 0; i < num_fields; ++i) {
27813 field_type = FieldTypeAt(i);
27814 other_field_type = other.FieldTypeAt(i);
27815 if (!field_type.IsSubtypeOf(other_field_type, space,
27816 function_type_equivalence)) {
27817 return false;
27818 }
27819 }
27820 return true;
27821}

◆ New()

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

Definition at line 27541 of file object.cc.

27544 {
27545 Zone* Z = Thread::Current()->zone();
27546 const RecordType& result = RecordType::Handle(Z, RecordType::New(space));
27547 result.set_shape(shape);
27548 result.set_field_types(field_types);
27549 result.SetHash(0);
27550 result.set_flags(0);
27551 result.set_nullability(nullability);
27553 result.InitializeTypeTestingStubNonAtomic(
27555 return result.ptr();
27556}
#define Z
static CodePtr DefaultCodeForType(const AbstractType &type, bool lazy_specialize=true)

◆ NumFields()

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

Definition at line 13366 of file object.h.

13366 {
13367 return Array::LengthOf(field_types());
13368}
static intptr_t LengthOf(const ArrayPtr array)
Definition object.h:10809

◆ Print()

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

Definition at line 27481 of file object.cc.

27482 {
27483 if (IsNull()) {
27484 printer->AddString("null");
27485 return;
27486 }
27487 Thread* thread = Thread::Current();
27488 Zone* zone = thread->zone();
27489 AbstractType& type = AbstractType::Handle(zone);
27490 String& name = String::Handle(zone);
27491 const intptr_t num_fields = NumFields();
27492 const Array& field_names = Array::Handle(zone, GetFieldNames(thread));
27493 const intptr_t num_positional_fields = num_fields - field_names.Length();
27494 printer->AddString("(");
27495 for (intptr_t i = 0; i < num_fields; ++i) {
27496 if (i != 0) {
27497 printer->AddString(", ");
27498 }
27499 if (i == num_positional_fields) {
27500 printer->AddString("{");
27501 }
27502 type = FieldTypeAt(i);
27503 type.PrintName(name_visibility, printer);
27504 if (i >= num_positional_fields) {
27505 printer->AddString(" ");
27506 name ^= field_names.At(i - num_positional_fields);
27507 printer->AddString(name.ToCString());
27508 }
27509 }
27510 if (num_positional_fields < num_fields) {
27511 printer->AddString("}");
27512 }
27513 printer->AddString(")");
27514 printer->AddString(NullabilitySuffix(name_visibility));
27515}
virtual const char * NullabilitySuffix(NameVisibility name_visibility) const
Definition object.cc:21360
ArrayPtr GetFieldNames(Thread *thread) const
Definition object.cc:27477
const char *const name

◆ PrintName()

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

Reimplemented from dart::AbstractType.

Definition at line 27706 of file object.cc.

27707 {
27708 RecordType::Cast(*this).Print(name_visibility, printer);
27709}

◆ SetFieldTypeAt()

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

Definition at line 27461 of file object.cc.

27462 {
27463 ASSERT(!value.IsNull());
27464 const Array& field_types = Array::Handle(untag()->field_types());
27465 field_types.SetAt(index, value);
27466}
uint8_t value

◆ shape()

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

Definition at line 11362 of file object.h.

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

◆ ToNullability()

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

Definition at line 27558 of file object.cc.

27559 {
27560 if (nullability() == value) {
27561 return ptr();
27562 }
27563 // Clone record type and set new nullability.
27564 // Always cloning in old space and removing space parameter would not satisfy
27565 // currently existing requests for type instantiation in new space.
27566 Thread* T = Thread::Current();
27567 Zone* Z = T->zone();
27568 AbstractType& type = RecordType::Handle(
27569 Z,
27570 RecordType::New(shape(), Array::Handle(Z, field_types()), value, space));
27571 if (IsFinalized()) {
27572 type.SetIsFinalized();
27573 if (IsCanonical()) {
27574 type ^= type.Canonicalize(T);
27575 }
27576 }
27577 return RecordType::Cast(type).ptr();
27578}
#define T

◆ type_class_id()

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

Reimplemented from dart::AbstractType.

Definition at line 11327 of file object.h.

11327{ 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 27751 of file object.cc.

27755 {
27757 ASSERT(num_parent_type_args_adjustment >= 0);
27758 Zone* zone = Thread::Current()->zone();
27759 const auto& types = Array::Handle(zone, field_types());
27760 Array* updated_types = nullptr;
27761 auto& type = AbstractType::Handle(zone);
27762 auto& updated = AbstractType::Handle(zone);
27763 for (intptr_t i = 0, n = NumFields(); i < n; ++i) {
27764 type ^= types.At(i);
27765 updated = type.UpdateFunctionTypes(num_parent_type_args_adjustment,
27766 num_free_fun_type_params, space,
27767 function_type_mapping);
27768 if (type.ptr() != updated.ptr()) {
27769 if (updated_types == nullptr) {
27770 updated_types = &Array::Handle(zone, Array::New(n, space));
27771 for (intptr_t j = 0; j < i; ++j) {
27772 type ^= types.At(j);
27773 updated_types->SetAt(j, type);
27774 }
27775 }
27776 }
27777 if (updated_types != nullptr) {
27778 updated_types->SetAt(i, updated);
27779 }
27780 }
27781 if (updated_types == nullptr) {
27782 return ptr();
27783 }
27784 const auto& new_rt = RecordType::Handle(
27785 zone, RecordType::New(shape(), *updated_types, nullability(), space));
27786 new_rt.SetIsFinalized();
27787 return new_rt.ptr();
27788}

Friends And Related Symbol Documentation

◆ Class

friend class Class
friend

Definition at line 11392 of file object.h.

◆ ClassFinalizer

friend class ClassFinalizer
friend

Definition at line 11393 of file object.h.

◆ Record

friend class Record
friend

Definition at line 11394 of file object.h.


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