Flutter Engine
The Flutter Engine
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 IsStrictlyNonNullable () const
 
virtual AbstractTypePtr SetInstantiatedNullability (const TypeParameter &type_param, Heap::Space space) const
 
virtual AbstractTypePtr NormalizeFutureOrType (Heap::Space space) const
 
virtual bool HasTypeClass () const
 
virtual classid_t type_class_id () const
 
virtual ClassPtr type_class () const
 
virtual TypeArgumentsPtr arguments () const
 
virtual bool IsInstantiated (Genericity genericity=kAny, intptr_t num_free_fun_type_params=kAllFree) const
 
virtual bool CanonicalizeEquals (const Instance &other) const
 
virtual uint32_t CanonicalizeHash () const
 
virtual bool Equals (const Instance &other) const
 
virtual bool IsEquivalent (const Instance &other, TypeEquality kind, FunctionTypeMapping *function_type_equivalence=nullptr) const
 
virtual AbstractTypePtr InstantiateFrom (const TypeArguments &instantiator_type_arguments, const TypeArguments &function_type_arguments, intptr_t num_free_fun_type_params, Heap::Space space, FunctionTypeMapping *function_type_mapping=nullptr, intptr_t num_parent_type_args_adjustment=0) const
 
virtual AbstractTypePtr UpdateFunctionTypes (intptr_t num_parent_type_args_adjustment, intptr_t num_free_fun_type_params, Heap::Space space, FunctionTypeMapping *function_type_mapping) const
 
virtual InstancePtr CanonicalizeLocked (Thread *thread) const
 
virtual AbstractTypePtr Canonicalize (Thread *thread) const
 
virtual const char * NullabilitySuffix (NameVisibility name_visibility) const
 
StringPtr Name () const
 
const char * NameCString () const
 
StringPtr UserVisibleName () const
 
const char * UserVisibleNameCString () const
 
StringPtr ScrubbedName () const
 
const char * ScrubbedNameCString () const
 
virtual void PrintName (NameVisibility visibility, BaseTextBuffer *printer) const
 
virtual void EnumerateURIs (URIs *uris) const
 
uword Hash () const
 
virtual uword ComputeHash () const
 
StringPtr ClassName () const
 
bool IsDynamicType () const
 
bool IsVoidType () const
 
bool IsNullType () const
 
bool IsNeverType () const
 
bool IsSentinelType () const
 
bool IsObjectType () const
 
bool IsNullableObjectType () const
 
bool IsTopTypeForSubtyping () const
 
bool IsTopTypeForInstanceOf () const
 
bool IsBoolType () const
 
bool IsIntType () const
 
bool IsIntegerImplementationType () const
 
bool IsDoubleType () const
 
bool IsFloat32x4Type () const
 
bool IsFloat64x2Type () const
 
bool IsInt32x4Type () const
 
bool IsNumberType () const
 
bool IsSmiType () const
 
bool IsMintType () const
 
bool IsStringType () const
 
bool IsDartFunctionType () const
 
bool IsDartClosureType () const
 
bool IsDartRecordType () const
 
bool IsFfiPointerType () const
 
bool IsFutureOrType () const
 
AbstractTypePtr UnwrapFutureOr () const
 
bool IsCatchAllType () const
 
bool IsTypeClassAllowedBySpawnUri () const
 
bool IsSubtypeOf (const AbstractType &other, Heap::Space space, FunctionTypeMapping *function_type_equivalence=nullptr) const
 
uword type_test_stub_entry_point () const
 
CodePtr type_test_stub () const
 
void SetTypeTestingStub (const Code &stub) const
 
void InitializeTypeTestingStubNonAtomic (const Code &stub) const
 
void UpdateTypeTestingStubEntryPoint () const
 
- Public Member Functions inherited from dart::Instance
virtual bool OperatorEquals (const Instance &other) const
 
bool IsIdenticalTo (const Instance &other) const
 
virtual bool CanonicalizeEquals (const Instance &other) const
 
virtual uint32_t CanonicalizeHash () const
 
intptr_t SizeFromClass () const
 
InstancePtr Canonicalize (Thread *thread) const
 
virtual InstancePtr CanonicalizeLocked (Thread *thread) const
 
virtual void CanonicalizeFieldsLocked (Thread *thread) const
 
InstancePtr CopyShallowToOldSpace (Thread *thread) const
 
ObjectPtr GetField (const Field &field) const
 
void SetField (const Field &field, const Object &value) const
 
AbstractTypePtr GetType (Heap::Space space) const
 
virtual TypeArgumentsPtr GetTypeArguments () const
 
virtual void SetTypeArguments (const TypeArguments &value) const
 
bool IsInstanceOf (const AbstractType &other, const TypeArguments &other_instantiator_type_arguments, const TypeArguments &other_function_type_arguments) const
 
bool IsAssignableTo (const AbstractType &other, const TypeArguments &other_instantiator_type_arguments, const TypeArguments &other_function_type_arguments) const
 
bool IsValidNativeIndex (int index) const
 
intptr_t * NativeFieldsDataAddr () const
 
intptr_t GetNativeField (int index) const
 
void GetNativeFields (uint16_t num_fields, intptr_t *field_values) const
 
void SetNativeFields (uint16_t num_fields, const intptr_t *field_values) const
 
uint16_t NumNativeFields () const
 
void SetNativeField (int index, intptr_t value) const
 
bool IsCallable (Function *function) const
 
ObjectPtr Invoke (const String &selector, const Array &arguments, const Array &argument_names, bool respect_reflectable=true, bool check_is_entrypoint=false) const
 
ObjectPtr InvokeGetter (const String &selector, bool respect_reflectable=true, bool check_is_entrypoint=false) const
 
ObjectPtr InvokeSetter (const String &selector, const Instance &argument, bool respect_reflectable=true, bool check_is_entrypoint=false) const
 
ObjectPtr EvaluateCompiledExpression (const Class &klass, const ExternalTypedData &kernel_buffer, const Array &type_definitions, const Array &arguments, const TypeArguments &type_arguments) const
 
virtual ObjectPtr HashCode () const
 
IntegerPtr IdentityHashCode (Thread *thread) const
 
virtual bool IsPointer () const
 
- Public Member Functions inherited from dart::Object
virtual ~Object ()
 
ObjectPtr ptr () const
 
void operator= (ObjectPtr value)
 
bool IsCanonical () const
 
void SetCanonical () const
 
void ClearCanonical () const
 
bool IsImmutable () const
 
void SetImmutable () const
 
void ClearImmutable () const
 
intptr_t GetClassId () const
 
ClassPtr clazz () const
 
 CLASS_LIST_FOR_HANDLES (DEFINE_CLASS_TESTER)
 
bool IsNull () const
 
virtual const char * ToCString () const
 
void PrintJSON (JSONStream *stream, bool ref=true) const
 
virtual void PrintJSONImpl (JSONStream *stream, bool ref) const
 
void PrintImplementationFields (JSONStream *stream) const
 
virtual void PrintImplementationFieldsImpl (const JSONArray &jsarr_fields) const
 
virtual const char * JSONType () const
 
virtual StringPtr DictionaryName () const
 
bool IsNew () const
 
bool IsOld () const
 
bool InVMIsolateHeap () const
 
void Print () const
 

Static Public Member Functions

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

Member Function Documentation

◆ AddURI()

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

Definition at line 21257 of file object.cc.

21257 {
21258 ASSERT(uris != nullptr);
21259 const intptr_t len = uris->length();
21260 ASSERT((len % 3) == 0);
21261 bool print_uri = false;
21262 for (intptr_t i = 0; i < len; i += 3) {
21263 if (uris->At(i).Equals(name)) {
21264 if (uris->At(i + 1).Equals(uri)) {
21265 // Same name and same URI: no need to add this already listed URI.
21266 return; // No state change is possible.
21267 } else {
21268 // Same name and different URI: the name is ambiguous, print both URIs.
21269 print_uri = true;
21270 uris->SetAt(i + 2, Symbols::print());
21271 }
21272 }
21273 }
21274 uris->Add(name);
21275 uris->Add(uri);
21276 if (print_uri) {
21277 uris->Add(Symbols::print());
21278 } else {
21279 uris->Add(Symbols::Empty());
21280 }
21281}
static const String & Empty()
Definition: symbols.h:688
#define ASSERT(E)
const char *const name
def print(*args, **kwargs)
Definition: run_tests.py:49

◆ arguments()

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

Reimplemented in dart::Type.

Definition at line 21051 of file object.cc.

21051 {
21052 // All subclasses should implement this appropriately, so the only value that
21053 // should reach this implementation should be the null value.
21054 ASSERT(IsNull());
21055 // AbstractType is an abstract class.
21056 UNREACHABLE();
21057 return nullptr;
21058}
#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 21240 of file object.cc.

21240 {
21241 // All subclasses should implement this appropriately, so the only value that
21242 // should reach this implementation should be the null value.
21243 ASSERT(IsNull());
21244 // AbstractType is an abstract class.
21245 UNREACHABLE();
21246 return nullptr;
21247}

◆ CanonicalizeEquals()

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

Reimplemented from dart::Instance.

Definition at line 9090 of file object.h.

9090 {
9091 return Equals(other);
9092 }
virtual bool Equals(const Instance &other) const
Definition: object.h:9094

◆ CanonicalizeHash()

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

Reimplemented from dart::Instance.

Definition at line 9093 of file object.h.

9093{ return Hash(); }
uword Hash() const
Definition: object.h:13377

◆ CanonicalizeLocked()

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

Reimplemented from dart::Instance.

Definition at line 9138 of file object.h.

9138 {
9139 return Canonicalize(thread);
9140 }
virtual AbstractTypePtr Canonicalize(Thread *thread) const
Definition: object.cc:21240

◆ ClassName()

StringPtr dart::AbstractType::ClassName ( ) const

Definition at line 21362 of file object.cc.

21362 {
21363 ASSERT(!IsFunctionType() && !IsRecordType());
21364 return Class::Handle(type_class()).Name();
21365}
virtual ClassPtr type_class() const
Definition: object.cc:21042
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 21748 of file object.cc.

21748 {
21749 // AbstractType is an abstract class.
21750 UNREACHABLE();
21751 return 0;
21752}

◆ EnumerateURIs()

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

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

Definition at line 21249 of file object.cc.

21249 {
21250 // All subclasses should implement this appropriately, so the only value that
21251 // should reach this implementation should be the null value.
21252 ASSERT(IsNull());
21253 // AbstractType is an abstract class.
21254 UNREACHABLE();
21255}

◆ Equals()

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

Definition at line 9094 of file object.h.

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

◆ flags_offset()

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

Definition at line 9046 of file object.h.

9046 {
9047 return OFFSET_OF(UntaggedAbstractType, flags_);
9048 }
#define OFFSET_OF(type, field)
Definition: globals.h:138

◆ Hash()

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

Definition at line 13377 of file object.h.

13377 {
13379 intptr_t result = Smi::Value(untag()->hash());
13380 if (result != 0) {
13381 return result;
13382 }
13383 return ComputeHash();
13384}
static uint32_t hash(const SkShaderBase::GradientInfo &v)
bool IsFinalized() const
Definition: object.h:9053
virtual uword ComputeHash() const
Definition: object.cc:21748
intptr_t Value() const
Definition: object.h:9990
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)
Definition: raw_object.cc:558

◆ hash_offset()

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

Definition at line 9049 of file object.h.

9049 {
9050 return OFFSET_OF(UntaggedAbstractType, hash_);
9051 }

◆ HasTypeClass()

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

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

Definition at line 9083 of file object.h.

9083{ return type_class_id() != kIllegalCid; }
virtual classid_t type_class_id() const
Definition: object.cc:21033
@ 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 21787 of file object.cc.

21787 {
21788 if (stub.IsNull()) {
21789 // This only happens during bootstrapping when creating Type objects before
21790 // we have the instructions.
21792 StoreNonPointer(&untag()->type_test_stub_entry_point_, 0);
21793 untag()->set_type_test_stub(stub.ptr());
21794 return;
21795 }
21796
21797 StoreNonPointer(&untag()->type_test_stub_entry_point_, stub.EntryPoint());
21798 untag()->set_type_test_stub(stub.ptr());
21799}
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 9329 of file object.h.

9329 {
9330 return RoundedAllocationSize(sizeof(UntaggedAbstractType));
9331 }
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 4287 of file object.cc.

4291 {
4292 if (!subtype->IsInstantiated()) {
4293 *subtype = subtype->InstantiateFrom(
4294 instantiator_type_args, function_type_args, kAllFree, Heap::kOld);
4295 }
4296 if (!supertype->IsInstantiated()) {
4297 *supertype = supertype->InstantiateFrom(
4298 instantiator_type_args, function_type_args, kAllFree, Heap::kOld);
4299 }
4300 return subtype->IsSubtypeOf(*supertype, Heap::kOld);
4301}
@ kOld
Definition: heap.h:39
@ kAllFree
Definition: object.h:2940

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

21222 {
21223 // All subclasses should implement this appropriately, so the only value that
21224 // should reach this implementation should be the null value.
21225 ASSERT(IsNull());
21226 // AbstractType is an abstract class.
21227 UNREACHABLE();
21228 return nullptr;
21229}

◆ IsBoolType()

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

Definition at line 9222 of file object.h.

9222{ return type_class_id() == kBoolCid; }

◆ IsCatchAllType()

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

Definition at line 9276 of file object.h.

9276{ return IsDynamicType() || IsObjectType(); }
bool IsObjectType() const
Definition: object.h:9201
bool IsDynamicType() const
Definition: object.h:9186

◆ IsDartClosureType()

bool dart::AbstractType::IsDartClosureType ( ) const

Definition at line 21456 of file object.cc.

21456 {
21457 return (type_class_id() == kClosureCid);
21458}

◆ IsDartFunctionType()

bool dart::AbstractType::IsDartFunctionType ( ) const

Definition at line 21451 of file object.cc.

21451 {
21452 return HasTypeClass() &&
21453 (type_class() == Type::Handle(Type::DartFunctionType()).type_class());
21454}
virtual bool HasTypeClass() const
Definition: object.h:9083
static TypePtr DartFunctionType()

◆ IsDartRecordType()

bool dart::AbstractType::IsDartRecordType ( ) const

Definition at line 21460 of file object.cc.

21460 {
21461 if (!HasTypeClass()) return false;
21462 const auto cid = type_class_id();
21463 return ((cid == kRecordCid) ||
21464 (cid == Class::Handle(
21465 IsolateGroup::Current()->object_store()->record_class())
21466 .id()));
21467}
static IsolateGroup * Current()
Definition: isolate.h:539
const intptr_t cid

◆ IsDoubleType()

bool dart::AbstractType::IsDoubleType ( ) const

Definition at line 21423 of file object.cc.

21423 {
21424 return HasTypeClass() &&
21425 (type_class() == Type::Handle(Type::Double()).type_class());
21426}
static TypePtr Double()

◆ IsDynamicType()

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

Definition at line 9186 of file object.h.

9186{ 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 21184 of file object.cc.

21187 {
21188 // All subclasses should implement this appropriately, so the only value that
21189 // should reach this implementation should be the null value.
21190 ASSERT(IsNull());
21191 // AbstractType is an abstract class.
21192 UNREACHABLE();
21193 return false;
21194}

◆ IsFfiPointerType()

bool dart::AbstractType::IsFfiPointerType ( ) const

Definition at line 21469 of file object.cc.

21469 {
21470 return HasTypeClass() && type_class_id() == kPointerCid;
21471}

◆ IsFinalized()

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

Definition at line 9053 of file object.h.

9053 {
9054 const auto state = type_state();
9057 }
UntaggedAbstractType::TypeState type_state() const
Definition: object.h:9351
AtkStateType state

◆ IsFloat32x4Type()

bool dart::AbstractType::IsFloat32x4Type ( ) const

Definition at line 21428 of file object.cc.

21428 {
21429 // kFloat32x4Cid refers to the private class and cannot be used here.
21430 return HasTypeClass() &&
21431 (type_class() == Type::Handle(Type::Float32x4()).type_class());
21432}
static TypePtr Float32x4()

◆ IsFloat64x2Type()

bool dart::AbstractType::IsFloat64x2Type ( ) const

Definition at line 21434 of file object.cc.

21434 {
21435 // kFloat64x2Cid refers to the private class and cannot be used here.
21436 return HasTypeClass() &&
21437 (type_class() == Type::Handle(Type::Float64x2()).type_class());
21438}
static TypePtr Float64x2()

◆ IsFutureOrType()

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

Definition at line 9267 of file object.h.

9267{ 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 21151 of file object.cc.

21152 {
21153 // All subclasses should implement this appropriately, so the only value that
21154 // should reach this implementation should be the null value.
21155 ASSERT(IsNull());
21156 // AbstractType is an abstract class.
21157 UNREACHABLE();
21158 return false;
21159}

◆ IsInt32x4Type()

bool dart::AbstractType::IsInt32x4Type ( ) const

Definition at line 21440 of file object.cc.

21440 {
21441 // kInt32x4Cid refers to the private class and cannot be used here.
21442 return HasTypeClass() &&
21443 (type_class() == Type::Handle(Type::Int32x4()).type_class());
21444}
static TypePtr Int32x4()

◆ IsIntegerImplementationType()

bool dart::AbstractType::IsIntegerImplementationType ( ) const

Definition at line 21416 of file object.cc.

21416 {
21417 return HasTypeClass() &&
21419 ->object_store()
21420 ->integer_implementation_class());
21421}
ObjectStore * object_store() const
Definition: isolate.h:510

◆ IsIntType()

bool dart::AbstractType::IsIntType ( ) const

Definition at line 21411 of file object.cc.

21411 {
21412 return HasTypeClass() &&
21413 (type_class() == Type::Handle(Type::IntType()).type_class());
21414}
static TypePtr IntType()

◆ IsMintType()

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

Definition at line 9249 of file object.h.

9249{ return type_class_id() == kMintCid; }

◆ IsNeverType()

bool dart::AbstractType::IsNeverType ( ) const

Definition at line 21371 of file object.cc.

21371 {
21372 return type_class_id() == kNeverCid;
21373}
@ kNeverCid
Definition: class_id.h:255

◆ IsNonNullable()

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

Definition at line 9071 of file object.h.

9071 {
9073 }
Nullability nullability() const
Definition: object.h:9060

◆ IsNullabilityEquivalent()

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

Definition at line 21196 of file object.cc.

21198 {
21199 Nullability this_type_nullability = nullability();
21200 Nullability other_type_nullability = other_type.nullability();
21201 if (kind == TypeEquality::kInSubtypeTest) {
21202 if (this_type_nullability == Nullability::kNullable &&
21203 other_type_nullability == Nullability::kNonNullable) {
21204 return false;
21205 }
21206 } else {
21208 (kind == TypeEquality::kCanonical));
21209 if (this_type_nullability != other_type_nullability) {
21210 return false;
21211 }
21212 }
21213 return true;
21214}
Nullability
Definition: object.h:1112

◆ IsNullable()

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

Definition at line 9066 of file object.h.

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

◆ IsNullableObjectType()

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

Definition at line 9204 of file object.h.

9204 {
9206 }

◆ IsNullType()

bool dart::AbstractType::IsNullType ( ) const

Definition at line 21367 of file object.cc.

21367 {
21368 return type_class_id() == kNullCid;
21369}
@ kNullCid
Definition: class_id.h:252

◆ IsNumberType()

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

Definition at line 9243 of file object.h.

9243{ return type_class_id() == kNumberCid; }

◆ IsObjectType()

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

Definition at line 9201 of file object.h.

9201{ return type_class_id() == kInstanceCid; }

◆ IsSentinelType()

bool dart::AbstractType::IsSentinelType ( ) const

Definition at line 21375 of file object.cc.

21375 {
21376 return type_class_id() == kSentinelCid;
21377}

◆ IsSmiType()

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

Definition at line 9246 of file object.h.

9246{ return type_class_id() == kSmiCid; }

◆ IsStrictlyNonNullable()

bool dart::AbstractType::IsStrictlyNonNullable ( ) const

Definition at line 21060 of file object.cc.

21060 {
21061 // Null can be assigned to legacy and nullable types.
21062 if (!IsNonNullable()) {
21063 return false;
21064 }
21065
21066 Thread* thread = Thread::Current();
21067 Zone* zone = thread->zone();
21068
21069 if (IsTypeParameter()) {
21070 const auto& bound =
21071 AbstractType::Handle(zone, TypeParameter::Cast(*this).bound());
21072 ASSERT(!bound.IsNull());
21073 return bound.IsStrictlyNonNullable();
21074 }
21075 if (IsFutureOrType()) {
21076 return AbstractType::Handle(zone, UnwrapFutureOr()).IsStrictlyNonNullable();
21077 }
21078 return true;
21079}
bool IsNonNullable() const
Definition: object.h:9071
bool IsFutureOrType() const
Definition: object.h:9267
AbstractTypePtr UnwrapFutureOr() const
Definition: object.cc:21526
friend class Thread
Definition: object.h:1025
static Thread * Current()
Definition: thread.h:362

◆ IsStringType()

bool dart::AbstractType::IsStringType ( ) const

Definition at line 21446 of file object.cc.

21446 {
21447 return HasTypeClass() &&
21448 (type_class() == Type::Handle(Type::StringType()).type_class());
21449}
static TypePtr StringType()

◆ IsSubtypeOf()

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

Definition at line 21550 of file object.cc.

21553 {
21554 TRACE_TYPE_CHECKS_VERBOSE(" AbstractType::IsSubtypeOf(%s, %s)\n",
21555 ToCString(), other.ToCString());
21557 ASSERT(other.IsFinalized());
21558 // Reflexivity.
21559 if (ptr() == other.ptr()) {
21560 TRACE_TYPE_CHECKS_VERBOSE(" - result: true (same types)\n");
21561 return true;
21562 }
21563 // Right top type.
21564 if (other.IsTopTypeForSubtyping()) {
21565 TRACE_TYPE_CHECKS_VERBOSE(" - result: true (right is top)\n");
21566 return true;
21567 }
21568 // Left bottom type.
21569 // Any form of Never in weak mode maps to Null and Null is a bottom type in
21570 // weak mode. In strong mode, Never and Never* are bottom types. Therefore,
21571 // Never and Never* are bottom types regardless of weak/strong mode.
21572 // Note that we cannot encounter Never?, as it is normalized to Null.
21573 if (IsNeverType()) {
21574 ASSERT(!IsNullable());
21575 TRACE_TYPE_CHECKS_VERBOSE(" - result: true (left is Never)\n");
21576 return true;
21577 }
21578 // Left top type.
21579 if (IsDynamicType() || IsVoidType()) {
21580 TRACE_TYPE_CHECKS_VERBOSE(" - result: false (left is top)\n");
21581 return false;
21582 }
21583 // Left Null type.
21584 if (IsNullType()) {
21585 const bool result = Instance::NullIsAssignableTo(other);
21586 TRACE_TYPE_CHECKS_VERBOSE(" - result: %s (left is Null)\n",
21587 (result ? "true" : "false"));
21588 return result;
21589 }
21590 Thread* thread = Thread::Current();
21591 Zone* zone = thread->zone();
21592 // Type parameters cannot be handled by Class::IsSubtypeOf().
21593 // When comparing two uninstantiated function types, one returning type
21594 // parameter K, the other returning type parameter V, we cannot assume that
21595 // K is a subtype of V, or vice versa. We only return true if K equals V, as
21596 // defined by TypeParameter::Equals.
21597 // The same rule applies when checking the upper bound of a still
21598 // uninstantiated type at compile time. Returning false will defer the test
21599 // to run time.
21600 // There are however some cases that can be decided at compile time.
21601 // For example, with class A<K, V extends K>, new A<T, T> called from within
21602 // a class B<T> will never require a run time bound check, even if T is
21603 // uninstantiated at compile time.
21604 if (IsTypeParameter()) {
21605 const TypeParameter& type_param = TypeParameter::Cast(*this);
21606 if (other.IsTypeParameter()) {
21607 const TypeParameter& other_type_param = TypeParameter::Cast(other);
21608 if (type_param.IsEquivalent(other_type_param,
21610 function_type_equivalence)) {
21612 " - result: true (equivalent type parameters)\n");
21613 return true;
21614 }
21615 }
21616 const AbstractType& bound = AbstractType::Handle(zone, type_param.bound());
21617 ASSERT(bound.IsFinalized());
21618 if (bound.IsSubtypeOf(other, space, function_type_equivalence)) {
21619 TRACE_TYPE_CHECKS_VERBOSE(" - result: true (bound is a subtype)\n");
21620 return true;
21621 }
21622 // Apply additional subtyping rules if 'other' is 'FutureOr'.
21623 if (IsSubtypeOfFutureOr(zone, other, space, function_type_equivalence)) {
21625 " - result: true (type parameter is a subtype of FutureOr)\n");
21626 return true;
21627 }
21629 " - result: false (left is a type parameter)\n");
21630 return false;
21631 }
21632 if (other.IsTypeParameter()) {
21634 " - result: false (right is a type parameter)\n");
21635 return false;
21636 }
21637 // Function types cannot be handled by Class::IsSubtypeOf().
21638 if (IsFunctionType()) {
21639 // Any type that can be the type of a closure is a subtype of Function or
21640 // non-nullable Object.
21641 if (other.IsObjectType() || other.IsDartFunctionType()) {
21642 const bool result = !IsNullable() || !other.IsNonNullable();
21643 TRACE_TYPE_CHECKS_VERBOSE(" - result: %s (function vs non-function)\n",
21644 (result ? "true" : "false"));
21645 return result;
21646 }
21647 if (other.IsFunctionType()) {
21648 // Check for two function types.
21649 if (IsNullable() && other.IsNonNullable()) {
21651 " - result: false (function nullability)\n");
21652 return false;
21653 }
21654 const bool result = FunctionType::Cast(*this).IsSubtypeOf(
21655 FunctionType::Cast(other), space, function_type_equivalence);
21656 TRACE_TYPE_CHECKS_VERBOSE(" - result: %s (function types)\n",
21657 (result ? "true" : "false"));
21658 return result;
21659 }
21660 // Apply additional subtyping rules if 'other' is 'FutureOr'.
21661 if (IsSubtypeOfFutureOr(zone, other, space, function_type_equivalence)) {
21663 " - result: true (function type is a subtype of FutureOr)\n");
21664 return true;
21665 }
21666 // All possible supertypes for FunctionType have been checked.
21667 TRACE_TYPE_CHECKS_VERBOSE(" - result: false (function type)\n");
21668 return false;
21669 } else if (other.IsFunctionType()) {
21670 // FunctionTypes can only be subtyped by other FunctionTypes, so don't
21671 // fall through to class-based type tests.
21673 " - result: false (right is a function type)\n");
21674 return false;
21675 }
21676 // Record types cannot be handled by Class::IsSubtypeOf().
21677 if (IsRecordType()) {
21678 if (other.IsObjectType() || other.IsDartRecordType()) {
21679 const bool result = !IsNullable() || !other.IsNonNullable();
21680 TRACE_TYPE_CHECKS_VERBOSE(" - result: %s (record vs non-record)\n",
21681 (result ? "true" : "false"));
21682 return result;
21683 }
21684 if (other.IsRecordType()) {
21685 // Check for two record types.
21686 if (IsNullable() && other.IsNonNullable()) {
21687 TRACE_TYPE_CHECKS_VERBOSE(" - result: false (record nullability)\n");
21688 return false;
21689 }
21690 const bool result = RecordType::Cast(*this).IsSubtypeOf(
21691 RecordType::Cast(other), space, function_type_equivalence);
21692 TRACE_TYPE_CHECKS_VERBOSE(" - result: %s (record types)\n",
21693 (result ? "true" : "false"));
21694 return result;
21695 }
21696 // Apply additional subtyping rules if 'other' is 'FutureOr'.
21697 if (IsSubtypeOfFutureOr(zone, other, space, function_type_equivalence)) {
21699 " - result: true (record type is a subtype of FutureOr)\n");
21700 return true;
21701 }
21702 // All possible supertypes for record type have been checked.
21703 TRACE_TYPE_CHECKS_VERBOSE(" - result: false (record type)\n");
21704 return false;
21705 } else if (other.IsRecordType()) {
21706 // RecordTypes can only be subtyped by other RecordTypes, so don't
21707 // fall through to class-based type tests.
21708 TRACE_TYPE_CHECKS_VERBOSE(" - result: false (right is a record type)\n");
21709 return false;
21710 }
21711 ASSERT(IsType());
21712 const Class& type_cls = Class::Handle(zone, type_class());
21713 const bool result = Class::IsSubtypeOf(
21714 type_cls,
21715 TypeArguments::Handle(zone, Type::Cast(*this).GetInstanceTypeArguments(
21716 thread, /*canonicalize=*/false)),
21717 nullability(), other, space, function_type_equivalence);
21718 TRACE_TYPE_CHECKS_VERBOSE(" - result: %s (class type check)\n",
21719 (result ? "true" : "false"));
21720 return result;
21721}
bool IsVoidType() const
Definition: object.h:9189
bool IsNullable() const
Definition: object.h:9066
bool IsNullType() const
Definition: object.cc:21367
friend class Class
Definition: object.h:9360
bool IsNeverType() const
Definition: object.cc:21371
static bool IsSubtypeOf(const Class &cls, const TypeArguments &type_arguments, Nullability nullability, const AbstractType &other, Heap::Space space, FunctionTypeMapping *function_type_equivalence=nullptr)
Definition: object.cc:5920
static bool NullIsAssignableTo(const AbstractType &other)
Definition: object.cc:20674
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 21379 of file object.cc.

21379 {
21380 const classid_t cid = type_class_id();
21381 if (cid == kDynamicCid || cid == kVoidCid) {
21382 return true;
21383 }
21384 if (cid == kInstanceCid) { // Object type.
21385 return IsNullable();
21386 }
21387 if (cid == kFutureOrCid) {
21388 // FutureOr<T> where T is a top type behaves as a top type.
21389 return AbstractType::Handle(UnwrapFutureOr()).IsTopTypeForInstanceOf();
21390 }
21391 return false;
21392}
int32_t classid_t
Definition: globals.h:524

◆ IsTopTypeForSubtyping()

bool dart::AbstractType::IsTopTypeForSubtyping ( ) const

Definition at line 21396 of file object.cc.

21396 {
21397 const classid_t cid = type_class_id();
21398 if (cid == kDynamicCid || cid == kVoidCid) {
21399 return true;
21400 }
21401 if (cid == kInstanceCid) { // Object type.
21402 return !IsNonNullable();
21403 }
21404 if (cid == kFutureOrCid) {
21405 // FutureOr<T> where T is a top type behaves as a top type.
21406 return AbstractType::Handle(UnwrapFutureOr()).IsTopTypeForSubtyping();
21407 }
21408 return false;
21409}

◆ IsTypeClassAllowedBySpawnUri()

bool dart::AbstractType::IsTypeClassAllowedBySpawnUri ( ) const

Definition at line 21473 of file object.cc.

21473 {
21474 if (!HasTypeClass()) return false;
21475
21476 intptr_t cid = type_class_id();
21477
21478 if (cid == kBoolCid) return true;
21479 if (cid == kDynamicCid) return true;
21480 if (cid == kInstanceCid) return true; // Object.
21481 if (cid == kNeverCid) return true;
21482 if (cid == kNullCid) return true;
21483 if (cid == kVoidCid) return true;
21484
21485 // These are not constant CID checks because kDoubleCid refers to _Double
21486 // not double, etc.
21487 ObjectStore* object_store = IsolateGroup::Current()->object_store();
21488 Type& candidate_type = Type::Handle();
21489 candidate_type = object_store->int_type();
21490 if (cid == candidate_type.type_class_id()) return true;
21491 candidate_type = object_store->double_type();
21492 if (cid == candidate_type.type_class_id()) return true;
21493 candidate_type = object_store->number_type();
21494 if (cid == candidate_type.type_class_id()) return true;
21495 candidate_type = object_store->string_type();
21496 if (cid == candidate_type.type_class_id()) return true;
21497
21498 Class& candidate_cls = Class::Handle();
21499 candidate_cls = object_store->list_class();
21500 if (cid == candidate_cls.id()) return true;
21501 candidate_cls = object_store->map_class();
21502 if (cid == candidate_cls.id()) return true;
21503 candidate_cls = object_store->set_class();
21504 if (cid == candidate_cls.id()) return true;
21505 candidate_cls = object_store->capability_class();
21506 if (cid == candidate_cls.id()) return true;
21507 candidate_cls = object_store->send_port_class();
21508 if (cid == candidate_cls.id()) return true;
21509 candidate_cls = object_store->transferable_class();
21510 if (cid == candidate_cls.id()) return true;
21511
21512 const auto& typed_data_lib =
21513 Library::Handle(object_store->typed_data_library());
21514
21515#define IS_CHECK(name) \
21516 candidate_cls = typed_data_lib.LookupClass(Symbols::name##List()); \
21517 if (cid == candidate_cls.id()) { \
21518 return true; \
21519 }
21521#undef IS_CHECK
21522
21523 return false;
21524}
#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 9189 of file object.h.

9189{ return type_class_id() == kVoidCid; }

◆ Name()

StringPtr dart::AbstractType::Name ( ) const

Definition at line 21320 of file object.cc.

21320 {
21322}
const char * NameCString() const
Definition: object.cc:21324
static StringPtr New(Thread *thread, const char *cstr)
Definition: symbols.h:723

◆ NameCString()

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

Definition at line 21324 of file object.cc.

21324 {
21325 Thread* thread = Thread::Current();
21326 ZoneTextBuffer printer(thread->zone());
21327 PrintName(kInternalName, &printer);
21328 return printer.buffer();
21329}
virtual void PrintName(NameVisibility visibility, BaseTextBuffer *printer) const
Definition: object.cc:21353
@ kInternalName
Definition: object.h:622

◆ NextFieldOffset()

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

Definition at line 9333 of file object.h.

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

◆ NormalizeFutureOrType()

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

Definition at line 21115 of file object.cc.

21115 {
21116 if (IsFutureOrType()) {
21117 Zone* zone = Thread::Current()->zone();
21118 const AbstractType& unwrapped_type =
21120 const classid_t cid = unwrapped_type.type_class_id();
21121 if (cid == kDynamicCid || cid == kVoidCid) {
21122 return unwrapped_type.ptr();
21123 }
21124 if (cid == kInstanceCid) {
21125 if (IsNonNullable()) {
21126 return unwrapped_type.ptr();
21127 }
21128 ASSERT(IsNullable());
21129 return Type::Cast(unwrapped_type)
21130 .ToNullability(Nullability::kNullable, space);
21131 }
21132 if (cid == kNeverCid && unwrapped_type.IsNonNullable()) {
21133 ObjectStore* object_store = IsolateGroup::Current()->object_store();
21134 const Type& future_never_type =
21135 Type::Handle(zone, object_store->non_nullable_future_never_type());
21136 ASSERT(!future_never_type.IsNull());
21137 return future_never_type.ToNullability(nullability(), space);
21138 }
21139 if (cid == kNullCid) {
21140 ObjectStore* object_store = IsolateGroup::Current()->object_store();
21141 ASSERT(object_store->nullable_future_null_type() != Type::null());
21142 return object_store->nullable_future_null_type();
21143 }
21144 if (IsNullable() && unwrapped_type.IsNullable()) {
21145 return Type::Cast(*this).ToNullability(Nullability::kNonNullable, space);
21146 }
21147 }
21148 return ptr();
21149}
static ObjectPtr null()
Definition: object.h:433
Zone * zone() const
Definition: thread_state.h:37

◆ nullability()

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

Definition at line 9060 of file object.h.

9060 {
9061 return static_cast<Nullability>(
9063 }
static constexpr T decode(S value)
Definition: bitfield.h:171
FlutterSemanticsFlag flags

◆ NullabilitySuffix()

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

Definition at line 21303 of file object.cc.

21304 {
21305 if (IsDynamicType() || IsVoidType() || IsNullType()) {
21306 // Hide nullable suffix.
21307 return "";
21308 }
21309 // Keep in sync with Nullability enum in runtime/vm/object.h.
21310 switch (nullability()) {
21312 return "?";
21314 return "";
21315 default:
21316 UNREACHABLE();
21317 }
21318}

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

21354 {
21355 // All subclasses should implement this appropriately, so the only value that
21356 // should reach this implementation should be the null value.
21357 ASSERT(IsNull());
21358 // AbstractType is an abstract class.
21359 UNREACHABLE();
21360}

◆ PrintURIs()

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

Definition at line 21283 of file object.cc.

21283 {
21284 ASSERT(uris != nullptr);
21285 Thread* thread = Thread::Current();
21286 Zone* zone = thread->zone();
21287 const intptr_t len = uris->length();
21288 ASSERT((len % 3) == 0);
21289 GrowableHandlePtrArray<const String> pieces(zone, 5 * (len / 3));
21290 for (intptr_t i = 0; i < len; i += 3) {
21291 // Only print URIs that have been marked.
21292 if (uris->At(i + 2).ptr() == Symbols::print().ptr()) {
21293 pieces.Add(Symbols::TwoSpaces());
21294 pieces.Add(uris->At(i));
21295 pieces.Add(Symbols::SpaceIsFromSpace());
21296 pieces.Add(uris->At(i + 1));
21297 pieces.Add(Symbols::NewLine());
21298 }
21299 }
21300 return Symbols::FromConcatAll(thread, pieces);
21301}
static const String & NewLine()
Definition: symbols.h:651
static StringPtr FromConcatAll(Thread *thread, const GrowableHandlePtrArray< const String > &strs)
Definition: symbols.cc:262

◆ ScrubbedName()

StringPtr dart::AbstractType::ScrubbedName ( ) const

Definition at line 21342 of file object.cc.

21342 {
21344}
const char * ScrubbedNameCString() const
Definition: object.cc:21346

◆ ScrubbedNameCString()

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

Definition at line 21346 of file object.cc.

21346 {
21347 Thread* thread = Thread::Current();
21348 ZoneTextBuffer printer(thread->zone());
21349 PrintName(kScrubbedName, &printer);
21350 return printer.buffer();
21351}
@ kScrubbedName
Definition: object.h:633

◆ set_flags()

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

Definition at line 21168 of file object.cc.

21168 {
21169 untag()->set_flags(value);
21170}
uint8_t value

◆ set_nullability()

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

Definition at line 21178 of file object.cc.

21178 {
21179 ASSERT(!IsCanonical());
21181 static_cast<uint8_t>(value), untag()->flags()));
21182}
void set_flags(uint32_t value) const
Definition: object.cc:21168
static constexpr S update(T value, S original)
Definition: bitfield.h:188
bool IsCanonical() const
Definition: object.h:335

◆ set_type_state()

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

Definition at line 21172 of file object.cc.

◆ SetHash()

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

Definition at line 13386 of file object.h.

13386 {
13387 // This is only safe because we create a new Smi, which does not cause
13388 // heap allocation.
13389 untag()->set_hash(Smi::New(value));
13390}
static SmiPtr New(intptr_t value)
Definition: object.h:10006

◆ SetInstantiatedNullability()

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

Definition at line 21081 of file object.cc.

21083 {
21084 Nullability result_nullability;
21085 const Nullability arg_nullability = nullability();
21086 const Nullability var_nullability = type_param.nullability();
21087 // Adjust nullability of result 'arg' instantiated from 'var'.
21088 // arg/var ! ?
21089 // ! ! ?
21090 // ? ? ?
21091 if (var_nullability == Nullability::kNullable) {
21092 result_nullability = Nullability::kNullable;
21093 } else {
21094 // Keep arg nullability.
21095 return ptr();
21096 }
21097 if (arg_nullability == result_nullability) {
21098 return ptr();
21099 }
21100 if (IsType()) {
21101 return Type::Cast(*this).ToNullability(result_nullability, space);
21102 }
21103 if (IsFunctionType()) {
21104 return FunctionType::Cast(*this).ToNullability(result_nullability, space);
21105 }
21106 if (IsRecordType()) {
21107 return RecordType::Cast(*this).ToNullability(result_nullability, space);
21108 }
21109 if (IsTypeParameter()) {
21110 return TypeParameter::Cast(*this).ToNullability(result_nullability, space);
21111 }
21112 UNREACHABLE();
21113}

◆ SetIsFinalized()

void dart::AbstractType::SetIsFinalized ( ) const

Definition at line 21161 of file object.cc.

21161 {
21162 ASSERT(!IsFinalized());
21166}
virtual bool IsInstantiated(Genericity genericity=kAny, intptr_t num_free_fun_type_params=kAllFree) const
Definition: object.cc:21151
void set_type_state(UntaggedAbstractType::TypeState value) const
Definition: object.cc:21172

◆ SetTypeTestingStub()

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

Definition at line 21761 of file object.cc.

21761 {
21762 if (stub.IsNull()) {
21764 return;
21765 }
21766
21767 auto& old = Code::Handle(Thread::Current()->zone());
21768 while (true) {
21769 // We load the old TTS and it's entrypoint.
21770 old = untag()->type_test_stub<std::memory_order_acquire>();
21771 uword old_entry_point = old.IsNull() ? 0 : old.EntryPoint();
21772
21773 // If we can successfully update the entrypoint of the TTS, we will
21774 // unconditionally also set the [Code] of the TTS.
21775 //
21776 // Any competing writer would do the same, lose the compare-exchange, loop
21777 // around and continue loading the old [Code] TTS and continue to lose the
21778 // race until we have finally also updated the [Code] TTS.
21779 if (untag()->type_test_stub_entry_point_.compare_exchange_strong(
21780 old_entry_point, stub.EntryPoint())) {
21781 untag()->set_type_test_stub<std::memory_order_release>(stub.ptr());
21782 return;
21783 }
21784 }
21785}
void InitializeTypeTestingStubNonAtomic(const Code &stub) const
Definition: object.cc:21787
uintptr_t uword
Definition: globals.h:501

◆ type_class()

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

Reimplemented in dart::Type.

Definition at line 21042 of file object.cc.

21042 {
21043 // All subclasses should implement this appropriately, so the only value that
21044 // should reach this implementation should be the null value.
21045 ASSERT(IsNull());
21046 // AbstractType is an abstract class.
21047 UNREACHABLE();
21048 return Class::null();
21049}

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

21033 {
21034 // All subclasses should implement this appropriately, so the only value that
21035 // should reach this implementation should be the null value.
21036 ASSERT(IsNull());
21037 // AbstractType is an abstract class.
21038 UNREACHABLE();
21039 return kIllegalCid;
21040}

◆ type_state()

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

Definition at line 9351 of file object.h.

◆ type_test_stub()

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

Definition at line 9304 of file object.h.

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

◆ type_test_stub_entry_point()

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

Definition at line 9301 of file object.h.

9301 {
9302 return untag()->type_test_stub_entry_point_;
9303 }

◆ type_test_stub_entry_point_offset()

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

Definition at line 9297 of file object.h.

9297 {
9298 return OFFSET_OF(UntaggedAbstractType, type_test_stub_entry_point_);
9299 }

◆ UnwrapFutureOr()

AbstractTypePtr dart::AbstractType::UnwrapFutureOr ( ) const

Definition at line 21526 of file object.cc.

21526 {
21527 if (!IsFutureOrType()) {
21528 return ptr();
21529 }
21530 if (arguments() == TypeArguments::null()) {
21531 return Type::dynamic_type().ptr();
21532 }
21533 Thread* thread = Thread::Current();
21535 TypeArguments& type_args = thread->TypeArgumentsHandle();
21536 type_args = arguments();
21538 AbstractType& type_arg = thread->AbstractTypeHandle();
21539 type_arg = type_args.TypeAt(0);
21540 while (type_arg.IsFutureOrType()) {
21541 if (type_arg.arguments() == TypeArguments::null()) {
21542 return Type::dynamic_type().ptr();
21543 }
21544 type_args = type_arg.arguments();
21545 type_arg = type_args.TypeAt(0);
21546 }
21547 return type_arg.ptr();
21548}
friend class TypeArguments
Definition: object.h:9363
virtual TypeArgumentsPtr arguments() const
Definition: object.cc:21051
#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 21231 of file object.cc.

21235 {
21236 UNREACHABLE();
21237 return nullptr;
21238}

◆ UpdateTypeTestingStubEntryPoint()

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

Definition at line 9322 of file object.h.

9322 {
9323 StoreNonPointer(&untag()->type_test_stub_entry_point_,
9325 }
CodePtr type_test_stub() const
Definition: object.h:9304
static uword EntryPointOf(const CodePtr code)
Definition: object.h:6865

◆ UserVisibleName()

StringPtr dart::AbstractType::UserVisibleName ( ) const

Definition at line 21331 of file object.cc.

21331 {
21333}
const char * UserVisibleNameCString() const
Definition: object.cc:21335

◆ UserVisibleNameCString()

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

Definition at line 21335 of file object.cc.

21335 {
21336 Thread* thread = Thread::Current();
21337 ZoneTextBuffer printer(thread->zone());
21338 PrintName(kUserVisibleName, &printer);
21339 return printer.buffer();
21340}
@ kUserVisibleName
Definition: object.h:645

Friends And Related Function Documentation

◆ Class

friend class Class
friend

Definition at line 9360 of file object.h.

◆ ClearTypeHashVisitor

friend class ClearTypeHashVisitor
friend

Definition at line 9361 of file object.h.

◆ Function

friend class Function
friend

Definition at line 9362 of file object.h.

◆ TypeArguments

friend class TypeArguments
friend

Definition at line 9363 of file object.h.


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