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

#include <object.h>

Inheritance diagram for dart::AbstractType:
dart::Instance dart::Object dart::FunctionType dart::RecordType dart::Type dart::TypeParameter

Public Member Functions

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

Protected Member Functions

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
 

Friends

class Class
 
class ClearTypeHashVisitor
 
class Function
 
class TypeArguments
 

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

Member Function Documentation

◆ AddURI()

void dart::AbstractType::AddURI ( URIs uris,
const String name,
const String uri 
)
static

Definition at line 21314 of file object.cc.

21314 {
21315 ASSERT(uris != nullptr);
21316 const intptr_t len = uris->length();
21317 ASSERT((len % 3) == 0);
21318 bool print_uri = false;
21319 for (intptr_t i = 0; i < len; i += 3) {
21320 if (uris->At(i).Equals(name)) {
21321 if (uris->At(i + 1).Equals(uri)) {
21322 // Same name and same URI: no need to add this already listed URI.
21323 return; // No state change is possible.
21324 } else {
21325 // Same name and different URI: the name is ambiguous, print both URIs.
21326 print_uri = true;
21327 uris->SetAt(i + 2, Symbols::print());
21328 }
21329 }
21330 }
21331 uris->Add(name);
21332 uris->Add(uri);
21333 if (print_uri) {
21334 uris->Add(Symbols::print());
21335 } else {
21336 uris->Add(Symbols::Empty());
21337 }
21338}
static const String & Empty()
Definition symbols.h:687
#define ASSERT(E)
const char *const name

◆ arguments()

TypeArgumentsPtr dart::AbstractType::arguments ( ) const
virtual

Reimplemented in dart::Type.

Definition at line 21092 of file object.cc.

21092 {
21093 // All subclasses should implement this appropriately, so the only value that
21094 // should reach this implementation should be the null value.
21095 ASSERT(IsNull());
21096 // AbstractType is an abstract class.
21097 UNREACHABLE();
21098 return nullptr;
21099}
#define UNREACHABLE()
Definition assert.h:248
bool IsNull() const
Definition object.h:363

◆ Canonicalize()

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

Reimplemented in dart::Type, dart::FunctionType, dart::TypeParameter, and dart::RecordType.

Definition at line 21297 of file object.cc.

21297 {
21298 // All subclasses should implement this appropriately, so the only value that
21299 // should reach this implementation should be the null value.
21300 ASSERT(IsNull());
21301 // AbstractType is an abstract class.
21302 UNREACHABLE();
21303 return nullptr;
21304}

◆ CanonicalizeEquals()

virtual bool dart::AbstractType::CanonicalizeEquals ( const Instance other) const
inlinevirtual

Reimplemented from dart::Instance.

Definition at line 9070 of file object.h.

9070 {
9071 return Equals(other);
9072 }
virtual bool Equals(const Instance &other) const
Definition object.h:9074

◆ CanonicalizeHash()

virtual uint32_t dart::AbstractType::CanonicalizeHash ( ) const
inlinevirtual

Reimplemented from dart::Instance.

Definition at line 9073 of file object.h.

9073{ return Hash(); }
uword Hash() const
Definition object.h:13351

◆ CanonicalizeLocked()

virtual InstancePtr dart::AbstractType::CanonicalizeLocked ( Thread thread) const
inlinevirtual

Reimplemented from dart::Instance.

Definition at line 9118 of file object.h.

9118 {
9119 return Canonicalize(thread);
9120 }
unibrow::Mapping< unibrow::Ecma262Canonicalize > Canonicalize

◆ ClassName()

StringPtr dart::AbstractType::ClassName ( ) const

Definition at line 21423 of file object.cc.

21423 {
21424 ASSERT(!IsFunctionType() && !IsRecordType());
21425 return Class::Handle(type_class()).Name();
21426}
virtual ClassPtr type_class() const
Definition object.cc:21083
static Object & Handle()
Definition object.h:407

◆ ComputeHash()

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

Reimplemented in dart::Type, dart::FunctionType, dart::TypeParameter, and dart::RecordType.

Definition at line 21809 of file object.cc.

21809 {
21810 // AbstractType is an abstract class.
21811 UNREACHABLE();
21812 return 0;
21813}

◆ EnumerateURIs()

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

Reimplemented in dart::Type, dart::FunctionType, dart::TypeParameter, and dart::RecordType.

Definition at line 21306 of file object.cc.

21306 {
21307 // All subclasses should implement this appropriately, so the only value that
21308 // should reach this implementation should be the null value.
21309 ASSERT(IsNull());
21310 // AbstractType is an abstract class.
21311 UNREACHABLE();
21312}

◆ Equals()

virtual bool dart::AbstractType::Equals ( const Instance other) const
inlinevirtual

Definition at line 9074 of file object.h.

9074 {
9076 }
virtual bool IsEquivalent(const Instance &other, TypeEquality kind, FunctionTypeMapping *function_type_equivalence=nullptr) const
Definition object.cc:21233

◆ flags_offset()

static intptr_t dart::AbstractType::flags_offset ( )
inlinestatic

Definition at line 9023 of file object.h.

9023 {
9024 return OFFSET_OF(UntaggedAbstractType, flags_);
9025 }
#define OFFSET_OF(type, field)
Definition globals.h:138

◆ Hash()

uword dart::AbstractType::Hash ( ) const
inline

Definition at line 13351 of file object.h.

13351 {
13353 intptr_t result = Smi::Value(untag()->hash());
13354 if (result != 0) {
13355 return result;
13356 }
13357 return ComputeHash();
13358}
static uint32_t hash(const SkShaderBase::GradientInfo &v)
bool IsFinalized() const
Definition object.h:9030
virtual uword ComputeHash() const
Definition object.cc:21809
intptr_t Value() const
Definition object.h:9969
GAsyncResult * result
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)

◆ hash_offset()

static intptr_t dart::AbstractType::hash_offset ( )
inlinestatic

Definition at line 9026 of file object.h.

9026 {
9027 return OFFSET_OF(UntaggedAbstractType, hash_);
9028 }

◆ HasTypeClass()

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

Reimplemented in dart::Type, dart::FunctionType, dart::TypeParameter, and dart::RecordType.

Definition at line 9063 of file object.h.

9063{ return type_class_id() != kIllegalCid; }
virtual classid_t type_class_id() const
Definition object.cc:21074
@ kIllegalCid
Definition class_id.h:214

◆ HEAP_OBJECT_IMPLEMENTATION()

dart::AbstractType::HEAP_OBJECT_IMPLEMENTATION ( AbstractType  ,
Instance   
)
protected

◆ InitializeTypeTestingStubNonAtomic()

void dart::AbstractType::InitializeTypeTestingStubNonAtomic ( const Code stub) const

Definition at line 21848 of file object.cc.

21848 {
21849 if (stub.IsNull()) {
21850 // This only happens during bootstrapping when creating Type objects before
21851 // we have the instructions.
21853 StoreNonPointer(&untag()->type_test_stub_entry_point_, 0);
21854 untag()->set_type_test_stub(stub.ptr());
21855 return;
21856 }
21857
21858 StoreNonPointer(&untag()->type_test_stub_entry_point_, stub.EntryPoint());
21859 untag()->set_type_test_stub(stub.ptr());
21860}
void StoreNonPointer(const FieldType *addr, ValueType value) const
Definition object.h:819
@ kVoidCid
Definition class_id.h:254
@ kDynamicCid
Definition class_id.h:253

◆ InstanceSize()

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

Definition at line 9309 of file object.h.

9309 {
9310 return RoundedAllocationSize(sizeof(UntaggedAbstractType));
9311 }
static constexpr intptr_t RoundedAllocationSize(intptr_t size)
Definition object.h:758

◆ InstantiateAndTestSubtype()

bool dart::AbstractType::InstantiateAndTestSubtype ( AbstractType subtype,
AbstractType supertype,
const TypeArguments instantiator_type_args,
const TypeArguments function_type_args 
)
static

Definition at line 4342 of file object.cc.

4346 {
4347 if (!subtype->IsInstantiated()) {
4348 *subtype = subtype->InstantiateFrom(
4349 instantiator_type_args, function_type_args, kAllFree, Heap::kOld);
4350 }
4351 if (!supertype->IsInstantiated()) {
4352 *supertype = supertype->InstantiateFrom(
4353 instantiator_type_args, function_type_args, kAllFree, Heap::kOld);
4354 }
4355 return subtype->IsSubtypeOf(*supertype, Heap::kOld);
4356}
@ kOld
Definition heap.h:39
@ kAllFree
Definition object.h:2920

◆ InstantiateFrom()

AbstractTypePtr dart::AbstractType::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 in dart::Type, dart::FunctionType, dart::TypeParameter, and dart::RecordType.

Definition at line 21273 of file object.cc.

21279 {
21280 // All subclasses should implement this appropriately, so the only value that
21281 // should reach this implementation should be the null value.
21282 ASSERT(IsNull());
21283 // AbstractType is an abstract class.
21284 UNREACHABLE();
21285 return nullptr;
21286}

◆ IsBoolType()

bool dart::AbstractType::IsBoolType ( ) const
inline

Definition at line 9202 of file object.h.

9202{ return type_class_id() == kBoolCid; }

◆ IsCatchAllType()

bool dart::AbstractType::IsCatchAllType ( ) const
inline

Definition at line 9256 of file object.h.

9256{ return IsDynamicType() || IsObjectType(); }
bool IsObjectType() const
Definition object.h:9181
bool IsDynamicType() const
Definition object.h:9166

◆ IsDartClosureType()

bool dart::AbstractType::IsDartClosureType ( ) const

Definition at line 21517 of file object.cc.

21517 {
21518 return (type_class_id() == kClosureCid);
21519}

◆ IsDartFunctionType()

bool dart::AbstractType::IsDartFunctionType ( ) const

Definition at line 21512 of file object.cc.

21512 {
21513 return HasTypeClass() &&
21514 (type_class() == Type::Handle(Type::DartFunctionType()).type_class());
21515}
virtual bool HasTypeClass() const
Definition object.h:9063
static TypePtr DartFunctionType()
Definition object.cc:21938

◆ IsDartRecordType()

bool dart::AbstractType::IsDartRecordType ( ) const

Definition at line 21521 of file object.cc.

21521 {
21522 if (!HasTypeClass()) return false;
21523 const auto cid = type_class_id();
21524 return ((cid == kRecordCid) ||
21525 (cid == Class::Handle(
21526 IsolateGroup::Current()->object_store()->record_class())
21527 .id()));
21528}
static IsolateGroup * Current()
Definition isolate.h:534
const intptr_t cid

◆ IsDoubleType()

bool dart::AbstractType::IsDoubleType ( ) const

Definition at line 21484 of file object.cc.

21484 {
21485 return HasTypeClass() &&
21486 (type_class() == Type::Handle(Type::Double()).type_class());
21487}
static TypePtr Double()
Definition object.cc:21902

◆ IsDynamicType()

bool dart::AbstractType::IsDynamicType ( ) const
inline

Definition at line 9166 of file object.h.

9166{ return type_class_id() == kDynamicCid; }

◆ IsEquivalent()

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

Reimplemented in dart::Type, dart::FunctionType, dart::TypeParameter, and dart::RecordType.

Definition at line 21233 of file object.cc.

21236 {
21237 // All subclasses should implement this appropriately, so the only value that
21238 // should reach this implementation should be the null value.
21239 ASSERT(IsNull());
21240 // AbstractType is an abstract class.
21241 UNREACHABLE();
21242 return false;
21243}

◆ IsFfiPointerType()

bool dart::AbstractType::IsFfiPointerType ( ) const

Definition at line 21530 of file object.cc.

21530 {
21531 return HasTypeClass() && type_class_id() == kPointerCid;
21532}

◆ IsFinalized()

bool dart::AbstractType::IsFinalized ( ) const
inline

Definition at line 9030 of file object.h.

9030 {
9031 const auto state = type_state();
9034 }
UntaggedAbstractType::TypeState type_state() const
Definition object.h:9331
AtkStateType state

◆ IsFloat32x4Type()

bool dart::AbstractType::IsFloat32x4Type ( ) const

Definition at line 21489 of file object.cc.

21489 {
21490 // kFloat32x4Cid refers to the private class and cannot be used here.
21491 return HasTypeClass() &&
21492 (type_class() == Type::Handle(Type::Float32x4()).type_class());
21493}
static TypePtr Float32x4()
Definition object.cc:21910

◆ IsFloat64x2Type()

bool dart::AbstractType::IsFloat64x2Type ( ) const

Definition at line 21495 of file object.cc.

21495 {
21496 // kFloat64x2Cid refers to the private class and cannot be used here.
21497 return HasTypeClass() &&
21498 (type_class() == Type::Handle(Type::Float64x2()).type_class());
21499}
static TypePtr Float64x2()
Definition object.cc:21914

◆ IsFutureOrType()

bool dart::AbstractType::IsFutureOrType ( ) const
inline

Definition at line 9247 of file object.h.

9247{ return type_class_id() == kFutureOrCid; }

◆ IsInstantiated()

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

Reimplemented in dart::Type, dart::FunctionType, dart::TypeParameter, and dart::RecordType.

Definition at line 21200 of file object.cc.

21201 {
21202 // All subclasses should implement this appropriately, so the only value that
21203 // should reach this implementation should be the null value.
21204 ASSERT(IsNull());
21205 // AbstractType is an abstract class.
21206 UNREACHABLE();
21207 return false;
21208}

◆ IsInt32x4Type()

bool dart::AbstractType::IsInt32x4Type ( ) const

Definition at line 21501 of file object.cc.

21501 {
21502 // kInt32x4Cid refers to the private class and cannot be used here.
21503 return HasTypeClass() &&
21504 (type_class() == Type::Handle(Type::Int32x4()).type_class());
21505}
static TypePtr Int32x4()
Definition object.cc:21918

◆ IsIntegerImplementationType()

bool dart::AbstractType::IsIntegerImplementationType ( ) const

Definition at line 21477 of file object.cc.

21477 {
21478 return HasTypeClass() &&
21480 ->object_store()
21481 ->integer_implementation_class());
21482}
ObjectStore * object_store() const
Definition isolate.h:505

◆ IsIntType()

bool dart::AbstractType::IsIntType ( ) const

Definition at line 21472 of file object.cc.

21472 {
21473 return HasTypeClass() &&
21474 (type_class() == Type::Handle(Type::IntType()).type_class());
21475}
static TypePtr IntType()
Definition object.cc:21886

◆ IsLegacy()

bool dart::AbstractType::IsLegacy ( ) const
inline

Definition at line 9053 of file object.h.

9053{ return nullability() == Nullability::kLegacy; }
Nullability nullability() const
Definition object.h:9037

◆ IsMintType()

bool dart::AbstractType::IsMintType ( ) const
inline

Definition at line 9229 of file object.h.

9229{ return type_class_id() == kMintCid; }

◆ IsNeverType()

bool dart::AbstractType::IsNeverType ( ) const

Definition at line 21432 of file object.cc.

21432 {
21433 return type_class_id() == kNeverCid;
21434}
@ kNeverCid
Definition class_id.h:255

◆ IsNonNullable()

bool dart::AbstractType::IsNonNullable ( ) const
inline

Definition at line 9048 of file object.h.

9048 {
9050 }

◆ IsNullabilityEquivalent()

bool dart::AbstractType::IsNullabilityEquivalent ( Thread thread,
const AbstractType other_type,
TypeEquality  kind 
) const
protected

Definition at line 21245 of file object.cc.

21247 {
21248 Nullability this_type_nullability = nullability();
21249 Nullability other_type_nullability = other_type.nullability();
21250 if (kind == TypeEquality::kInSubtypeTest) {
21251 if (this_type_nullability == Nullability::kNullable &&
21252 other_type_nullability == Nullability::kNonNullable) {
21253 return false;
21254 }
21255 } else {
21256 if (kind == TypeEquality::kSyntactical) {
21257 if (this_type_nullability == Nullability::kLegacy) {
21258 this_type_nullability = Nullability::kNonNullable;
21259 }
21260 if (other_type_nullability == Nullability::kLegacy) {
21261 other_type_nullability = Nullability::kNonNullable;
21262 }
21263 } else {
21265 }
21266 if (this_type_nullability != other_type_nullability) {
21267 return false;
21268 }
21269 }
21270 return true;
21271}
Nullability
Definition object.h:1112

◆ IsNullable()

bool dart::AbstractType::IsNullable ( ) const
inline

Definition at line 9043 of file object.h.

9043{ return nullability() == Nullability::kNullable; }

◆ IsNullableObjectType()

bool dart::AbstractType::IsNullableObjectType ( ) const
inline

Definition at line 9184 of file object.h.

9184 {
9186 }

◆ IsNullType()

bool dart::AbstractType::IsNullType ( ) const

Definition at line 21428 of file object.cc.

21428 {
21429 return type_class_id() == kNullCid;
21430}
@ kNullCid
Definition class_id.h:252

◆ IsNumberType()

bool dart::AbstractType::IsNumberType ( ) const
inline

Definition at line 9223 of file object.h.

9223{ return type_class_id() == kNumberCid; }

◆ IsObjectType()

bool dart::AbstractType::IsObjectType ( ) const
inline

Definition at line 9181 of file object.h.

9181{ return type_class_id() == kInstanceCid; }

◆ IsSentinelType()

bool dart::AbstractType::IsSentinelType ( ) const

Definition at line 21436 of file object.cc.

21436 {
21437 return type_class_id() == kSentinelCid;
21438}

◆ IsSmiType()

bool dart::AbstractType::IsSmiType ( ) const
inline

Definition at line 9226 of file object.h.

9226{ return type_class_id() == kSmiCid; }

◆ IsStrictlyNonNullable()

bool dart::AbstractType::IsStrictlyNonNullable ( ) const

Definition at line 21101 of file object.cc.

21101 {
21102 // Null can be assigned to legacy and nullable types.
21103 if (!IsNonNullable()) {
21104 return false;
21105 }
21106
21107 Thread* thread = Thread::Current();
21108 Zone* zone = thread->zone();
21109
21110 if (IsTypeParameter()) {
21111 const auto& bound =
21112 AbstractType::Handle(zone, TypeParameter::Cast(*this).bound());
21113 ASSERT(!bound.IsNull());
21114 return bound.IsStrictlyNonNullable();
21115 }
21116 if (IsFutureOrType()) {
21117 return AbstractType::Handle(zone, UnwrapFutureOr()).IsStrictlyNonNullable();
21118 }
21119 return true;
21120}
bool IsNonNullable() const
Definition object.h:9048
bool IsFutureOrType() const
Definition object.h:9247
AbstractTypePtr UnwrapFutureOr() const
Definition object.cc:21587
static Thread * Current()
Definition thread.h:361

◆ IsStringType()

bool dart::AbstractType::IsStringType ( ) const

Definition at line 21507 of file object.cc.

21507 {
21508 return HasTypeClass() &&
21509 (type_class() == Type::Handle(Type::StringType()).type_class());
21510}
static TypePtr StringType()
Definition object.cc:21930

◆ IsSubtypeOf()

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

Definition at line 21611 of file object.cc.

21614 {
21615 TRACE_TYPE_CHECKS_VERBOSE(" AbstractType::IsSubtypeOf(%s, %s)\n",
21616 ToCString(), other.ToCString());
21618 ASSERT(other.IsFinalized());
21619 // Reflexivity.
21620 if (ptr() == other.ptr()) {
21621 TRACE_TYPE_CHECKS_VERBOSE(" - result: true (same types)\n");
21622 return true;
21623 }
21624 // Right top type.
21625 if (other.IsTopTypeForSubtyping()) {
21626 TRACE_TYPE_CHECKS_VERBOSE(" - result: true (right is top)\n");
21627 return true;
21628 }
21629 // Left bottom type.
21630 // Any form of Never in weak mode maps to Null and Null is a bottom type in
21631 // weak mode. In strong mode, Never and Never* are bottom types. Therefore,
21632 // Never and Never* are bottom types regardless of weak/strong mode.
21633 // Note that we cannot encounter Never?, as it is normalized to Null.
21634 if (IsNeverType()) {
21635 ASSERT(!IsNullable());
21636 TRACE_TYPE_CHECKS_VERBOSE(" - result: true (left is Never)\n");
21637 return true;
21638 }
21639 // Left top type.
21640 if (IsDynamicType() || IsVoidType()) {
21641 TRACE_TYPE_CHECKS_VERBOSE(" - result: false (left is top)\n");
21642 return false;
21643 }
21644 // Left Null type.
21645 if (IsNullType()) {
21646 const bool result = Instance::NullIsAssignableTo(other);
21647 TRACE_TYPE_CHECKS_VERBOSE(" - result: %s (left is Null)\n",
21648 (result ? "true" : "false"));
21649 return result;
21650 }
21651 Thread* thread = Thread::Current();
21652 Zone* zone = thread->zone();
21653 // Type parameters cannot be handled by Class::IsSubtypeOf().
21654 // When comparing two uninstantiated function types, one returning type
21655 // parameter K, the other returning type parameter V, we cannot assume that
21656 // K is a subtype of V, or vice versa. We only return true if K equals V, as
21657 // defined by TypeParameter::Equals.
21658 // The same rule applies when checking the upper bound of a still
21659 // uninstantiated type at compile time. Returning false will defer the test
21660 // to run time.
21661 // There are however some cases that can be decided at compile time.
21662 // For example, with class A<K, V extends K>, new A<T, T> called from within
21663 // a class B<T> will never require a run time bound check, even if T is
21664 // uninstantiated at compile time.
21665 if (IsTypeParameter()) {
21666 const TypeParameter& type_param = TypeParameter::Cast(*this);
21667 if (other.IsTypeParameter()) {
21668 const TypeParameter& other_type_param = TypeParameter::Cast(other);
21669 if (type_param.IsEquivalent(other_type_param,
21671 function_type_equivalence)) {
21673 " - result: true (equivalent type parameters)\n");
21674 return true;
21675 }
21676 }
21677 const AbstractType& bound = AbstractType::Handle(zone, type_param.bound());
21678 ASSERT(bound.IsFinalized());
21679 if (bound.IsSubtypeOf(other, space, function_type_equivalence)) {
21680 TRACE_TYPE_CHECKS_VERBOSE(" - result: true (bound is a subtype)\n");
21681 return true;
21682 }
21683 // Apply additional subtyping rules if 'other' is 'FutureOr'.
21684 if (IsSubtypeOfFutureOr(zone, other, space, function_type_equivalence)) {
21686 " - result: true (type parameter is a subtype of FutureOr)\n");
21687 return true;
21688 }
21690 " - result: false (left is a type parameter)\n");
21691 return false;
21692 }
21693 if (other.IsTypeParameter()) {
21695 " - result: false (right is a type parameter)\n");
21696 return false;
21697 }
21698 // Function types cannot be handled by Class::IsSubtypeOf().
21699 if (IsFunctionType()) {
21700 // Any type that can be the type of a closure is a subtype of Function or
21701 // non-nullable Object.
21702 if (other.IsObjectType() || other.IsDartFunctionType()) {
21703 const bool result = !IsNullable() || !other.IsNonNullable();
21704 TRACE_TYPE_CHECKS_VERBOSE(" - result: %s (function vs non-function)\n",
21705 (result ? "true" : "false"));
21706 return result;
21707 }
21708 if (other.IsFunctionType()) {
21709 // Check for two function types.
21710 if (IsNullable() && other.IsNonNullable()) {
21712 " - result: false (function nullability)\n");
21713 return false;
21714 }
21715 const bool result = FunctionType::Cast(*this).IsSubtypeOf(
21716 FunctionType::Cast(other), space, function_type_equivalence);
21717 TRACE_TYPE_CHECKS_VERBOSE(" - result: %s (function types)\n",
21718 (result ? "true" : "false"));
21719 return result;
21720 }
21721 // Apply additional subtyping rules if 'other' is 'FutureOr'.
21722 if (IsSubtypeOfFutureOr(zone, other, space, function_type_equivalence)) {
21724 " - result: true (function type is a subtype of FutureOr)\n");
21725 return true;
21726 }
21727 // All possible supertypes for FunctionType have been checked.
21728 TRACE_TYPE_CHECKS_VERBOSE(" - result: false (function type)\n");
21729 return false;
21730 } else if (other.IsFunctionType()) {
21731 // FunctionTypes can only be subtyped by other FunctionTypes, so don't
21732 // fall through to class-based type tests.
21734 " - result: false (right is a function type)\n");
21735 return false;
21736 }
21737 // Record types cannot be handled by Class::IsSubtypeOf().
21738 if (IsRecordType()) {
21739 if (other.IsObjectType() || other.IsDartRecordType()) {
21740 const bool result = !IsNullable() || !other.IsNonNullable();
21741 TRACE_TYPE_CHECKS_VERBOSE(" - result: %s (record vs non-record)\n",
21742 (result ? "true" : "false"));
21743 return result;
21744 }
21745 if (other.IsRecordType()) {
21746 // Check for two record types.
21747 if (IsNullable() && other.IsNonNullable()) {
21748 TRACE_TYPE_CHECKS_VERBOSE(" - result: false (record nullability)\n");
21749 return false;
21750 }
21751 const bool result = RecordType::Cast(*this).IsSubtypeOf(
21752 RecordType::Cast(other), space, function_type_equivalence);
21753 TRACE_TYPE_CHECKS_VERBOSE(" - result: %s (record types)\n",
21754 (result ? "true" : "false"));
21755 return result;
21756 }
21757 // Apply additional subtyping rules if 'other' is 'FutureOr'.
21758 if (IsSubtypeOfFutureOr(zone, other, space, function_type_equivalence)) {
21760 " - result: true (record type is a subtype of FutureOr)\n");
21761 return true;
21762 }
21763 // All possible supertypes for record type have been checked.
21764 TRACE_TYPE_CHECKS_VERBOSE(" - result: false (record type)\n");
21765 return false;
21766 } else if (other.IsRecordType()) {
21767 // RecordTypes can only be subtyped by other RecordTypes, so don't
21768 // fall through to class-based type tests.
21769 TRACE_TYPE_CHECKS_VERBOSE(" - result: false (right is a record type)\n");
21770 return false;
21771 }
21772 ASSERT(IsType());
21773 const Class& type_cls = Class::Handle(zone, type_class());
21774 const bool result = Class::IsSubtypeOf(
21775 type_cls,
21776 TypeArguments::Handle(zone, Type::Cast(*this).GetInstanceTypeArguments(
21777 thread, /*canonicalize=*/false)),
21778 nullability(), other, space, function_type_equivalence);
21779 TRACE_TYPE_CHECKS_VERBOSE(" - result: %s (class type check)\n",
21780 (result ? "true" : "false"));
21781 return result;
21782}
bool IsVoidType() const
Definition object.h:9169
bool IsNullable() const
Definition object.h:9043
bool IsNullType() const
Definition object.cc:21428
friend class Class
Definition object.h:9340
bool IsNeverType() const
Definition object.cc:21432
static bool IsSubtypeOf(const Class &cls, const TypeArguments &type_arguments, Nullability nullability, const AbstractType &other, Heap::Space space, FunctionTypeMapping *function_type_equivalence=nullptr)
Definition object.cc:5975
static bool NullIsAssignableTo(const AbstractType &other)
Definition object.cc:20715
ObjectPtr ptr() const
Definition object.h:332
virtual const char * ToCString() const
Definition object.h:366
#define TRACE_TYPE_CHECKS_VERBOSE(format,...)
Definition object.cc:226

◆ IsTopTypeForInstanceOf()

bool dart::AbstractType::IsTopTypeForInstanceOf ( ) const

Definition at line 21440 of file object.cc.

21440 {
21441 const classid_t cid = type_class_id();
21442 if (cid == kDynamicCid || cid == kVoidCid) {
21443 return true;
21444 }
21445 if (cid == kInstanceCid) { // Object type.
21446 return !IsNonNullable(); // kLegacy or kNullable.
21447 }
21448 if (cid == kFutureOrCid) {
21449 // FutureOr<T> where T is a top type behaves as a top type.
21450 return AbstractType::Handle(UnwrapFutureOr()).IsTopTypeForInstanceOf();
21451 }
21452 return false;
21453}
int32_t classid_t
Definition globals.h:524

◆ IsTopTypeForSubtyping()

bool dart::AbstractType::IsTopTypeForSubtyping ( ) const

Definition at line 21457 of file object.cc.

21457 {
21458 const classid_t cid = type_class_id();
21459 if (cid == kDynamicCid || cid == kVoidCid) {
21460 return true;
21461 }
21462 if (cid == kInstanceCid) { // Object type.
21463 return !IsNonNullable();
21464 }
21465 if (cid == kFutureOrCid) {
21466 // FutureOr<T> where T is a top type behaves as a top type.
21467 return AbstractType::Handle(UnwrapFutureOr()).IsTopTypeForSubtyping();
21468 }
21469 return false;
21470}

◆ IsTypeClassAllowedBySpawnUri()

bool dart::AbstractType::IsTypeClassAllowedBySpawnUri ( ) const

Definition at line 21534 of file object.cc.

21534 {
21535 if (!HasTypeClass()) return false;
21536
21537 intptr_t cid = type_class_id();
21538
21539 if (cid == kBoolCid) return true;
21540 if (cid == kDynamicCid) return true;
21541 if (cid == kInstanceCid) return true; // Object.
21542 if (cid == kNeverCid) return true;
21543 if (cid == kNullCid) return true;
21544 if (cid == kVoidCid) return true;
21545
21546 // These are not constant CID checks because kDoubleCid refers to _Double
21547 // not double, etc.
21548 ObjectStore* object_store = IsolateGroup::Current()->object_store();
21549 Type& candidate_type = Type::Handle();
21550 candidate_type = object_store->int_type();
21551 if (cid == candidate_type.type_class_id()) return true;
21552 candidate_type = object_store->double_type();
21553 if (cid == candidate_type.type_class_id()) return true;
21554 candidate_type = object_store->number_type();
21555 if (cid == candidate_type.type_class_id()) return true;
21556 candidate_type = object_store->string_type();
21557 if (cid == candidate_type.type_class_id()) return true;
21558
21559 Class& candidate_cls = Class::Handle();
21560 candidate_cls = object_store->list_class();
21561 if (cid == candidate_cls.id()) return true;
21562 candidate_cls = object_store->map_class();
21563 if (cid == candidate_cls.id()) return true;
21564 candidate_cls = object_store->set_class();
21565 if (cid == candidate_cls.id()) return true;
21566 candidate_cls = object_store->capability_class();
21567 if (cid == candidate_cls.id()) return true;
21568 candidate_cls = object_store->send_port_class();
21569 if (cid == candidate_cls.id()) return true;
21570 candidate_cls = object_store->transferable_class();
21571 if (cid == candidate_cls.id()) return true;
21572
21573 const auto& typed_data_lib =
21574 Library::Handle(object_store->typed_data_library());
21575
21576#define IS_CHECK(name) \
21577 candidate_cls = typed_data_lib.LookupClass(Symbols::name##List()); \
21578 if (cid == candidate_cls.id()) { \
21579 return true; \
21580 }
21582#undef IS_CHECK
21583
21584 return false;
21585}
#define DART_CLASS_LIST_TYPED_DATA(V)
Definition class_id.h:177
#define IS_CHECK(name)

◆ IsVoidType()

bool dart::AbstractType::IsVoidType ( ) const
inline

Definition at line 9169 of file object.h.

9169{ return type_class_id() == kVoidCid; }

◆ Name()

StringPtr dart::AbstractType::Name ( ) const

Definition at line 21381 of file object.cc.

21381 {
21383}
const char * NameCString() const
Definition object.cc:21385
static StringPtr New(Thread *thread, const char *cstr)
Definition symbols.h:722

◆ NameCString()

const char * dart::AbstractType::NameCString ( ) const

Definition at line 21385 of file object.cc.

21385 {
21386 Thread* thread = Thread::Current();
21387 ZoneTextBuffer printer(thread->zone());
21388 PrintName(kInternalName, &printer);
21389 return printer.buffer();
21390}
virtual void PrintName(NameVisibility visibility, BaseTextBuffer *printer) const
Definition object.cc:21414
@ kInternalName
Definition object.h:622

◆ NextFieldOffset()

static intptr_t dart::AbstractType::NextFieldOffset ( )
inlinestatic

Definition at line 9313 of file object.h.

9313{ return -kWordSize; }
constexpr intptr_t kWordSize
Definition globals.h:509

◆ NormalizeFutureOrType()

AbstractTypePtr dart::AbstractType::NormalizeFutureOrType ( Heap::Space  space) const
virtual

Definition at line 21161 of file object.cc.

21161 {
21162 if (IsFutureOrType()) {
21163 Zone* zone = Thread::Current()->zone();
21164 const AbstractType& unwrapped_type =
21166 const classid_t cid = unwrapped_type.type_class_id();
21167 if (cid == kDynamicCid || cid == kVoidCid) {
21168 return unwrapped_type.ptr();
21169 }
21170 if (cid == kInstanceCid) {
21171 if (IsNonNullable()) {
21172 return unwrapped_type.ptr();
21173 }
21174 if (IsNullable() || unwrapped_type.IsNullable()) {
21175 return Type::Cast(unwrapped_type)
21176 .ToNullability(Nullability::kNullable, space);
21177 }
21178 return Type::Cast(unwrapped_type)
21179 .ToNullability(Nullability::kLegacy, space);
21180 }
21181 if (cid == kNeverCid && unwrapped_type.IsNonNullable()) {
21182 ObjectStore* object_store = IsolateGroup::Current()->object_store();
21183 const Type& future_never_type =
21184 Type::Handle(zone, object_store->non_nullable_future_never_type());
21185 ASSERT(!future_never_type.IsNull());
21186 return future_never_type.ToNullability(nullability(), space);
21187 }
21188 if (cid == kNullCid) {
21189 ObjectStore* object_store = IsolateGroup::Current()->object_store();
21190 ASSERT(object_store->nullable_future_null_type() != Type::null());
21191 return object_store->nullable_future_null_type();
21192 }
21193 if (IsNullable() && unwrapped_type.IsNullable()) {
21194 return Type::Cast(*this).ToNullability(Nullability::kNonNullable, space);
21195 }
21196 }
21197 return ptr();
21198}
static ObjectPtr null()
Definition object.h:433
Zone * zone() const

◆ nullability()

Nullability dart::AbstractType::nullability ( ) const
inline

Definition at line 9037 of file object.h.

9037 {
9038 return static_cast<Nullability>(
9040 }
static constexpr T decode(S value)
Definition bitfield.h:173
FlutterSemanticsFlag flags

◆ NullabilitySuffix()

const char * dart::AbstractType::NullabilitySuffix ( NameVisibility  name_visibility) const
virtual

Definition at line 21360 of file object.cc.

21361 {
21362 if (IsDynamicType() || IsVoidType() || IsNullType()) {
21363 // Hide nullable suffix.
21364 return "";
21365 }
21366 // Keep in sync with Nullability enum in runtime/vm/object.h.
21367 switch (nullability()) {
21369 return "?";
21371 return "";
21373 return (FLAG_show_internal_names || name_visibility != kUserVisibleName)
21374 ? "*"
21375 : "";
21376 default:
21377 UNREACHABLE();
21378 }
21379}
@ kUserVisibleName
Definition object.h:645

◆ PrintName()

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

Reimplemented in dart::Type, dart::FunctionType, dart::TypeParameter, and dart::RecordType.

Definition at line 21414 of file object.cc.

21415 {
21416 // All subclasses should implement this appropriately, so the only value that
21417 // should reach this implementation should be the null value.
21418 ASSERT(IsNull());
21419 // AbstractType is an abstract class.
21420 UNREACHABLE();
21421}

◆ PrintURIs()

StringPtr dart::AbstractType::PrintURIs ( URIs uris)
static

Definition at line 21340 of file object.cc.

21340 {
21341 ASSERT(uris != nullptr);
21342 Thread* thread = Thread::Current();
21343 Zone* zone = thread->zone();
21344 const intptr_t len = uris->length();
21345 ASSERT((len % 3) == 0);
21346 GrowableHandlePtrArray<const String> pieces(zone, 5 * (len / 3));
21347 for (intptr_t i = 0; i < len; i += 3) {
21348 // Only print URIs that have been marked.
21349 if (uris->At(i + 2).ptr() == Symbols::print().ptr()) {
21350 pieces.Add(Symbols::TwoSpaces());
21351 pieces.Add(uris->At(i));
21352 pieces.Add(Symbols::SpaceIsFromSpace());
21353 pieces.Add(uris->At(i + 1));
21354 pieces.Add(Symbols::NewLine());
21355 }
21356 }
21357 return Symbols::FromConcatAll(thread, pieces);
21358}
static const String & NewLine()
Definition symbols.h:650
static StringPtr FromConcatAll(Thread *thread, const GrowableHandlePtrArray< const String > &strs)
Definition symbols.cc:262

◆ ScrubbedName()

StringPtr dart::AbstractType::ScrubbedName ( ) const

Definition at line 21403 of file object.cc.

21403 {
21405}
const char * ScrubbedNameCString() const
Definition object.cc:21407

◆ ScrubbedNameCString()

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

Definition at line 21407 of file object.cc.

21407 {
21408 Thread* thread = Thread::Current();
21409 ZoneTextBuffer printer(thread->zone());
21410 PrintName(kScrubbedName, &printer);
21411 return printer.buffer();
21412}
@ kScrubbedName
Definition object.h:633

◆ set_flags()

void dart::AbstractType::set_flags ( uint32_t  value) const
protected

Definition at line 21217 of file object.cc.

21217 {
21218 untag()->set_flags(value);
21219}

◆ set_nullability()

void dart::AbstractType::set_nullability ( Nullability  value) const
protected

Definition at line 21227 of file object.cc.

21227 {
21228 ASSERT(!IsCanonical());
21230 static_cast<uint8_t>(value), untag()->flags()));
21231}
void set_flags(uint32_t value) const
Definition object.cc:21217
static constexpr S update(T value, S original)
Definition bitfield.h:190
bool IsCanonical() const
Definition object.h:335

◆ set_type_state()

void dart::AbstractType::set_type_state ( UntaggedAbstractType::TypeState  value) const
protected

Definition at line 21221 of file object.cc.

21221 {
21222 ASSERT(!IsCanonical());
21223 set_flags(
21225}

◆ SetHash()

void dart::AbstractType::SetHash ( intptr_t  value) const
inlineprotected

Definition at line 13360 of file object.h.

13360 {
13361 // This is only safe because we create a new Smi, which does not cause
13362 // heap allocation.
13363 untag()->set_hash(Smi::New(value));
13364}
static SmiPtr New(intptr_t value)
Definition object.h:9985

◆ SetInstantiatedNullability()

AbstractTypePtr dart::AbstractType::SetInstantiatedNullability ( const TypeParameter type_param,
Heap::Space  space 
) const
virtual

Definition at line 21122 of file object.cc.

21124 {
21125 Nullability result_nullability;
21126 const Nullability arg_nullability = nullability();
21127 const Nullability var_nullability = type_param.nullability();
21128 // Adjust nullability of result 'arg' instantiated from 'var'.
21129 // arg/var ! ? *
21130 // ! ! ? *
21131 // ? ? ? ?
21132 // * * ? *
21133 if (var_nullability == Nullability::kNullable ||
21134 arg_nullability == Nullability::kNullable) {
21135 result_nullability = Nullability::kNullable;
21136 } else if (var_nullability == Nullability::kLegacy ||
21137 arg_nullability == Nullability::kLegacy) {
21138 result_nullability = Nullability::kLegacy;
21139 } else {
21140 // Keep arg nullability.
21141 return ptr();
21142 }
21143 if (arg_nullability == result_nullability) {
21144 return ptr();
21145 }
21146 if (IsType()) {
21147 return Type::Cast(*this).ToNullability(result_nullability, space);
21148 }
21149 if (IsFunctionType()) {
21150 return FunctionType::Cast(*this).ToNullability(result_nullability, space);
21151 }
21152 if (IsRecordType()) {
21153 return RecordType::Cast(*this).ToNullability(result_nullability, space);
21154 }
21155 if (IsTypeParameter()) {
21156 return TypeParameter::Cast(*this).ToNullability(result_nullability, space);
21157 }
21158 UNREACHABLE();
21159}

◆ SetIsFinalized()

void dart::AbstractType::SetIsFinalized ( ) const

Definition at line 21210 of file object.cc.

21210 {
21211 ASSERT(!IsFinalized());
21214 : UntaggedAbstractType::kFinalizedUninstantiated);
21215}
virtual bool IsInstantiated(Genericity genericity=kAny, intptr_t num_free_fun_type_params=kAllFree) const
Definition object.cc:21200
void set_type_state(UntaggedAbstractType::TypeState value) const
Definition object.cc:21221

◆ SetTypeTestingStub()

void dart::AbstractType::SetTypeTestingStub ( const Code stub) const

Definition at line 21822 of file object.cc.

21822 {
21823 if (stub.IsNull()) {
21825 return;
21826 }
21827
21828 auto& old = Code::Handle(Thread::Current()->zone());
21829 while (true) {
21830 // We load the old TTS and it's entrypoint.
21831 old = untag()->type_test_stub<std::memory_order_acquire>();
21832 uword old_entry_point = old.IsNull() ? 0 : old.EntryPoint();
21833
21834 // If we can successfully update the entrypoint of the TTS, we will
21835 // unconditionally also set the [Code] of the TTS.
21836 //
21837 // Any competing writer would do the same, lose the compare-exchange, loop
21838 // around and continue loading the old [Code] TTS and continue to lose the
21839 // race until we have finally also updated the [Code] TTS.
21840 if (untag()->type_test_stub_entry_point_.compare_exchange_strong(
21841 old_entry_point, stub.EntryPoint())) {
21842 untag()->set_type_test_stub<std::memory_order_release>(stub.ptr());
21843 return;
21844 }
21845 }
21846}
void InitializeTypeTestingStubNonAtomic(const Code &stub) const
Definition object.cc:21848
uintptr_t uword
Definition globals.h:501

◆ type_class()

ClassPtr dart::AbstractType::type_class ( ) const
virtual

Reimplemented in dart::Type.

Definition at line 21083 of file object.cc.

21083 {
21084 // All subclasses should implement this appropriately, so the only value that
21085 // should reach this implementation should be the null value.
21086 ASSERT(IsNull());
21087 // AbstractType is an abstract class.
21088 UNREACHABLE();
21089 return Class::null();
21090}

◆ type_class_id()

classid_t dart::AbstractType::type_class_id ( ) const
virtual

Reimplemented in dart::Type, dart::FunctionType, dart::TypeParameter, and dart::RecordType.

Definition at line 21074 of file object.cc.

21074 {
21075 // All subclasses should implement this appropriately, so the only value that
21076 // should reach this implementation should be the null value.
21077 ASSERT(IsNull());
21078 // AbstractType is an abstract class.
21079 UNREACHABLE();
21080 return kIllegalCid;
21081}

◆ type_state()

UntaggedAbstractType::TypeState dart::AbstractType::type_state ( ) const
inlineprotected

Definition at line 9331 of file object.h.

◆ type_test_stub()

CodePtr dart::AbstractType::type_test_stub ( ) const
inline

Definition at line 9284 of file object.h.

9284{ return untag()->type_test_stub(); }

◆ type_test_stub_entry_point()

uword dart::AbstractType::type_test_stub_entry_point ( ) const
inline

Definition at line 9281 of file object.h.

9281 {
9282 return untag()->type_test_stub_entry_point_;
9283 }

◆ type_test_stub_entry_point_offset()

static intptr_t dart::AbstractType::type_test_stub_entry_point_offset ( )
inlinestatic

Definition at line 9277 of file object.h.

9277 {
9278 return OFFSET_OF(UntaggedAbstractType, type_test_stub_entry_point_);
9279 }

◆ UnwrapFutureOr()

AbstractTypePtr dart::AbstractType::UnwrapFutureOr ( ) const

Definition at line 21587 of file object.cc.

21587 {
21588 if (!IsFutureOrType()) {
21589 return ptr();
21590 }
21591 if (arguments() == TypeArguments::null()) {
21592 return Type::dynamic_type().ptr();
21593 }
21594 Thread* thread = Thread::Current();
21596 TypeArguments& type_args = thread->TypeArgumentsHandle();
21597 type_args = arguments();
21599 AbstractType& type_arg = thread->AbstractTypeHandle();
21600 type_arg = type_args.TypeAt(0);
21601 while (type_arg.IsFutureOrType()) {
21602 if (type_arg.arguments() == TypeArguments::null()) {
21603 return Type::dynamic_type().ptr();
21604 }
21605 type_args = type_arg.arguments();
21606 type_arg = type_args.TypeAt(0);
21607 }
21608 return type_arg.ptr();
21609}
friend class TypeArguments
Definition object.h:9343
virtual TypeArgumentsPtr arguments() const
Definition object.cc:21092
#define REUSABLE_ABSTRACT_TYPE_HANDLESCOPE(thread)
#define REUSABLE_TYPE_ARGUMENTS_HANDLESCOPE(thread)

◆ UpdateFunctionTypes()

AbstractTypePtr dart::AbstractType::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 in dart::Type, dart::FunctionType, dart::TypeParameter, and dart::RecordType.

Definition at line 21288 of file object.cc.

21292 {
21293 UNREACHABLE();
21294 return nullptr;
21295}

◆ UpdateTypeTestingStubEntryPoint()

void dart::AbstractType::UpdateTypeTestingStubEntryPoint ( ) const
inline

Definition at line 9302 of file object.h.

9302 {
9303 StoreNonPointer(&untag()->type_test_stub_entry_point_,
9305 }
CodePtr type_test_stub() const
Definition object.h:9284
static uword EntryPointOf(const CodePtr code)
Definition object.h:6838

◆ UserVisibleName()

StringPtr dart::AbstractType::UserVisibleName ( ) const

Definition at line 21392 of file object.cc.

21392 {
21394}
const char * UserVisibleNameCString() const
Definition object.cc:21396

◆ UserVisibleNameCString()

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

Definition at line 21396 of file object.cc.

21396 {
21397 Thread* thread = Thread::Current();
21398 ZoneTextBuffer printer(thread->zone());
21399 PrintName(kUserVisibleName, &printer);
21400 return printer.buffer();
21401}

Friends And Related Symbol Documentation

◆ Class

friend class Class
friend

Definition at line 9340 of file object.h.

◆ ClearTypeHashVisitor

friend class ClearTypeHashVisitor
friend

Definition at line 9341 of file object.h.

◆ Function

friend class Function
friend

Definition at line 9342 of file object.h.

◆ TypeArguments

friend class TypeArguments
friend

Definition at line 9343 of file object.h.


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