5#ifndef RUNTIME_VM_OBJECT_H_
6#define RUNTIME_VM_OBJECT_H_
8#if defined(SHOULD_NOT_INCLUDE_RUNTIME)
9#error "Should not include runtime"
54#define DEFINE_FORWARD_DECLARATION(clazz) class clazz;
56#undef DEFINE_FORWARD_DECLARATION
58class ArgumentsDescriptor;
62class DisassemblyFormatter;
63class FinalizablePersistentHandle;
64class FlowGraphCompiler;
67class CallSiteResetter;
69class IsolateGroupReloadContext;
70class ObjectGraphCopier;
71class FunctionTypeMapping;
74#define REUSABLE_FORWARD_DECLARATION(name) class Reusable##name##HandleScope;
76#undef REUSABLE_FORWARD_DECLARATION
82#define CHECK_HANDLE() CheckHandle();
90#define ALLSTATIC_CONTAINS_COMPRESSED_IMPLEMENTATION(object, handle) \
92 using UntaggedObjectType = dart::Untagged##object; \
93 using ObjectPtrType = dart::object##Ptr; \
94 static_assert(std::is_base_of<dart::handle##Ptr, ObjectPtrType>::value, \
95 #object "Ptr must be a subtype of " #handle "Ptr"); \
96 static_assert(dart::handle::ContainsCompressedPointers() == \
97 UntaggedObjectType::kContainsCompressedPointers, \
98 "Pointer compression in Untagged" #object \
99 " must match pointer compression in Untagged" #handle); \
100 static constexpr bool ContainsCompressedPointers() { \
101 return UntaggedObjectType::kContainsCompressedPointers; \
106#define BASE_OBJECT_IMPLEMENTATION(object, super) \
108 using UntaggedObjectType = dart::Untagged##object; \
109 using ObjectPtrType = dart::object##Ptr; \
110 static_assert(!dart::super::ContainsCompressedPointers() || \
111 UntaggedObjectType::kContainsCompressedPointers, \
113 " must have compressed pointers, as supertype Untagged" #super \
114 " has compressed pointers"); \
115 static constexpr bool ContainsCompressedPointers() { \
116 return UntaggedObjectType::kContainsCompressedPointers; \
118 object##Ptr ptr() const { \
119 return static_cast<object##Ptr>(ptr_); \
121 bool Is##object() const { \
124 DART_NOINLINE static object& Handle() { \
125 return static_cast<object&>( \
126 HandleImpl(Thread::Current()->zone(), object::null(), kClassId)); \
128 DART_NOINLINE static object& Handle(Zone* zone) { \
129 return static_cast<object&>(HandleImpl(zone, object::null(), kClassId)); \
131 DART_NOINLINE static object& Handle(object##Ptr ptr) { \
132 return static_cast<object&>( \
133 HandleImpl(Thread::Current()->zone(), ptr, kClassId)); \
135 DART_NOINLINE static object& Handle(Zone* zone, object##Ptr ptr) { \
136 return static_cast<object&>(HandleImpl(zone, ptr, kClassId)); \
138 DART_NOINLINE static object& ZoneHandle() { \
139 return static_cast<object&>( \
140 ZoneHandleImpl(Thread::Current()->zone(), object::null(), kClassId)); \
142 DART_NOINLINE static object& ZoneHandle(Zone* zone) { \
143 return static_cast<object&>( \
144 ZoneHandleImpl(zone, object::null(), kClassId)); \
146 DART_NOINLINE static object& ZoneHandle(object##Ptr ptr) { \
147 return static_cast<object&>( \
148 ZoneHandleImpl(Thread::Current()->zone(), ptr, kClassId)); \
150 DART_NOINLINE static object& ZoneHandle(Zone* zone, object##Ptr ptr) { \
151 return static_cast<object&>(ZoneHandleImpl(zone, ptr, kClassId)); \
153 static object* ReadOnlyHandle() { \
154 return static_cast<object*>(ReadOnlyHandleImpl(kClassId)); \
156 DART_NOINLINE static object& CheckedHandle(Zone* zone, ObjectPtr ptr) { \
157 object* obj = reinterpret_cast<object*>(VMHandles::AllocateHandle(zone)); \
158 initializeHandle(obj, ptr); \
159 if (!obj->Is##object()) { \
160 FATAL("Handle check failed: saw %s expected %s", obj->ToCString(), \
165 DART_NOINLINE static object& CheckedZoneHandle(Zone* zone, ObjectPtr ptr) { \
167 reinterpret_cast<object*>(VMHandles::AllocateZoneHandle(zone)); \
168 initializeHandle(obj, ptr); \
169 if (!obj->Is##object()) { \
170 FATAL("Handle check failed: saw %s expected %s", obj->ToCString(), \
175 DART_NOINLINE static object& CheckedZoneHandle(ObjectPtr ptr) { \
176 return CheckedZoneHandle(Thread::Current()->zone(), ptr); \
181 static const object& Cast(const Object& obj) { \
182 ASSERT(obj.Is##object()); \
183 return reinterpret_cast<const object&>(obj); \
185 static object##Ptr RawCast(ObjectPtr raw) { \
186 ASSERT(Is##object##NoHandle(raw)); \
187 return static_cast<object##Ptr>(raw); \
189 static object##Ptr null() { \
190 return static_cast<object##Ptr>(Object::null()); \
192 virtual const char* ToCString() const; \
193 static const ClassId kClassId = k##object##Cid; \
197 static void initializeHandle(object* obj, ObjectPtr ptr) { \
198 obj->setPtr(ptr, kClassId); \
202 void operator delete(void* pointer) { \
207 void* operator new(size_t size); \
208 object(const object& value) = delete; \
209 void operator=(super##Ptr value) = delete; \
210 void operator=(const object& value) = delete; \
211 void operator=(const super& value) = delete;
221#define OBJECT_SERVICE_SUPPORT(object) \
226 virtual void PrintJSONImpl(JSONStream* stream, bool ref) const; \
229 virtual void PrintImplementationFieldsImpl(const JSONArray& jsarr_fields) \
231 virtual const char* JSONType() const { \
235#define OBJECT_SERVICE_SUPPORT(object) protected:
238#define SNAPSHOT_SUPPORT(object) \
239 friend class object##MessageSerializationCluster; \
240 friend class object##MessageDeserializationCluster;
242#define OBJECT_IMPLEMENTATION(object, super) \
244 DART_NOINLINE void operator=(object##Ptr value) { \
245 initializeHandle(this, value); \
247 DART_NOINLINE void operator^=(ObjectPtr value) { \
248 initializeHandle(this, value); \
249 ASSERT(IsNull() || Is##object()); \
253 object() : super() {} \
254 BASE_OBJECT_IMPLEMENTATION(object, super) \
255 OBJECT_SERVICE_SUPPORT(object) \
260#define HEAP_OBJECT_IMPLEMENTATION(object, super) \
261 OBJECT_IMPLEMENTATION(object, super); \
262 Untagged##object* untag() const { \
263 ASSERT(ptr() != null()); \
264 return const_cast<Untagged##object*>(ptr()->untag()); \
266 SNAPSHOT_SUPPORT(object) \
267 friend class StackFrame; \
268 friend class Thread; \
269 friend void DFLRT_ExitSafepoint(NativeArguments __unusable_);
272#define FINAL_HEAP_OBJECT_IMPLEMENTATION_HELPER(object, rettype, super) \
274 void operator=(object##Ptr value) { \
278 void operator^=(ObjectPtr value) { \
284 object() : super() {} \
285 BASE_OBJECT_IMPLEMENTATION(object, super) \
286 OBJECT_SERVICE_SUPPORT(object) \
287 Untagged##object* untag() const { \
288 ASSERT(ptr() != null()); \
289 return const_cast<Untagged##object*>(ptr()->untag()); \
291 static intptr_t NextFieldOffset() { \
294 SNAPSHOT_SUPPORT(rettype) \
295 friend class Object; \
296 friend class StackFrame; \
297 friend class Thread; \
298 friend void DFLRT_ExitSafepoint(NativeArguments __unusable_);
300#define FINAL_HEAP_OBJECT_IMPLEMENTATION(object, super) \
301 FINAL_HEAP_OBJECT_IMPLEMENTATION_HELPER(object, object, super)
303#define MINT_OBJECT_IMPLEMENTATION(object, rettype, super) \
304 FINAL_HEAP_OBJECT_IMPLEMENTATION_HELPER(object, rettype, super)
309#if defined(DART_PRECOMPILED_RUNTIME)
342 return !
ptr()->IsHeapObject() ?
static_cast<intptr_t
>(kSmiCid)
345 inline ClassPtr
clazz()
const;
349#define DEFINE_CLASS_TESTER(clazz) \
350 virtual bool Is##clazz() const { return false; } \
351 static bool Is##clazz##NoHandle(ObjectPtr ptr) { \
355 char buf[sizeof(Object)]; \
356 Object* obj = reinterpret_cast<Object*>(&buf); \
357 initializeHandle(obj, ptr); \
358 return obj->IsNull() || obj->Is##clazz(); \
361#undef DEFINE_CLASS_TESTER
390 bool IsNew()
const {
return ptr()->IsNewObject(); }
391 bool IsOld()
const {
return ptr()->IsOldObject(); }
402 bool IsZoneHandle()
const;
403 bool IsReadOnlyHandle()
const;
404 bool IsNotTemporaryScopedHandle()
const;
435#if defined(HASH_IN_OBJECT_HEADER)
436 static uint32_t GetCachedHash(
const ObjectPtr obj) {
437 return obj->
untag()->GetHeaderHash();
440 static uint32_t SetCachedHashIfNotSet(ObjectPtr obj, uint32_t
hash) {
441 return obj->untag()->SetHeaderHashIfNotSet(
hash);
457#define SHARED_READONLY_HANDLES_LIST(V) \
458 V(Object, null_object) \
459 V(Class, null_class) \
460 V(Array, null_array) \
461 V(String, null_string) \
462 V(Instance, null_instance) \
463 V(Function, null_function) \
464 V(FunctionType, null_function_type) \
465 V(RecordType, null_record_type) \
466 V(TypeArguments, null_type_arguments) \
467 V(CompressedStackMaps, null_compressed_stackmaps) \
468 V(Closure, null_closure) \
469 V(TypeArguments, empty_type_arguments) \
470 V(Array, empty_array) \
471 V(Array, empty_instantiations_cache_array) \
472 V(Array, empty_subtype_test_cache_array) \
473 V(ContextScope, empty_context_scope) \
474 V(ObjectPool, empty_object_pool) \
475 V(CompressedStackMaps, empty_compressed_stackmaps) \
476 V(PcDescriptors, empty_descriptors) \
477 V(LocalVarDescriptors, empty_var_descriptors) \
478 V(ExceptionHandlers, empty_exception_handlers) \
479 V(ExceptionHandlers, empty_async_exception_handlers) \
480 V(Array, synthetic_getter_parameter_types) \
481 V(Array, synthetic_getter_parameter_names) \
482 V(Sentinel, sentinel) \
483 V(Sentinel, transition_sentinel) \
484 V(Sentinel, unknown_constant) \
485 V(Sentinel, non_constant) \
486 V(Sentinel, optimized_out) \
488 V(Bool, bool_false) \
489 V(Smi, smi_illegal_cid) \
491 V(ApiError, no_callbacks_error) \
492 V(UnwindError, unwind_in_progress_error) \
493 V(LanguageError, snapshot_writer_error) \
494 V(LanguageError, branch_offset_error) \
495 V(LanguageError, speculative_inlining_error) \
496 V(LanguageError, background_compilation_error) \
497 V(LanguageError, out_of_memory_error) \
498 V(Array, vm_isolate_snapshot_object_table) \
499 V(Type, dynamic_type) \
501 V(AbstractType, null_abstract_type)
503#define DEFINE_SHARED_READONLY_HANDLE_GETTER(Type, name) \
504 static const Type& name() { \
505 ASSERT(name##_ != nullptr); \
509#undef DEFINE_SHARED_READONLY_HANDLE_GETTER
522 return ffi_trampoline_data_class_;
529 return kernel_program_info_class_;
534 return instructions_section_class_;
537 return instructions_table_class_;
543 return compressed_stackmaps_class_;
547 return exception_handlers_class_;
555 return unhandled_exception_class_;
561 return monomorphicsmiablecall_class_;
568 return weak_serialization_reference_class_;
585 const uint8_t* kernel_buffer,
586 intptr_t kernel_buffer_size);
589 intptr_t original_size,
596 template <
class FakeObject>
602 ASSERT(builtin_vtables_[
cid] == fake.vtable());
676 intptr_t default_cid) {
683 intptr_t default_cid) {
702 memcpy(&
result,
reinterpret_cast<const void*
>(
this),
707 memcpy(
reinterpret_cast<void*
>(
this), &
value,
715 uword ptr_field_start_offset,
716 uword ptr_field_end_offset);
721 template <
typename T>
722 DART_FORCE_INLINE
static typename T::ObjectPtrType
Allocate(
724 return static_cast<typename T::ObjectPtrType
>(
Allocate(
725 T::kClassId, T::InstanceSize(), space, T::ContainsCompressedPointers(),
726 Object::from_offset<T>(), Object::to_offset<T>()));
728 template <
typename T>
729 DART_FORCE_INLINE
static typename T::ObjectPtrType
Allocate(
732 return static_cast<typename T::ObjectPtrType
>(
733 Allocate(T::kClassId, T::InstanceSize(elements), space,
734 T::ContainsCompressedPointers(), Object::from_offset<T>(),
735 Object::to_offset<T>(elements)));
741 template <
typename T>
745 return static_cast<typename T::ObjectPtrType
>(
Allocate(
746 class_id, T::InstanceSize(), space, T::ContainsCompressedPointers(),
747 Object::from_offset<T>(), Object::to_offset<T>()));
749 template <
typename T>
750 DART_FORCE_INLINE
static typename T::ObjectPtrType
752 return static_cast<typename T::ObjectPtrType
>(
753 Allocate(class_id, T::InstanceSize(elements), space,
754 T::ContainsCompressedPointers(), Object::from_offset<T>(),
755 Object::to_offset<T>(elements)));
770 template <
typename type, std::memory_order order = std::memory_order_relaxed>
775 template <
typename type, std::memory_order order = std::memory_order_relaxed>
779 template <
typename type,
780 typename compressed_type,
781 std::memory_order order = std::memory_order_relaxed>
786 template <
typename type>
795 void StoreSmi(SmiPtr
const* addr, SmiPtr value)
const {
799 template <
typename FieldType>
802 value.writeTo(
const_cast<FieldType*
>(addr));
805 template <
typename FieldType>
807 return *
const_cast<FieldType*
>(addr);
810 template <
typename FieldType, std::memory_order order>
812 return reinterpret_cast<std::atomic<FieldType>*
>(
813 const_cast<FieldType*
>(addr))
818 template <
typename FieldType,
typename ValueType>
822 *
const_cast<FieldType*
>(addr) =
value;
825 template <
typename FieldType,
typename ValueType, std::memory_order order>
829 reinterpret_cast<std::atomic<FieldType>*
>(
const_cast<FieldType*
>(addr))
830 ->store(
value, order);
836 template <
typename FieldType>
844 return const_cast<FieldType*
>(addr);
849#define STORE_NON_POINTER_ILLEGAL_TYPE(type) \
850 template <typename ValueType> \
851 void StoreNonPointer(type##Ptr const* addr, ValueType value) const { \
852 UnimplementedMethod(); \
854 type##Ptr* UnsafeMutableNonPointer(type##Ptr const* addr) const { \
855 UnimplementedMethod(); \
861#undef STORE_NON_POINTER_ILLEGAL_TYPE
866 bool load_with_relaxed_atomics =
false);
878 template <
typename T>
880 return UntaggedObject::from_offset<typename T::UntaggedObjectType>();
892 template <
typename T>
894 return UntaggedObject::to_offset<typename T::UntaggedObjectType>(
length);
898 const char* protocol_type,
902 static intptr_t NextFieldOffset() {
907 static void InitializeObject(
uword address,
911 uword ptr_field_start_offset,
912 uword ptr_field_end_offset);
917 template <
typename T>
918 DART_FORCE_INLINE
static void InitializeObject(
uword address) {
919 return InitializeObject(address, T::kClassId, T::InstanceSize(),
920 T::ContainsCompressedPointers(),
921 Object::from_offset<T>(), Object::to_offset<T>());
923 template <
typename T>
924 DART_FORCE_INLINE
static void InitializeObject(
uword address,
926 return InitializeObject(address, T::kClassId, T::InstanceSize(elements),
927 T::ContainsCompressedPointers(),
928 Object::from_offset<T>(),
929 Object::to_offset<T>(elements));
935 template <
typename T>
936 DART_FORCE_INLINE
static void InitializeObjectVariant(
uword address,
938 return InitializeObject(address, class_id, T::InstanceSize(),
939 T::ContainsCompressedPointers(),
940 Object::from_offset<T>(), Object::to_offset<T>());
942 template <
typename T>
943 DART_FORCE_INLINE
static void InitializeObjectVariant(
uword address,
946 return InitializeObject(address, class_id, T::InstanceSize(elements),
947 T::ContainsCompressedPointers(),
948 Object::from_offset<T>(),
949 Object::to_offset<T>(elements));
952 static void RegisterClass(
const Class& cls,
955 static void RegisterPrivateClass(
const Class& cls,
960 static void initializeHandle(
Object* obj, ObjectPtr
ptr) {
961 obj->setPtr(
ptr, kObjectCid);
968 static ObjectPtr null_;
969 static BoolPtr true_;
970 static BoolPtr false_;
972 static ClassPtr class_class_;
973 static ClassPtr dynamic_class_;
974 static ClassPtr void_class_;
975 static ClassPtr type_parameters_class_;
976 static ClassPtr type_arguments_class_;
977 static ClassPtr patch_class_class_;
978 static ClassPtr function_class_;
979 static ClassPtr closure_data_class_;
980 static ClassPtr ffi_trampoline_data_class_;
981 static ClassPtr field_class_;
982 static ClassPtr script_class_;
983 static ClassPtr library_class_;
984 static ClassPtr namespace_class_;
985 static ClassPtr kernel_program_info_class_;
986 static ClassPtr code_class_;
987 static ClassPtr instructions_class_;
988 static ClassPtr instructions_section_class_;
989 static ClassPtr instructions_table_class_;
990 static ClassPtr object_pool_class_;
991 static ClassPtr pc_descriptors_class_;
992 static ClassPtr code_source_map_class_;
993 static ClassPtr compressed_stackmaps_class_;
994 static ClassPtr var_descriptors_class_;
995 static ClassPtr exception_handlers_class_;
996 static ClassPtr context_class_;
997 static ClassPtr context_scope_class_;
998 static ClassPtr sentinel_class_;
999 static ClassPtr singletargetcache_class_;
1000 static ClassPtr unlinkedcall_class_;
1001 static ClassPtr monomorphicsmiablecall_class_;
1002 static ClassPtr icdata_class_;
1003 static ClassPtr megamorphic_cache_class_;
1004 static ClassPtr subtypetestcache_class_;
1005 static ClassPtr loadingunit_class_;
1006 static ClassPtr api_error_class_;
1007 static ClassPtr language_error_class_;
1008 static ClassPtr unhandled_exception_class_;
1009 static ClassPtr unwind_error_class_;
1010 static ClassPtr weak_serialization_reference_class_;
1011 static ClassPtr weak_array_class_;
1013#define DECLARE_SHARED_READONLY_HANDLE(Type, name) static Type* name##_;
1015#undef DECLARE_SHARED_READONLY_HANDLE
1027#define REUSABLE_FRIEND_DECLARATION(name) \
1028 friend class Reusable##name##HandleScope;
1030#undef REUSABLE_FRIEND_DECLARATION
1048#if defined(DART_PRECOMPILER)
1049#define PRECOMPILER_WSR_FIELD_DECLARATION(Type, Name) \
1050 Type##Ptr Name() const; \
1051 void set_##Name(const Object& value) const { \
1052 untag()->set_##Name(value.ptr()); \
1055#define PRECOMPILER_WSR_FIELD_DECLARATION(Type, Name) \
1056 Type##Ptr Name() const { \
1057 return untag()->Name(); \
1059 void set_##Name(const Type& value) const;
1102 DISALLOW_ALLOCATION();
1151#if defined(DART_PRECOMPILER)
1152 return (
untag()->target_instance_size_in_words_ *
1153 compiler::target::kCompressedWordSize);
1162#if defined(DART_PRECOMPILER)
1163 return (
clazz->untag()->target_instance_size_in_words_ *
1164 compiler::target::kCompressedWordSize);
1170 intptr_t target_value_in_bytes)
const {
1174 target_value_in_bytes / compiler::target::kCompressedWordSize);
1177 intptr_t target_value)
const {
1181#if defined(DART_PRECOMPILER)
1184 compiler::target::kObjectAlignment));
1196#if defined(DART_PRECOMPILER)
1197 return untag()->target_next_field_offset_in_words_ *
1198 compiler::target::kCompressedWordSize;
1204 intptr_t target_value_in_bytes)
const {
1207 target_value_in_bytes / compiler::target::kCompressedWordSize);
1210 intptr_t target_value)
const {
1214 ASSERT((host_value < 0) ||
1215 ((host_value <=
untag()->host_instance_size_in_words_) &&
1217 untag()->host_instance_size_in_words_)));
1219#if defined(DART_PRECOMPILER)
1220 ASSERT((target_value < 0) ||
1221 ((target_value <=
untag()->target_instance_size_in_words_) &&
1222 (target_value + (compiler::target::kObjectAlignment /
1223 compiler::target::kCompressedWordSize) >
1224 untag()->target_instance_size_in_words_)));
1242#if !defined(DART_PRECOMPILED_RUNTIME)
1258 StringPtr
Name()
const;
1268 ClassPtr
Mixin()
const;
1277#if !defined(DART_PRECOMPILED_RUNTIME)
1282#if defined(DART_PRECOMPILED_RUNTIME)
1283 return TokenPosition::kNoSource;
1285 return untag()->token_pos_;
1289#if !defined(DART_PRECOMPILED_RUNTIME)
1294#if defined(DART_PRECOMPILED_RUNTIME)
1295 return TokenPosition::kNoSource;
1297 return untag()->end_token_pos_;
1301#if !defined(DART_PRECOMPILED_RUNTIME)
1305 uint32_t
Hash()
const;
1306 static uint32_t
Hash(ClassPtr);
1333 bool canonicalize =
true)
const;
1342 return untag()->type_parameters();
1379 if (
untag()->host_type_arguments_field_offset_in_words_ ==
1383 return untag()->host_type_arguments_field_offset_in_words_ *
1387#if defined(DART_PRECOMPILER)
1389 if (
untag()->target_type_arguments_field_offset_in_words_ ==
1390 compiler::target::Class::kNoTypeArguments) {
1391 return compiler::target::Class::kNoTypeArguments;
1393 return untag()->target_type_arguments_field_offset_in_words_ *
1394 compiler::target::kCompressedWordSize;
1400 intptr_t target_value_in_bytes)
const {
1401 intptr_t host_value, target_value;
1403 target_value_in_bytes == RTN::Class::kNoTypeArguments) {
1405 target_value_in_bytes == RTN::Class::kNoTypeArguments);
1407 target_value = RTN::Class::kNoTypeArguments;
1412 target_value_in_bytes / compiler::target::kCompressedWordSize;
1417 intptr_t target_value)
const {
1420#if defined(DART_PRECOMPILER)
1435 return untag()->super_type();
1451 return untag()->interfaces();
1469 bool consider_only_super_classes =
false)
const;
1472 bool consider_only_super_classes =
false)
const {
1474 consider_only_super_classes);
1492 bool consider_only_super_classes =
false)
const;
1495 bool consider_only_super_classes =
false)
const {
1497 consider_only_super_classes);
1520#if !defined(PRODUCT) || !defined(DART_PRECOMPILED_RUNTIME)
1525 return untag()->direct_implementors();
1528 return untag()->direct_implementors();
1532#if !defined(DART_PRECOMPILED_RUNTIME)
1537#if !defined(PRODUCT) || !defined(DART_PRECOMPILED_RUNTIME)
1545 return untag()->direct_subclasses();
1549#if !defined(DART_PRECOMPILED_RUNTIME)
1590 cls->untag()->library()->untag()->flags_);
1595 return cls->untag()->id_;
1620 return untag()->fields();
1646 return untag()->functions();
1677 bool instance_only =
false)
const;
1795 return clazz->untag()->num_native_fields_;
1801#if !defined(DART_PRECOMPILED_RUNTIME)
1807#if defined(DART_PRECOMPILED_RUNTIME)
1810 return untag()->kernel_offset_;
1815#if defined(DART_PRECOMPILED_RUNTIME)
1832 const Array& args_desc,
1834 bool create_if_absent)
const;
1841 const Array& arguments,
1842 const Array& argument_names,
1843 bool respect_reflectable =
true,
1844 bool check_is_entrypoint =
false)
const;
1846 bool throw_nsm_if_absent,
1847 bool respect_reflectable =
true,
1848 bool check_is_entrypoint =
false)
const;
1851 bool respect_reflectable =
true,
1852 bool check_is_entrypoint =
false)
const;
1861 const Array& type_definitions,
1862 const Array& param_values,
1873 template <
class FakeObject,
class TargetFakeObject>
1874 static ClassPtr
New(
IsolateGroup* isolate_group,
bool register_class =
true);
1881 bool register_class =
true);
1909#if !defined(DART_PRECOMPILED_RUNTIME)
1932 const Class& old_cls)
const;
1935 const Class& new_cls)
const;
1942 const Array& args_desc,
1946 return cls->untag()->host_instance_size_in_words_;
1950#if defined(DART_PRECOMPILER)
1951 return cls->untag()->target_instance_size_in_words_;
1958 return cls->untag()->host_next_field_offset_in_words_;
1962#if defined(DART_PRECOMPILER)
1963 return cls->untag()->target_next_field_offset_in_words_;
1970 return cls->untag()->host_type_arguments_field_offset_in_words_;
1974 const ClassPtr cls) {
1975#if defined(DART_PRECOMPILER)
1976 return cls->untag()->target_type_arguments_field_offset_in_words_;
1984 const Field& field)
const;
1986#if !defined(PRODUCT) || defined(FORCE_INCLUDE_SAMPLING_HEAP_PROFILER)
1991 TypePtr declaration_type()
const {
1992 return untag()->declaration_type<std::memory_order_acquire>();
1996 void set_declaration_type(
const Type&
type)
const;
1998 TypeArgumentsPtr declaration_instance_type_arguments()
const {
2000 ->declaration_instance_type_arguments<std::memory_order_acquire>();
2002 void set_declaration_instance_type_arguments(
2003 const TypeArguments& value)
const;
2005 bool CanReloadFinalized(
const Class& replacement,
2006 ProgramReloadContext* context)
const;
2007 bool CanReloadPreFinalized(
const Class& replacement,
2008 ProgramReloadContext* context)
const;
2011 bool RequiresInstanceMorphing(ClassTable* class_table,
2012 const Class& replacement)
const;
2014 template <
class FakeInstance,
class TargetFakeInstance>
2015 static ClassPtr NewCommon(intptr_t index);
2021 kInstanceAllowAbstract,
2027 kImplementedBit = 1,
2028 kClassFinalizedPos = 2,
2029 kClassFinalizedSize = 2,
2030 kClassLoadingPos = kClassFinalizedPos + kClassFinalizedSize,
2031 kClassLoadingSize = 2,
2032 kAbstractBit = kClassLoadingPos + kClassLoadingSize,
2033 kSynthesizedClassBit,
2035 kMixinTypeAppliedBit,
2036 kFieldsMarkedNullableBit,
2038 kTransformedMixinApplicationBit,
2053 kIsIsolateUnsendableBit,
2056 kIsIsolateUnsendableDueToPragmaBit,
2066 kIsDeeplyImmutableBit,
2068 kIsFutureSubtypeBit,
2074 class ConstBit :
public BitField<uint32_t, bool, kConstBit, 1> {};
2075 class ImplementedBit :
public BitField<uint32_t, bool, kImplementedBit, 1> {};
2076 class ClassFinalizedBits :
public BitField<uint32_t,
2077 UntaggedClass::ClassFinalizedState,
2079 kClassFinalizedSize> {};
2080 class ClassLoadingBits :
public BitField<uint32_t,
2081 UntaggedClass::ClassLoadingState,
2083 kClassLoadingSize> {};
2084 class AbstractBit :
public BitField<uint32_t, bool, kAbstractBit, 1> {};
2085 class SynthesizedClassBit
2086 :
public BitField<uint32_t, bool, kSynthesizedClassBit, 1> {};
2087 class FieldsMarkedNullableBit
2088 :
public BitField<uint32_t, bool, kFieldsMarkedNullableBit, 1> {};
2089 class EnumBit :
public BitField<uint32_t, bool, kEnumBit, 1> {};
2090 class TransformedMixinApplicationBit
2091 :
public BitField<uint32_t, bool, kTransformedMixinApplicationBit, 1> {};
2092 class IsAllocatedBit :
public BitField<uint32_t, bool, kIsAllocatedBit, 1> {};
2093 class IsLoadedBit :
public BitField<uint32_t, bool, kIsLoadedBit, 1> {};
2094 class HasPragmaBit :
public BitField<uint32_t, bool, kHasPragmaBit, 1> {};
2095 class SealedBit :
public BitField<uint32_t, bool, kSealedBit, 1> {};
2096 class MixinClassBit :
public BitField<uint32_t, bool, kMixinClassBit, 1> {};
2097 class BaseClassBit :
public BitField<uint32_t, bool, kBaseClassBit, 1> {};
2098 class InterfaceClassBit
2099 :
public BitField<uint32_t, bool, kInterfaceClassBit, 1> {};
2100 class FinalBit :
public BitField<uint32_t, bool, kFinalBit, 1> {};
2101 class IsIsolateUnsendableBit
2102 :
public BitField<uint32_t, bool, kIsIsolateUnsendableBit, 1> {};
2103 class IsIsolateUnsendableDueToPragmaBit
2104 :
public BitField<uint32_t, bool, kIsIsolateUnsendableDueToPragmaBit, 1> {
2106 class IsDeeplyImmutableBit
2107 :
public BitField<uint32_t, bool, kIsDeeplyImmutableBit, 1> {};
2108 class IsFutureSubtypeBit
2109 :
public BitField<uint32_t, bool, kIsFutureSubtypeBit, 1> {};
2110 class CanBeFutureBit :
public BitField<uint32_t, bool, kCanBeFutureBit, 1> {};
2112 void set_name(
const String& value)
const;
2113 void set_user_name(
const String& value)
const;
2114 const char* GenerateUserVisibleName()
const;
2115 void set_state_bits(intptr_t bits)
const;
2116 void set_implementor_cid(intptr_t value)
const;
2118 FunctionPtr CreateInvocationDispatcher(
const String& target_name,
2119 const Array& args_desc,
2122 FunctionPtr CreateRecordFieldGetter(
const String& getter_name)
const;
2125 UnboxedFieldBitmap CalculateFieldOffsets()
const;
2128 static constexpr intptr_t kFunctionLookupHashThreshold = 16;
2131 static constexpr intptr_t kUnknownNumTypeArguments = -1;
2133 int16_t num_type_arguments()
const {
2134 return LoadNonPointer<int16_t, std::memory_order_relaxed>(
2135 &
untag()->num_type_arguments_);
2138 uint32_t state_bits()
const {
2141 return LoadNonPointer<uint32_t, std::memory_order_acquire>(
2142 &
untag()->state_bits_);
2181 void set_functions(
const Array& value)
const;
2182 void set_fields(
const Array& value)
const;
2183 void set_invocation_dispatcher_cache(
const Array& cache)
const;
2185 ArrayPtr invocation_dispatcher_cache()
const;
2190 intptr_t ComputeNumTypeArguments()
const;
2193 void InitEmptyFields()
const;
2195 static FunctionPtr CheckFunctionType(
const Function& func, MemberKind kind);
2197 MemberKind kind)
const;
2199 MemberKind kind)
const;
2202 FunctionPtr LookupAccessorFunction(
const char* prefix,
2203 intptr_t prefix_length,
2207 template <
class FakeInstance,
class TargetFakeInstance>
2208 static ClassPtr
New(intptr_t
id,
2210 bool register_class =
true,
2214 static ClassPtr NewInstanceClass();
2254#if !defined(DART_PRECOMPILED_RUNTIME)
2255 return untag()->kernel_library_index_;
2264#if !defined(DART_PRECOMPILED_RUNTIME)
2266 return untag()->kernel_program_info();
2284 void set_wrapped_class(
const Class& value)
const;
2285 void set_script(
const Script& value)
const;
2287 static PatchClassPtr New();
2301#define DEFINE_NON_POINTER_FIELD_ACCESSORS(type, name) \
2302 type name() const { return untag()->name##_; } \
2303 void set_##name(type value) const { \
2304 StoreNonPointer(&untag()->name##_, value); \
2306 static intptr_t name##_offset() { \
2307 return OFFSET_OF(UntaggedSingleTargetCache, name##_); \
2313#undef DEFINE_NON_POINTER_FIELD_ACCESSORS
2319 static SingleTargetCachePtr
New();
2374 void set_target_name(
const String& value)
const;
2375 void set_arguments_descriptor(
const Array& value)
const;
2386 return untag()->can_patch_to_monomorphic_;
2396 static UnlinkedCallPtr New();
2401 void set_can_patch_to_monomorphic(
bool value)
const;
2438 FunctionPtr Owner()
const;
2440 ICDataPtr Original()
const;
2446 intptr_t NumArgsTested()
const;
2449#if defined(DART_PRECOMPILED_RUNTIME)
2453 return untag()->deopt_id_;
2459#if !defined(DART_PRECOMPILED_RUNTIME)
2461 return untag()->receivers_static_type();
2464 return untag()->state_bits_.Read<TrackingExactnessBit>();
2467 bool is_tracking_exactness()
const {
return false; }
2473#define DEOPT_REASONS(V) \
2480 V(PolymorphicInstanceCallTestFail) \
2486 V(CheckArrayBound) \
2493#define DEFINE_ENUM_LIST(name) kDeopt##name,
2495#undef DEFINE_ENUM_LIST
2498 static constexpr intptr_t kLastRecordedDeoptReason = kDeoptUnknown - 1;
2505 kGeneralized = 1 << 1
2509 uint32_t DeoptReasons()
const;
2510 void SetDeoptReasons(uint32_t reasons)
const;
2517#define FOR_EACH_REBIND_RULE(V) \
2526#define REBIND_ENUM_DEF(name) k##name,
2528#undef REBIND_ENUM_DEF
2531 static const char* RebindRuleToCString(RebindRule r);
2532 static bool ParseRebindRule(
const char* str, RebindRule* out);
2533 RebindRule rebind_rule()
const;
2536 untag()->state_bits_.UpdateBool<MegamorphicBit, std::memory_order_release>(
2542 intptr_t Length()
const;
2544 intptr_t NumberOfChecks()
const;
2548 intptr_t NumberOfUsedChecks()
const;
2550 bool NumberOfChecksIs(intptr_t n)
const;
2553 return 0 <= index && index < NumberOfChecks();
2567 return ((1 << kNumArgsTestedSize) - 1) << kNumArgsTestedPos;
2576#if !defined(DART_PRECOMPILED_RUNTIME)
2584 TruncateTo(0, proof_of_reload);
2588 void TruncateTo(intptr_t num_checks,
2593 void ClearCountAt(intptr_t index,
2599 void ClearAndSetStaticTarget(
const Function& func,
2602 void DebugDump()
const;
2613 intptr_t
count = 1)
const;
2619 intptr_t
count = 1)
const;
2628 void EnsureHasReceiverCheck(
2629 intptr_t receiver_class_id,
2637 void AddReceiverCheck(intptr_t receiver_class_id,
2645 void GetCheckAt(intptr_t index,
2651 void GetOneClassCheckAt(intptr_t index,
2655 intptr_t GetCidAt(intptr_t index)
const;
2657 intptr_t GetReceiverClassIdAt(intptr_t index)
const;
2658 intptr_t GetClassIdAt(intptr_t index, intptr_t arg_nr)
const;
2660 FunctionPtr GetTargetAt(intptr_t index)
const;
2662 void IncrementCountAt(intptr_t index, intptr_t value)
const;
2663 void SetCountAt(intptr_t index, intptr_t value)
const;
2664 intptr_t GetCountAt(intptr_t index)
const;
2665 intptr_t AggregateCount()
const;
2670 ICDataPtr AsUnaryClassChecksForArgNr(intptr_t arg_nr)
const;
2677 ICDataPtr AsUnaryClassChecksSortedByCount()
const;
2679 UnlinkedCallPtr AsUnlinkedCall()
const;
2681 bool HasReceiverClassId(intptr_t class_id)
const;
2687 static ICDataPtr New(
2692 intptr_t num_args_tested,
2693 RebindRule rebind_rule,
2694 const AbstractType& receiver_type = Object::null_abstract_type());
2697 static ICDataPtr NewWithCheck(
2702 intptr_t num_args_tested,
2703 RebindRule rebind_rule,
2706 const AbstractType& receiver_type = Object::null_abstract_type());
2708 static ICDataPtr NewForStaticCall(
const Function& owner,
2712 intptr_t num_args_tested,
2713 RebindRule rebind_rule);
2715 static ICDataPtr NewFrom(
const ICData& from, intptr_t num_args_tested);
2724 static ICDataPtr ICDataOfEntriesArray(
const Array& array);
2726 static intptr_t TestEntryLengthFor(intptr_t num_args,
2727 bool tracking_exactness);
2737 bool IsUsedAt(intptr_t i)
const;
2739 void PrintToJSONArray(
const JSONArray& jsarray,
2751 kCachedICDataZeroArgTestedWithoutExactnessTrackingIdx = 0,
2752 kCachedICDataMaxArgsTestedWithoutExactnessTracking = 2,
2753 kCachedICDataOneArgWithExactnessTrackingIdx =
2754 kCachedICDataZeroArgTestedWithoutExactnessTrackingIdx +
2755 kCachedICDataMaxArgsTestedWithoutExactnessTracking + 1,
2756 kCachedICDataArrayCount = kCachedICDataOneArgWithExactnessTrackingIdx + 1,
2759 bool is_static_call()
const;
2764 return untag()->entries<std::memory_order_acquire>();
2768 return untag()->state_bits_.Read<ReceiverCannotBeSmiBit>();
2772 untag()->state_bits_.UpdateBool<ReceiverCannotBeSmiBit>(
value);
2778 static ICDataPtr New();
2782 ArrayPtr Grow(intptr_t* index)
const;
2784 void set_deopt_id(intptr_t value)
const;
2785 void set_entries(
const Array& value)
const;
2786 void set_owner(
const Function& value)
const;
2787 void set_rebind_rule(uint32_t rebind_rule)
const;
2788 void clear_state_bits()
const;
2789 void set_tracking_exactness(
bool value)
const {
2790 untag()->state_bits_.UpdateBool<TrackingExactnessBit>(
value);
2794 void SetNumArgsTested(intptr_t value)
const;
2795 void SetReceiversStaticType(
const AbstractType&
type)
const;
2796 DEBUG_ONLY(
void AssertInvariantsAreSatisfied()
const;)
2798 static void SetTargetAtPos(
const Array&
data,
2800 intptr_t num_args_tested,
2802 void AddCheckInternal(
const GrowableArray<intptr_t>& class_ids,
2804 intptr_t
count)
const;
2805 void AddReceiverCheckInternal(intptr_t receiver_class_id,
2808 StaticTypeExactnessState exactness)
const;
2816 bool is_megamorphic()
const {
2820 ->state_bits_.Read<MegamorphicBit, std::memory_order_acquire>();
2823 bool ValidateInterceptor(
const Function&
target)
const;
2826 kNumArgsTestedPos = 0,
2827 kNumArgsTestedSize = 2,
2828 kTrackingExactnessPos = kNumArgsTestedPos + kNumArgsTestedSize,
2829 kTrackingExactnessSize = 1,
2830 kDeoptReasonPos = kTrackingExactnessPos + kTrackingExactnessSize,
2831 kDeoptReasonSize = kLastRecordedDeoptReason + 1,
2832 kRebindRulePos = kDeoptReasonPos + kDeoptReasonSize,
2833 kRebindRuleSize = 3,
2834 kMegamorphicPos = kRebindRulePos + kRebindRuleSize,
2835 kMegamorphicSize = 1,
2836 kReceiverCannotBeSmiPos = kMegamorphicPos + kMegamorphicSize,
2837 kReceiverCannotBeSmiSize = 1,
2840 COMPILE_ASSERT(kReceiverCannotBeSmiPos + kReceiverCannotBeSmiSize <=
2844 class NumArgsTestedBits :
public BitField<uint32_t,
2847 kNumArgsTestedSize> {};
2848 class TrackingExactnessBit :
public BitField<uint32_t,
2850 kTrackingExactnessPos,
2851 kTrackingExactnessSize> {};
2852 class DeoptReasonBits :
public BitField<uint32_t,
2854 ICData::kDeoptReasonPos,
2855 ICData::kDeoptReasonSize> {};
2856 class RebindRuleBits :
public BitField<uint32_t,
2858 ICData::kRebindRulePos,
2859 ICData::kRebindRuleSize> {};
2860 class MegamorphicBit
2861 :
public BitField<uint32_t, bool, kMegamorphicPos, kMegamorphicSize> {};
2863 class ReceiverCannotBeSmiBit :
public BitField<uint32_t,
2865 kReceiverCannotBeSmiPos,
2866 kReceiverCannotBeSmiSize> {};
2870 bool HasCheck(
const GrowableArray<intptr_t>& cids)
const;
2873 intptr_t TestEntryLength()
const;
2874 static ArrayPtr NewNonCachedEmptyICDataArray(intptr_t num_args_tested,
2875 bool tracking_exactness);
2876 static ArrayPtr CachedEmptyICDataArray(intptr_t num_args_tested,
2877 bool tracking_exactness);
2878 static bool IsCachedEmptyEntry(
const Array& array);
2879 static ICDataPtr NewDescriptor(Zone* zone,
2880 const Function& owner,
2884 intptr_t num_args_tested,
2885 RebindRule rebind_rule,
2886 const AbstractType& receiver_type);
2888 static void WriteSentinel(
const Array&
data,
2889 intptr_t test_entry_length,
2893 static ArrayPtr cached_icdata_arrays_[kCachedICDataArrayCount];
2932 bool include_class_name =
true;
2939 bool include_parent_name =
true;
2943 Object::NameDisambiguation::kNo)
2944 : name_visibility(visibility),
2945 disambiguate_names(name_disambiguation ==
2951 params.include_class_name =
false;
2958 params.include_class_name =
false;
2959 params.include_parent_name =
false;
2973 StringPtr UserVisibleName()
const;
2974 const char* UserVisibleNameCString()
const;
2976 const char* NameCString(NameVisibility name_visibility)
const;
2980 StringPtr QualifiedScrubbedName()
const;
2981 const char* QualifiedScrubbedNameCString()
const;
2982 StringPtr QualifiedUserVisibleName()
const;
2983 const char* QualifiedUserVisibleNameCString()
const;
2987 StringPtr GetSource()
const;
2994 FunctionTypePtr FfiCSignature()
const;
2996 bool FfiCSignatureContainsHandles()
const;
2997 bool FfiCSignatureReturnsStruct()
const;
3000 int32_t FfiCallbackId()
const;
3003 void AssignFfiCallbackId(int32_t callback_id)
const;
3006 bool FfiIsLeaf()
const;
3009 FunctionPtr FfiCallbackTarget()
const;
3015 InstancePtr FfiCallbackExceptionalReturn()
const;
3018 void SetFfiCallbackExceptionalReturn(
const Instance& value)
const;
3037 StringPtr InternalSignature()
const;
3044 StringPtr UserVisibleSignature()
const;
3051 bool HasInstantiatedSignature(
3053 intptr_t num_free_fun_type_params = kAllFree)
const;
3055 bool IsPrivate()
const;
3057 ClassPtr Owner()
const;
3058 void set_owner(
const Object& value)
const;
3059 ScriptPtr script()
const;
3060#if !defined(DART_PRECOMPILED_RUNTIME)
3065 RegExpPtr regexp()
const;
3066 intptr_t string_specialization_cid()
const;
3067 bool is_sticky_specialization()
const;
3068 void SetRegExpData(
const RegExp& regexp,
3069 intptr_t string_specialization_cid,
3072 StringPtr native_name()
const;
3073 void set_native_name(
const String&
name)
const;
3075 InstancePtr GetNativeAnnotation()
const;
3076 bool is_ffi_native()
const;
3077 bool is_old_native()
const;
3080 return signature()->untag()->result_type();
3086 AbstractTypePtr ParameterTypeAt(intptr_t index)
const;
3088 return signature()->untag()->parameter_types();
3095 StringPtr ParameterNameAt(intptr_t index)
const;
3098 void SetParameterNameAt(intptr_t index,
const String& value)
const;
3102 void CreateNameArray(
Heap::Space space = Heap::kOld)
const;
3105 bool IsRequiredAt(intptr_t index)
const;
3110 return signature()->untag()->type_parameters();
3114 intptr_t NumTypeParameters()
const;
3116 intptr_t NumParentTypeArguments()
const;
3119 intptr_t NumTypeArguments()
const;
3121 bool IsGeneric()
const;
3126 TypeParameterPtr TypeParameterAt(
3128 Nullability nullability = Nullability::kNonNullable)
const;
3132 void InstallOptimizedCode(
const Code& code)
const;
3133 void AttachCode(
const Code& value)
const;
3134 void SetInstructions(
const Code& value)
const;
3135 void SetInstructionsSafe(
const Code& value)
const;
3136 void ClearCode()
const;
3137 void ClearCodeSafe()
const;
3140 void SwitchToUnoptimizedCode()
const;
3146 CodePtr EnsureHasCode()
const;
3150 void SwitchToLazyCompiledUnoptimizedCode()
const;
3153 void EnsureHasCompiledUnoptimizedCode()
const;
3159 bool SafeToClosurize()
const;
3166#if defined(DART_PRECOMPILED_RUNTIME)
3167 return static_cast<CodePtr
>(Object::null());
3169 return untag()->unoptimized_code();
3172 void set_unoptimized_code(
const Code& value)
const;
3173 bool HasCode()
const;
3174 static bool HasCode(FunctionPtr
function);
3180 return function->untag()->entry_point_;
3185 switch (entry_kind) {
3186 case CodeEntryKind::kNormal:
3188 case CodeEntryKind::kUnchecked:
3199 virtual uword Hash()
const;
3203 bool HasBreakpoint()
const;
3205 ContextScopePtr context_scope()
const;
3206 void set_context_scope(
const ContextScope& value)
const;
3211 uint8_t depth = UntaggedClosureData::kNoAwaiterLinkDepth;
3214 uint8_t index =
static_cast<uint8_t
>(-1);
3220 return IsClosureFunction() &&
3221 (awaiter_link().depth != UntaggedClosureData::kNoAwaiterLinkDepth);
3225 FunctionPtr parent_function()
const;
3237 TypeArgumentsPtr DefaultTypeArguments(
Zone* zone)
const;
3241 void set_default_type_arguments_instantiation_mode(
3245 FunctionPtr GetOutermostFunction()
const;
3248 FunctionPtr extracted_method_closure()
const;
3250 void set_saved_args_desc(
const Array& array)
const;
3251 ArrayPtr saved_args_desc()
const;
3254 return IsInvokeFieldDispatcher() || IsNoSuchMethodDispatcher();
3257 void set_accessor_field(
const Field& value)
const;
3258 FieldPtr accessor_field()
const;
3261 return kind() == UntaggedFunction::kRegularFunction;
3265 return kind() == UntaggedFunction::kMethodExtractor;
3269 return kind() == UntaggedFunction::kNoSuchMethodDispatcher;
3273 return kind() == UntaggedFunction::kRecordFieldGetter;
3277 return kind() == UntaggedFunction::kInvokeFieldDispatcher;
3281 return IsInvokeFieldDispatcher() &&
3282 IsDynamicInvocationForwarderName(
name());
3289 if (!IsDynamicInvokeFieldDispatcher())
return false;
3290 return IsDynamicClosureCallDispatcher(Thread::Current());
3292 bool IsDynamicClosureCallDispatcher(
Thread* thread)
const;
3295 return kind() == UntaggedFunction::kDynamicInvocationForwarder;
3299 return kind() == UntaggedFunction::kImplicitGetter ||
3300 kind() == UntaggedFunction::kImplicitSetter ||
3301 kind() == UntaggedFunction::kImplicitStaticGetter;
3307 return implicit_closure_function() != null();
3313 FunctionPtr ImplicitClosureFunction()
const;
3314 void DropUncompiledImplicitClosureFunction()
const;
3318 ClosurePtr ImplicitStaticClosure()
const;
3320 ClosurePtr ImplicitInstanceClosure(
const Instance& receiver)
const;
3324 FunctionPtr ImplicitClosureTarget(
Zone* zone)
const;
3326 FunctionPtr ForwardingTarget()
const;
3331 return func->untag()->kind_tag_.Read<
KindBits>();
3341 return kind() == UntaggedFunction::kConstructor;
3344 return IsConstructor() && !is_static();
3346 bool IsImplicitConstructor()
const;
3347 bool IsFactory()
const {
return IsConstructor() && is_static(); }
3350 return IsDynamicFunction(
true) ||
3351 IsGenerativeConstructor() || (IsFieldInitializer() && !is_static());
3355 if (is_static() || (!allow_abstract && is_abstract())) {
3359 case UntaggedFunction::kRegularFunction:
3360 case UntaggedFunction::kGetterFunction:
3361 case UntaggedFunction::kSetterFunction:
3362 case UntaggedFunction::kImplicitGetter:
3363 case UntaggedFunction::kImplicitSetter:
3364 case UntaggedFunction::kMethodExtractor:
3365 case UntaggedFunction::kNoSuchMethodDispatcher:
3366 case UntaggedFunction::kInvokeFieldDispatcher:
3367 case UntaggedFunction::kDynamicInvocationForwarder:
3368 case UntaggedFunction::kRecordFieldGetter:
3370 case UntaggedFunction::kClosureFunction:
3371 case UntaggedFunction::kImplicitClosureFunction:
3372 case UntaggedFunction::kConstructor:
3373 case UntaggedFunction::kImplicitStaticGetter:
3374 case UntaggedFunction::kFieldInitializer:
3375 case UntaggedFunction::kIrregexpFunction:
3387 case UntaggedFunction::kRegularFunction:
3388 case UntaggedFunction::kGetterFunction:
3389 case UntaggedFunction::kSetterFunction:
3390 case UntaggedFunction::kImplicitGetter:
3391 case UntaggedFunction::kImplicitSetter:
3392 case UntaggedFunction::kImplicitStaticGetter:
3393 case UntaggedFunction::kFieldInitializer:
3394 case UntaggedFunction::kIrregexpFunction:
3396 case UntaggedFunction::kClosureFunction:
3397 case UntaggedFunction::kImplicitClosureFunction:
3398 case UntaggedFunction::kConstructor:
3399 case UntaggedFunction::kMethodExtractor:
3400 case UntaggedFunction::kNoSuchMethodDispatcher:
3401 case UntaggedFunction::kInvokeFieldDispatcher:
3402 case UntaggedFunction::kDynamicInvocationForwarder:
3403 case UntaggedFunction::kFfiTrampoline:
3404 case UntaggedFunction::kRecordFieldGetter:
3413 return !(is_static() || (kind() == UntaggedFunction::kConstructor));
3417 return !(is_static() || (kind() == UntaggedFunction::kConstructor));
3420 bool NeedsMonomorphicCheckedEntry(
Zone* zone)
const;
3421 bool HasDynamicCallers(
Zone* zone)
const;
3422 bool PrologueNeedsArgumentsDescriptor()
const;
3424 bool MayHaveUncheckedEntryPoint()
const;
3427#if defined(DART_PRECOMPILED_RUNTIME)
3428 return TokenPosition::kNoSource;
3430 return untag()->token_pos_;
3436#if defined(DART_PRECOMPILED_RUNTIME)
3437 return TokenPosition::kNoSource;
3439 return untag()->end_token_pos_;
3443#if defined(DART_PRECOMPILED_RUNTIME)
3446 StoreNonPointer(&
untag()->end_token_pos_,
value);
3450#if !defined(PRODUCT) && \
3451 (defined(DART_PRECOMPILER) || defined(DART_PRECOMPILED_RUNTIME))
3452 int32_t line()
const {
return untag()->token_pos_.Serialize(); }
3454 void set_line(int32_t line)
const {
3455 StoreNonPointer(&untag()->token_pos_, TokenPosition::Deserialize(line));
3460 intptr_t SourceSize()
const;
3463#if defined(DART_PRECOMPILED_RUNTIME)
3466 return untag()->packed_fields_;
3469 void set_packed_fields(uint32_t packed_fields)
const;
3472 intptr_t num_fixed_parameters()
const;
3474 bool HasOptionalParameters()
const;
3476 bool HasOptionalNamedParameters()
const;
3478 bool HasRequiredNamedParameters()
const;
3480 bool HasOptionalPositionalParameters()
const;
3482 intptr_t NumOptionalParameters()
const;
3484 intptr_t NumOptionalPositionalParameters()
const;
3486 intptr_t NumOptionalNamedParameters()
const;
3488 intptr_t NumParameters()
const;
3490 intptr_t NumImplicitParameters()
const;
3495 return HasOptionalParameters() || IsSuspendableFunction();
3498#if !defined(DART_PRECOMPILED_RUNTIME)
3499 intptr_t MaxNumberOfParametersInRegisters(
Zone* zone)
const;
3502#if defined(DART_PRECOMPILED_RUNTIME)
3503#define DEFINE_GETTERS_AND_SETTERS(return_type, type, name) \
3504 static intptr_t name##_offset() { \
3508 return_type name() const { return 0; } \
3510 void set_##name(type value) const { UNREACHABLE(); }
3512#define DEFINE_GETTERS_AND_SETTERS(return_type, type, name) \
3513 static intptr_t name##_offset() { \
3514 return OFFSET_OF(UntaggedFunction, name##_); \
3516 return_type name() const { \
3517 return LoadNonPointer<type, std::memory_order_relaxed>(&untag()->name##_); \
3520 void set_##name(type value) const { \
3521 StoreNonPointer<type, type, std::memory_order_relaxed>(&untag()->name##_, \
3528#undef DEFINE_GETTERS_AND_SETTERS
3531#if defined(DART_PRECOMPILED_RUNTIME)
3534 return untag()->kernel_offset_;
3539#if defined(DART_PRECOMPILED_RUNTIME)
3543 StoreNonPointer(&
untag()->kernel_offset_,
value);
3547 void InheritKernelOffsetFrom(
const Function& src)
const;
3548 void InheritKernelOffsetFrom(
const Field& src)
const;
3550 static constexpr intptr_t kMaxInstructionCount = (1 << 16) - 1;
3553 if (
value > kMaxInstructionCount)
value = kMaxInstructionCount;
3554 set_optimized_instruction_count(
value);
3558 if (
value > kMaxInstructionCount)
value = kMaxInstructionCount;
3559 set_optimized_call_site_count(
value);
3562 void SetKernelLibraryAndEvalScript(
3565 intptr_t index)
const;
3567 intptr_t KernelLibraryOffset()
const;
3568 intptr_t KernelLibraryIndex()
const;
3570 TypedDataViewPtr KernelLibrary()
const;
3572 bool IsOptimizable()
const;
3573 void SetIsOptimizable(
bool value)
const;
3580 bool ForceOptimize()
const;
3583 bool IsPreferInline()
const;
3590 bool IsIdempotent()
const;
3592 bool IsCachableIdempotent()
const;
3595 bool RecognizedKindForceOptimize()
const;
3597 bool CanBeInlined()
const;
3605 return recognized_kind() != MethodRecognizer::kUnknown;
3608 bool HasOptimizedCode()
const;
3613 bool AreValidArgumentCounts(intptr_t num_type_arguments,
3614 intptr_t num_arguments,
3615 intptr_t num_named_arguments,
3616 String* error_message)
const;
3669 bool AreValidArguments(intptr_t num_type_arguments,
3670 intptr_t num_arguments,
3671 const Array& argument_names,
3672 String* error_message)
const;
3674 String* error_message)
const;
3678 const char* ToFullyQualifiedCString()
const;
3680 const char* ToLibNamePrefixedQualifiedCString()
const;
3682 const char* ToQualifiedCString()
const;
3686 return UntaggedFunction::UnboxedParameterBitmap::kCapacity - 1;
3690#if !defined(DART_PRECOMPILED_RUNTIME)
3691 StoreNonPointer(&
untag()->unboxed_parameters_info_,
3697#if !defined(DART_PRECOMPILED_RUNTIME)
3698 ASSERT(index >= 0 && index < maximum_unboxed_parameter_count());
3701 &
untag()->unboxed_parameters_info_)
3702 ->SetUnboxedInteger(index);
3709#if !defined(DART_PRECOMPILED_RUNTIME)
3710 ASSERT(index >= 0 && index < maximum_unboxed_parameter_count());
3713 &
untag()->unboxed_parameters_info_)
3714 ->SetUnboxedDouble(index);
3722#if !defined(DART_PRECOMPILED_RUNTIME)
3724 &
untag()->unboxed_parameters_info_)
3725 ->SetUnboxedInteger(0);
3732#if !defined(DART_PRECOMPILED_RUNTIME)
3734 &
untag()->unboxed_parameters_info_)
3735 ->SetUnboxedDouble(0);
3743#if !defined(DART_PRECOMPILED_RUNTIME)
3745 &
untag()->unboxed_parameters_info_)
3746 ->SetUnboxedRecord(0);
3754#if !defined(DART_PRECOMPILED_RUNTIME)
3757 return untag()->unboxed_parameters_info_.IsUnboxed(index);
3764#if !defined(DART_PRECOMPILED_RUNTIME)
3767 return untag()->unboxed_parameters_info_.IsUnboxedInteger(index);
3774#if !defined(DART_PRECOMPILED_RUNTIME)
3777 return untag()->unboxed_parameters_info_.IsUnboxedDouble(index);
3784#if !defined(DART_PRECOMPILED_RUNTIME)
3785 return untag()->unboxed_parameters_info_.IsUnboxed(0);
3792#if !defined(DART_PRECOMPILED_RUNTIME)
3793 return untag()->unboxed_parameters_info_.IsUnboxedInteger(0);
3800#if !defined(DART_PRECOMPILED_RUNTIME)
3801 return untag()->unboxed_parameters_info_.IsUnboxedDouble(0);
3808#if !defined(DART_PRECOMPILED_RUNTIME)
3809 return untag()->unboxed_parameters_info_.IsUnboxedRecord(0);
3815#if !defined(DART_PRECOMPILED_RUNTIME)
3817 return untag()->unboxed_parameters_info_.HasUnboxedParameters();
3824 case UntaggedFunction::kImplicitGetter:
3825 case UntaggedFunction::kImplicitSetter:
3826 case UntaggedFunction::kImplicitStaticGetter:
3827 case UntaggedFunction::kNoSuchMethodDispatcher:
3828 case UntaggedFunction::kInvokeFieldDispatcher:
3829 case UntaggedFunction::kDynamicInvocationForwarder:
3838 return kind() == UntaggedFunction::kGetterFunction;
3843 return kind() == UntaggedFunction::kImplicitGetter;
3849 return kind() == UntaggedFunction::kImplicitStaticGetter;
3854 return kind() == UntaggedFunction::kSetterFunction;
3859 return kind() == UntaggedFunction::kImplicitSetter;
3866 return kind() == UntaggedFunction::kFieldInitializer;
3873 return (k == UntaggedFunction::kClosureFunction) ||
3874 (k == UntaggedFunction::kImplicitClosureFunction);
3879 return kind() == UntaggedFunction::kIrregexpFunction;
3884 return kind() == UntaggedFunction::kImplicitClosureFunction;
3887 return KindOf(func) == UntaggedFunction::kImplicitClosureFunction;
3892 return IsClosureFunction() && !IsImplicitClosureFunction();
3898 return IsImplicitClosureFunction() && is_static();
3900 static bool IsImplicitStaticClosureFunction(FunctionPtr func);
3905 return IsImplicitClosureFunction() && !is_static();
3907 static bool IsImplicitInstanceClosureFunction(FunctionPtr func);
3910 bool HasParent()
const {
return parent_function() != Function::null(); }
3914 return !IsImplicitClosureFunction() && HasParent();
3919 return kind() == UntaggedFunction::kFfiTrampoline;
3924 UntaggedFunction::kFfiTrampoline;
3929 bool IsFfiCallClosure()
const;
3932 InstancePtr GetFfiCallClosurePragmaValue()
const;
3938 return modifier() != UntaggedFunction::kNoModifier;
3943 return modifier() == UntaggedFunction::kAsync;
3948 return modifier() == UntaggedFunction::kSyncGen;
3953 return modifier() == UntaggedFunction::kAsyncGen;
3956 bool IsTypedDataViewFactory()
const;
3957 bool IsUnmodifiableTypedDataViewFactory()
const;
3960 ErrorPtr VerifyCallEntryPoint()
const;
3963 ErrorPtr VerifyClosurizedEntryPoint()
const;
3991 static FunctionPtr NewClosureFunction(
const String&
name,
3996 static FunctionPtr NewImplicitClosureFunction(
const String&
name,
4000 FunctionPtr CreateMethodExtractor(
const String& getter_name)
const;
4001 FunctionPtr GetMethodExtractor(
const String& getter_name)
const;
4003 static bool IsDynamicInvocationForwarderName(
const String&
name);
4004 static bool IsDynamicInvocationForwarderName(StringPtr
name);
4006 static StringPtr DemangleDynamicInvocationForwarderName(
const String&
name);
4008 static StringPtr CreateDynamicInvocationForwarderName(
const String&
name);
4010#if !defined(DART_PRECOMPILED_RUNTIME)
4011 FunctionPtr CreateDynamicInvocationForwarder(
4012 const String& mangled_name)
const;
4014 FunctionPtr GetDynamicInvocationForwarder(
const String& mangled_name,
4015 bool allow_add =
true)
const;
4020 int32_t SourceFingerprint()
const;
4023 bool CheckSourceFingerprint(int32_t fp,
const char* kind =
nullptr)
const;
4028 const Array& edge_counters_array,
4029 const Array& coverage_array)
const;
4033 bool clone_ic_data)
const;
4039 static constexpr intptr_t kEdgeCounters = 0;
4040 static constexpr intptr_t kCoverageData = 1;
4041 static constexpr intptr_t kFirstICData = 2;
4044 ArrayPtr ic_data_array()
const;
4045 void ClearICDataArray()
const;
4046 ICDataPtr FindICData(intptr_t deopt_id)
const;
4051 ArrayPtr GetCoverageArray()
const;
4054 void AddFunctionServiceId(
const JSONObject& obj)
const;
4069#define STATE_BITS_LIST(V) \
4072 V(ProhibitsInstructionHoisting) \
4073 V(ProhibitsBoundsCheckGeneralization)
4076#define DECLARE_FLAG_POS(Name) k##Name##Pos,
4078#undef DECLARE_FLAG_POS
4080#define DEFINE_FLAG_BIT(Name) \
4081 class Name##Bit : public BitField<uint8_t, bool, k##Name##Pos, 1> {};
4083#undef DEFINE_FLAG_BIT
4085#define DEFINE_FLAG_ACCESSORS(Name) \
4086 void Set##Name(bool value) const { \
4087 set_state_bits(Name##Bit::update(value, state_bits())); \
4089 bool Name() const { return Name##Bit::decode(state_bits()); }
4091#undef DEFINE_FLAG_ACCESSORS
4094 if (usage_counter() > 0) {
4095 SetWasExecuted(
true);
4097 set_usage_counter(
value);
4100 bool WasExecuted()
const {
return (usage_counter() > 0) || WasExecutedBit(); }
4135#define FOR_EACH_FUNCTION_KIND_BIT(V) \
4136 V(Static, is_static) \
4137 V(Const, is_const) \
4138 V(Abstract, is_abstract) \
4139 V(Reflectable, is_reflectable) \
4140 V(Visible, is_visible) \
4141 V(Debuggable, is_debuggable) \
4142 V(Intrinsic, is_intrinsic) \
4143 V(Native, is_native) \
4144 V(External, is_external) \
4145 V(PolymorphicTarget, is_polymorphic_target) \
4146 V(HasPragma, has_pragma) \
4147 V(IsSynthetic, is_synthetic) \
4148 V(IsExtensionMember, is_extension_member) \
4149 V(IsExtensionTypeMember, is_extension_type_member) \
4150 V(IsRedirectingFactory, is_redirecting_factory)
4153#define FOR_EACH_FUNCTION_VOLATILE_KIND_BIT(V) V(Inlinable, is_inlinable)
4155#define DEFINE_ACCESSORS(name, accessor_name) \
4156 void set_##accessor_name(bool value) const { \
4157 untag()->kind_tag_.UpdateUnsynchronized<name##Bit>(value); \
4159 bool accessor_name() const { return untag()->kind_tag_.Read<name##Bit>(); }
4161#undef DEFINE_ACCESSORS
4164 return f.untag()->kind_tag_.Read<VisibleBit>();
4167#define DEFINE_ACCESSORS(name, accessor_name) \
4168 void set_##accessor_name(bool value) const { \
4169 untag()->kind_tag_.UpdateBool<name##Bit>(value); \
4171 bool accessor_name() const { return untag()->kind_tag_.Read<name##Bit>(); }
4173#undef DEFINE_ACCESSORS
4179#if defined(DART_PRECOMPILED_RUNTIME)
4186#if defined(DART_PRECOMPILED_RUNTIME)
4197 kRecognizedTagPos = kKindTagPos + kKindTagSize,
4198 kRecognizedTagSize = 9,
4199 kModifierPos = kRecognizedTagPos + kRecognizedTagSize,
4201 kLastModifierBitPos = kModifierPos + (kModifierSize - 1),
4211 (1 << kRecognizedTagSize));
4214 sizeof(
decltype(UntaggedFunction::kind_tag_))));
4216#define ASSERT_FUNCTION_KIND_IN_RANGE(Name) \
4217 COMPILE_ASSERT(UntaggedFunction::k##Name < (1 << kKindTagSize));
4219#undef ASSERT_FUNCTION_KIND_IN_RANGE
4222 UntaggedFunction::Kind,
4227 MethodRecognizer::Kind,
4229 kRecognizedTagSize> {};
4231 UntaggedFunction::AsyncModifier,
4235#define DEFINE_BIT(name, _) \
4236 class name##Bit : public BitField<uint32_t, bool, k##name##Bit, 1> {};
4242 enum class EvalFunctionData {
4245 kKernelLibraryIndex,
4248 enum NativeFunctionData {
4254 void set_ic_data_array(
const Array& value)
const;
4255 void set_name(
const String& value)
const;
4256 void set_kind(UntaggedFunction::Kind value)
const;
4257 void set_parent_function(
const Function& value)
const;
4258 FunctionPtr implicit_closure_function()
const;
4259 void set_implicit_closure_function(
const Function& value)
const;
4260 ClosurePtr implicit_static_closure()
const;
4261 void set_implicit_static_closure(
const Closure& closure)
const;
4262 ScriptPtr eval_script()
const;
4263 void set_eval_script(
const Script& value)
const;
4264 void set_num_optional_parameters(intptr_t value)
const;
4265 void set_kind_tag(uint32_t value)
const;
4266 bool is_eval_function()
const;
4268#if !defined(DART_PRECOMPILED_RUNTIME)
4269 ArrayPtr positional_parameter_names()
const {
4270 return untag()->positional_parameter_names();
4272 void set_positional_parameter_names(
const Array& value)
const;
4275 ObjectPtr
data()
const {
return untag()->data<std::memory_order_acquire>(); }
4276 void set_data(
const Object& value)
const;
4278 static FunctionPtr New(Heap::Space space = Heap::kOld);
4304 static constexpr uint8_t kNoAwaiterLinkDepth =
4305 UntaggedClosureData::kNoAwaiterLinkDepth;
4308 ContextScopePtr context_scope()
const {
return untag()->context_scope(); }
4309 void set_context_scope(
const ContextScope& value)
const;
4311 void set_packed_fields(uint32_t value)
const {
4315 Function::AwaiterLink awaiter_link()
const;
4316 void set_awaiter_link(Function::AwaiterLink link)
const;
4321 ClosurePtr implicit_static_closure()
const {
4322 return untag()->closure<std::memory_order_acquire>();
4324 void set_implicit_static_closure(
const Closure& closure)
const;
4327 ClosureDataPtr ptr) {
4328 return ptr->untag()->packed_fields_.Read<PackedInstantiationMode>();
4331 return DefaultTypeArgumentsInstantiationMode(ptr());
4333 void set_default_type_arguments_instantiation_mode(
4334 InstantiationMode value)
const;
4336 static ClosureDataPtr New();
4359 FunctionTypePtr c_signature()
const {
return untag()->c_signature(); }
4360 void set_c_signature(
const FunctionType& value)
const;
4362 FunctionPtr callback_target()
const {
return untag()->callback_target(); }
4363 void set_callback_target(
const Function& value)
const;
4365 InstancePtr callback_exceptional_return()
const {
4366 return untag()->callback_exceptional_return();
4368 void set_callback_exceptional_return(
const Instance& value)
const;
4373 void set_ffi_function_kind(FfiCallbackKind kind)
const;
4375 int32_t callback_id()
const {
return untag()->callback_id_; }
4376 void set_callback_id(int32_t value)
const;
4378 static FfiTrampolineDataPtr New();
4390 FieldPtr Original()
const;
4401 return !
untag()->owner()->IsField();
4406 FieldPtr CloneFromOriginal()
const;
4409 StringPtr UserVisibleName()
const;
4410 const char* UserVisibleNameCString()
const;
4414 return LoadNonPointer<uint16_t, std::memory_order_acquire>(
4415 &
untag()->kind_bits_);
4418 bool is_static()
const {
return StaticBit::decode(kind_bits()); }
4420 bool is_final()
const {
return FinalBit::decode(kind_bits()); }
4421 bool is_const()
const {
return ConstBit::decode(kind_bits()); }
4422 bool is_late()
const {
return IsLateBit::decode(kind_bits()); }
4424 return IsExtensionMemberBit::decode(kind_bits());
4427 return IsExtensionTypeMemberBit::decode(kind_bits());
4430 return NeedsLoadGuardBit::decode(kind_bits());
4436 set_kind_bits(ReflectableBit::update(
value,
untag()->kind_bits_));
4440 return InitializerChangedAfterInitializationBit::decode(kind_bits());
4444 set_kind_bits(InitializerChangedAfterInitializationBit::update(
4448 bool has_pragma()
const {
return HasPragmaBit::decode(kind_bits()); }
4451 set_kind_bits(HasPragmaBit::update(
value,
untag()->kind_bits_));
4457 set_kind_bits(CovariantBit::update(
value,
untag()->kind_bits_));
4461 return GenericCovariantImplBit::decode(kind_bits());
4465 set_kind_bits(GenericCovariantImplBit::update(
value,
untag()->kind_bits_));
4469#if defined(DART_PRECOMPILED_RUNTIME)
4472 return untag()->kernel_offset_;
4477#if defined(DART_PRECOMPILED_RUNTIME)
4481 StoreNonPointer(&
untag()->kernel_offset_,
value);
4485 void InheritKernelOffsetFrom(
const Field& src)
const;
4487 TypedDataViewPtr KernelLibrary()
const;
4488 intptr_t KernelLibraryOffset()
const;
4489 intptr_t KernelLibraryIndex()
const;
4492 inline void SetOffset(intptr_t host_offset_in_bytes,
4493 intptr_t target_offset_in_bytes)
const;
4495 inline intptr_t HostOffset()
const;
4500 inline intptr_t TargetOffset()
const;
4501 static inline intptr_t TargetOffsetOf(FieldPtr field);
4503 ObjectPtr StaticConstFieldValue()
const;
4504 void SetStaticConstFieldValue(
const Instance& value,
4505 bool assert_initializing_store =
true)
const;
4508 void SetStaticValue(
const Object& value)
const;
4510 inline intptr_t field_id()
const;
4511 inline void set_field_id(intptr_t field_id)
const;
4512 inline void set_field_id_unsafe(intptr_t field_id)
const;
4514 ClassPtr Owner()
const;
4515 ScriptPtr
Script()
const;
4516#if !defined(DART_PRECOMPILED_RUNTIME)
4521 uint32_t Hash()
const;
4526 void SetFieldTypeSafe(
const AbstractType& value)
const;
4539 bool is_reflectable,
4546 static FieldPtr NewTopLevel(
const String&
name,
4556 FieldPtr Clone(
const Field& original)
const;
4565 int32_t SourceFingerprint()
const;
4567 StringPtr InitializingExpression()
const;
4570 return HasNontrivialInitializerBit::decode(kind_bits());
4574 bool has_nontrivial_initializer)
const {
4577 set_kind_bits(HasNontrivialInitializerBit::update(
4578 has_nontrivial_initializer,
untag()->kind_bits_));
4582 IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
4583 set_has_nontrivial_initializer_unsafe(has_nontrivial_initializer);
4587 return HasInitializerBit::decode(kind_bits());
4594 HasInitializerBit::update(has_initializer,
untag()->kind_bits_));
4598 IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
4599 set_has_initializer_unsafe(has_initializer);
4603 return has_initializer() && !has_nontrivial_initializer();
4607 return StaticTypeExactnessState::Decode(
4608 LoadNonPointer<int8_t, std::memory_order_relaxed>(
4609 &
untag()->static_type_exactness_state_));
4614 IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
4615 set_static_type_exactness_state_unsafe(
state);
4620 StoreNonPointer<int8_t, int8_t, std::memory_order_relaxed>(
4621 &
untag()->static_type_exactness_state_,
state.Encode());
4631 intptr_t guarded_cid()
const;
4635 IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
4636 set_guarded_cid_unsafe(
cid);
4639 StoreNonPointer<ClassIdTagType, ClassIdTagType, std::memory_order_relaxed>(
4649 intptr_t guarded_list_length()
const;
4650 void set_guarded_list_length_unsafe(intptr_t list_length)
const;
4653 IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
4654 set_guarded_list_length_unsafe(list_length);
4659 intptr_t guarded_list_length_in_object_offset()
const;
4660 void set_guarded_list_length_in_object_offset_unsafe(intptr_t
offset)
const;
4663 IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
4664 set_guarded_list_length_in_object_offset_unsafe(
offset);
4671 const bool r = guarded_list_length() >= Field::kUnknownFixedLength;
4672 ASSERT(!r || is_final());
4676 bool NeedsSetter()
const;
4677 bool NeedsGetter()
const;
4680 return needs_load_guard() || (is_late() && !has_trivial_initializer());
4683 const char* GuardedPropertiesAsCString()
const;
4685 bool is_unboxed()
const {
return UnboxedBit::decode(kind_bits()); }
4690 set_kind_bits(UnboxedBit::update(
b,
untag()->kind_bits_));
4695 IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
4696 set_is_unboxed_unsafe(
b);
4700 kUnknownLengthOffset = -1,
4701 kUnknownFixedLength = -1,
4702 kNoFixedLength = -2,
4706 set_kind_bits(IsLateBit::update(
value,
untag()->kind_bits_));
4710 set_kind_bits(IsExtensionMemberBit::update(
value,
untag()->kind_bits_));
4714 set_kind_bits(IsExtensionTypeMemberBit::update(
value,
untag()->kind_bits_));
4718 set_kind_bits(NeedsLoadGuardBit::update(
value,
untag()->kind_bits_));
4725 bool is_nullable()
const;
4728 IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
4729 set_is_nullable_unsafe(val);
4732 return LoadNonPointer<ClassIdTagType, std::memory_order_relaxed>(
4736 StoreNonPointer<ClassIdTagType, ClassIdTagType, std::memory_order_relaxed>(
4745 void RecordStore(
const Object& value)
const;
4747 void InitializeGuardedListLengthInObjectOffset(
bool unsafe =
false)
const;
4753 WeakArrayPtr dependent_code()
const;
4754 void set_dependent_code(
const WeakArray& array)
const;
4757 void RegisterDependentCode(
const Code& code)
const;
4760 void DeoptimizeDependentCode(
bool are_mutators_stopped =
false)
const;
4764 bool IsConsistentWith(
const Field& field)
const;
4766 bool IsUninitialized()
const;
4776 FunctionPtr EnsureInitializerFunction()
const;
4778 return untag()->initializer_function<std::memory_order_acquire>();
4781 bool HasInitializerFunction()
const;
4788 InstancePtr GetterClosure()
const;
4789 InstancePtr SetterClosure()
const;
4790 InstancePtr AccessorClosure(
bool make_setter)
const;
4793 static StringPtr GetterName(
const String& field_name);
4794 static StringPtr GetterSymbol(
const String& field_name);
4796 static StringPtr LookupGetterSymbol(
const String& field_name);
4797 static StringPtr SetterName(
const String& field_name);
4798 static StringPtr SetterSymbol(
const String& field_name);
4800 static StringPtr LookupSetterSymbol(
const String& field_name);
4801 static StringPtr NameFromGetter(
const String& getter_name);
4802 static StringPtr NameFromSetter(
const String& setter_name);
4803 static StringPtr NameFromInit(
const String& init_name);
4804 static bool IsGetterName(
const String& function_name);
4805 static bool IsSetterName(
const String& function_name);
4806 static bool IsInitName(
const String& function_name);
4814 bool is_reflectable,
4825 kHasNontrivialInitializerBit,
4828 kInitializerChangedAfterInitializationBit,
4831 kGenericCovariantImplBit,
4833 kIsExtensionMemberBit,
4834 kIsExtensionTypeMemberBit,
4838 class ConstBit :
public BitField<uint16_t, bool, kConstBit, 1> {};
4839 class StaticBit :
public BitField<uint16_t, bool, kStaticBit, 1> {};
4840 class FinalBit :
public BitField<uint16_t, bool, kFinalBit, 1> {};
4841 class HasNontrivialInitializerBit
4842 :
public BitField<uint16_t, bool, kHasNontrivialInitializerBit, 1> {};
4843 class UnboxedBit :
public BitField<uint16_t, bool, kUnboxedBit, 1> {};
4844 class ReflectableBit :
public BitField<uint16_t, bool, kReflectableBit, 1> {};
4845 class InitializerChangedAfterInitializationBit
4846 :
public BitField<uint16_t,
4848 kInitializerChangedAfterInitializationBit,
4850 class HasPragmaBit :
public BitField<uint16_t, bool, kHasPragmaBit, 1> {};
4851 class CovariantBit :
public BitField<uint16_t, bool, kCovariantBit, 1> {};
4852 class GenericCovariantImplBit
4853 :
public BitField<uint16_t, bool, kGenericCovariantImplBit, 1> {};
4854 class IsLateBit :
public BitField<uint16_t, bool, kIsLateBit, 1> {};
4855 class IsExtensionMemberBit
4856 :
public BitField<uint16_t, bool, kIsExtensionMemberBit, 1> {};
4857 class IsExtensionTypeMemberBit
4858 :
public BitField<uint16_t, bool, kIsExtensionTypeMemberBit, 1> {};
4859 class NeedsLoadGuardBit
4860 :
public BitField<uint16_t, bool, kNeedsLoadGuardBit, 1> {};
4861 class HasInitializerBit
4862 :
public BitField<uint16_t, bool, kHasInitializerBit, 1> {};
4865 void ForceDynamicGuardedCidAndLength()
const;
4867 void set_name(
const String& value)
const;
4868 void set_is_static(
bool is_static)
const {
4870 set_kind_bits(StaticBit::update(is_static,
untag()->kind_bits_));
4872 void set_is_final(
bool is_final)
const {
4874 set_kind_bits(FinalBit::update(is_final,
untag()->kind_bits_));
4876 void set_is_const(
bool value)
const {
4878 set_kind_bits(ConstBit::update(value,
untag()->kind_bits_));
4880 void set_owner(
const Object& value)
const {
untag()->set_owner(
value.ptr()); }
4881 void set_token_pos(TokenPosition token_pos)
const {
4882 StoreNonPointer(&
untag()->token_pos_, token_pos);
4884 void set_end_token_pos(TokenPosition token_pos)
const {
4885 StoreNonPointer(&
untag()->end_token_pos_, token_pos);
4887 void set_kind_bits(uint16_t value)
const {
4888 StoreNonPointer<uint16_t, uint16_t, std::memory_order_release>(
4889 &
untag()->kind_bits_, value);
4892 static FieldPtr New();
4904 void set_url(
const String& value)
const;
4907 StringPtr resolved_url()
const;
4908 bool HasSource()
const;
4909 StringPtr Source()
const;
4910 bool IsPartOfDartColonLibrary()
const;
4912 GrowableObjectArrayPtr GenerateLineNumberArray()
const;
4923#if !defined(DART_PRECOMPILED_RUNTIME)
4926 intptr_t script_index,
4939 TypedDataPtr line_starts()
const;
4941#if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
4942 TypedDataViewPtr constant_coverage()
const;
4945 LibraryPtr FindLibrary()
const;
4946 StringPtr GetLine(intptr_t line_number,
Heap::Space space = Heap::kNew)
const;
4947 StringPtr GetSnippet(intptr_t from_line,
4948 intptr_t from_column,
4950 intptr_t to_column)
const;
4961 intptr_t* column =
nullptr)
const;
4965 intptr_t GetTokenLength(
const TokenPosition& token_pos)
const;
4970 bool TokenRangeAtLine(intptr_t line_number,
4980 static ScriptPtr New(
const String& url,
4981 const String& resolved_url,
4984#if !defined(DART_PRECOMPILED_RUNTIME)
4985 void LoadSourceFromKernel(
const uint8_t* kernel_buffer,
4986 intptr_t kernel_buffer_len)
const;
4989 void CollectTokenPositionsFor()
const;
4990 ArrayPtr CollectConstConstructorCoverageFrom()
const;
4993 KernelProgramInfoPtr kernel_program_info()
const {
4994 return untag()->kernel_program_info();
4997 void set_debug_positions(
const Array& value)
const;
4999#if !defined(DART_PRECOMPILED_RUNTIME)
5000 bool HasCachedMaxPosition()
const;
5002 void SetHasCachedMaxPosition(
bool value)
const;
5003 void SetCachedMaxPosition(intptr_t value)
const;
5006 void set_resolved_url(
const String& value)
const;
5007 void set_source(
const String& value)
const;
5008 void set_load_timestamp(int64_t value)
const;
5009 ArrayPtr debug_positions()
const;
5026 void MoveToNextObject();
5028 const Array& array_;
5046 IterationKind kind = kNoIteratePrivate);
5049 return (next_ix_ < size_) || !toplevel_class_.IsNull();
5053 ClassPtr GetNextClass();
5056 void MoveToNextClass();
5058 Class& toplevel_class_;
5069 static StringPtr
UrlOf(LibraryPtr lib) {
return lib->untag()->url(); }
5072 return untag()->load_state_ == UntaggedLibrary::kAllocated;
5075 return untag()->load_state_ == UntaggedLibrary::kLoadRequested;
5078 return untag()->load_state_ == UntaggedLibrary::kLoadInProgress;
5080 void SetLoadRequested()
const;
5081 void SetLoadInProgress()
const;
5083 return untag()->load_state_ == UntaggedLibrary::kLoaded;
5085 void SetLoaded()
const;
5088 void set_loading_unit(
const LoadingUnit& value)
const;
5094 static LibraryPtr New(
const String& url);
5097 const Array& arguments,
5098 const Array& argument_names,
5099 bool respect_reflectable =
true,
5100 bool check_is_entrypoint =
false)
const;
5102 bool throw_nsm_if_absent,
5103 bool respect_reflectable =
true,
5104 bool check_is_entrypoint =
false)
const;
5107 bool respect_reflectable =
true,
5108 bool check_is_entrypoint =
false)
const;
5117 const Array& type_definitions,
5118 const Array& param_values,
5126 void AddClass(
const Class& cls)
const;
5132 LibraryPrefixPtr LookupLocalLibraryPrefix(
const String&
name)
const;
5135 ClassPtr LookupClass(
const String&
name)
const;
5136 ClassPtr LookupClassAllowPrivate(
const String&
name)
const;
5137 FieldPtr LookupFieldAllowPrivate(
const String&
name)
const;
5138 FunctionPtr LookupFunctionAllowPrivate(
const String&
name)
const;
5146 ScriptPtr LookupScript(
const String& url,
bool useResolvedUri =
false)
const;
5147 ArrayPtr LoadedScripts()
const;
5149 void AddExport(
const Namespace& ns)
const;
5151 void AddMetadata(
const Object& declaration, intptr_t kernel_offset)
const;
5154#if !defined(DART_PRECOMPILED_RUNTIME)
5155 void EvaluatePragmas();
5156 void CopyPragmas(
const Library& old_lib);
5172 static bool FindPragma(
Thread*
T,
5175 const String& pragma_name,
5176 bool multiple =
false,
5180 void set_toplevel_class(
const Class& value)
const;
5183 return untag()->used_scripts();
5189 void AddImport(
const Namespace& ns)
const;
5191 NamespacePtr ImportAt(intptr_t index)
const;
5192 LibraryPtr ImportLibraryAt(intptr_t index)
const;
5195 void set_dependencies(
const Array& deps)
const;
5197 void DropDependenciesAndCaches()
const;
5201 return LoadNonPointer<Dart_NativeEntryResolver, std::memory_order_relaxed>(
5202 &
untag()->native_entry_resolver_);
5206 std::memory_order_relaxed>(&
untag()->native_entry_resolver_,
5210 return LoadNonPointer<Dart_NativeEntrySymbol, std::memory_order_relaxed>(
5211 &
untag()->native_entry_symbol_resolver_);
5216 std::memory_order_relaxed>(
5217 &
untag()->native_entry_symbol_resolver_, native_symbol_resolver);
5222 return LoadNonPointer<Dart_FfiNativeResolver, std::memory_order_relaxed>(
5223 &
untag()->ffi_native_resolver_);
5227 std::memory_order_relaxed>(&
untag()->ffi_native_resolver_,
5232 return UntaggedLibrary::InFullSnapshotBit::decode(
untag()->flags_);
5236 UntaggedLibrary::InFullSnapshotBit::update(
value,
untag()->flags_));
5239 StringPtr PrivateName(
const String&
name)
const;
5244 ((
value >= 0) && (
value < std::numeric_limits<classid_t>::max())));
5249 static void RegisterLibraries(
Thread* thread,
5253 return UntaggedLibrary::DebuggableBit::decode(
untag()->flags_);
5256 set_flags(UntaggedLibrary::DebuggableBit::update(
value,
untag()->flags_));
5260 return UntaggedLibrary::DartSchemeBit::decode(
untag()->flags_);
5263 set_flags(UntaggedLibrary::DartSchemeBit::update(
value,
untag()->flags_));
5267 bool IsAnyCoreLibrary()
const;
5269 inline intptr_t UrlHash()
const;
5271#if !defined(DART_PRECOMPILED_RUNTIME)
5273 return untag()->kernel_program_info();
5276 TypedDataViewPtr KernelLibrary()
const;
5277 intptr_t KernelLibraryOffset()
const;
5281#if defined(DART_PRECOMPILED_RUNTIME)
5284 return untag()->kernel_library_index_;
5289#if defined(DART_PRECOMPILED_RUNTIME)
5293 StoreNonPointer(&
untag()->kernel_library_index_,
value);
5297 static LibraryPtr LookupLibrary(
Thread* thread,
const String& url);
5298 static LibraryPtr GetLibrary(intptr_t index);
5300 static void InitCoreLibrary(
IsolateGroup* isolate_group);
5301 static void InitNativeWrappersLibrary(
IsolateGroup* isolate_group,
5302 bool is_kernel_file);
5304 static LibraryPtr AsyncLibrary();
5305 static LibraryPtr ConvertLibrary();
5306 static LibraryPtr CoreLibrary();
5307 static LibraryPtr CollectionLibrary();
5308 static LibraryPtr DeveloperLibrary();
5309 static LibraryPtr FfiLibrary();
5310 static LibraryPtr InternalLibrary();
5311 static LibraryPtr IsolateLibrary();
5312 static LibraryPtr MathLibrary();
5313#if !defined(DART_PRECOMPILED_RUNTIME)
5314 static LibraryPtr MirrorsLibrary();
5316 static LibraryPtr NativeWrappersLibrary();
5317 static LibraryPtr TypedDataLibrary();
5318 static LibraryPtr VMServiceLibrary();
5321 static ErrorPtr CompileAll(
bool ignore_error =
false);
5322#if !defined(DART_PRECOMPILED_RUNTIME)
5324 static ErrorPtr FinalizeAllClasses();
5327#if defined(DEBUG) && !defined(DART_PRECOMPILED_RUNTIME)
5330 static void CheckFunctionFingerprints();
5336 static const String& PrivateCoreLibName(
const String& member);
5339 static bool IsPrivateCoreLibName(
const String&
name,
const String& member);
5343 static ClassPtr LookupCoreClass(
const String& class_name);
5347 const char* class_name,
5348 const char* function_name);
5351 static const char kPrivateIdentifierStart =
'_';
5355 static const char kPrivateKeySeparator =
'@';
5357 void CheckReload(
const Library& replacement,
5366 void EnsureTopLevelClassIsFinalized()
const;
5369 static constexpr int kInitialImportsCapacity = 4;
5370 static constexpr int kImportsCapacityIncrement = 8;
5372 static LibraryPtr New();
5377 void set_url(
const String& url)
const;
5378 void set_private_key(
const String&
key)
const;
5380 void set_num_imports(intptr_t value)
const;
5381 void set_flags(uint8_t
flags)
const;
5382 bool HasExports()
const;
5383 ArrayPtr loaded_scripts()
const {
return untag()->loaded_scripts(); }
5384 ArrayPtr metadata()
const {
5386 IsolateGroup::Current()->program_lock()->IsCurrentThreadReader());
5387 return untag()->metadata();
5389 void set_metadata(
const Array& value)
const;
5390 ArrayPtr dictionary()
const {
return untag()->dictionary(); }
5391 void InitClassDictionary()
const;
5393 void InitImportList()
const;
5394 void RehashDictionary(
const Array& old_dict, intptr_t new_dict_size)
const;
5395 static LibraryPtr NewLibraryHelper(
const String& url,
bool import_core_lib);
5396 ObjectPtr LookupEntry(
const String&
name, intptr_t* index)
const;
5397 ObjectPtr LookupLocalObject(
const String&
name)
const;
5398 ObjectPtr LookupLocalObjectAllowPrivate(
const String&
name)
const;
5400 void AllocatePrivateKey()
const;
5432 static NamespacePtr New(
const Library& library,
5433 const Array& show_names,
5434 const Array& hide_names,
5438 static NamespacePtr New();
5447 static KernelProgramInfoPtr New(
const TypedDataBase& kernel_component,
5455 const Array& libraries_cache,
5456 const Array& classes_cache);
5465 return untag()->kernel_component();
5472 return untag()->metadata_payloads();
5476 return untag()->metadata_mappings();
5479 intptr_t KernelLibraryStartOffset(intptr_t library_index)
const;
5480 intptr_t KernelLibraryEndOffset(intptr_t library_index)
const;
5481 TypedDataViewPtr KernelLibrary(intptr_t library_index)
const;
5484 return untag()->constants_table();
5493 void set_constants(
const Array& constants)
const;
5495 ScriptPtr ScriptAt(intptr_t index)
const;
5498 void set_libraries_cache(
const Array& cache)
const;
5499 LibraryPtr LookupLibrary(
Thread* thread,
const Smi& name_index)
const;
5500 LibraryPtr InsertLibrary(
Thread* thread,
5501 const Smi& name_index,
5505 void set_classes_cache(
const Array& cache)
const;
5506 ClassPtr LookupClass(
Thread* thread,
const Smi& name_index)
const;
5507 ClassPtr InsertClass(
Thread* thread,
5508 const Smi& name_index,
5509 const Class& klass)
const;
5512 static KernelProgramInfoPtr New();
5534 : obj_(obj), type_(
EntryType::kTaggedObject) {}
5556 sizeof(UntaggedObjectPool::Entry) * index;
5561 return ObjectPool::data_offset();
5564 static constexpr intptr_t kElementSize =
sizeof(UntaggedObjectPool::Entry);
5568 ASSERT((index >= 0) && (index <= Length()));
5569 return TypeBits::decode(
untag()->entry_bits()[index]);
5573 ASSERT((index >= 0) && (index <= Length()));
5574 return PatchableBit::decode(
untag()->entry_bits()[index]);
5578 ASSERT((index >= 0) && (index <= Length()));
5579 return SnapshotBehaviorBits::decode(
untag()->entry_bits()[index]);
5585 return PatchableBit::encode(patchable) | TypeBits::encode(
type) |
5586 SnapshotBehaviorBits::encode(snapshot_behavior);
5593 ASSERT(index >= 0 && index <= Length());
5594 const uint8_t bits = EncodeBits(
type, patchable, snapshot_behavior);
5595 StoreNonPointer(&
untag()->entry_bits()[index], bits);
5598 template <std::memory_order order = std::memory_order_relaxed>
5600 ASSERT(TypeAt(index) == EntryType::kTaggedObject);
5601 return LoadPointer<ObjectPtr, order>(&(EntryAddr(index)->raw_obj_));
5604 template <std::memory_order order = std::memory_order_relaxed>
5606 ASSERT((TypeAt(index) == EntryType::kTaggedObject) ||
5607 (TypeAt(index) == EntryType::kImmediate && obj.IsSmi()));
5608 StorePointer<ObjectPtr, order>(&EntryAddr(index)->raw_obj_, obj.
ptr());
5612 ASSERT(TypeAt(index) != EntryType::kTaggedObject);
5613 return EntryAddr(index)->raw_value_;
5616 ASSERT(TypeAt(index) != EntryType::kTaggedObject);
5617 StoreNonPointer(&EntryAddr(index)->raw_value_, raw_value);
5626 static constexpr intptr_t kBytesPerElement =
5627 sizeof(UntaggedObjectPool::Entry) +
sizeof(uint8_t);
5628 static constexpr intptr_t kMaxElements = kSmiMax / kBytesPerElement;
5634 ASSERT(0 <= len && len <= kMaxElements);
5636 (len * kBytesPerElement));
5639 static ObjectPoolPtr NewFromBuilder(
5641 static ObjectPoolPtr New(intptr_t len);
5650#if defined(DART_PRECOMPILER)
5652 compiler::target::ObjectPool::element_offset(0)) /
5653 compiler::target::kWordSize;
5663 void DebugPrint()
const;
5666 UntaggedObjectPool::Entry
const* EntryAddr(intptr_t index)
const {
5667 ASSERT((index >= 0) && (index < Length()));
5668 return &
untag()->data()[index];
5682 kFlagsPos = kSizePos + kSizeSize,
5686#define INSTRUCTIONS_FLAGS_LIST(V) \
5687 V(HasMonomorphicEntry) \
5691#define DEFINE_INSTRUCTIONS_FLAG(Name) k##Name##Index,
5693#undef DEFINE_INSTRUCTIONS_FLAG
5698#define DEFINE_INSTRUCTIONS_FLAG_HANDLING(Name) \
5700 : public BitField<uint32_t, bool, kFlagsPos + k##Name##Index, 1> {}; \
5701 bool Name() const { return Name##Bit::decode(untag()->size_and_flags_); } \
5702 static bool Name(const InstructionsPtr instr) { \
5703 return Name##Bit::decode(instr->untag()->size_and_flags_); \
5708#undef DEFINE_INSTRUCTIONS_FLAG_HANDLING
5711 intptr_t
Size()
const {
return SizeBits::decode(
untag()->size_and_flags_); }
5712 static intptr_t
Size(
const InstructionsPtr instr) {
5713 return SizeBits::decode(instr->untag()->size_and_flags_);
5720 return reinterpret_cast<uword>(instr->untag()) + HeaderSize();
5725#if defined(TARGET_ARCH_IA32)
5726 static constexpr intptr_t kMonomorphicEntryOffsetJIT = 6;
5727 static constexpr intptr_t kPolymorphicEntryOffsetJIT = 36;
5728 static constexpr intptr_t kMonomorphicEntryOffsetAOT = 0;
5729 static constexpr intptr_t kPolymorphicEntryOffsetAOT = 0;
5730#elif defined(TARGET_ARCH_X64)
5731 static constexpr intptr_t kMonomorphicEntryOffsetJIT = 8;
5732 static constexpr intptr_t kPolymorphicEntryOffsetJIT = 42;
5733 static constexpr intptr_t kMonomorphicEntryOffsetAOT = 8;
5734 static constexpr intptr_t kPolymorphicEntryOffsetAOT = 22;
5735#elif defined(TARGET_ARCH_ARM)
5736 static constexpr intptr_t kMonomorphicEntryOffsetJIT = 0;
5737 static constexpr intptr_t kPolymorphicEntryOffsetJIT = 44;
5738 static constexpr intptr_t kMonomorphicEntryOffsetAOT = 0;
5739 static constexpr intptr_t kPolymorphicEntryOffsetAOT = 16;
5740#elif defined(TARGET_ARCH_ARM64)
5741 static constexpr intptr_t kMonomorphicEntryOffsetJIT = 8;
5742 static constexpr intptr_t kPolymorphicEntryOffsetJIT = 52;
5743 static constexpr intptr_t kMonomorphicEntryOffsetAOT = 8;
5744 static constexpr intptr_t kPolymorphicEntryOffsetAOT = 24;
5745#elif defined(TARGET_ARCH_RISCV32)
5746 static constexpr intptr_t kMonomorphicEntryOffsetJIT = 6;
5747 static constexpr intptr_t kPolymorphicEntryOffsetJIT = 44;
5748 static constexpr intptr_t kMonomorphicEntryOffsetAOT = 6;
5749 static constexpr intptr_t kPolymorphicEntryOffsetAOT = 18;
5750#elif defined(TARGET_ARCH_RISCV64)
5751 static constexpr intptr_t kMonomorphicEntryOffsetJIT = 6;
5752 static constexpr intptr_t kPolymorphicEntryOffsetJIT = 44;
5753 static constexpr intptr_t kMonomorphicEntryOffsetAOT = 6;
5754 static constexpr intptr_t kPolymorphicEntryOffsetAOT = 18;
5756#error Missing entry offsets for current architecture
5760 uword entry = PayloadStart(instr);
5761 if (HasMonomorphicEntry(instr)) {
5762 entry += !FLAG_precompiled_mode ? kMonomorphicEntryOffsetJIT
5763 : kMonomorphicEntryOffsetAOT;
5769 uword entry = PayloadStart(instr);
5770 if (HasMonomorphicEntry(instr)) {
5771 entry += !FLAG_precompiled_mode ? kPolymorphicEntryOffsetJIT
5772 : kPolymorphicEntryOffsetAOT;
5777 static constexpr intptr_t kMaxElements =
5779 (2 * kObjectStartAlignment)));
5786 static constexpr intptr_t kBarePayloadAlignment = 4;
5790 static constexpr intptr_t kNonBarePayloadAlignment =
kWordSize;
5797#if defined(DART_PRECOMPILED_RUNTIME)
5801 kNonBarePayloadAlignment);
5811#if defined(DART_PRECOMPILED_RUNTIME)
5814 return RoundedAllocationSize(HeaderSize() + size);
5818#if defined(DART_PRECOMPILED_RUNTIME)
5821 return static_cast<InstructionsPtr
>(payload_start - HeaderSize() +
5829 static bool Equals(InstructionsPtr
a, InstructionsPtr
b) {
5838 if (
a->untag()->size_and_flags_ !=
b->untag()->size_and_flags_) {
5842 return memcmp(
a->untag()->data(),
b->untag()->data(), Size(
a)) == 0;
5847 static uint32_t
Hash(
const InstructionsPtr instr) {
5848 return HashBytes(
reinterpret_cast<const uint8_t*
>(PayloadStart(instr)),
5856 friend struct RelocatorTestHelper;
5858 void SetSize(intptr_t value)
const {
5860 StoreNonPointer(&
untag()->size_and_flags_,
5861 SizeBits::update(value,
untag()->size_and_flags_));
5864#define DEFINE_INSTRUCTIONS_FLAG_HANDLING(Name) \
5865 void Set##Name(bool value) const { \
5866 StoreNonPointer(&untag()->size_and_flags_, \
5867 Name##Bit::update(value, untag()->size_and_flags_)); \
5872#undef DEFINE_INSTRUCTIONS_FLAG_HANDLING
5878 static InstructionsPtr New(intptr_t size,
5879 bool has_monomorphic_entry,
5880 bool should_be_aligned);
5885 friend class AssemblyImageWriter;
5903 static intptr_t
Size(
const InstructionsSectionPtr instr) {
5904 return instr->untag()->payload_length_;
5913 return Utils::RoundUp(HeaderSize() + size, kObjectAlignment);
5916 static constexpr intptr_t kPayloadAlignment = 32;
5918 static_assert(Instructions::kBarePayloadAlignment <= kPayloadAlignment);
5944 static InstructionsTablePtr New(intptr_t
length,
5949 void SetCodeAt(intptr_t index, CodePtr code)
const;
5952 static bool ContainsPc(InstructionsTablePtr
table,
uword pc);
5954 static CodePtr FindCode(InstructionsTablePtr
table,
uword pc);
5960 InstructionsTablePtr
table);
5962 const UntaggedInstructionsTable::Data*
rodata()
const {
5963 return ptr()->untag()->rodata_;
5968 return InstructionsTable::PayloadStartAt(this->ptr(), index);
5973 uword EntryPointAt(intptr_t index)
const;
5976 uword start_pc()
const {
return InstructionsTable::start_pc(this->ptr()); }
5977 static uword start_pc(InstructionsTablePtr
table) {
5978 return table->untag()->start_pc_;
5981 uword end_pc()
const {
return InstructionsTable::end_pc(this->ptr()); }
5982 static uword end_pc(InstructionsTablePtr
table) {
5983 return table->untag()->end_pc_;
5986 ArrayPtr code_objects()
const {
return untag()->code_objects_; }
5988 void set_length(intptr_t value)
const;
5989 void set_start_pc(uword value)
const;
5990 void set_end_pc(uword value)
const;
5991 void set_code_objects(
const Array& value)
const;
5992 void set_rodata(uword rodata)
const;
5994 uint32_t ConvertPcToOffset(uword pc)
const {
5995 return InstructionsTable::ConvertPcToOffset(this->ptr(), pc);
5997 static uint32_t ConvertPcToOffset(InstructionsTablePtr
table, uword pc);
5999 static intptr_t FindEntry(InstructionsTablePtr
table,
6001 intptr_t start_index = 0);
6010 intptr_t Length()
const;
6012 StringPtr GetName(intptr_t var_index)
const;
6014 void SetVar(intptr_t var_index,
6018 void GetInfo(intptr_t var_index,
6021 static constexpr intptr_t kBytesPerElement =
6023 static constexpr intptr_t kMaxElements =
6024 UntaggedLocalVarDescriptors::kMaxIndex;
6032 ASSERT(0 <= len && len <= kMaxElements);
6033 return RoundedAllocationSize(
6039 static LocalVarDescriptorsPtr New(intptr_t num_variables);
6041 static const char* KindToCString(
6052 static constexpr intptr_t kBytesPerElement = 1;
6053 static constexpr intptr_t kMaxElements =
kMaxInt32 / kBytesPerElement;
6057 return UnroundedSize(desc->untag()->length_);
6066 ASSERT(0 <= len && len <= kMaxElements);
6067 return RoundedAllocationSize(UnroundedSize(len));
6070 static PcDescriptorsPtr New(
const void* delta_encoded_data, intptr_t size);
6077 void PrintToJSONObject(
JSONObject* jsobj,
bool ref)
const;
6086 : descriptors_(descriptors),
6087 kind_mask_(kind_mask),
6098 ReadStream stream(descriptors_.untag()->data(), descriptors_.Length(),
6101 while (byte_index_ < descriptors_.Length()) {
6102 const int32_t kind_and_metadata = stream.ReadSLEB128<int32_t>();
6103 cur_kind_ = UntaggedPcDescriptors::KindAndMetadata::DecodeKind(
6105 cur_try_index_ = UntaggedPcDescriptors::KindAndMetadata::DecodeTryIndex(
6108 UntaggedPcDescriptors::KindAndMetadata::DecodeYieldIndex(
6111 cur_pc_offset_ += stream.ReadSLEB128();
6113 if (!FLAG_precompiled_mode) {
6114 cur_deopt_id_ += stream.ReadSLEB128();
6115 cur_token_pos_ = Utils::AddWithWrapAround(
6116 cur_token_pos_, stream.ReadSLEB128<int32_t>());
6118 byte_index_ = stream.Position();
6120 if ((cur_kind_ & kind_mask_) != 0) {
6128 intptr_t
DeoptId()
const {
return cur_deopt_id_; }
6130 return TokenPosition::Deserialize(cur_token_pos_);
6144 descriptors_(iter.descriptors_),
6145 kind_mask_(iter.kind_mask_),
6146 byte_index_(iter.byte_index_),
6147 cur_pc_offset_(iter.cur_pc_offset_),
6148 cur_kind_(iter.cur_kind_),
6149 cur_deopt_id_(iter.cur_deopt_id_),
6150 cur_token_pos_(iter.cur_token_pos_),
6151 cur_try_index_(iter.cur_try_index_),
6152 cur_yield_index_(iter.cur_yield_index_) {}
6155 const intptr_t kind_mask_;
6156 intptr_t byte_index_;
6158 intptr_t cur_pc_offset_;
6160 intptr_t cur_deopt_id_;
6161 int32_t cur_token_pos_;
6162 intptr_t cur_try_index_;
6163 intptr_t cur_yield_index_;
6166 intptr_t Length()
const;
6168 if (Length() != other.
Length()) {
6172 return memcmp(
untag()->data(), other.untag()->data(), Length()) == 0;
6182 static PcDescriptorsPtr New(intptr_t
length);
6184 void SetLength(intptr_t value)
const;
6185 void CopyData(
const void* bytes, intptr_t size);
6194 static constexpr intptr_t kBytesPerElement = 1;
6195 static constexpr intptr_t kMaxElements =
kMaxInt32 / kBytesPerElement;
6199 return UnroundedSize(map->untag()->length_);
6208 ASSERT(0 <= len && len <= kMaxElements);
6209 return RoundedAllocationSize(UnroundedSize(len));
6212 static CodeSourceMapPtr New(intptr_t
length);
6215 uint8_t*
Data()
const {
return UnsafeMutableNonPointer(&
untag()->data()[0]); }
6218 if (Length() != other.
Length()) {
6222 return memcmp(
untag()->data(), other.untag()->data(), Length()) == 0;
6233 void SetLength(intptr_t value)
const;
6244 return UntaggedCompressedStackMaps::SizeField::decode(
6245 raw->untag()->payload()->flags_and_size());
6248 const uint8_t*
data()
const {
return ptr()->untag()->payload()->data(); }
6253 if (
untag()->payload()->flags_and_size() !=
6254 other.untag()->payload()->flags_and_size()) {
6258 return memcmp(data(), other.
data(), payload_size()) == 0;
6267 return UnroundedSize(CompressedStackMaps::PayloadSizeOf(maps));
6270 return HeaderSize() +
length;
6274 return RoundedAllocationSize(UnroundedSize(
length));
6279 return UntaggedCompressedStackMaps::UsesTableBit::decode(
6280 raw->untag()->payload()->flags_and_size());
6285 return UntaggedCompressedStackMaps::GlobalTableBit::decode(
6286 raw->untag()->payload()->flags_and_size());
6289 static CompressedStackMapsPtr
NewInlined(
const void* payload, intptr_t size) {
6290 return New(payload, size,
false,
6295 return New(payload, size,
false,
6301 return New(payload, size,
true,
6314 bool IsNull()
const {
return payload_ ==
nullptr; }
6324 payload_ = maps.untag()->payload();
6329 ASSERT(maps != CompressedStackMaps::null());
6330 payload_ = maps.untag()->payload();
6335 return UntaggedCompressedStackMaps::SizeField::decode(
6336 payload()->flags_and_size());
6338 const uint8_t*
data()
const {
return payload()->data(); }
6341 return UntaggedCompressedStackMaps::UsesTableBit::decode(
6342 payload()->flags_and_size());
6346 return UntaggedCompressedStackMaps::GlobalTableBit::decode(
6347 payload()->flags_and_size());
6354 template <
typename PayloadHandle>
6357 Iterator(
const PayloadHandle& maps,
const PayloadHandle& global_table)
6359 bits_container_(maps.UsesGlobalTable() ? global_table : maps) {
6361 ASSERT(!bits_container_.IsNull());
6362 ASSERT(!maps_.IsGlobalTable());
6363 ASSERT(!maps_.UsesGlobalTable() || bits_container_.IsGlobalTable());
6368 bits_container_(it.bits_container_),
6369 next_offset_(it.next_offset_),
6370 current_pc_offset_(it.current_pc_offset_),
6371 current_global_table_offset_(it.current_global_table_offset_),
6372 current_spill_slot_bit_count_(it.current_spill_slot_bit_count_),
6373 current_non_spill_slot_bit_count_(it.current_spill_slot_bit_count_),
6374 current_bits_offset_(it.current_bits_offset_) {}
6379 if (next_offset_ >= maps_.payload_size()) {
6384 ReadStream stream(maps_.data(), maps_.payload_size(), next_offset_);
6386 auto const pc_delta = stream.ReadLEB128();
6388 current_pc_offset_ += pc_delta;
6395 if (maps_.UsesGlobalTable()) {
6396 current_global_table_offset_ = stream.ReadLEB128();
6397 ASSERT(current_global_table_offset_ < bits_container_.payload_size());
6403 current_spill_slot_bit_count_ = -1;
6404 current_non_spill_slot_bit_count_ = -1;
6405 current_bits_offset_ = -1;
6407 next_offset_ = stream.Position();
6409 current_spill_slot_bit_count_ = stream.ReadLEB128();
6410 ASSERT(current_spill_slot_bit_count_ >= 0);
6412 current_non_spill_slot_bit_count_ = stream.ReadLEB128();
6413 ASSERT(current_non_spill_slot_bit_count_ >= 0);
6415 const auto stackmap_bits =
6416 current_spill_slot_bit_count_ + current_non_spill_slot_bit_count_;
6417 const uintptr_t stackmap_size =
6419 ASSERT(stackmap_size <= (maps_.payload_size() - stream.Position()));
6421 current_bits_offset_ = stream.Position();
6422 next_offset_ = current_bits_offset_ + stackmap_size;
6433 if (pc_offset == 0)
return false;
6435 if (current_pc_offset_ >= pc_offset)
break;
6436 }
while (MoveNext());
6437 return current_pc_offset_ == pc_offset;
6445 ASSERT(HasLoadedEntry());
6446 return current_pc_offset_;
6451 EnsureFullyLoadedEntry();
6452 return current_spill_slot_bit_count_ + current_non_spill_slot_bit_count_;
6456 EnsureFullyLoadedEntry();
6457 return current_spill_slot_bit_count_;
6462 EnsureFullyLoadedEntry();
6463 ASSERT(bit_index >= 0 && bit_index < Length());
6465 const intptr_t bit_remainder = bit_index & (
kBitsPerByte - 1);
6466 uint8_t byte_mask = 1U << bit_remainder;
6467 const intptr_t byte_offset = current_bits_offset_ + byte_index;
6469 return (bits_container_.data()[byte_offset] & byte_mask) != 0;
6473 bool HasLoadedEntry()
const {
return next_offset_ > 0; }
6477 void LazyLoadGlobalTableEntry()
const {
6478 ASSERT(maps_.UsesGlobalTable());
6479 ASSERT(HasLoadedEntry());
6480 ASSERT(current_global_table_offset_ < bits_container_.payload_size());
6483 ReadStream stream(bits_container_.data(), bits_container_.payload_size(),
6484 current_global_table_offset_);
6486 current_spill_slot_bit_count_ = stream.ReadLEB128();
6487 ASSERT(current_spill_slot_bit_count_ >= 0);
6489 current_non_spill_slot_bit_count_ = stream.ReadLEB128();
6490 ASSERT(current_non_spill_slot_bit_count_ >= 0);
6492 const auto stackmap_bits = Length();
6493 const uintptr_t stackmap_size =
6496 (bits_container_.payload_size() - stream.Position()));
6498 current_bits_offset_ = stream.Position();
6501 void EnsureFullyLoadedEntry()
const {
6502 ASSERT(HasLoadedEntry());
6503 if (current_spill_slot_bit_count_ < 0) {
6504 LazyLoadGlobalTableEntry();
6505 ASSERT(current_spill_slot_bit_count_ >= 0);
6509 const PayloadHandle& maps_;
6510 const PayloadHandle& bits_container_;
6512 uintptr_t next_offset_ = 0;
6513 uint32_t current_pc_offset_ = 0;
6515 uintptr_t current_global_table_offset_ = 0;
6519 mutable intptr_t current_spill_slot_bit_count_ = -1;
6520 mutable intptr_t current_non_spill_slot_bit_count_ = -1;
6521 mutable intptr_t current_bits_offset_ = -1;
6533 const char* separator)
const;
6536 static CompressedStackMapsPtr New(
const void* payload,
6538 bool is_global_table,
6539 bool uses_global_table);
6547 static constexpr intptr_t kInvalidPcOffset = 0;
6549 intptr_t num_entries()
const;
6551 bool has_async_handler()
const;
6552 void set_has_async_handler(
bool value)
const;
6556 uword HandlerPCOffset(intptr_t try_index)
const;
6557 intptr_t OuterTryIndex(intptr_t try_index)
const;
6558 bool NeedsStackTrace(intptr_t try_index)
const;
6559 bool IsGenerated(intptr_t try_index)
const;
6561 void SetHandlerInfo(intptr_t try_index,
6562 intptr_t outer_try_index,
6563 uword handler_pc_offset,
6564 bool needs_stacktrace,
6566 bool is_generated)
const;
6568 ArrayPtr GetHandledTypes(intptr_t try_index)
const;
6569 void SetHandledTypes(intptr_t try_index,
const Array& handled_types)
const;
6570 bool HasCatchAll(intptr_t try_index)
const;
6589 static ExceptionHandlersPtr New(intptr_t num_handlers);
6590 static ExceptionHandlersPtr New(
const Array& handled_types_data);
6603 static constexpr intptr_t kMaxHandlers = 1024 * 1024;
6605 void set_handled_types_data(
const Array& value)
const;
6637 return obj->
untag()->target();
6641#if defined(DART_PRECOMPILER)
6642 if (obj->IsHeapObject() && obj->IsWeakSerializationReference()) {
6643 return TargetOf(
static_cast<WeakSerializationReferencePtr
>(obj));
6670 intptr_t
Length()
const {
return LengthOf(ptr()); }
6671 static inline intptr_t LengthOf(
const WeakArrayPtr array);
6681 kBytesPerElement * index;
6684 intptr_t index = (offset_in_bytes - data_offset()) / kBytesPerElement;
6692 static constexpr intptr_t kElementSize = kCompressedWordSize;
6702 return untag()->element<std::memory_order_acquire>(index);
6705 untag()->set_element<std::memory_order_release>(index,
value.ptr());
6708 static constexpr intptr_t kBytesPerElement = kCompressedWordSize;
6709 static constexpr intptr_t kMaxElements = kSmiMax / kBytesPerElement;
6723 (len * kBytesPerElement));
6738#if defined(DART_PRECOMPILED_RUNTIME)
6742 return untag()->active_instructions();
6749 return code->untag()->instructions();
6755#if !defined(DART_PRECOMPILED_RUNTIME)
6763 static const char* EntryKindToCString(
EntryKind kind);
6764 static bool ParseEntryKind(
const char* str,
EntryKind* out);
6768 case EntryKind::kNormal:
6770 case EntryKind::kUnchecked:
6772 case EntryKind::kMonomorphic:
6774 case EntryKind::kMonomorphicUnchecked:
6787 return PtrOffBits::decode(
untag()->state_bits_);
6791 return OptimizedBit::decode(
untag()->state_bits_);
6793 void set_is_optimized(
bool value)
const;
6795 return Code::OptimizedBit::decode(code->untag()->state_bits_);
6799 return ForceOptimizedBit::decode(
untag()->state_bits_);
6801 void set_is_force_optimized(
bool value)
const;
6804 void set_is_alive(
bool value)
const;
6808 return DiscardedBit::decode(code->untag()->state_bits_);
6810 void set_is_discarded(
bool value)
const;
6814#if defined(DART_PRECOMPILED_RUNTIME)
6815 return code->untag()->entry_point_ !=
6816 code->untag()->monomorphic_entry_point_;
6818 return Instructions::HasMonomorphicEntry(InstructionsOf(code));
6825#if defined(DART_PRECOMPILED_RUNTIME)
6826 if (IsUnknownDartCode(code))
return 0;
6827 const uword entry_offset = HasMonomorphicEntry(code)
6828 ? Instructions::kPolymorphicEntryOffsetAOT
6830 return EntryPointOf(code) - entry_offset;
6832 return Instructions::PayloadStart(InstructionsOf(code));
6839#if defined(DART_PRECOMPILED_RUNTIME)
6840 return code->untag()->entry_point_;
6842 return Instructions::EntryPoint(InstructionsOf(code));
6847 return code->untag()->unchecked_entry_point_;
6852#if defined(DART_PRECOMPILED_RUNTIME)
6853 return untag()->unchecked_entry_point_;
6855 return EntryPoint() +
untag()->unchecked_offset_;
6860#if defined(DART_PRECOMPILED_RUNTIME)
6861 return untag()->monomorphic_entry_point_;
6863 return Instructions::MonomorphicEntryPoint(instructions());
6868#if defined(DART_PRECOMPILED_RUNTIME)
6869 return untag()->monomorphic_unchecked_entry_point_;
6871 return MonomorphicEntryPoint() +
untag()->unchecked_offset_;
6878#if defined(DART_PRECOMPILED_RUNTIME)
6879 if (IsUnknownDartCode(code))
return kUwordMax;
6880 return code->untag()->instructions_length_;
6882 return Instructions::Size(InstructionsOf(code));
6886 ObjectPoolPtr GetObjectPool()
const;
6889 return ContainsInstructionAt(ptr(), addr);
6894 return UntaggedCode::ContainsPC(code, pc);
6898 bool HasBreakpoint()
const;
6903 untag()->set_pc_descriptors(descriptors.
ptr());
6907 return untag()->code_source_map();
6912 untag()->set_code_source_map(code_source_map.
ptr());
6917#if defined(DART_PRECOMPILED_RUNTIME)
6921 return untag()->deopt_info_array();
6924 void set_deopt_info_array(
const Array& array)
const;
6926#if !defined(DART_PRECOMPILED_RUNTIME)
6927 intptr_t num_variables()
const;
6928 void set_num_variables(intptr_t num_variables)
const;
6931#if defined(DART_PRECOMPILED_RUNTIME) || defined(DART_PRECOMPILER)
6932 TypedDataPtr catch_entry_moves_maps()
const;
6933 void set_catch_entry_moves_maps(
const TypedData& maps)
const;
6937 return untag()->compressed_stackmaps();
6942 kPcRelativeCall = 1,
6943 kPcRelativeTTSCall = 2,
6944 kPcRelativeTailCall = 3,
6954 kSCallTableKindAndOffset = 0,
6955 kSCallTableCodeOrTypeTarget = 1,
6956 kSCallTableFunctionTarget = 2,
6957 kSCallTableEntryLength = 3,
6967 :
public BitField<intptr_t, CallEntryPoint, KindField::kNextBit, 1> {};
6969 :
public BitField<intptr_t, intptr_t, EntryPointField::kNextBit, 26> {};
6971 void set_static_calls_target_table(
const Array& value)
const;
6973#if defined(DART_PRECOMPILED_RUNTIME)
6977 return untag()->static_calls_target_table();
6981 TypedDataPtr GetDeoptInfoAtPc(
uword pc,
6983 uint32_t* deopt_flags)
const;
6986 FunctionPtr GetStaticCallTargetFunctionAt(
uword pc)
const;
6988 void SetStaticCallTargetCodeAt(
uword pc,
const Code& code)
const;
6989 void SetStubCallTargetCodeAt(
uword pc,
const Code& code)
const;
6993#if defined(INCLUDE_IL_PRINTER)
6994 class Comments :
public ZoneAllocated,
public CodeComments {
6996 static Comments& New(intptr_t
count);
6998 intptr_t Length()
const override;
7000 void SetPCOffsetAt(intptr_t idx, intptr_t pc_offset);
7001 void SetCommentAt(intptr_t idx,
const String& comment);
7003 intptr_t PCOffsetAt(intptr_t idx)
const override;
7004 const char* CommentAt(intptr_t idx)
const override;
7007 explicit Comments(
const Array& comments);
7010 enum {kPCOffsetEntry = 0,
7014 const Array& comments_;
7022 const CodeComments& comments()
const;
7023 void set_comments(
const CodeComments& comments)
const;
7031 return untag()->return_address_metadata();
7035 void SetPrologueOffset(intptr_t
offset)
const;
7037 intptr_t GetPrologueOffset()
const;
7039 ArrayPtr inlined_id_to_function()
const;
7040 void set_inlined_id_to_function(
const Array& value)
const;
7050 void GetInlinedFunctionsAtInstruction(
7060 GetInlinedFunctionsAtInstruction(pc_offset - 1, functions, token_positions);
7064 void DumpInlineIntervals()
const;
7065 void DumpSourcePositions(
bool relative_addresses =
false)
const;
7072 return untag()->var_descriptors();
7085 LocalVarDescriptorsPtr GetLocalVarDescriptors()
const;
7088 return untag()->exception_handlers();
7092 untag()->set_exception_handlers(handlers.
ptr());
7102 ASSERT(IsFunctionCode());
7103 return Function::RawCast(owner());
7107 return WeakSerializationReference::Unwrap(
untag()->owner());
7109 void set_owner(
const Object& owner)
const;
7113 ObjectPtr owner = WeakSerializationReference::Unwrap(raw->untag()->owner());
7114 if (!owner->IsHeapObject()) {
7125 static constexpr intptr_t kBytesPerElement =
7127 static constexpr intptr_t kMaxElements = kSmiMax / kBytesPerElement;
7131 static constexpr intptr_t kElementSize = kBytesPerElement;
7140 ASSERT(0 <= len && len <= kMaxElements);
7142 (len * kBytesPerElement));
7144#if !defined(DART_PRECOMPILED_RUNTIME)
7155 PoolAttachment pool_attachment,
7160 static void NotifyCodeObservers(
const Code& code,
bool optimized);
7164 static void NotifyCodeObservers(
const char*
name,
7172 PoolAttachment pool_attachment,
7173 bool optimized =
false,
7175 static CodePtr FinalizeCodeAndNotify(
const char*
name,
7178 PoolAttachment pool_attachment,
7179 bool optimized =
false,
7183 static CodePtr FindCode(
uword pc, int64_t timestamp);
7184 static CodePtr FindCodeUnsafe(
uword pc);
7188 return *PointerOffsetAddrAt(index);
7193 uword GetPcForDeoptId(intptr_t deopt_id,
7195 intptr_t GetDeoptIdForOsr(
uword pc)
const;
7197 uint32_t Hash()
const;
7198 const char* Name()
const;
7205 return untag()->compile_timestamp_;
7209 bool IsStubCode()
const;
7210 bool IsAllocationStubCode()
const;
7211 bool IsTypeTestStubCode()
const;
7212 bool IsFunctionCode()
const;
7217 static bool IsUnknownDartCode(CodePtr code);
7219 void DisableDartCode()
const;
7221 void DisableStubCode(
bool is_cls_parameterized)
const;
7224 if (!IsDisabled())
return;
7225 ResetActiveInstructions();
7230#if defined(DART_PRECOMPILED_RUNTIME)
7234 return code->untag()->instructions() !=
7235 code->untag()->active_instructions();
7240 untag()->set_object_pool(object_pool);
7244 void set_state_bits(intptr_t bits)
const;
7248 friend struct RelocatorTestHelper;
7252 kForceOptimizedBit = 1,
7259 class OptimizedBit :
public BitField<int32_t, bool, kOptimizedBit, 1> {};
7263 class ForceOptimizedBit
7264 :
public BitField<int32_t, bool, kForceOptimizedBit, 1> {};
7266 class AliveBit :
public BitField<int32_t, bool, kAliveBit, 1> {};
7272 class DiscardedBit :
public BitField<int32_t, bool, kDiscardedBit, 1> {};
7275 :
public BitField<int32_t, intptr_t, kPtrOffBit, kPtrOffSize> {};
7277 static constexpr intptr_t kEntrySize =
sizeof(int32_t);
7279 void set_compile_timestamp(int64_t timestamp)
const {
7283 StoreNonPointer(&
untag()->compile_timestamp_, timestamp);
7289 static void InitializeCachedEntryPointsFrom(CodePtr code,
7290 InstructionsPtr instructions,
7291 uint32_t unchecked_offset);
7295 void SetActiveInstructions(
const Instructions& instructions,
7296 uint32_t unchecked_offset)
const;
7297 void SetActiveInstructionsSafe(
const Instructions& instructions,
7298 uint32_t unchecked_offset)
const;
7302 void ResetActiveInstructions()
const;
7304 void set_instructions(
const Instructions& instructions)
const {
7305 ASSERT(Thread::Current()->IsDartMutatorThread() || !is_alive());
7306 untag()->set_instructions(instructions.ptr());
7308#if !defined(DART_PRECOMPILED_RUNTIME)
7309 void set_unchecked_offset(uword
offset)
const {
7310 StoreNonPointer(&
untag()->unchecked_offset_,
offset);
7315 uint32_t UncheckedEntryPointOffset()
const {
7316 return UncheckedEntryPointOffsetOf(ptr());
7318 static uint32_t UncheckedEntryPointOffsetOf(CodePtr code) {
7319#if defined(DART_PRECOMPILED_RUNTIME)
7322 return code->untag()->unchecked_offset_;
7326 void set_pointer_offsets_length(intptr_t value) {
7328 ASSERT(Utils::IsUint(30, value));
7329 set_state_bits(PtrOffBits::update(value,
untag()->state_bits_));
7331 int32_t* PointerOffsetAddrAt(
int index)
const {
7333 ASSERT(index < pointer_offsets_length());
7335 return &UnsafeMutableNonPointer(
untag()->
data())[index];
7337 void SetPointerOffsetAt(
int index, int32_t offset_in_instructions) {
7338 NoSafepointScope no_safepoint;
7339 *PointerOffsetAddrAt(index) = offset_in_instructions;
7342 intptr_t BinarySearchInSCallTable(uword pc)
const;
7343 static CodePtr LookupCodeInIsolateGroup(IsolateGroup* isolate_group,
7350 static CodePtr New(intptr_t pointer_offsets_length);
7369 friend class CodeKeyValueTrait;
7370 friend class InstanceCall;
7371 friend class StaticCall;
7390 return context->untag()->num_variables_;
7394 return untag()->element(context_index);
7396 inline void SetAt(intptr_t context_index,
const Object& value)
const;
7398 intptr_t GetLevel()
const;
7400 void Dump(
int indent = 0)
const;
7402 static constexpr intptr_t kBytesPerElement = kCompressedWordSize;
7403 static constexpr intptr_t kMaxElements = kSmiMax / kBytesPerElement;
7407 static constexpr intptr_t kElementSize = kBytesPerElement;
7412 (kBytesPerElement * context_index);
7416 return 0 <= len && len <= compiler::target::Context::kMaxElements;
7426 ASSERT(IsValidLength(len));
7428 (len * kBytesPerElement));
7431 static ContextPtr New(intptr_t num_variables,
Heap::Space space = Heap::kNew);
7434 void set_num_variables(intptr_t num_variables)
const {
7435 StoreNonPointer(&
untag()->num_variables_, num_variables);
7458 void SetTokenIndexAt(intptr_t scope_index,
TokenPosition token_pos)
const;
7460 TokenPosition DeclarationTokenIndexAt(intptr_t scope_index)
const;
7461 void SetDeclarationTokenIndexAt(intptr_t scope_index,
7464 StringPtr NameAt(intptr_t scope_index)
const;
7465 void SetNameAt(intptr_t scope_index,
const String&
name)
const;
7467 void ClearFlagsAt(intptr_t scope_index)
const;
7469 intptr_t LateInitOffsetAt(intptr_t scope_index)
const;
7470 void SetLateInitOffsetAt(intptr_t scope_index,
7471 intptr_t late_init_offset)
const;
7473#define DECLARE_FLAG_ACCESSORS(Name) \
7474 bool Is##Name##At(intptr_t scope_index) const; \
7475 void SetIs##Name##At(intptr_t scope_index, bool value) const;
7478#undef DECLARE_FLAG_ACCESSORS
7480 AbstractTypePtr TypeAt(intptr_t scope_index)
const;
7481 void SetTypeAt(intptr_t scope_index,
const AbstractType&
type)
const;
7483 intptr_t CidAt(intptr_t scope_index)
const;
7484 void SetCidAt(intptr_t scope_index, intptr_t cid)
const;
7486 intptr_t ContextIndexAt(intptr_t scope_index)
const;
7487 void SetContextIndexAt(intptr_t scope_index, intptr_t context_index)
const;
7489 intptr_t ContextLevelAt(intptr_t scope_index)
const;
7490 void SetContextLevelAt(intptr_t scope_index, intptr_t context_level)
const;
7492 intptr_t KernelOffsetAt(intptr_t scope_index)
const;
7493 void SetKernelOffsetAt(intptr_t scope_index, intptr_t kernel_offset)
const;
7495 static constexpr intptr_t kBytesPerElement =
7496 sizeof(UntaggedContextScope::VariableDesc);
7497 static constexpr intptr_t kMaxElements = kSmiMax / kBytesPerElement;
7503 static constexpr intptr_t kElementSize = kBytesPerElement;
7513 ASSERT(0 <= len && len <= kMaxElements);
7515 (len * kBytesPerElement));
7518 static ContextScopePtr New(intptr_t num_variables,
bool is_implicit);
7521 void set_num_variables(intptr_t num_variables)
const {
7522 StoreNonPointer(&
untag()->num_variables_, num_variables);
7525 void set_is_implicit(
bool is_implicit)
const {
7526 StoreNonPointer(&untag()->is_implicit_, is_implicit);
7529 const UntaggedContextScope::VariableDesc* VariableDescAddr(
7530 intptr_t index)
const {
7531 ASSERT((index >= 0) && (index < num_variables()));
7532 return untag()->VariableDescAddr(index);
7535 bool GetFlagAt(intptr_t scope_index, intptr_t bit_index)
const;
7536 void SetFlagAt(intptr_t scope_index, intptr_t bit_index,
bool value)
const;
7560 static SentinelPtr New();
7570 static constexpr intptr_t kInitialCapacity = 16;
7571 static constexpr intptr_t kSpreadFactor = 7;
7572 static constexpr double kLoadFactor = 0.50;
7580 ArrayPtr buckets()
const;
7581 void set_buckets(
const Array& buckets)
const;
7583 intptr_t mask()
const;
7584 void set_mask(intptr_t mask)
const;
7586 intptr_t filled_entry_count()
const;
7587 void set_filled_entry_count(intptr_t num)
const;
7614 static MegamorphicCachePtr New();
7618 void EnsureCapacityLocked()
const;
7621 void InsertEntryLocked(
const Smi& class_id,
const Object&
target)
const;
7623 static inline void SetEntry(
const Array& array,
7625 const Smi& class_id,
7629 static inline ObjectPtr GetTargetFunction(
const Array& array, intptr_t index);
7660 kInstanceCidOrSignature = 0,
7661 kInstanceTypeArguments = 1,
7662 kInstantiatorTypeArguments = 2,
7663 kFunctionTypeArguments = 3,
7664 kInstanceParentFunctionTypeArguments = 4,
7665 kInstanceDelayedFunctionTypeArguments = 5,
7666 kDestinationType = 6,
7668 kTestEntryLength = 8,
7672 static_assert(kInstanceCidOrSignature == 0 &&
7673 kDestinationType + 1 == kTestResult &&
7674 kTestResult + 1 == kTestEntryLength,
7675 "Need to adjust number of max inputs");
7676 static constexpr intptr_t kMaxInputs = kTestResult;
7679 intptr_t NumberOfChecks()
const;
7682 intptr_t NumEntries()
const;
7686 const Object& instance_class_id_or_signature,
7691 const TypeArguments& instance_parent_function_type_arguments,
7693 const Bool& test_result)
const;
7694 void GetCheck(intptr_t ix,
7695 Object* instance_class_id_or_signature,
7702 Bool* test_result)
const;
7706 void GetCurrentCheck(intptr_t ix,
7707 Object* instance_class_id_or_signature,
7714 Bool* test_result)
const;
7720 bool GetNextCheck(intptr_t* ix,
7721 Object* instance_class_id_or_signature,
7728 Bool* test_result)
const;
7741 bool HasCheck(
const Object& instance_class_id_or_signature,
7746 const TypeArguments& instance_parent_function_type_arguments,
7755 void WriteEntryToBuffer(
Zone* zone,
7758 const char* line_prefix =
nullptr)
const;
7761 void WriteToBuffer(
Zone* zone,
7763 const char* line_prefix =
nullptr)
const;
7771 bool IsHash()
const;
7774 SubtypeTestCachePtr Copy(
Thread* thread)
const;
7776 static SubtypeTestCachePtr New(intptr_t num_inputs);
7785 ArrayPtr cache()
const;
7796#if defined(TARGET_ARCH_IA32)
7799 static constexpr intptr_t kMaxLinearCacheEntries = 100;
7801 static constexpr intptr_t kMaxLinearCacheEntries = 30;
7806 bool IsOccupied(intptr_t index)
const;
7816 if (
count <= kMaxLinearCacheEntries)
return count;
7817 intptr_t allocated_entries = Utils::RoundUpToPowerOfTwo(
count);
7818 if (LoadFactor(
count, allocated_entries) >= kMaxLoadFactor) {
7819 allocated_entries *= 2;
7821 const intptr_t max_entries =
7822 static_cast<intptr_t
>(kMaxLoadFactor * allocated_entries);
7823 assert(LoadFactor(max_entries, allocated_entries) < kMaxLoadFactor);
7824 assert(max_entries >=
count);
7829 static constexpr double LoadFactor(intptr_t occupied, intptr_t capacity) {
7830 return occupied /
static_cast<double>(capacity);
7835 static intptr_t NumEntries(
const Array& array);
7838 static bool IsLinear(
const Array& array) {
return !IsHash(array); }
7841 static bool IsHash(
const Array& array);
7843 struct KeyLocation {
7858 static KeyLocation FindKeyOrUnused(
7860 intptr_t num_inputs,
7861 const Object& instance_class_id_or_signature,
7862 const AbstractType& destination_type,
7863 const TypeArguments& instance_type_arguments,
7864 const TypeArguments& instantiator_type_arguments,
7865 const TypeArguments& function_type_arguments,
7866 const TypeArguments& instance_parent_function_type_arguments,
7867 const TypeArguments& instance_delayed_type_arguments);
7875 ArrayPtr EnsureCapacity(Zone* zone,
7877 intptr_t new_capacity,
7878 bool* was_grown)
const;
7883 static constexpr intptr_t kMaxLinearCacheSize =
7884 (kMaxLinearCacheEntries + 1) * kTestEntryLength;
7889 static constexpr intptr_t kNumInitialHashCacheEntries =
7890 Utils::RoundUpToPowerOfTwo(2 * kMaxLinearCacheEntries);
7891 static_assert(Utils::IsPowerOfTwo(kNumInitialHashCacheEntries),
7892 "number of hash-based cache entries must be a power of two");
7895 static constexpr double kMaxLoadFactor = 0.71;
7897 void set_cache(
const Array& value)
const;
7898 void set_num_occupied(intptr_t value)
const;
7901 static void GetCheckFromArray(
7903 intptr_t num_inputs,
7905 Object* instance_class_id_or_signature,
7917 void WriteCurrentEntryToBuffer(
Zone* zone,
7920 const char* line_prefix =
nullptr)
const;
7925 void WriteToBufferUnlocked(
Zone* zone,
7927 const char* line_prefix =
nullptr)
const;
7938 static constexpr intptr_t kIllegalId = 0;
7940 static constexpr intptr_t kRootId = 1;
7942 static LoadingUnitPtr New(intptr_t
id,
const LoadingUnit& parent);
7949 static intptr_t LoadingUnitOf(
const Code& code);
7954 void set_base_objects(
const Array& value)
const;
7963 UntaggedLoadingUnit::kLoaded;
7967 ASSERT(load_outstanding());
7968 auto const expected =
7969 value ? UntaggedLoadingUnit::kLoaded : UntaggedLoadingUnit::kNotLoaded;
7970 auto const got =
untag()
7973 expected, UntaggedLoadingUnit::kLoadOutstanding);
7982 UntaggedLoadingUnit::kLoadOutstanding;
7985 auto const previous = UntaggedLoadingUnit::kNotLoaded;
7989 auto const expected = UntaggedLoadingUnit::kLoadOutstanding;
7990 auto const got =
untag()
7993 expected, previous);
8001 return untag()->instructions_image_;
8004 ASSERT(load_outstanding());
8005 StoreNonPointer(&
untag()->instructions_image_,
value);
8008 return loaded() && instructions_image() !=
nullptr;
8013 bool transient_error)
const;
8022 virtual const char* ToErrorCString()
const;
8038 virtual const char* ToErrorCString()
const;
8043 static ApiErrorPtr New();
8056 StringPtr FormatMessage()
const;
8063 static LanguageErrorPtr NewFormatted(
const Error& prev_error,
8066 bool report_after_token,
8072 static LanguageErrorPtr NewFormattedV(const
Error& prev_error,
8075 bool report_after_token,
8081 static LanguageErrorPtr New(const
String& formatted_message,
8085 virtual const
char* ToErrorCString() const;
8090 ErrorPtr previous_error()
const {
return untag()->previous_error(); }
8091 void set_previous_error(
const Error& value)
const;
8093 ScriptPtr script()
const {
return untag()->script(); }
8094 void set_script(
const Script& value)
const;
8096 void set_token_pos(TokenPosition value)
const;
8098 bool report_after_token()
const {
return untag()->report_after_token_; }
8099 void set_report_after_token(
bool value)
const;
8101 void set_kind(uint8_t value)
const;
8103 StringPtr
message()
const {
return untag()->message(); }
8104 void set_message(
const String& value)
const;
8106 StringPtr formatted_message()
const {
return untag()->formatted_message(); }
8107 void set_formatted_message(
const String& value)
const;
8109 static LanguageErrorPtr New();
8131 static UnhandledExceptionPtr New(
const Instance& exception,
8135 virtual const char* ToErrorCString()
const;
8138 static UnhandledExceptionPtr New(
Heap::Space space = Heap::kNew);
8140 void set_exception(
const Instance& exception)
const;
8141 void set_stacktrace(
const Instance& stacktrace)
const;
8151 void set_is_user_initiated(
bool value)
const;
8162 virtual const char* ToErrorCString()
const;
8182 virtual bool OperatorEquals(
const Instance& other)
const;
8183 bool IsIdenticalTo(
const Instance& other)
const;
8184 virtual bool CanonicalizeEquals(
const Instance& other)
const;
8185 virtual uint32_t CanonicalizeHash()
const;
8189 const Class& cls = Class::Handle(clazz());
8192 return (clazz()->
untag()->host_instance_size_in_words_ *
8193 kCompressedWordSize);
8198 virtual InstancePtr CanonicalizeLocked(
Thread* thread)
const;
8199 virtual void CanonicalizeFieldsLocked(
Thread* thread)
const;
8201 InstancePtr CopyShallowToOldSpace(
Thread* thread)
const;
8205 void SetField(
const Field& field,
const Object& value)
const;
8212 virtual TypeArgumentsPtr GetTypeArguments()
const;
8213 virtual void SetTypeArguments(
const TypeArguments& value)
const;
8231 static bool NullIsAssignableTo(
const AbstractType& other);
8236 static bool NullIsAssignableTo(
8242 return ((index >= 0) && (index < clazz()->
untag()->num_native_fields_));
8245 intptr_t* NativeFieldsDataAddr()
const;
8246 inline intptr_t GetNativeField(
int index)
const;
8247 inline void GetNativeFields(uint16_t num_fields,
8248 intptr_t* field_values)
const;
8249 void SetNativeFields(uint16_t num_fields,
const intptr_t* field_values)
const;
8252 return clazz()->untag()->num_native_fields_;
8255 void SetNativeField(
int index, intptr_t value)
const;
8263 const Array& arguments,
8264 const Array& argument_names,
8265 bool respect_reflectable =
true,
8266 bool check_is_entrypoint =
false)
const;
8268 bool respect_reflectable =
true,
8269 bool check_is_entrypoint =
false)
const;
8272 bool respect_reflectable =
true,
8273 bool check_is_entrypoint =
false)
const;
8278 const Array& type_definitions,
8279 const Array& arguments,
8291 static ObjectPtr EvaluateCompiledExpression(
8297 const Array& type_definitions,
8298 const Array& param_values,
8305 IntegerPtr IdentityHashCode(
Thread* thread)
const;
8313 static InstancePtr NewAlreadyFinalized(
const Class& cls,
8317 static intptr_t DataOffsetFor(intptr_t cid);
8318 static intptr_t ElementSizeFor(intptr_t cid);
8324 virtual bool IsPointer()
const;
8332 virtual void PrintSharedInstanceJSON(
JSONObject* jsobj,
8334 bool include_id =
true)
const;
8339 bool RuntimeTypeIsSubtypeOf(
8347 bool RuntimeTypeIsSubtypeOfFutureOr(
Zone* zone,
8351 static bool NullIsInstanceOf(
8361 CompressedObjectPtr* FieldAddr(
const Field& field)
const {
8362 return FieldAddrAtOffset(field.HostOffset());
8365 return FieldAddrAtOffset(
sizeof(UntaggedObject));
8367 void SetFieldAtOffset(intptr_t
offset,
const Object& value)
const {
8368 StoreCompressedPointer(FieldAddrAtOffset(
offset),
value.ptr());
8370 bool IsValidFieldOffset(intptr_t
offset)
const;
8378 ObjectPtr RawGetFieldAtOffset(intptr_t
offset)
const {
8381 void RawSetFieldAtOffset(intptr_t
offset,
const Object& value)
const {
8382 StoreCompressedPointer(RawFieldAddrAtOffset(
offset),
value.ptr());
8384 void RawSetFieldAtOffset(intptr_t
offset, ObjectPtr value)
const {
8385 StoreCompressedPointer(RawFieldAddrAtOffset(
offset), value);
8388 template <
typename T>
8389 T* RawUnboxedFieldAddrAtOffset(intptr_t
offset)
const {
8392 template <
typename T>
8393 T RawGetUnboxedFieldAtOffset(intptr_t
offset)
const {
8394 return *RawUnboxedFieldAddrAtOffset<T>(
offset);
8396 template <
typename T>
8397 void RawSetUnboxedFieldAtOffset(intptr_t
offset,
const T& value)
const {
8429 LibraryPtr GetLibrary(
int index)
const;
8430 void AddImport(
const Namespace&
import)
const;
8438 static LibraryPrefixPtr New(
const String&
name,
8444 static constexpr int kInitialSize = 2;
8445 static constexpr int kIncrementSize = 2;
8447 void set_name(
const String& value)
const;
8448 void set_imports(
const Array& value)
const;
8449 void set_num_imports(intptr_t value)
const;
8450 void set_importer(
const Library& value)
const;
8452 static LibraryPrefixPtr New();
8462 intptr_t Length()
const;
8467 StringPtr NameAt(intptr_t index)
const;
8468 void SetNameAt(intptr_t index,
const String& value)
const;
8477 AbstractTypePtr BoundAt(intptr_t index)
const;
8478 void SetBoundAt(intptr_t index,
const AbstractType& value)
const;
8479 bool AllDynamicBounds()
const;
8484 AbstractTypePtr DefaultAt(intptr_t index)
const;
8485 void SetDefaultAt(intptr_t index,
const AbstractType& value)
const;
8486 bool AllDynamicDefaults()
const;
8490 bool IsGenericCovariantImplAt(intptr_t index)
const;
8491 void SetIsGenericCovariantImplAt(intptr_t index,
bool value)
const;
8495#if !defined(DART_COMPRESSED_POINTERS)
8500 static constexpr intptr_t kFlagsPerSmi = 1LL << kFlagsPerSmiShift;
8502 static constexpr intptr_t kFlagsPerSmiMask = kFlagsPerSmi - 1;
8504 void Print(
Thread* thread,
8506 bool are_class_type_parameters,
8515 static TypeParametersPtr New(
Heap::Space space = Heap::kOld);
8516 static TypeParametersPtr New(intptr_t
count,
Heap::Space space = Heap::kOld);
8519 ArrayPtr names()
const {
return untag()->names(); }
8520 void set_names(
const Array& value)
const;
8521 ArrayPtr
flags()
const {
return untag()->flags(); }
8522 void set_flags(
const Array& value)
const;
8523 TypeArgumentsPtr
bounds()
const {
return untag()->bounds(); }
8524 void set_bounds(
const TypeArguments& value)
const;
8525 TypeArgumentsPtr defaults()
const {
return untag()->defaults(); }
8526 void set_defaults(
const TypeArguments& value)
const;
8529 void AllocateFlags(Heap::Space space)
const;
8531 void OptimizeFlags()
const;
8549 static constexpr intptr_t kAllDynamicHash = 1;
8553 bool HasCount(intptr_t
count)
const;
8557 intptr_t Length()
const;
8558 AbstractTypePtr TypeAt(intptr_t index)
const;
8559 AbstractTypePtr TypeAtNullSafe(intptr_t index)
const;
8564 return types_offset() + index * kCompressedWordSize;
8566 void SetTypeAt(intptr_t index,
const AbstractType& value)
const;
8570 return TypeArguments::types_offset();
8573 static constexpr intptr_t kElementSize = kCompressedWordSize;
8592 static constexpr intptr_t kNullabilityBitsPerType = 2;
8593 static constexpr intptr_t kNullabilityMaxTypes =
8594 kSmiBits / kNullabilityBitsPerType;
8595 static constexpr intptr_t kNonNullableBits = 0;
8596 static constexpr intptr_t kNullableBits = 3;
8597 static constexpr intptr_t kLegacyBits = 2;
8598 intptr_t nullability()
const;
8604 StringPtr Name()
const;
8608 StringPtr UserVisibleName()
const;
8612 void PrintSubvectorName(intptr_t from_index,
8614 NameVisibility name_visibility,
8620 bool IsRaw(intptr_t from_index, intptr_t len)
const {
8621 return IsDynamicTypes(
false, from_index, len);
8631 return IsDynamicTypes(
true, 0, len);
8634 TypeArgumentsPtr Prepend(
Zone* zone,
8636 intptr_t other_length,
8637 intptr_t total_length)
const;
8640 TypeArgumentsPtr ConcatenateTypeParameters(
Zone* zone,
8657 const Class* cls =
nullptr)
const;
8661 return IsSubvectorEquivalent(other, 0,
IsNull() ? 0 : Length(),
8662 TypeEquality::kCanonical);
8670 return IsSubvectorEquivalent(other, 0,
IsNull() ? other.
Length() : Length(),
8671 kind, function_type_equivalence);
8673 bool IsSubvectorEquivalent(
8675 intptr_t from_index,
8682 intptr_t num_free_fun_type_params = kAllFree)
const {
8683 return IsSubvectorInstantiated(0, Length(), genericity,
8684 num_free_fun_type_params);
8686 bool IsSubvectorInstantiated(
8687 intptr_t from_index,
8690 intptr_t num_free_fun_type_params = kAllFree)
const;
8691 bool IsUninstantiatedIdentity()
const;
8700 bool CanShareInstantiatorTypeArguments(
8701 const Class& instantiator_class,
8702 bool* with_runtime_check =
nullptr)
const;
8704 bool* with_runtime_check =
nullptr)
const;
8705 TypeArgumentsPtr TruncatedTo(intptr_t
length)
const;
8708 bool IsFinalized()
const;
8719 TypeArgumentsPtr FromInstanceTypeArguments(
Thread* thread,
8720 const Class& cls)
const;
8729 TypeArgumentsPtr ToInstantiatorTypeArguments(
Thread* thread,
8730 const Class& cls)
const;
8734 void EnumerateURIs(
URIs* uris)
const;
8741 TypeArgumentsPtr InstantiateFrom(
8744 intptr_t num_free_fun_type_params,
8747 intptr_t num_parent_type_args_adjustment = 0)
const;
8751 TypeArgumentsPtr UpdateFunctionTypes(
8752 intptr_t num_parent_type_args_adjustment,
8753 intptr_t num_free_fun_type_params,
8759 TypeArgumentsPtr InstantiateAndCanonicalizeFrom(
8796 compiler::target::kSmiBits -
8797 compiler::target::kBitsPerWordLog2>;
8800 NumOccupiedBits::kNextBit,
8801 compiler::target::kBitsPerWordLog2>;
8809 kInstantiatorTypeArgsIndex = kSentinelIndex,
8841 return FindKeyOrUnused(data_, instantiator_tav, function_tav);
8845 bool IsOccupied(intptr_t entry)
const;
8848 TypeArgumentsPtr Retrieve(intptr_t entry)
const;
8857 KeyLocation AddEntry(intptr_t entry,
8866 return Object::empty_instantiations_cache_array();
8876 static constexpr double LoadFactor(intptr_t occupied, intptr_t capacity) {
8877 return occupied /
static_cast<double>(capacity);
8882 static intptr_t NumOccupied(
const Array& array);
8885 static bool IsLinear(
const Array& array) {
return !IsHash(array); }
8888 static bool IsHash(
const Array& array);
8895 bool EnsureCapacity(intptr_t occupied)
const;
8903#if defined(TARGET_ARCH_IA32)
8905 static constexpr intptr_t kMaxLinearCacheEntries = 500;
8907 static constexpr intptr_t kMaxLinearCacheEntries = 10;
8913 static intptr_t NumEntries(
const Array& array);
8925 static constexpr intptr_t kSentinelValue = 0;
8930 static constexpr intptr_t kMaxLinearCacheSize =
8931 kHeaderSize + (kMaxLinearCacheEntries + 1) * kEntrySize;
8936 static constexpr intptr_t kNumInitialHashCacheEntries =
8937 Utils::RoundUpToPowerOfTwo(2 * kMaxLinearCacheEntries);
8938 static_assert(Utils::IsPowerOfTwo(kNumInitialHashCacheEntries),
8939 "number of hash-based cache entries must be a power of two");
8942 static constexpr double kMaxLoadFactor = 0.71;
8953 bool HasInstantiations()
const;
8959 static constexpr intptr_t kBytesPerElement = kCompressedWordSize;
8960 static constexpr intptr_t kMaxElements = kSmiMax / kBytesPerElement;
8973 ASSERT(0 <= len && len <= kMaxElements);
8975 (len * kBytesPerElement));
8983 uword HashForRange(intptr_t from_index, intptr_t len)
const;
8988 static TypeArgumentsPtr New(intptr_t len,
Heap::Space space = Heap::kOld);
8991 intptr_t ComputeNullability()
const;
8992 void set_nullability(intptr_t value)
const;
8994 uword ComputeHash()
const;
8995 void SetHash(intptr_t value)
const;
9001 bool IsDynamicTypes(
bool raw_instantiated,
9002 intptr_t from_index,
9003 intptr_t len)
const;
9005 ArrayPtr instantiations()
const;
9006 void set_instantiations(
const Array& value)
const;
9007 void SetLength(intptr_t value)
const;
9010 static constexpr int kNumFields = 4;
9031 const auto state = type_state();
9032 return (
state == UntaggedAbstractType::kFinalizedInstantiated) ||
9033 (
state == UntaggedAbstractType::kFinalizedUninstantiated);
9035 void SetIsFinalized()
const;
9039 UntaggedAbstractType::NullabilityBits::decode(
untag()->
flags()));
9043 bool IsNullable()
const {
return nullability() == Nullability::kNullable; }
9049 return nullability() == Nullability::kNonNullable;
9053 bool IsLegacy()
const {
return nullability() == Nullability::kLegacy; }
9056 bool IsStrictlyNonNullable()
const;
9058 virtual AbstractTypePtr SetInstantiatedNullability(
9061 virtual AbstractTypePtr NormalizeFutureOrType(
Heap::Space space)
const;
9064 virtual classid_t type_class_id()
const;
9065 virtual ClassPtr type_class()
const;
9066 virtual TypeArgumentsPtr arguments()
const;
9067 virtual bool IsInstantiated(
9069 intptr_t num_free_fun_type_params = kAllFree)
const;
9075 return IsEquivalent(other, TypeEquality::kCanonical);
9077 virtual bool IsEquivalent(
9093 virtual AbstractTypePtr InstantiateFrom(
9096 intptr_t num_free_fun_type_params,
9099 intptr_t num_parent_type_args_adjustment = 0)
const;
9111 virtual AbstractTypePtr UpdateFunctionTypes(
9112 intptr_t num_parent_type_args_adjustment,
9113 intptr_t num_free_fun_type_params,
9129 static StringPtr PrintURIs(
URIs* uris);
9133 virtual const char* NullabilitySuffix(NameVisibility name_visibility)
const;
9136 StringPtr Name()
const;
9137 const char* NameCString()
const;
9141 StringPtr UserVisibleName()
const;
9142 const char* UserVisibleNameCString()
const;
9146 StringPtr ScrubbedName()
const;
9147 const char* ScrubbedNameCString()
const;
9151 virtual void PrintName(NameVisibility visibility,
9156 virtual void EnumerateURIs(
URIs* uris)
const;
9159 virtual uword ComputeHash()
const;
9163 StringPtr ClassName()
const;
9172 bool IsNullType()
const;
9175 bool IsNeverType()
const;
9178 bool IsSentinelType()
const;
9185 return IsObjectType() && (nullability() == Nullability::kNullable);
9195 bool IsTopTypeForSubtyping()
const;
9199 bool IsTopTypeForInstanceOf()
const;
9205 bool IsIntType()
const;
9208 bool IsIntegerImplementationType()
const;
9211 bool IsDoubleType()
const;
9214 bool IsFloat32x4Type()
const;
9217 bool IsFloat64x2Type()
const;
9220 bool IsInt32x4Type()
const;
9226 bool IsSmiType()
const {
return type_class_id() == kSmiCid; }
9232 bool IsStringType()
const;
9235 bool IsDartFunctionType()
const;
9238 bool IsDartClosureType()
const;
9241 bool IsDartRecordType()
const;
9244 bool IsFfiPointerType()
const;
9251 AbstractTypePtr UnwrapFutureOr()
const;
9261 bool IsTypeClassAllowedBySpawnUri()
const;
9271 static bool InstantiateAndTestSubtype(
9282 return untag()->type_test_stub_entry_point_;
9293 void SetTypeTestingStub(
const Code& stub)
const;
9300 void InitializeTypeTestingStubNonAtomic(
const Code& stub)
const;
9303 StoreNonPointer(&
untag()->type_test_stub_entry_point_,
9304 Code::EntryPointOf(
untag()->type_test_stub()));
9318 bool IsSubtypeOfFutureOr(
9325 bool IsNullabilityEquivalent(
Thread* thread,
9329 void SetHash(intptr_t value)
const;
9333 UntaggedAbstractType::TypeStateBits::decode(
untag()->
flags()));
9335 void set_flags(uint32_t value)
const;
9358 virtual classid_t type_class_id()
const;
9359 virtual ClassPtr type_class()
const;
9360 void set_type_class(
const Class& value)
const;
9366 TypeArgumentsPtr GetInstanceTypeArguments(
Thread* thread,
9367 bool canonicalize =
true)
const;
9369 virtual bool IsInstantiated(
9371 intptr_t num_free_fun_type_params = kAllFree)
const;
9372 virtual bool IsEquivalent(
9379 bool IsDeclarationTypeOf(
const Class& cls)
const;
9381 virtual AbstractTypePtr InstantiateFrom(
9384 intptr_t num_free_fun_type_params,
9387 intptr_t num_parent_type_args_adjustment = 0)
const;
9389 virtual AbstractTypePtr UpdateFunctionTypes(
9390 intptr_t num_parent_type_args_adjustment,
9391 intptr_t num_free_fun_type_params,
9396 virtual void EnumerateURIs(
URIs* uris)
const;
9397 virtual void PrintName(NameVisibility visibility,
9400 virtual uword ComputeHash()
const;
9407 static TypePtr NullType();
9410 static TypePtr DynamicType();
9413 static TypePtr VoidType();
9416 static TypePtr NeverType();
9419 static TypePtr ObjectType();
9422 static TypePtr BoolType();
9425 static TypePtr IntType();
9428 static TypePtr NullableIntType();
9431 static TypePtr SmiType();
9434 static TypePtr MintType();
9440 static TypePtr NullableDouble();
9455 static TypePtr NullableNumber();
9458 static TypePtr StringType();
9461 static TypePtr ArrayType();
9464 static TypePtr DartFunctionType();
9467 static TypePtr DartTypeType();
9470 static TypePtr NewNonParameterizedType(
const Class& type_class);
9472 static TypePtr New(
const Class& clazz,
9481 void set_type_class_id(intptr_t
id)
const;
9483 static TypePtr New(
Heap::Space space = Heap::kOld);
9511 virtual bool IsInstantiated(
9513 intptr_t num_free_fun_type_params = kAllFree)
const;
9514 virtual bool IsEquivalent(
9519 virtual AbstractTypePtr InstantiateFrom(
9522 intptr_t num_free_fun_type_params,
9525 intptr_t num_parent_type_args_adjustment = 0)
const;
9527 virtual AbstractTypePtr UpdateFunctionTypes(
9528 intptr_t num_parent_type_args_adjustment,
9529 intptr_t num_free_fun_type_params,
9534 virtual void EnumerateURIs(
URIs* uris)
const;
9535 virtual void PrintName(NameVisibility visibility,
9538 virtual uword ComputeHash()
const;
9551 return NumParentTypeArgumentsOf(ptr());
9553 void SetNumParentTypeArguments(intptr_t value)
const;
9561 return NumTypeParametersOf(ptr) + NumParentTypeArgumentsOf(ptr);
9569 void set_num_implicit_parameters(intptr_t value)
const;
9576 void set_num_fixed_parameters(intptr_t value)
const;
9590 return HasOptionalNamedParameters(ptr());
9592 bool HasRequiredNamedParameters()
const;
9595 return !HasOptionalNamedParameters(ptr) && HasOptionalParameters(ptr);
9598 return HasOptionalPositionalParameters(ptr());
9606 return NumOptionalParametersOf(ptr());
9608 void SetNumOptionalParameters(intptr_t num_optional_parameters,
9609 bool are_optional_positional)
const;
9612 return HasOptionalNamedParameters(ptr) ? 0 : NumOptionalParametersOf(ptr);
9615 return NumOptionalPositionalParametersOf(ptr());
9619 return HasOptionalNamedParameters(ptr) ? NumOptionalParametersOf(ptr) : 0;
9622 return NumOptionalNamedParametersOf(ptr());
9626 return NumFixedParametersOf(ptr) + NumOptionalParametersOf(ptr);
9631 return untag()->packed_parameter_counts_;
9633 void set_packed_parameter_counts(uint32_t packed_parameter_counts)
const;
9638 return untag()->packed_type_parameter_counts_;
9640 void set_packed_type_parameter_counts(uint16_t packed_parameter_counts)
const;
9646 TypeParameterPtr TypeParameterAt(
9648 Nullability nullability = Nullability::kNonNullable)
const;
9656 AbstractTypePtr ParameterTypeAt(intptr_t index)
const;
9657 void SetParameterTypeAt(intptr_t index,
const AbstractType& value)
const;
9659 void set_parameter_types(
const Array& value)
const;
9670 return untag()->named_parameter_names();
9672 void set_named_parameter_names(
const Array& value)
const;
9678 StringPtr ParameterNameAt(intptr_t index)
const;
9680 void SetParameterNameAt(intptr_t index,
const String& value)
const;
9684 bool IsRequiredAt(intptr_t index)
const;
9685 void SetIsRequiredAt(intptr_t index)
const;
9694 void CreateNameArrayIncludingFlags(
Heap::Space space = Heap::kOld)
const;
9698 void FinalizeNameArray()
const;
9708 return untag()->type_parameters();
9718 bool HasSameTypeParametersAndBounds(
9725 return ptr->untag()->type_parameters() != TypeParameters::null();
9735 bool IsContravariantParameter(
9736 intptr_t parameter_position,
9738 intptr_t other_parameter_position,
9745 intptr_t GetRequiredFlagIndex(intptr_t index, intptr_t* flag_mask)
const;
9747 void Print(NameVisibility name_visibility,
BaseTextBuffer* printer)
const;
9748 void PrintParameters(
Thread* thread,
9750 NameVisibility name_visibility,
9753 StringPtr ToUserVisibleString()
const;
9754 const char* ToUserVisibleCString()
const;
9760 static FunctionTypePtr New(intptr_t num_parent_type_arguments = 0,
9766 bool ContainsHandles()
const;
9793 return UntaggedTypeParameter::IsFunctionTypeParameter::decode(
9799 void set_base(intptr_t value)
const;
9801 void set_index(intptr_t value)
const;
9806 classid_t parameterized_class_id()
const;
9807 void set_parameterized_class_id(
classid_t value)
const;
9808 ClassPtr parameterized_class()
const;
9809 FunctionTypePtr parameterized_function_type()
const;
9811 AbstractTypePtr bound()
const;
9813 virtual bool IsInstantiated(
9815 intptr_t num_free_fun_type_params = kAllFree)
const;
9816 virtual bool IsEquivalent(
9820 virtual AbstractTypePtr InstantiateFrom(
9823 intptr_t num_free_fun_type_params,
9826 intptr_t num_parent_type_args_adjustment = 0)
const;
9828 virtual AbstractTypePtr UpdateFunctionTypes(
9829 intptr_t num_parent_type_args_adjustment,
9830 intptr_t num_free_fun_type_params,
9836 virtual void PrintName(NameVisibility visibility,
9843 AbstractTypePtr GetFromTypeArguments(
9849 return CanonicalNameCString(IsClassTypeParameter(),
base(), index());
9852 static const char* CanonicalNameCString(
bool is_class_type_parameter,
9861 static TypeParameterPtr New(
const Object& owner,
9867 virtual uword ComputeHash()
const;
9869 void set_owner(
const Object& value)
const;
9871 static TypeParameterPtr New();
9895 static IntegerPtr NewFromUint64(uint64_t
value,
9900 static IntegerPtr NewCanonical(
const String& str);
9901 static IntegerPtr NewCanonical(int64_t
value);
9906 static bool IsValueInRange(uint64_t
value);
9914 virtual uint32_t CanonicalizeHash()
const;
9919 virtual bool IsZero()
const;
9920 virtual bool IsNegative()
const;
9922 virtual double AsDoubleValue()
const;
9923 virtual int64_t AsInt64Value()
const;
9925 virtual uint32_t AsTruncatedUint32Value()
const;
9927 virtual bool FitsIntoSmi()
const;
9930 virtual int CompareWith(
const Integer& other)
const;
9933 const char* ToHexCString(
Zone* zone)
const;
9936 IntegerPtr AsValidInteger()
const;
9951 return RawSmiValue(
static_cast<const SmiPtr
>(obj));
9954 return static_cast<const MintPtr
>(obj)->
untag()->value_;
9965 static constexpr intptr_t
kBits = kSmiBits;
9966 static constexpr intptr_t kMaxValue = kSmiMax;
9967 static constexpr intptr_t kMinValue = kSmiMin;
9975 virtual double AsDoubleValue()
const;
9976 virtual int64_t AsInt64Value()
const;
9977 virtual uint32_t AsTruncatedUint32Value()
const;
9981 virtual int CompareWith(
const Integer& other)
const;
9985 static SmiPtr
New(intptr_t value) {
9986 SmiPtr raw_smi =
static_cast<SmiPtr
>(
9995#if defined(DART_COMPRESSED_POINTERS)
9996 static intptr_t
Value(
const CompressedSmiPtr raw_smi) {
9997 return Smi::Value(
static_cast<SmiPtr
>(raw_smi.DecompressSmi()));
10002 return static_cast<intptr_t
>(New(
value));
10017 static intptr_t NextFieldOffset() {
10022 Smi() : Integer() {}
10028 friend class ReusableSmiHandleScope;
10034 static const char*
Name() {
return "SmiTraits"; }
10038 return Smi::Cast(
a).Value() == Smi::Cast(
b).Value();
10047 static constexpr int64_t kMaxValue =
10049 static constexpr int64_t kMinValue =
10054 static int64_t
Value(MintPtr mint) {
return mint->untag()->value_; }
10061 virtual double AsDoubleValue()
const;
10062 virtual int64_t AsInt64Value()
const;
10063 virtual uint32_t AsTruncatedUint32Value()
const;
10065 virtual bool FitsIntoSmi()
const;
10067 virtual int CompareWith(
const Integer& other)
const;
10078 static MintPtr New(int64_t value,
Heap::Space space = Heap::kNew);
10080 static MintPtr NewCanonical(int64_t value);
10095 static double Value(DoublePtr dbl) {
return dbl->untag()->value_; }
10097 bool BitwiseEqualsToDouble(
double value)
const;
10098 virtual bool OperatorEquals(
const Instance& other)
const;
10099 virtual bool CanonicalizeEquals(
const Instance& other)
const;
10100 virtual uint32_t CanonicalizeHash()
const;
10102 static DoublePtr New(
double d,
Heap::Space space = Heap::kNew);
10107 static DoublePtr NewCanonical(
double d);
10112 static DoublePtr NewCanonical(
const String& str);
10139 static constexpr intptr_t kOneByteChar = 1;
10140 static constexpr intptr_t kTwoByteChar = 2;
10145#if defined(HASH_IN_OBJECT_HEADER)
10146 static constexpr intptr_t kSizeofRawString =
10149 static constexpr intptr_t kSizeofRawString =
10152 static constexpr intptr_t kMaxElements = kSmiMax / kTwoByteChar;
10163 : str_(str), ch_(0), index_(-1), end_(str.Length()) {
10189 intptr_t
Length()
const {
return LengthOf(ptr()); }
10191 return Smi::Value(obj->untag()->length());
10200 result = String::Hash(*
this, 0, this->Length());
10201 uword set_hash = SetCachedHashIfNotSet(ptr(),
result);
10206 static uword Hash(StringPtr raw);
10209 ASSERT(Smi::New(0) ==
nullptr);
10210 return GetCachedHash(ptr()) != 0;
10214#if defined(HASH_IN_OBJECT_HEADER)
10222 static uword Hash(
const String& str, intptr_t begin_index, intptr_t len);
10223 static uword Hash(
const char* characters, intptr_t len);
10224 static uword Hash(
const uint16_t* characters, intptr_t len);
10227 ASSERT(symbol->untag()->IsCanonical());
10239 static uint16_t CharAt(StringPtr str, intptr_t index);
10241 intptr_t CharSize()
const;
10246 intptr_t begin_index,
10247 intptr_t len)
const;
10250 bool Equals(
const char* cstr)
const;
10254 return Equals(characters, len);
10258 bool Equals(
const uint16_t* characters, intptr_t len)
const;
10261 bool Equals(
const int32_t* characters, intptr_t len)
const;
10264 bool EqualsConcat(
const String& str1,
const String& str2)
const;
10275 intptr_t CompareTo(
const String& other)
const;
10279 return StartsWith(ptr(), other.
ptr());
10281 static bool StartsWith(StringPtr str, StringPtr prefix);
10282 bool EndsWith(
const String& other)
const;
10286 virtual InstancePtr CanonicalizeLocked(
Thread* thread)
const;
10288 bool IsSymbol()
const {
return ptr()->untag()->IsCanonical(); }
10291 return ptr()->GetClassId() == kOneByteStringCid;
10295 return ptr()->GetClassId() == kTwoByteStringCid;
10298 char* ToMallocCString()
const;
10299 void ToUTF8(uint8_t* utf8_array, intptr_t array_len)
const;
10300 static const char* ToCString(
Thread* thread, StringPtr ptr);
10305 static StringPtr New(
const char* cstr,
Heap::Space space = Heap::kNew);
10308 static StringPtr FromUTF8(
const uint8_t* utf8_array,
10309 intptr_t array_len,
10313 static StringPtr FromLatin1(
const uint8_t* latin1_array,
10314 intptr_t array_len,
10318 static StringPtr FromUTF16(
const uint16_t* utf16_array,
10319 intptr_t array_len,
10323 static StringPtr FromUTF32(
const int32_t* utf32_array,
10324 intptr_t array_len,
10333 intptr_t array_len,
10335 intptr_t external_allocation_size,
10342 intptr_t array_len,
10344 intptr_t external_allocation_size,
10348 static void Copy(
const String& dst,
10349 intptr_t dst_offset,
10350 const uint8_t* characters,
10352 static void Copy(
const String& dst,
10353 intptr_t dst_offset,
10354 const uint16_t* characters,
10356 static void Copy(
const String& dst,
10357 intptr_t dst_offset,
10359 intptr_t src_offset,
10362 static StringPtr EscapeSpecialCharacters(
const String& str);
10365 static const char* EncodeIRI(
const String& str);
10367 static StringPtr DecodeIRI(
const String& str);
10368 static StringPtr Concat(
const String& str1,
10371 static StringPtr ConcatAll(
const Array& strings,
10374 static StringPtr ConcatAllRange(
const Array& strings,
10379 static StringPtr SubString(
const String& str,
10380 intptr_t begin_index,
10383 intptr_t begin_index,
10386 return SubString(Thread::Current(), str, begin_index,
length, space);
10388 static StringPtr SubString(
Thread* thread,
10390 intptr_t begin_index,
10394 static StringPtr Transform(int32_t (*mapping)(int32_t ch),
10398 static StringPtr ToUpperCase(
const String& str,
10400 static StringPtr ToLowerCase(
const String& str,
10403 static StringPtr RemovePrivateKey(
const String&
name);
10405 static const char* ScrubName(
const String&
name,
bool is_extension =
false);
10406 static StringPtr ScrubNameRetainPrivate(
const String&
name,
10407 bool is_extension =
false);
10409 static bool EqualsIgnoringPrivateKey(
const String& str1,
const String& str2);
10412 static StringPtr NewFormatted(
Heap::Space space, const
char*
format, ...)
10414 static StringPtr NewFormattedV(const
char*
format,
10418 static
bool ParseDouble(const
String& str,
10423#if !defined(HASH_IN_OBJECT_HEADER)
10425 return Smi::Value(obj->untag()->hash_);
10429 ASSERT(Smi::Value(obj->untag()->hash_) == 0 ||
10430 Smi::Value(obj->untag()->hash_) ==
static_cast<intptr_t
>(
hash));
10431 return SetCachedHash(obj,
hash);
10434 obj->untag()->hash_ = Smi::New(
hash);
10438 static uint32_t SetCachedHash(StringPtr obj, uint32_t
hash) {
10439 return Object::SetCachedHashIfNotSet(obj,
hash);
10447 bool Equals(
const uint8_t* characters, intptr_t len)
const;
10448 static uword Hash(
const uint8_t* characters, intptr_t len);
10457 const intptr_t hash_set = SetCachedHashIfNotSet(ptr(),
value);
10466 template <
typename CharType>
10473 friend class Pass2Visitor;
10481 void Add(
const uint8_t* code_units, intptr_t len) {
10488 void Add(
const uint16_t* code_units, intptr_t len) {
10490 Add(LoadUnaligned(code_units));
10495 void Add(
const String& str, intptr_t begin_index, intptr_t len);
10510 static uint16_t
CharAt(OneByteStringPtr str, intptr_t index) {
10512 return str->untag()->data()[index];
10517 *CharAddr(str, index) = code_unit;
10519 static OneByteStringPtr EscapeSpecialCharacters(
const String& str);
10521 static constexpr intptr_t kBytesPerElement = 1;
10523 static constexpr intptr_t kMaxNewSpaceElements =
10530 static constexpr intptr_t kElementSize = kBytesPerElement;
10538 return UnroundedSize(
Smi::Value(str->untag()->length()));
10550 ASSERT(0 <= len && len <= kMaxElements);
10554 static OneByteStringPtr New(intptr_t len,
Heap::Space space);
10555 static OneByteStringPtr
New(
const char* c_string,
10557 return New(
reinterpret_cast<const uint8_t*
>(c_string), strlen(c_string),
10560 static OneByteStringPtr New(
const uint8_t* characters,
10563 static OneByteStringPtr New(
const uint16_t* characters,
10566 static OneByteStringPtr New(
const int32_t* characters,
10571 static OneByteStringPtr New(
const String& other_one_byte_string,
10572 intptr_t other_start_index,
10573 intptr_t other_len,
10576 static OneByteStringPtr New(
const TypedDataBase& other_typed_data,
10577 intptr_t other_start_index,
10578 intptr_t other_len,
10584 static OneByteStringPtr ConcatAll(
const Array& strings,
10590 static OneByteStringPtr Transform(int32_t (*mapping)(int32_t ch),
10596 static OneByteStringPtr SubStringUnchecked(
const String& str,
10597 intptr_t begin_index,
10608 static OneByteStringPtr raw(
const String& str) {
10609 return static_cast<OneByteStringPtr
>(str.
ptr());
10612 static const UntaggedOneByteString*
untag(
const String& str) {
10613 return reinterpret_cast<const UntaggedOneByteString*
>(str.untag());
10616 static uint8_t* CharAddr(
const String& str, intptr_t index) {
10617 ASSERT((index >= 0) && (index < str.Length()));
10618 ASSERT(str.IsOneByteString());
10619 return &str.UnsafeMutableNonPointer(
untag(str)->
data())[index];
10622 static uint8_t* DataStart(
const String& str) {
10623 ASSERT(str.IsOneByteString());
10624 return &str.UnsafeMutableNonPointer(
untag(str)->
data())[0];
10649 static uint16_t
CharAt(TwoByteStringPtr str, intptr_t index) {
10651 return str->untag()->data()[index];
10656 *CharAddr(str, index) = ch;
10659 static TwoByteStringPtr EscapeSpecialCharacters(
const String& str);
10662 static constexpr intptr_t kBytesPerElement = 2;
10664 static constexpr intptr_t kMaxNewSpaceElements =
10671 static constexpr intptr_t kElementSize = kBytesPerElement;
10678 return UnroundedSize(
Smi::Value(str->untag()->length()));
10690 ASSERT(0 <= len && len <= kMaxElements);
10694 static TwoByteStringPtr New(intptr_t len,
Heap::Space space);
10695 static TwoByteStringPtr New(
const uint16_t* characters,
10698 static TwoByteStringPtr New(intptr_t utf16_len,
10699 const int32_t* characters,
10704 static TwoByteStringPtr New(
const TypedDataBase& other_typed_data,
10705 intptr_t other_start_index,
10706 intptr_t other_len,
10712 static TwoByteStringPtr ConcatAll(
const Array& strings,
10718 static TwoByteStringPtr Transform(int32_t (*mapping)(int32_t ch),
10729 static TwoByteStringPtr raw(
const String& str) {
10730 return static_cast<TwoByteStringPtr
>(str.
ptr());
10737 static uint16_t* CharAddr(
const String& str, intptr_t index) {
10738 ASSERT((index >= 0) && (index < str.Length()));
10739 ASSERT(str.IsTwoByteString());
10740 return &str.UnsafeMutableNonPointer(
untag(str)->
data())[index];
10745 static uint16_t* DataStart(
const String& str) {
10746 ASSERT(str.IsTwoByteString());
10747 return &str.UnsafeMutableNonPointer(
untag(str)->
data())[0];
10781 return value ? Bool::True() : Bool::False();
10798 const intptr_t array_length) {
10799 return Array::InstanceSize(array_length) > kNewAllocatableSize;
10806 static constexpr intptr_t kMaxLengthForWriteBarrierElimination = 8;
10808 intptr_t
Length()
const {
return LengthOf(ptr()); }
10810 return Smi::Value(array->untag()->length());
10819 kBytesPerElement * index;
10822 intptr_t index = (offset_in_bytes - data_offset()) / kBytesPerElement;
10830 static constexpr intptr_t kElementSize = kCompressedWordSize;
10834 if (
a ==
b)
return true;
10835 if (
a->IsRawNull() ||
b->IsRawNull())
return false;
10836 if (
a->untag()->length() !=
b->untag()->length())
return false;
10837 if (
a->untag()->type_arguments() !=
b->untag()->type_arguments()) {
10840 const intptr_t
length = LengthOf(
a);
10841 return memcmp(
a->untag()->data(),
b->untag()->data(),
10842 kBytesPerElement *
length) == 0;
10850 return array->
untag()->data();
10853 template <std::memory_order order = std::memory_order_relaxed>
10855 return untag()->element<order>(index);
10857 template <std::memory_order order = std::memory_order_relaxed>
10859 untag()->set_element<order>(index,
value.ptr());
10861 template <std::memory_order order = std::memory_order_relaxed>
10863 untag()->set_element<order>(index,
value.ptr(), thread);
10868 return untag()->element<std::memory_order_acquire>(index);
10871 untag()->set_element<std::memory_order_release>(index,
value.ptr());
10874 bool IsImmutable()
const {
return ptr()->GetClassId() == kImmutableArrayCid; }
10877 static constexpr intptr_t kElementTypeTypeArgPos = 0;
10880 return untag()->type_arguments();
10887 ((
value.Length() >= 1) &&
10888 value.IsInstantiated() ));
10891 StoreArrayPointer(&
untag()->type_arguments_,
value.ptr());
10894 virtual bool CanonicalizeEquals(
const Instance& other)
const;
10895 virtual uint32_t CanonicalizeHash()
const;
10897 static constexpr intptr_t kBytesPerElement = ArrayTraits::kElementSize;
10898 static constexpr intptr_t kMaxElements = kSmiMax / kBytesPerElement;
10899 static constexpr intptr_t kMaxNewSpaceElements =
10900 (kNewAllocatableSize -
sizeof(
UntaggedArray)) / kBytesPerElement;
10907 return 0 <= len && len <= kMaxElements;
10920 ASSERT(IsValidLength(len));
10924 return RoundedAllocationSize(UnroundedSize(len));
10927 virtual void CanonicalizeFieldsLocked(
Thread* thread)
const;
10931 void MakeImmutable()
const;
10934 return New(kArrayCid, len, space);
10940 return NewUninitialized(kArrayCid, len, space);
10942 static ArrayPtr New(intptr_t len,
10950 intptr_t new_length,
10957 void Truncate(intptr_t new_length)
const;
10968 bool unique =
false);
10970 ArrayPtr Slice(intptr_t
start, intptr_t
count,
bool with_type_argument)
const;
10972 return Slice(0, Length(),
true);
10976 static ArrayPtr New(intptr_t class_id,
10979 static ArrayPtr NewUninitialized(intptr_t class_id,
10986 ASSERT((index >= 0) && (index < Length()));
10987 return &
untag()->data()[index];
10990 void SetLength(intptr_t value)
const { untag()->set_length(Smi::New(value)); }
10991 void SetLengthRelease(intptr_t value)
const {
10992 untag()->set_length<std::memory_order_release>(Smi::New(value));
10995 template <
typename type,
10996 std::memory_order order = std::memory_order_relaxed,
10997 typename value_type>
10998 void StoreArrayPointer(
type const* addr, value_type value)
const {
10999 ptr()->untag()->StoreArrayPointer<
type, order, value_type>(
addr,
value);
11013 return Array::ContainsCompressedPointers();
11016 static ImmutableArrayPtr New(intptr_t len,
Heap::Space space = Heap::kNew);
11023 return Array::InstanceSize(len);
11027 static intptr_t NextFieldOffset() {
11032 static ImmutableArrayPtr raw(
const Array& array) {
11033 return static_cast<ImmutableArrayPtr
>(array.ptr());
11044 return Smi::Value(DataArray()->
length());
11062 ASSERT(index < Length());
11063 return data()->untag()->element(index);
11067 ASSERT(index < Length());
11070 data()->untag()->set_element(index,
value.ptr());
11075 void Grow(intptr_t new_capacity,
Heap::Space space = Heap::kNew)
const;
11079 return untag()->type_arguments();
11086 value.IsCanonical()));
11100 return Instance::null();
11119 return New(kDefaultInitialCapacity, space);
11121 static GrowableObjectArrayPtr New(intptr_t capacity,
11123 static GrowableObjectArrayPtr New(
const Array& array,
11127 return array->untag()->length();
11131 return array->untag()->data();
11135 UntaggedArray* DataArray()
const {
return data()->untag(); }
11137 static constexpr int kDefaultInitialCapacity = 0;
11146 static Float32x4Ptr New(
float value0,
11159 void set_x(
float x)
const;
11160 void set_y(
float y)
const;
11161 void set_z(
float z)
const;
11162 void set_w(
float w)
const;
11175 virtual bool CanonicalizeEquals(
const Instance& other)
const;
11176 virtual uint32_t CanonicalizeHash()
const;
11185 static Int32x4Ptr New(int32_t value0,
11197 void set_x(int32_t
x)
const;
11198 void set_y(int32_t
y)
const;
11199 void set_z(int32_t z)
const;
11200 void set_w(int32_t
w)
const;
11211 virtual bool CanonicalizeEquals(
const Instance& other)
const;
11212 virtual uint32_t CanonicalizeHash()
const;
11221 static Float64x2Ptr New(
double value0,
11230 void set_x(
double x)
const;
11231 void set_y(
double y)
const;
11244 virtual bool CanonicalizeEquals(
const Instance& other)
const;
11245 virtual uint32_t CanonicalizeHash()
const;
11255 kNumFieldsBits = 16,
11256 kFieldNamesIndexBits = kSmiBits - kNumFieldsBits,
11261 NumFieldsBitField::kNextBit,
11262 kFieldNamesIndexBits>;
11265 static constexpr intptr_t kNumFieldsMask = NumFieldsBitField::mask();
11266 static constexpr intptr_t kMaxNumFields = kNumFieldsMask;
11267 static constexpr intptr_t kFieldNamesIndexMask =
11268 FieldNamesIndexBitField::mask();
11269 static constexpr intptr_t kFieldNamesIndexShift =
11270 FieldNamesIndexBitField::shift();
11271 static constexpr intptr_t kMaxFieldNamesIndex = kFieldNamesIndexMask;
11288 intptr_t
num_fields()
const {
return NumFieldsBitField::decode(value_); }
11291 return FieldNamesIndexBitField::decode(value_);
11294 SmiPtr
AsSmi()
const {
return Smi::New(value_); }
11299 return value_ == other.value_;
11302 return value_ != other.value_;
11308 intptr_t num_fields,
11309 const Array& field_names);
11312 ArrayPtr GetFieldNames(
Thread* thread)
const;
11328 virtual bool IsInstantiated(
11330 intptr_t num_free_fun_type_params = kAllFree)
const;
11331 virtual bool IsEquivalent(
11336 virtual AbstractTypePtr InstantiateFrom(
11339 intptr_t num_free_fun_type_params,
11342 intptr_t num_parent_type_args_adjustment = 0)
const;
11344 virtual AbstractTypePtr UpdateFunctionTypes(
11345 intptr_t num_parent_type_args_adjustment,
11346 intptr_t num_free_fun_type_params,
11351 virtual void EnumerateURIs(
URIs* uris)
const;
11352 virtual void PrintName(NameVisibility visibility,
11355 virtual uword ComputeHash()
const;
11366 AbstractTypePtr FieldTypeAt(intptr_t index)
const;
11367 void SetFieldTypeAt(intptr_t index,
const AbstractType& value)
const;
11370 ArrayPtr GetFieldNames(
Thread* thread)
const;
11372 intptr_t NumFields()
const;
11374 void Print(NameVisibility name_visibility,
BaseTextBuffer* printer)
const;
11381 const Array& field_types,
11387 void set_field_types(
const Array& value)
const;
11408 return untag()->field(field_index);
11411 untag()->set_field(field_index,
value.ptr());
11414 static constexpr intptr_t kBytesPerElement = kCompressedWordSize;
11415 static constexpr intptr_t kMaxElements = RecordShape::kMaxNumFields;
11419 static constexpr intptr_t kElementSize = kBytesPerElement;
11424 kBytesPerElement * index;
11427 const intptr_t index =
11442 (num_fields * kBytesPerElement));
11447 virtual bool CanonicalizeEquals(
const Instance& other)
const;
11448 virtual uint32_t CanonicalizeHash()
const;
11449 virtual void CanonicalizeFieldsLocked(
Thread* thread)
const;
11455 RecordTypePtr GetRecordType()
const;
11459 static intptr_t GetPositionalFieldIndexFromFieldName(
11460 const String& field_name);
11465 intptr_t GetFieldIndexByName(
Thread* thread,
const String& field_name)
const;
11468 return shape().GetFieldNames(thread);
11498 return ElementSizeInBytes(ptr()->GetClassId()) * Length();
11502 return ElementType(ptr()->GetClassId());
11506 return element_size(ElementType(ptr()->GetClassId()));
11515 return kUint8ArrayElement;
11517 const intptr_t index =
11522 const intptr_t index =
11527 const intptr_t index =
11533 const intptr_t index =
11540 bool IsExternalOrExternalView()
const;
11541 TypedDataViewPtr ViewFromTo(intptr_t
start,
11546 ASSERT((byte_offset == 0) ||
11547 ((byte_offset > 0) && (byte_offset < LengthInBytes())));
11548 return reinterpret_cast<void*
>(
Validate(
untag()->data_) + byte_offset);
11551#define TYPED_GETTER_SETTER(name, type) \
11552 type Get##name(intptr_t byte_offset) const { \
11553 ASSERT(static_cast<uintptr_t>(byte_offset) <= \
11554 static_cast<uintptr_t>(LengthInBytes()) - sizeof(type)); \
11555 return LoadUnaligned( \
11556 reinterpret_cast<type*>(untag()->data_ + byte_offset)); \
11558 void Set##name(intptr_t byte_offset, type value) const { \
11559 ASSERT(static_cast<uintptr_t>(byte_offset) <= \
11560 static_cast<uintptr_t>(LengthInBytes()) - sizeof(type)); \
11561 StoreUnaligned(reinterpret_cast<type*>(untag()->data_ + byte_offset), \
11579#undef TYPED_GETTER_SETTER
11588 return UnsafeMutableNonPointer(data);
11595 ASSERT(0 <= index && index < kNumElementSizes);
11596 intptr_t size = element_size_table[index];
11600 static constexpr intptr_t kNumElementSizes =
11601 ((kLastTypedDataCid + 1) - kFirstTypedDataCid) /
11603 static const intptr_t element_size_table[kNumElementSizes];
11610 virtual bool CanonicalizeEquals(
const Instance& other)
const;
11611 virtual uint32_t CanonicalizeHash()
const;
11613#define TYPED_GETTER_SETTER(name, type) \
11614 type Get##name(intptr_t byte_offset) const { \
11615 ASSERT(static_cast<uintptr_t>(byte_offset) <= \
11616 static_cast<uintptr_t>(LengthInBytes()) - sizeof(type)); \
11617 return LoadUnaligned( \
11618 reinterpret_cast<const type*>(untag()->data() + byte_offset)); \
11620 void Set##name(intptr_t byte_offset, type value) const { \
11621 ASSERT(static_cast<uintptr_t>(byte_offset) <= \
11622 static_cast<uintptr_t>(LengthInBytes()) - sizeof(type)); \
11623 return StoreUnaligned( \
11624 reinterpret_cast<type*>(untag()->data() + byte_offset), value); \
11641#undef TYPED_GETTER_SETTER
11644 return UntaggedTypedData::payload_offset();
11654 ASSERT(0 <= lengthInBytes && lengthInBytes <= kSmiMax);
11660 return (kSmiMax / ElementSizeInBytes(class_id));
11666 ElementSizeInBytes(class_id);
11669 static TypedDataPtr New(intptr_t class_id,
11673 static TypedDataPtr Grow(
const TypedData& current,
11693 template <
typename FieldType>
11694 const FieldType* ReadOnlyDataAddr(intptr_t byte_offset)
const {
11695 return reinterpret_cast<const FieldType*
>((
untag()->data()) + byte_offset);
11708 static constexpr int kDataSerializationAlignment = 8;
11712 intptr_t external_size)
const;
11720 return (kSmiMax / ElementSizeInBytes(class_id));
11723 static ExternalTypedDataPtr New(
11728 bool perform_eager_msan_initialization_check =
true);
11730 static ExternalTypedDataPtr NewFinalizeWithFree(uint8_t* data, intptr_t len);
11739 virtual uint8_t*
Validate(uint8_t* data)
const {
return data; }
11747 ASSERT(!IsolateGroup::Current()->heap()->Contains(
11748 reinterpret_cast<uword>(data)));
11749 StoreNonPointer(&
untag()->data_, data);
11759 static TypedDataViewPtr New(intptr_t class_id,
11761 static TypedDataViewPtr New(intptr_t class_id,
11763 intptr_t offset_in_bytes,
11780 const auto& data = Instance::Handle(Data(view_obj));
11781 intptr_t
cid = data.ptr()->GetClassId();
11797 intptr_t offset_in_bytes,
11801 untag()->set_typed_data(typed_data.
ptr());
11803 untag()->set_offset_in_bytes(Smi::New(offset_in_bytes));
11806 RecomputeDataField();
11812 virtual uint8_t*
Validate(uint8_t* data)
const {
return data; }
11815 void RecomputeDataField()
const { ptr()->untag()->RecomputeDataField(); }
11818 untag()->set_length(Smi::New(0));
11819 untag()->set_offset_in_bytes(Smi::New(0));
11820 StoreNonPointer(&untag()->data_,
nullptr);
11821 untag()->set_typed_data(TypedDataBase::RawCast(Object::null()));
11834 return Instance::ContainsCompressedPointers();
11839 return reinterpret_cast<CompressedInstancePtr*
>(
11840 reinterpret_cast<uword>(view_obj.untag()) + data_offset())
11841 ->Decompress(view_obj.untag()->heap_base());
11847 return sizeof(
UntaggedObject) + (kCompressedWordSize * kDataIndex);
11859 static PointerPtr New(
uword native_address,
Heap::Space space = Heap::kNew);
11865 static bool IsPointer(
const Instance& obj);
11868 return reinterpret_cast<size_t>(
untag()->data_);
11872 uint8_t*
value =
reinterpret_cast<uint8_t*
>(address);
11880 static constexpr intptr_t kNativeTypeArgPos = 0;
11884 TypeArguments& type_args = TypeArguments::Handle(GetTypeArguments());
11896 static DynamicLibraryPtr New(
void* handle,
11912 return untag()->handle_;
11921 return untag()->canBeClosed_;
11926 StoreNonPointer(&
untag()->canBeClosed_,
value);
11931 return untag()->isClosed_;
11935 StoreNonPointer(&
untag()->isClosed_,
value);
11948 ASSERT(index_size >= kInitialIndexSize);
11949 intptr_t index_bits = Utils::BitLength(index_size) - 2;
11950#if defined(HAS_SMI_63_BITS)
11951 return (1 << (32 - index_bits)) - 1;
11953 return (1 << (Object::kHashBits - index_bits)) - 1;
11985 ASSERT(obj.IsMap() || obj.IsSet());
11990 return GetClassId() == kConstMapCid || GetClassId() == kConstSetCid;
11994 return untag()->type_arguments();
11997 const intptr_t num_type_args = IsMap() ? 2 : 1;
11999 ((
value.Length() >= num_type_args) &&
12000 value.IsInstantiated() ));
12032 if (
untag()->used_data() == Object::null())
return 0;
12033 if (
untag()->deleted_keys() == Object::null())
return 0;
12035 intptr_t used = Smi::Value(
untag()->used_data());
12039 const intptr_t deleted = Smi::Value(
untag()->deleted_keys());
12040 return used - deleted;
12046 void ComputeAndSetHashMask()
const;
12048 virtual bool CanonicalizeEquals(
const Instance& other)
const;
12049 virtual uint32_t CanonicalizeHash()
const;
12050 virtual void CanonicalizeFieldsLocked(
Thread* thread)
const;
12054 static constexpr intptr_t kInitialIndexBits = 2;
12055 static constexpr intptr_t kInitialIndexSize = 1 << (kInitialIndexBits + 1);
12058 LinkedHashBasePtr ptr()
const {
return static_cast<LinkedHashBasePtr
>(ptr_); }
12060 ASSERT(ptr() != null());
12066 friend class LinkedHashBaseDeserializationCluster;
12072 return LinkedHashBase::ContainsCompressedPointers();
12086 return RoundedAllocationSize(
sizeof(
UntaggedMap));
12090 static MapPtr NewDefault(intptr_t class_id = kMapCid,
12092 static MapPtr New(intptr_t class_id,
12095 intptr_t hash_mask,
12096 intptr_t used_data,
12097 intptr_t deleted_keys,
12108 : data_(
Array::Handle(map.data())),
12109 scratch_(
Object::Handle()),
12111 length_(
Smi::
Value(map.used_data())) {}
12116 if (offset_ >= length_) {
12119 scratch_ = data_.At(offset_);
12120 if (scratch_.ptr() != data_.ptr()) {
12132 const Array& data_;
12135 const intptr_t length_;
12143 static MapPtr NewUninitialized(intptr_t class_id,
12157 return Map::ContainsCompressedPointers();
12160 static ConstMapPtr NewDefault(
Heap::Space space = Heap::kNew);
12162 static ConstMapPtr NewUninitialized(
Heap::Space space = Heap::kNew);
12169 static intptr_t NextFieldOffset() {
12174 static ConstMapPtr raw(
const Map& map) {
12175 return static_cast<ConstMapPtr
>(map.ptr());
12189 return RoundedAllocationSize(
sizeof(
UntaggedSet));
12193 static SetPtr NewDefault(intptr_t class_id = kSetCid,
12195 static SetPtr New(intptr_t class_id,
12198 intptr_t hash_mask,
12199 intptr_t used_data,
12200 intptr_t deleted_keys,
12211 : data_(
Array::Handle(set.data())),
12212 scratch_(
Object::Handle()),
12214 length_(
Smi::
Value(set.used_data())) {}
12219 if (offset_ >= length_) {
12222 scratch_ = data_.At(offset_);
12223 if (scratch_.ptr() != data_.ptr()) {
12233 const Array& data_;
12236 const intptr_t length_;
12244 static SetPtr NewUninitialized(intptr_t class_id,
12258 return Set::ContainsCompressedPointers();
12261 static ConstSetPtr NewDefault(
Heap::Space space = Heap::kNew);
12263 static ConstSetPtr NewUninitialized(
Heap::Space space = Heap::kNew);
12270 static intptr_t NextFieldOffset() {
12275 static ConstSetPtr raw(
const Set& map) {
12276 return static_cast<ConstSetPtr
>(map.ptr());
12284#if defined(DART_PRECOMPILED_RUNTIME)
12285 uword entry_point()
const {
return untag()->entry_point_; }
12286 void set_entry_point(
uword entry_point)
const {
12289 static intptr_t entry_point_offset() {
12295 return untag()->instantiator_type_arguments();
12298 untag()->set_instantiator_type_arguments(
args.ptr());
12305 return untag()->function_type_arguments();
12308 untag()->set_function_type_arguments(
args.ptr());
12315 return untag()->delayed_type_arguments();
12318 untag()->set_delayed_type_arguments(
args.ptr());
12329 return closure.untag()->function();
12351 return delayed_type_arguments() == Object::empty_type_arguments().ptr();
12361 virtual void CanonicalizeFieldsLocked(
Thread* thread)
const;
12362 virtual bool CanonicalizeEquals(
const Instance& other)
const;
12366 uword ComputeHash()
const;
12368 static ClosurePtr New(
const TypeArguments& instantiator_type_arguments,
12374 static ClosurePtr New(
const TypeArguments& instantiator_type_arguments,
12381 FunctionTypePtr GetInstantiatedSignature(
Zone* zone)
const;
12396 static CapabilityPtr New(uint64_t
id,
Heap::Space space = Heap::kNew);
12421 return IsOpen::decode(Smi::Value(
untag()->bitfield()));
12424 const auto updated = IsOpen::update(
value, Smi::Value(
untag()->bitfield()));
12425 untag()->set_bitfield(Smi::New(updated));
12429 return IsKeepIsolateAlive::decode(Smi::Value(
untag()->bitfield()));
12432 const auto updated =
12433 IsKeepIsolateAlive::update(
value, Smi::Value(
untag()->bitfield()));
12434 untag()->set_bitfield(Smi::New(updated));
12437#if !defined(PRODUCT)
12439 return untag()->allocation_location();
12448 static ReceivePortPtr New(
Dart_Port id,
12449 const String& debug_name,
12453 class IsOpen :
public BitField<intptr_t, bool, 0, 1> {};
12454 class IsKeepIsolateAlive
12455 :
public BitField<intptr_t, bool, IsOpen::kNextBit, 1> {};
12468 ASSERT(origin_id() == 0);
12469 StoreNonPointer(&(
untag()->origin_id_),
id);
12495 uint8_t*
data()
const {
return data_; }
12516 static TransferableTypedDataPtr New(uint8_t* data, intptr_t len);
12532 static constexpr int kPreallocatedStackdepth = 90;
12534 intptr_t Length()
const;
12537 void set_async_link(
const StackTrace& async_link)
const;
12538 void set_expand_inlined(
bool value)
const;
12541 ObjectPtr CodeAtFrame(intptr_t frame_index)
const;
12542 void SetCodeAtFrame(intptr_t frame_index,
const Object& code)
const;
12545 uword PcOffsetAtFrame(intptr_t frame_index)
const;
12546 void SetPcOffsetAtFrame(intptr_t frame_index,
uword pc_offset)
const;
12548 bool skip_sync_start_in_parent_stack()
const;
12549 void set_skip_sync_start_in_parent_stack(
bool value)
const;
12563 static constexpr intptr_t kSyncAsyncCroppedFrames = 2;
12568 static StackTracePtr New(
const Array& code_array,
12572 static StackTracePtr New(
const Array& code_array,
12575 bool skip_sync_start_in_parent_stack,
12579 void set_code_array(
const Array& code_array)
const;
12580 void set_pc_offset_array(
const TypedData& pc_offset_array)
const;
12581 bool expand_inlined()
const;
12591 static constexpr intptr_t kSuspendStateVarIndex = 0;
12595 return UnroundedSize(ptr->untag()->frame_capacity());
12598 return HeaderSize() + frame_capacity;
12606 return RoundedAllocationSize(UnroundedSize(frame_capacity));
12615#if !defined(DART_PRECOMPILED_RUNTIME)
12634 return UntaggedSuspendState::payload_offset();
12637 static SuspendStatePtr New(intptr_t frame_size,
12643 static SuspendStatePtr Clone(
Thread* thread,
12658 CodePtr GetCodeObject()
const;
12661#if !defined(DART_PRECOMPILED_RUNTIME)
12662 void set_frame_capacity(intptr_t frame_capcity)
const;
12664 void set_frame_size(intptr_t frame_size)
const;
12665 void set_pc(
uword pc)
const;
12666 void set_function_data(
const Instance& function_data)
const;
12667 void set_then_callback(
const Closure& then_callback)
const;
12668 void set_error_callback(
const Closure& error_callback)
const;
12670 uint8_t* payload()
const {
return untag()->payload(); }
12691 static constexpr int kDefaultFlags = 0;
12696 inline bool IsGlobal()
const {
return (value_ & kGlobal) != 0; }
12697 inline bool IgnoreCase()
const {
return (value_ & kIgnoreCase) != 0; }
12699 inline bool IsUnicode()
const {
return (value_ & kUnicode) != 0; }
12700 inline bool IsDotAll()
const {
return (value_ & kDotAll) != 0; }
12705 return IsUnicode() && IgnoreCase();
12714 const char* ToCString()
const;
12719 return value_ == other.value_;
12722 return value_ != other.value_;
12737 kUninitialized = 0,
12754 :
public BitField<int8_t, bool, IgnoreCaseBit::kNextBit, 1> {};
12766 return LoadNonPointer<intptr_t, std::memory_order_relaxed>(
12767 is_one_byte ? &
untag()->num_one_byte_registers_
12768 : &
untag()->num_two_byte_registers_);
12773 return untag()->num_bracket_expressions_;
12777 TypedDataPtr
bytecode(
bool is_one_byte,
bool sticky)
const {
12779 return TypedData::RawCast(
12780 is_one_byte ?
untag()->one_byte_sticky<std::memory_order_acquire>()
12781 :
untag()->two_byte_sticky<std::memory_order_acquire>());
12783 return TypedData::RawCast(
12784 is_one_byte ?
untag()->one_byte<std::memory_order_acquire>()
12785 :
untag()->two_byte<std::memory_order_acquire>());
12792 case kOneByteStringCid:
12794 case kTwoByteStringCid:
12799 case kOneByteStringCid:
12801 case kTwoByteStringCid:
12813 case kOneByteStringCid:
12814 return static_cast<FunctionPtr
>(
untag()->one_byte_sticky());
12815 case kTwoByteStringCid:
12816 return static_cast<FunctionPtr
>(
untag()->two_byte_sticky());
12820 case kOneByteStringCid:
12821 return static_cast<FunctionPtr
>(
untag()->one_byte());
12822 case kTwoByteStringCid:
12823 return static_cast<FunctionPtr
>(
untag()->two_byte());
12828 return Function::null();
12831 void set_pattern(
const String& pattern)
const;
12832 void set_function(intptr_t cid,
bool sticky,
const Function& value)
const;
12833 void set_bytecode(
bool is_one_byte,
12839 void set_num_bracket_expressions(intptr_t value)
const;
12840 void set_capture_name_map(
const Array& array)
const;
12859 StoreNonPointer<intptr_t, intptr_t, std::memory_order_relaxed>(
12860 is_one_byte ? &
untag()->num_one_byte_registers_
12861 : &
untag()->num_two_byte_registers_,
12872 virtual bool CanonicalizeEquals(
const Instance& other)
const;
12873 virtual uint32_t CanonicalizeHash()
const;
12882 void set_type(RegExType
type)
const {
12883 untag()->type_flags_.Update<TypeBits>(
type);
12885 RegExType
type()
const {
return untag()->type_flags_.Read<TypeBits>(); }
12904 static WeakPropertyPtr New(
Heap::Space space = Heap::kNew);
12930 static WeakReferencePtr New(
Heap::Space space = Heap::kNew);
13001 static FinalizerEntryPtr New(
const FinalizerBase& finalizer,
13030 return untag()->entries_collected();
13033 untag()->set_entries_collected(
value.ptr());
13059 static FinalizerPtr New(
Heap::Space space = Heap::kNew);
13068 typedef void (*Callback)(
void*);
13082 static NativeFinalizerPtr New(
Heap::Space space = Heap::kNew);
13085 const char* trace_context)
const;
13097 untag()->set_referent(referent.
ptr());
13100 AbstractTypePtr GetAbstractTypeReferent()
const;
13102 ClassPtr GetClassReferent()
const;
13104 FieldPtr GetFieldReferent()
const;
13106 FunctionPtr GetFunctionReferent()
const;
13108 FunctionTypePtr GetFunctionTypeReferent()
const;
13110 LibraryPtr GetLibraryReferent()
const;
13112 TypeParameterPtr GetTypeParameterReferent()
const;
13114 static MirrorReferencePtr New(
const Object& referent,
13130 ASSERT(t >= UserTags::kUserTagIdOffset);
13131 ASSERT(t < UserTags::kUserTagIdOffset + UserTags::kMaxUserTags);
13132 StoreNonPointer(&
untag()->tag_, t);
13137 StoreNonPointer(&
untag()->streamable_, streamable);
13144 UserTagPtr MakeActive()
const;
13151 static UserTagPtr DefaultTag();
13153 static bool TagTableIsFull(
Thread* thread);
13154 static UserTagPtr FindTagById(
const Isolate* isolate,
uword tag_id);
13155 static UserTagPtr FindTagInIsolate(
Isolate* isolate,
13160 static UserTagPtr FindTagInIsolate(
Thread* thread,
const String& label);
13161 static void AddTagToIsolate(
Thread* thread,
const UserTag& tag);
13163 void set_label(
const String& tag_label)
const {
13164 untag()->set_label(tag_label.
ptr());
13179 return untag()->type_arguments();
13203 intptr_t
cid =
value->GetClassIdMayBeSmi();
13210 cid = kInstanceCid;
13222#if !defined(DART_PRECOMPILED_RUNTIME)
13223 return (
untag()->target_offset_ * compiler::target::kCompressedWordSize);
13225 return HostOffset();
13230#if !defined(DART_PRECOMPILED_RUNTIME)
13231 return field->untag()->target_offset_;
13233 return Smi::Value(field->untag()->host_offset_or_field_id());
13238 intptr_t target_offset_in_bytes)
const {
13241 untag()->set_host_offset_or_field_id(
13243#if !defined(DART_PRECOMPILED_RUNTIME)
13244 ASSERT(compiler::target::kCompressedWordSize != 0);
13246 &
untag()->target_offset_,
13247 target_offset_in_bytes / compiler::target::kCompressedWordSize);
13249 ASSERT(host_offset_in_bytes == target_offset_in_bytes);
13265 set_field_id_unsafe(field_id);
13274 return Smi::Value(array->untag()->length());
13282 ASSERT(IsValidNativeIndex(index));
13284 TypedDataPtr native_fields =
static_cast<TypedDataPtr
>(
13285 NativeFieldsAddr()->Decompress(
untag()->heap_base()));
13289 return reinterpret_cast<intptr_t*
>(native_fields->untag()->data())[index];
13293 intptr_t* field_values)
const {
13295 ASSERT(num_fields == NumNativeFields());
13296 ASSERT(field_values !=
nullptr);
13297 TypedDataPtr native_fields =
static_cast<TypedDataPtr
>(
13298 NativeFieldsAddr()->Decompress(
untag()->heap_base()));
13300 for (intptr_t i = 0; i < num_fields; i++) {
13301 field_values[i] = 0;
13305 reinterpret_cast<intptr_t*
>(native_fields->untag()->data());
13306 for (intptr_t i = 0; i < num_fields; i++) {
13307 field_values[i] = fields[i];
13312 if (
ptr() == str.
ptr()) {
13333void MegamorphicCache::SetEntry(
const Array& array,
13335 const Smi& class_id,
13338 array.
SetAt((index * kEntryLength) + kClassIdIndex, class_id);
13339 array.
SetAt((index * kEntryLength) + kTargetFunctionIndex,
target);
13343 return array.At((index * kEntryLength) + kClassIdIndex);
13346ObjectPtr MegamorphicCache::GetTargetFunction(
const Array& array,
13348 return array.At((index * kEntryLength) + kTargetFunctionIndex);
13357 return ComputeHash();
13371 if (
IsNull())
return kAllDynamicHash;
13376 return ComputeHash();
13379inline void TypeArguments::SetHash(intptr_t value)
const {
13386 switch (str->GetClassId()) {
13387 case kOneByteStringCid:
13389 case kTwoByteStringCid:
13435template <
typename EnumType,
typename TupleT,
int kStartOffset = 0>
13438 static constexpr intptr_t EntrySize = std::tuple_size<TupleT>::value;
13445 : array_(array), index_(index) {}
13447 template <EnumType kElement,
13448 std::memory_order order = std::memory_order_relaxed>
13449 typename std::tuple_element<kElement, TupleT>::type::ObjectPtrType
Get()
13451 using object_type =
typename std::tuple_element<kElement, TupleT>::type;
13452 return object_type::RawCast(array_.At<order>(index_ + kElement));
13455 template <EnumType kElement,
13456 std::memory_order order = std::memory_order_relaxed>
13457 void Set(
const typename std::tuple_element<kElement, TupleT>::type& value)
13459 array_.SetAt<order>(index_ + kElement,
value);
13462 intptr_t
index()
const {
return (index_ - kStartOffset) / EntrySize; }
13465 const Array& array_;
13476 return entry_.index_ == other.entry_.index_;
13479 return entry_.index_ != other.entry_.index_;
13485 entry_.index_ += EntrySize;
13500 return (array_.Length() - kStartOffset) / EntrySize;
13504 return TupleView(array_, kStartOffset + i * EntrySize);
13512 return Iterator(array_, kStartOffset + Length() * EntrySize);
13516 const Array& array_;
13539 std::tuple<Object, TypeArguments, TypeArguments>,
13547 const Object& metadata_obj,
13548 const String& pragma_name,
13549 bool multiple =
false,
13553 const Array& metadata,
13554 Field* reusable_field_handle,
13555 Object* reusable_object_handle);
13563#undef PRECOMPILER_WSR_FIELD_DECLARATION
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static constexpr uint64_t kBits
static struct Initializer initializer
static constexpr size_t kHeaderSize
static void operation(T operation, uint32_t &a, uint32_t b, uint32_t c, uint32_t d, uint32_t x, uint8_t s, uint32_t t)
static void encode(uint8_t output[16], const uint32_t input[4])
@ kYes
Do pre-clip the geometry before applying the (perspective) matrix.
static uint32_t hash(const SkShaderBase::GradientInfo &v)
void Dump(const SkPath &path)
#define DEBUG_ASSERT(cond)
#define ASSERT_EQUAL(expected, actual)
#define COMPILE_ASSERT(expr)
bool Equals(const SkPath &a, const SkPath &b)
bool IsNullableObjectType() const
bool IsNonNullable() const
UntaggedAbstractType::TypeState type_state() const
static intptr_t flags_offset()
virtual bool HasTypeClass() const
void SetHash(intptr_t value) const
static intptr_t type_test_stub_entry_point_offset()
static intptr_t NextFieldOffset()
uword type_test_stub_entry_point() const
Nullability nullability() const
virtual bool Equals(const Instance &other) const
static intptr_t InstanceSize()
bool IsObjectType() const
bool IsNumberType() const
virtual uint32_t CanonicalizeHash() const
bool IsCatchAllType() const
bool IsFutureOrType() const
CodePtr type_test_stub() const
HEAP_OBJECT_IMPLEMENTATION(AbstractType, Instance)
void UpdateTypeTestingStubEntryPoint() const
static intptr_t hash_offset()
bool IsDynamicType() const
virtual InstancePtr CanonicalizeLocked(Thread *thread) const
virtual bool CanonicalizeEquals(const Instance &other) const
StringPtr message() const
static intptr_t InstanceSize()
Iterator(const Array &array, intptr_t index)
const TupleView & operator*() const
bool operator==(const Iterator &other)
bool operator!=(const Iterator &other)
std::tuple_element< kElement, TupleT >::type::ObjectPtrType Get() const
void Set(const typename std::tuple_element< kElement, TupleT >::type &value) const
TupleView(const Array &array, intptr_t index)
ArrayOfTuplesView(const Array &array)
TupleView operator[](intptr_t i) const
TupleView At(intptr_t i) const
static intptr_t type_arguments_offset()
static intptr_t InstanceSize()
void SetAt(intptr_t index, const Object &value, Thread *thread) const
static intptr_t index_at_offset(intptr_t offset_in_bytes)
static CompressedObjectPtr * DataOf(ArrayPtr array)
static bool Equals(ArrayPtr a, ArrayPtr b)
ObjectPtr AtAcquire(intptr_t index) const
static intptr_t element_offset(intptr_t index)
static ArrayPtr New(intptr_t len, Heap::Space space=Heap::kNew)
static constexpr intptr_t InstanceSize(intptr_t len)
void SetAtRelease(intptr_t index, const Object &value) const
virtual TypeArgumentsPtr GetTypeArguments() const
static constexpr bool UseCardMarkingForAllocation(const intptr_t array_length)
static constexpr bool IsValidLength(intptr_t len)
virtual void SetTypeArguments(const TypeArguments &value) const
static intptr_t LengthOf(const ArrayPtr array)
ObjectPtr At(intptr_t index) const
static ArrayPtr NewUninitialized(intptr_t len, Heap::Space space=Heap::kNew)
static constexpr intptr_t UnroundedSize(intptr_t len)
static intptr_t data_offset()
void SetAt(intptr_t index, const Object &value) const
static intptr_t length_offset()
bool Equals(const Array &other) const
static constexpr bool decode(uint8_t value)
static constexpr bool is_valid(ClassIdTagType value)
static intptr_t InstanceSize()
virtual uint32_t CanonicalizeHash() const
static const Bool & False()
static const Bool & Get(bool value)
static const Bool & True()
static InstancePtr Data(const Instance &view_obj)
static constexpr bool ContainsCompressedPointers()
static intptr_t NumberOfFields()
static intptr_t data_offset()
intptr_t CountWithTypeArgs() const
intptr_t CountWithoutTypeArgs() const
static intptr_t target_name_offset()
intptr_t SizeWithoutTypeArgs() const
StringPtr target_name() const
intptr_t SizeWithTypeArgs() const
static intptr_t arguments_descriptor_offset()
intptr_t TypeArgsLen() const
ArrayPtr arguments_descriptor() const
static intptr_t InstanceSize()
void Register(const Class &cls)
ClassPtr At(intptr_t cid) const
static intptr_t target_instance_size(ClassPtr clazz)
void PatchFieldsAndFunctions() const
void CopyDeclarationType(const Class &old_cls) const
void AddFields(const GrowableArray< const Field * > &fields) const
static intptr_t id_offset()
TypeArgumentsPtr DefaultTypeArguments(Zone *zone) const
void AddFunction(const Function &function) const
void set_is_implemented_unsafe() const
void set_num_type_arguments(intptr_t value) const
void set_is_transformed_mixin_application() const
bool is_base_class() const
static intptr_t host_instance_size(ClassPtr clazz)
void set_is_implemented() const
FieldPtr LookupInstanceField(const String &name) const
intptr_t kernel_offset() const
void set_has_pragma(bool value) const
const char * NameCString(NameVisibility name_visibility) const
void set_is_finalized_unsafe() const
intptr_t FindImplicitClosureFunctionIndex(const Function &needle) const
intptr_t NumTypeParameters() const
const char * ScrubbedNameCString() const
FunctionPtr LookupFunctionAllowPrivate(const String &name) const
ObjectPtr InvokeSetter(const String &selector, const Instance &argument, bool respect_reflectable=true, bool check_is_entrypoint=false) const
CodePtr allocation_stub() const
void set_is_deeply_immutable(bool value) const
FunctionPtr LookupDynamicFunctionAllowPrivate(const String &name) const
void set_instance_size(intptr_t host_value_in_bytes, intptr_t target_value_in_bytes) const
LibraryPtr library() const
void set_is_isolate_unsendable_due_to_pragma(bool value) const
void set_super_type(const Type &value) const
bool TraceAllocation(IsolateGroup *isolate_group) const
FunctionPtr InvocationDispatcherFunctionFromIndex(intptr_t idx) const
void set_is_allocate_finalized() const
FunctionPtr LookupConstructorAllowPrivate(const String &name) const
static ClassPtr NewTypedDataViewClass(intptr_t class_id, IsolateGroup *isolate_group)
void set_is_enum_class() const
void set_is_synthesized_class() const
FunctionPtr LookupGetterFunction(const String &name) const
void CopyCanonicalConstants(const Class &old_cls) const
static uint16_t NumNativeFieldsOf(ClassPtr clazz)
static int32_t target_next_field_offset_in_words(const ClassPtr cls)
static int32_t host_next_field_offset_in_words(const ClassPtr cls)
bool IsRecordClass() const
bool IsInFullSnapshot() const
ObjectPtr InvokeGetter(const String &selector, bool throw_nsm_if_absent, bool respect_reflectable=true, bool check_is_entrypoint=false) const
FieldPtr LookupInstanceFieldAllowPrivate(const String &name) const
void set_is_allocated_unsafe(bool value) const
bool can_be_future() const
void AddDirectImplementor(const Class &subclass, bool is_mixin) const
TypePtr GetInstantiationOf(Zone *zone, const Class &cls) const
bool is_declaration_loaded() const
intptr_t target_type_arguments_field_offset() const
static intptr_t super_type_offset()
void SetFields(const Array &value) const
void set_is_prefinalized() const
void set_is_interface_class() const
bool IsDartFunctionClass() const
void set_next_field_offset_in_words(intptr_t host_value, intptr_t target_value) const
StringPtr ScrubbedName() const
static intptr_t InstanceSize()
GrowableObjectArrayPtr direct_subclasses() const
GrowableObjectArrayPtr direct_implementors_unsafe() const
bool is_mixin_class() const
TypeArgumentsPtr GetDeclarationInstanceTypeArguments() const
TypePtr super_type() const
FunctionPtr GetInvocationDispatcher(const String &target_name, const Array &args_desc, UntaggedFunction::Kind kind, bool create_if_absent) const
intptr_t host_next_field_offset() const
FunctionPtr LookupStaticFunction(const String &name) const
static intptr_t UnboxedFieldSizeInBytesByCid(intptr_t cid)
void set_is_declaration_loaded() const
static ClassPtr NewExternalTypedDataClass(intptr_t class_id, IsolateGroup *isolate)
void set_num_type_arguments_unsafe(intptr_t value) const
intptr_t target_instance_size() const
void set_is_fields_marked_nullable() const
intptr_t NumTypeArguments() const
void set_is_abstract() const
static intptr_t host_type_arguments_field_offset_in_words_offset()
void set_is_mixin_class() const
FunctionPtr LookupConstructor(const String &name) const
void set_type_arguments_field_offset_in_words(intptr_t host_value, intptr_t target_value) const
void set_num_native_fields(uint16_t value) const
static ClassPtr NewTypedDataClass(intptr_t class_id, IsolateGroup *isolate_group)
void set_type_arguments_field_offset(intptr_t host_value_in_bytes, intptr_t target_value_in_bytes) const
WeakArrayPtr dependent_code() const
static bool is_valid_id(intptr_t value)
void set_dependent_code(const WeakArray &array) const
intptr_t target_next_field_offset() const
static int32_t host_type_arguments_field_offset_in_words(const ClassPtr cls)
bool is_isolate_unsendable() const
ObjectPtr EvaluateCompiledExpression(const ExternalTypedData &kernel_buffer, const Array &type_definitions, const Array ¶m_values, const TypeArguments &type_param_values) const
FunctionPtr LookupSetterFunction(const String &name) const
FunctionPtr GetRecordFieldGetter(const String &getter_name) const
void set_is_sealed() const
void set_direct_subclasses(const GrowableObjectArray &subclasses) const
static intptr_t declaration_type_offset()
intptr_t host_type_arguments_field_offset() const
static bool IsIsolateUnsendable(ClassPtr clazz)
ArrayPtr interfaces() const
bool IsObjectClass() const
bool InjectCIDFields() const
void set_interfaces(const Array &value) const
bool is_type_finalized() const
void SetUserVisibleNameInClassTable()
static int32_t target_type_arguments_field_offset_in_words(const ClassPtr cls)
InstancePtr InsertCanonicalConstant(Zone *zone, const Instance &constant) const
void set_script(const Script &value) const
bool is_deeply_immutable() const
static bool IsSubtypeOf(const Class &cls, const TypeArguments &type_arguments, Nullability nullability, const AbstractType &other, Heap::Space space, FunctionTypeMapping *function_type_equivalence=nullptr)
void DisableAllocationStub() const
void SetTraceAllocation(bool trace_allocation) const
ArrayPtr constants() const
bool HasInstanceFields() const
void set_is_future_subtype(bool value) const
void set_is_declaration_loaded_unsafe() const
InstancePtr LookupCanonicalInstance(Zone *zone, const Instance &value) const
uint16_t num_native_fields() const
void MigrateImplicitStaticClosures(ProgramReloadContext *context, const Class &new_cls) const
intptr_t implementor_cid() const
void set_is_finalized() const
ArrayPtr OffsetToFieldMap(ClassTable *class_table=nullptr) const
intptr_t host_instance_size() const
static bool IsDeeplyImmutable(ClassPtr clazz)
void DisableAllCHAOptimizedCode()
FunctionPtr LookupFunctionReadLocked(const String &name) const
void AddField(const Field &field) const
void DisableCHAOptimizedCode(const Class &subclass)
bool HasCompressedPointers() const
static intptr_t num_type_arguments_offset()
void set_is_allocated(bool value) const
void set_allocation_stub(const Code &value) const
int32_t SourceFingerprint() const
static int32_t host_instance_size_in_words(const ClassPtr cls)
FunctionPtr LookupDynamicFunctionUnsafe(const String &name) const
bool IsDynamicClass() const
bool IsClosureClass() const
InvocationDispatcherEntry
@ kInvocationDispatcherArgsDesc
@ kInvocationDispatcherName
@ kInvocationDispatcherFunction
@ kInvocationDispatcherEntrySize
static bool IsInFullSnapshot(ClassPtr cls)
static constexpr intptr_t kNoTypeArguments
FunctionPtr LookupStaticFunctionAllowPrivate(const String &name) const
void set_token_pos(TokenPosition value) const
TypePtr DeclarationType() const
FieldPtr LookupStaticFieldAllowPrivate(const String &name) const
FunctionPtr LookupFactory(const String &name) const
TokenPosition token_pos() const
void set_instance_size_in_words(intptr_t host_value, intptr_t target_value) const
ErrorPtr EnsureIsFinalized(Thread *thread) const
void set_is_synthesized_class_unsafe() const
bool FindInstantiationOf(Zone *zone, const Class &cls, GrowableArray< const Type * > *path, bool consider_only_super_classes=false) const
void set_is_base_class() const
static ClassPtr New(IsolateGroup *isolate_group, bool register_class=true)
bool is_prefinalized() const
void RegisterCHACode(const Code &code)
bool IsFutureClass() const
GrowableObjectArrayPtr direct_subclasses_unsafe() const
KernelProgramInfoPtr KernelProgramInfo() const
TokenPosition end_token_pos() const
bool is_future_subtype() const
FieldPtr LookupField(const String &name) const
friend class Intrinsifier
void CopyStaticFieldValues(ProgramReloadContext *reload_context, const Class &old_cls) const
void set_kernel_offset(intptr_t value) const
void set_library(const Library &value) const
void set_end_token_pos(TokenPosition value) const
ErrorPtr EnsureIsAllocateFinalized(Thread *thread) const
void DisableCHAImplementorUsers()
bool is_fields_marked_nullable() const
FunctionPtr LookupFactoryAllowPrivate(const String &name) const
ClassPtr SuperClass(ClassTable *class_table=nullptr) const
void set_is_loaded(bool value) const
static ClassPtr NewStringClass(intptr_t class_id, IsolateGroup *isolate_group)
void set_constants(const Array &value) const
intptr_t FindFieldIndex(const Field &needle) const
StringPtr UserVisibleName() const
void AddInvocationDispatcher(const String &target_name, const Array &args_desc, const Function &dispatcher) const
bool FindInstantiationOf(Zone *zone, const Class &cls, bool consider_only_super_classes=false) const
void AddDirectSubclass(const Class &subclass) const
void set_id(intptr_t value) const
bool FindInstantiationOf(Zone *zone, const Type &type, bool consider_only_super_classes=false) const
static intptr_t GetClassId(ClassPtr cls)
FieldPtr FieldFromIndex(intptr_t idx) const
static int32_t target_instance_size_in_words(const ClassPtr cls)
bool is_enum_class() const
bool IsNeverClass() const
bool NoteImplementor(const Class &implementor) const
TypeParametersPtr type_parameters() const
void set_is_type_finalized() const
const char * UserVisibleNameCString() const
void MarkFieldBoxedDuringReload(ClassTable *class_table, const Field &field) const
void set_is_final() const
GrowableObjectArrayPtr direct_implementors() const
intptr_t FindFunctionIndex(const Function &needle) const
bool is_implemented() const
TypeParameterPtr TypeParameterAt(intptr_t index, Nullability nullability=Nullability::kNonNullable) const
static ClassPtr NewPointerClass(intptr_t class_id, IsolateGroup *isolate_group)
void set_next_field_offset(intptr_t host_value_in_bytes, intptr_t target_value_in_bytes) const
void set_is_const() const
bool is_allocate_finalized() const
bool is_transformed_mixin_application() const
FunctionPtr ImplicitClosureFunctionFromIndex(intptr_t idx) const
FunctionPtr FunctionFromIndex(intptr_t idx) const
bool IsFutureOrClass() const
UntaggedClass::ClassLoadingState class_loading_state() const
bool is_allocated() const
static ClassPtr NewNativeWrapper(const Library &library, const String &name, int num_fields)
void SetFunctions(const Array &value) const
void set_type_parameters(const TypeParameters &value) const
bool is_synthesized_class() const
static ClassPtr NewUnmodifiableTypedDataViewClass(intptr_t class_id, IsolateGroup *isolate_group)
DART_WARN_UNUSED_RESULT ErrorPtr VerifyEntryPoint() const
void CheckReload(const Class &replacement, ProgramReloadContext *context) const
FieldPtr LookupFieldAllowPrivate(const String &name, bool instance_only=false) const
bool is_isolate_unsendable_due_to_pragma() const
bool is_interface_class() const
void set_direct_implementors(const GrowableObjectArray &implementors) const
intptr_t FindInvocationDispatcherFunctionIndex(const Function &needle) const
static bool IsClosureClass(ClassPtr cls)
bool is_finalized() const
ArrayPtr current_functions() const
ArrayPtr functions() const
FieldPtr LookupStaticField(const String &name) const
void EnsureDeclarationLoaded() const
virtual StringPtr DictionaryName() const
TypeArgumentsPtr GetInstanceTypeArguments(Thread *thread, const TypeArguments &type_arguments, bool canonicalize=true) const
void set_is_isolate_unsendable(bool value) const
void set_can_be_future(bool value) const
static intptr_t packed_fields_offset()
static intptr_t InstanceSize()
ObjectPtr RawContext() const
ContextPtr GetContext() const
static intptr_t delayed_type_arguments_offset()
static intptr_t function_offset()
virtual uint32_t CanonicalizeHash() const
void set_delayed_type_arguments(const TypeArguments &args) const
static intptr_t instantiator_type_arguments_offset()
static intptr_t function_type_arguments_offset()
TypeArgumentsPtr instantiator_type_arguments() const
TypeArgumentsPtr delayed_type_arguments() const
TypeArgumentsPtr function_type_arguments() const
static intptr_t hash_offset()
void set_function_type_arguments(const TypeArguments &args) const
static intptr_t InstanceSize()
InstancePtr GetImplicitClosureReceiver() const
static FunctionPtr FunctionOf(ClosurePtr closure)
FunctionPtr function() const
void set_instantiator_type_arguments(const TypeArguments &args) const
static intptr_t context_offset()
static intptr_t InstanceSize()
static intptr_t HeaderSize()
void PrintToJSONObject(JSONObject *jsobj, bool ref) const
static intptr_t InstanceSize(intptr_t len)
static intptr_t UnroundedSize(CodeSourceMapPtr map)
static intptr_t UnroundedSize(intptr_t len)
bool Equals(const CodeSourceMap &other) const
static intptr_t instructions_offset()
void set_exception_handlers(const ExceptionHandlers &handlers) const
FunctionPtr function() const
void GetInlinedFunctionsAtReturnAddress(intptr_t pc_offset, GrowableArray< const Function * > *functions, GrowableArray< TokenPosition > *token_positions) const
LocalVarDescriptorsPtr var_descriptors() const
uword UncheckedEntryPoint() const
ArrayPtr deopt_info_array() const
void set_code_source_map(const CodeSourceMap &code_source_map) const
static uword PayloadSizeOf(const CodePtr code)
static bool IsDisabled(CodePtr code)
static intptr_t owner_offset()
NOT_IN_PRODUCT(void PrintJSONInlineIntervals(JSONObject *object) const)
void set_pc_descriptors(const PcDescriptors &descriptors) const
int32_t GetPointerOffsetAt(int index) const
PcDescriptorsPtr pc_descriptors() const
bool is_optimized() const
classid_t OwnerClassId() const
CodeSourceMapPtr code_source_map() const
static uword EntryPointOf(const CodePtr code)
bool is_force_optimized() const
static bool ContainsInstructionAt(const CodePtr code, uword pc)
ObjectPoolPtr object_pool() const
static intptr_t InstanceSize()
static uword UncheckedEntryPointOf(const CodePtr code)
void set_var_descriptors(const LocalVarDescriptors &value) const
static intptr_t active_instructions_offset()
static InstructionsPtr InstructionsOf(const CodePtr code)
bool ContainsInstructionAt(uword addr) const
static uword PayloadStartOf(const CodePtr code)
uword MonomorphicUncheckedEntryPoint() const
bool HasMonomorphicEntry() const
ArrayPtr static_calls_target_table() const
static bool IsDiscarded(const CodePtr code)
uword MonomorphicEntryPoint() const
void set_object_pool(ObjectPoolPtr object_pool) const
static intptr_t entry_point_offset(EntryKind kind=EntryKind::kNormal)
static intptr_t object_pool_offset()
static bool IsOptimized(CodePtr code)
static intptr_t InstanceSize(intptr_t len)
intptr_t pointer_offsets_length() const
static classid_t OwnerClassIdOf(CodePtr raw)
InstructionsPtr active_instructions() const
ObjectPtr return_address_metadata() const
CompressedStackMapsPtr compressed_stackmaps() const
bool IsUnknownDartCode() const
bool is_discarded() const
InstructionsPtr instructions() const
uword PayloadStart() const
ExceptionHandlersPtr exception_handlers() const
static bool HasMonomorphicEntry(const CodePtr code)
int64_t compile_timestamp() const
Iterator(const Iterator &it)
bool Find(uint32_t pc_offset)
Iterator(const PayloadHandle &maps, const PayloadHandle &global_table)
bool IsObject(intptr_t bit_index) const
intptr_t SpillSlotBitCount() const
uint32_t pc_offset() const
const uint8_t * data() const
bool IsGlobalTable() const
uintptr_t payload_size() const
bool UsesGlobalTable() const
RawPayloadHandle(const RawPayloadHandle &)=default
RawPayloadHandle & operator=(const CompressedStackMaps &maps)
RawPayloadHandle & operator=(CompressedStackMapsPtr maps)
const UntaggedCompressedStackMaps::Payload * payload() const
RawPayloadHandle & operator=(const RawPayloadHandle &)=default
RawPayloadHandle & operator=(const UntaggedCompressedStackMaps::Payload *payload)
bool IsGlobalTable() const
const uint8_t * data() const
static intptr_t UnroundedSize(intptr_t length)
bool Equals(const CompressedStackMaps &other) const
static bool IsGlobalTable(const CompressedStackMapsPtr raw)
static CompressedStackMapsPtr NewUsingTable(const void *payload, intptr_t size)
static CompressedStackMapsPtr NewInlined(const void *payload, intptr_t size)
static CompressedStackMapsPtr NewGlobalTable(const void *payload, intptr_t size)
static intptr_t HeaderSize()
static intptr_t InstanceSize()
uintptr_t payload_size() const
bool UsesGlobalTable() const
static intptr_t UnroundedSize(CompressedStackMapsPtr maps)
static uintptr_t PayloadSizeOf(const CompressedStackMapsPtr raw)
static intptr_t InstanceSize(intptr_t length)
static bool UsesGlobalTable(const CompressedStackMapsPtr raw)
static intptr_t InstanceSize()
static constexpr bool ContainsCompressedPointers()
static intptr_t InstanceSize()
static constexpr bool ContainsCompressedPointers()
static intptr_t InstanceSize()
static intptr_t InstanceSize(intptr_t len)
intptr_t num_variables() const
static intptr_t NumVariables(const ContextPtr context)
static intptr_t num_variables_offset()
static bool IsValidLength(intptr_t len)
static intptr_t variable_offset(intptr_t context_index)
static intptr_t parent_offset()
void set_parent(const Context &parent) const
void SetAt(intptr_t context_index, const Object &value) const
static intptr_t InstanceSize()
static intptr_t InstanceSize(intptr_t len)
ObjectPtr At(intptr_t context_index) const
intptr_t num_variables() const
ContextPtr parent() const
static uword AllocateReadOnlyHandle()
static intptr_t value_offset()
static intptr_t InstanceSize()
static double Value(DoublePtr dbl)
void SetClosed(bool value) const
static bool IsDynamicLibrary(const Instance &obj)
static intptr_t InstanceSize()
void SetCanBeClosed(bool value) const
void SetHandle(void *value) const
static intptr_t InstanceSize(intptr_t len)
static intptr_t InstanceSize()
static intptr_t InstanceSize()
virtual uint8_t * Validate(uint8_t *data) const
void SetData(uint8_t *data) const
void SetLength(intptr_t value) const
static bool IsExternalTypedData(const Instance &obj)
static intptr_t MaxElements(intptr_t class_id)
static intptr_t InstanceSize()
ObjectPtr At(intptr_t index, bool concurrent_use=false) const
uint16_t kind_bits() const
FunctionPtr InitializerFunction() const
bool has_initializer() const
intptr_t kernel_offset() const
void set_has_nontrivial_initializer_unsafe(bool has_nontrivial_initializer) const
void set_is_reflectable(bool value) const
static intptr_t guarded_cid_offset()
static intptr_t static_type_exactness_state_offset()
void set_is_nullable_unsafe(bool val) const
void set_is_late(bool value) const
bool NeedsInitializationCheckOnLoad() const
static intptr_t kind_bits_offset()
void set_is_unboxed(bool b) const
bool is_reflectable() const
void set_is_extension_type_member(bool value) const
void set_has_initializer(bool has_initializer) const
bool needs_length_check() const
intptr_t TargetOffset() const
void set_static_type_exactness_state(StaticTypeExactnessState state) const
static intptr_t guarded_list_length_in_object_offset_offset()
void set_is_generic_covariant_impl(bool value) const
StaticTypeExactnessState static_type_exactness_state() const
bool is_extension_member() const
static intptr_t host_offset_or_field_id_offset()
static intptr_t InstanceSize()
void SetOffset(intptr_t host_offset_in_bytes, intptr_t target_offset_in_bytes) const
void set_initializer_changed_after_initialization(bool value) const
void set_is_extension_member(bool value) const
void set_has_pragma(bool value) const
void set_guarded_cid(intptr_t cid) const
void set_guarded_list_length_in_object_offset(intptr_t offset) const
ObjectPtr StaticValue() const
bool needs_load_guard() const
bool has_trivial_initializer() const
bool is_covariant() const
void set_needs_load_guard(bool value) const
void set_has_initializer_unsafe(bool has_initializer) const
void set_is_covariant(bool value) const
bool is_generic_covariant_impl() const
void set_has_nontrivial_initializer(bool has_nontrivial_initializer) const
bool is_nullable_unsafe() const
intptr_t field_id() const
void set_guarded_cid_unsafe(intptr_t cid) const
intptr_t HostOffset() const
void set_is_nullable(bool val) const
void set_field_id(intptr_t field_id) const
static intptr_t initializer_function_offset()
AbstractTypePtr type() const
void set_kernel_offset(intptr_t value) const
static intptr_t TargetOffsetOf(FieldPtr field)
virtual StringPtr DictionaryName() const
bool is_extension_type_member() const
void set_is_unboxed_unsafe(bool b) const
void set_field_id_unsafe(intptr_t field_id) const
void set_guarded_list_length(intptr_t list_length) const
TokenPosition end_token_pos() const
TokenPosition token_pos() const
static intptr_t is_nullable_offset()
bool has_nontrivial_initializer() const
void set_static_type_exactness_state_unsafe(StaticTypeExactnessState state) const
static intptr_t guarded_list_length_offset()
bool initializer_changed_after_initialization() const
FinalizerEntryPtr entries_collected() const
void set_isolate(Isolate *value) const
SetPtr all_entries() const
static intptr_t entries_collected_offset()
static intptr_t all_entries_offset()
Isolate * isolate() const
void set_all_entries(const Set &value) const
static intptr_t detachments_offset()
static intptr_t isolate_offset()
void set_entries_collected(const FinalizerEntry &value) const
void set_value(const Object &value) const
FinalizerBasePtr finalizer() const
static intptr_t external_size_offset()
void set_next(const FinalizerEntry &value) const
void set_token(const Object &value) const
void set_detach(const Object &value) const
static intptr_t InstanceSize()
static intptr_t token_offset()
static intptr_t next_offset()
static intptr_t value_offset()
static intptr_t detach_offset()
FinalizerEntryPtr next() const
void set_external_size(intptr_t value) const
static intptr_t finalizer_offset()
intptr_t external_size() const
static intptr_t callback_offset()
static intptr_t type_arguments_offset()
static intptr_t InstanceSize()
ObjectPtr callback() const
static intptr_t value_offset()
static intptr_t InstanceSize()
static intptr_t InstanceSize()
static intptr_t value_offset()
static intptr_t NumOptionalParametersOf(FunctionTypePtr ptr)
TypeParametersPtr type_parameters() const
intptr_t NumOptionalNamedParameters() const
intptr_t num_implicit_parameters() const
static intptr_t parameter_types_offset()
static bool HasOptionalPositionalParameters(FunctionTypePtr ptr)
AbstractTypePtr result_type() const
intptr_t NumOptionalPositionalParameters() const
static bool HasOptionalParameters(FunctionTypePtr ptr)
static intptr_t packed_parameter_counts_offset()
ArrayPtr named_parameter_names() const
static intptr_t NumFixedParametersOf(FunctionTypePtr ptr)
intptr_t NumParentTypeArguments() const
static intptr_t NumParentTypeArgumentsOf(FunctionTypePtr ptr)
intptr_t NumTypeArguments() const
static intptr_t NumTypeArgumentsOf(FunctionTypePtr ptr)
bool HasOptionalNamedParameters() const
static intptr_t named_parameter_names_offset()
bool HasOptionalParameters() const
bool HasOptionalPositionalParameters() const
bool HasGenericParent() const
static intptr_t NameArrayLengthIncludingFlags(intptr_t num_parameters)
static intptr_t NumParametersOf(FunctionTypePtr ptr)
intptr_t NumParameters() const
static intptr_t NumOptionalNamedParametersOf(FunctionTypePtr ptr)
static bool HasOptionalNamedParameters(FunctionTypePtr ptr)
static bool IsGeneric(FunctionTypePtr ptr)
intptr_t num_fixed_parameters() const
static intptr_t NumTypeParametersOf(FunctionTypePtr ptr)
intptr_t NumTypeParameters() const
virtual classid_t type_class_id() const
static intptr_t InstanceSize()
virtual bool HasTypeClass() const
static intptr_t type_parameters_offset()
uint16_t packed_type_parameter_counts() const
intptr_t NumOptionalParameters() const
ArrayPtr parameter_types() const
uint32_t packed_parameter_counts() const
static intptr_t NumOptionalPositionalParametersOf(FunctionTypePtr ptr)
static intptr_t packed_type_parameter_counts_offset()
bool IsSyncGenerator() const
bool is_unboxed_integer_parameter_at(intptr_t index) const
bool IsRecognized() const
bool has_unboxed_return() const
bool HasUnboxedParameters() const
COMPILE_ASSERT(MethodRecognizer::kNumRecognizedMethods<(1<< kRecognizedTagSize))
CodePtr CurrentCode() const
virtual StringPtr DictionaryName() const
static uword EntryPointOf(const FunctionPtr function)
bool IsDispatcherOrImplicitAccessor() const
bool IsIrregexpFunction() const
COMPILE_ASSERT(kNumTagBits<=(kBitsPerByte *sizeof(decltype(UntaggedFunction::kind_tag_))))
void set_unboxed_integer_return() const
bool has_unboxed_double_return() const
bool IsImplicitInstanceClosureFunction() const
void SetOptimizedInstructionCountClamped(uintptr_t value) const
bool IsImplicitClosureFunction() const
void set_kernel_offset(intptr_t value) const
bool IsNoSuchMethodDispatcher() const
static bool IsFfiCallbackTrampoline(FunctionPtr function)
bool IsRegularFunction() const
bool IsImplicitGetterOrSetter() const
static bool is_visible(FunctionPtr f)
bool has_unboxed_integer_return() const
void set_end_token_pos(TokenPosition value) const
static intptr_t code_offset()
bool IsDynamicClosureCallDispatcher() const
ArrayPtr parameter_types() const
bool MakesCopyOfParameters() const
bool IsFieldInitializer() const
bool NeedsTypeArgumentTypeChecks() const
bool has_unboxed_record_return() const
bool IsStaticFunction() const
bool IsDynamicFunction(bool allow_abstract=false) const
ObjectPtr RawOwner() const
void set_unboxed_double_parameter_at(intptr_t index) const
bool IsSuspendableFunction() const
static intptr_t InstanceSize()
void SetUsageCounter(intptr_t value) const
bool IsImplicitGetterFunction() const
void set_unboxed_integer_parameter_at(intptr_t index) const
static constexpr intptr_t maximum_unboxed_parameter_count()
bool IsGetterFunction() const
bool HasAwaiterLink() const
TokenPosition token_pos() const
static intptr_t kind_tag_offset()
uword entry_point() const
PRECOMPILER_WSR_FIELD_DECLARATION(FunctionType, signature)
uint32_t packed_fields() const
bool IsClosureFunction() const
bool IsFfiCallbackTrampoline() const
bool IsImplicitStaticGetterFunction() const
static bool IsImplicitClosureFunction(FunctionPtr func)
void set_unboxed_record_return() const
intptr_t kernel_offset() const
static CodePtr CurrentCodeOf(const FunctionPtr function)
static intptr_t signature_offset()
bool is_unboxed_parameter_at(intptr_t index) const
void SetOptimizedCallSiteCountClamped(uintptr_t value) const
bool IsRecordFieldGetter() const
bool IsAsyncFunction() const
bool IsInvokeFieldDispatcher() const
void reset_unboxed_parameters_and_return() const
bool IsAsyncGenerator() const
bool IsNonImplicitClosureFunction() const
bool HasSavedArgumentsDescriptor() const
bool IsImplicitStaticClosureFunction() const
bool IsMethodExtractor() const
CodePtr unoptimized_code() const
static intptr_t entry_point_offset(CodeEntryKind entry_kind=CodeEntryKind::kNormal)
bool HasThisParameter() const
bool is_unboxed_double_parameter_at(intptr_t index) const
bool is_optimizable() const
bool HasGenericParent() const
void SetWasExecuted(bool value) const
bool HasUnboxedReturnValue() const
static UntaggedFunction::Kind KindOf(FunctionPtr func)
UntaggedFunction::AsyncModifier modifier() const
TypeParametersPtr type_parameters() const
bool NeedsArgumentTypeChecks() const
bool IsLocalFunction() const
bool IsGenerativeConstructor() const
bool IsDynamicInvocationForwarder() const
UntaggedFunction::Kind kind() const
TokenPosition end_token_pos() const
static intptr_t unchecked_entry_point_offset()
bool IsImplicitSetterFunction() const
static intptr_t data_offset()
bool IsDynamicInvokeFieldDispatcher() const
void set_is_optimizable(bool value) const
void set_unboxed_double_return() const
MethodRecognizer::Kind recognized_kind() const
bool IsConstructor() const
bool HasImplicitClosureFunction() const
bool IsSetterFunction() const
AbstractTypePtr result_type() const
static intptr_t InstanceSize()
static intptr_t type_arguments_offset()
virtual TypeArgumentsPtr GetTypeArguments() const
virtual InstancePtr CanonicalizeLocked(Thread *thread) const
void SetData(const Array &value) const
void SetLength(intptr_t value) const
static SmiPtr NoSafepointLength(const GrowableObjectArrayPtr array)
virtual void SetTypeArguments(const TypeArguments &value) const
static GrowableObjectArrayPtr New(Heap::Space space=Heap::kNew)
static ArrayPtr NoSafepointData(const GrowableObjectArrayPtr array)
static intptr_t type_arguments_offset()
virtual TypeArgumentsPtr GetTypeArguments() const
static intptr_t InstanceSize()
static intptr_t data_offset()
ObjectPtr At(intptr_t index) const
virtual bool CanonicalizeEquals(const Instance &other) const
void SetAt(intptr_t index, const Object &value) const
intptr_t Capacity() const
static intptr_t length_offset()
static intptr_t ExactnessIndexFor(intptr_t num_args)
static intptr_t owner_offset()
static intptr_t CodeIndexFor(intptr_t num_args)
static intptr_t TargetIndexFor(intptr_t num_args)
bool receiver_cannot_be_smi() const
static intptr_t NumArgsTestedMask()
intptr_t deopt_id() const
ICDataPtr AsUnaryClassChecks() const
static intptr_t entries_offset()
static intptr_t state_bits_offset()
static intptr_t CountIndexFor(intptr_t num_args)
static intptr_t NumArgsTestedShift()
bool IsValidEntryIndex(intptr_t index) const
static intptr_t InstanceSize()
void Clear(const CallSiteResetter &proof_of_reload) const
bool is_tracking_exactness() const
AbstractTypePtr receivers_static_type() const
void set_receiver_cannot_be_smi(bool value) const
static intptr_t receivers_static_type_offset()
void set_is_megamorphic(bool value) const
bool HasDeoptReasons() const
static intptr_t EntryPointIndexFor(intptr_t num_args)
static intptr_t InstanceSize()
static intptr_t InstanceSize(intptr_t len)
static constexpr bool ContainsCompressedPointers()
static constexpr bool ContainsCompressedPointers()
static intptr_t data_offset()
intptr_t GetNativeField(int index) const
static intptr_t NextFieldOffset()
uint16_t NumNativeFields() const
static intptr_t InstanceSize()
static intptr_t NativeFieldsOffset()
void GetNativeFields(uint16_t num_fields, intptr_t *field_values) const
static intptr_t UnroundedSize()
intptr_t SizeFromClass() const
bool IsValidNativeIndex(int index) const
static intptr_t InstanceSize(intptr_t size)
static intptr_t HeaderSize()
static intptr_t InstanceSize()
static intptr_t Size(const InstructionsSectionPtr instr)
static intptr_t InstanceSize()
bool ContainsPc(uword pc) const
static uword PayloadStartAt(InstructionsTablePtr table, intptr_t index)
uword PayloadStartAt(intptr_t index) const
const UntaggedInstructionsTable::Data * rodata() const
static uword MonomorphicEntryPoint(const InstructionsPtr instr)
static intptr_t InstanceSize()
static InstructionsPtr FromPayloadStart(uword payload_start)
static intptr_t InstanceSize(intptr_t size)
uword MonomorphicEntryPoint() const
uword PayloadStart() const
static uword PayloadStart(const InstructionsPtr instr)
static uint32_t Hash(const InstructionsPtr instr)
static intptr_t HeaderSize()
bool Equals(const Instructions &other) const
static uword EntryPoint(const InstructionsPtr instr)
static intptr_t Size(const InstructionsPtr instr)
static bool Equals(InstructionsPtr a, InstructionsPtr b)
static intptr_t InstanceSize()
static intptr_t value_offset()
static int64_t GetInt64Value(const IntegerPtr obj)
virtual ObjectPtr HashCode() const
virtual bool OperatorEquals(const Instance &other) const
virtual int64_t AsTruncatedInt64Value() const
virtual bool CanonicalizeEquals(const Instance &other) const
static IsolateGroup * Current()
ClassTable * class_table() const
FieldTable * field_table() const
static Isolate * Current()
static intptr_t InstanceSize()
ArrayPtr libraries_cache() const
ArrayPtr constants() const
TypedDataViewPtr constants_table() const
TypedDataPtr string_offsets() const
TypedDataViewPtr string_data() const
ArrayPtr classes_cache() const
TypedDataViewPtr metadata_mappings() const
TypedDataPtr canonical_names() const
TypedDataBasePtr kernel_component() const
TypedDataViewPtr metadata_payloads() const
static intptr_t InstanceSize()
Report::Kind kind() const
virtual StringPtr DictionaryName() const
static intptr_t InstanceSize()
bool is_deferred_load() const
intptr_t num_imports() const
LibraryPtr importer() const
intptr_t num_imports() const
void set_native_entry_symbol_resolver(Dart_NativeEntrySymbol native_symbol_resolver) const
void set_is_dart_scheme(bool value) const
bool LoadRequested() const
GrowableObjectArrayPtr used_scripts() const
ArrayPtr dependencies() const
void set_native_entry_resolver(Dart_NativeEntryResolver value) const
bool LoadNotStarted() const
void set_ffi_native_resolver(Dart_FfiNativeResolver value) const
bool is_in_fullsnapshot() const
ClassPtr toplevel_class() const
static intptr_t InstanceSize()
Dart_NativeEntrySymbol native_entry_symbol_resolver() const
void set_debuggable(bool value) const
void set_is_in_fullsnapshot(bool value) const
bool is_dart_scheme() const
LoadingUnitPtr loading_unit() const
Dart_NativeEntryResolver native_entry_resolver() const
void set_index(intptr_t value) const
bool IsDebuggable() const
void set_kernel_library_index(intptr_t value) const
StringPtr private_key() const
bool LoadInProgress() const
intptr_t kernel_library_index() const
Dart_FfiNativeResolver ffi_native_resolver() const
KernelProgramInfoPtr kernel_program_info() const
static StringPtr UrlOf(LibraryPtr lib)
void set_hash_mask(intptr_t value) const
void set_data(const Array &value) const
static intptr_t IndexSizeToHashMask(intptr_t index_size)
static intptr_t deleted_keys_offset()
TypedDataPtr index() const
SmiPtr deleted_keys() const
static intptr_t data_offset()
virtual void SetTypeArguments(const TypeArguments &value) const
void set_deleted_keys(intptr_t value) const
static intptr_t InstanceSize()
static const LinkedHashBase & Cast(const Object &obj)
static intptr_t type_arguments_offset()
static intptr_t index_offset()
void set_used_data(intptr_t value) const
static intptr_t used_data_offset()
void set_index(const TypedData &value) const
static intptr_t hash_mask_offset()
virtual TypeArgumentsPtr GetTypeArguments() const
const uint8_t * instructions_image() const
LoadingUnitPtr parent() const
COMPILE_ASSERT(kIllegalId==WeakTable::kNoValue)
static intptr_t InstanceSize()
void set_loaded(bool value) const
bool load_outstanding() const
void set_instructions_image(const uint8_t *value) const
bool has_instructions_image() const
ArrayPtr base_objects() const
void set_load_outstanding() const
static intptr_t InstanceSize(intptr_t len)
static intptr_t InstanceSize()
ObjectPtr CurrentValue() const
ObjectPtr CurrentKey() const
static intptr_t InstanceSize()
static intptr_t InstanceSize()
static intptr_t buckets_offset()
static intptr_t arguments_descriptor_offset()
static intptr_t mask_offset()
static intptr_t InstanceSize()
virtual bool IsZero() const
virtual bool IsNegative() const
static int64_t Value(MintPtr mint)
static intptr_t value_offset()
ObjectPtr referent() const
static intptr_t InstanceSize()
void set_referent(const Object &referent) const
static intptr_t entrypoint_offset()
static intptr_t expected_cid_offset()
static MonomorphicSmiableCallPtr New(classid_t expected_cid, const Code &target)
static intptr_t InstanceSize()
classid_t expected_cid() const
ArrayPtr hide_names() const
static intptr_t InstanceSize()
ArrayPtr show_names() const
LibraryPtr target() const
static intptr_t callback_offset()
void set_callback(const Pointer &value) const
static intptr_t InstanceSize()
PointerPtr callback() const
EntryType TypeAt(intptr_t index) const
ObjectPtr ObjectAt(intptr_t index) const
uword RawValueAt(intptr_t index) const
void SetObjectAt(intptr_t index, const Object &obj) const
static uint8_t EncodeBits(EntryType type, Patchability patchable, SnapshotBehavior snapshot_behavior)
SnapshotBehavior SnapshotBehaviorAt(intptr_t index) const
static intptr_t InstanceSize()
void SetRawValueAt(intptr_t index, uword raw_value) const
static intptr_t length_offset()
static intptr_t OffsetFromIndex(intptr_t index)
void SetLength(intptr_t value) const
static intptr_t element_offset(intptr_t index)
Patchability PatchableAt(intptr_t index) const
static intptr_t data_offset()
static intptr_t IndexFromOffset(intptr_t offset)
static intptr_t InstanceSize(intptr_t len)
void SetTypeAt(intptr_t index, EntryType type, Patchability patchable, SnapshotBehavior snapshot_behavior) const
ObjectPtr Decompress(uword heap_base) const
UntaggedObject * untag() const
intptr_t GetClassId() const
static ObjectPtr Clone(const Object &orig, Heap::Space space, bool load_with_relaxed_atomics=false)
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)
static ClassPtr icdata_class()
static ClassPtr pc_descriptors_class()
void setPtr(ObjectPtr value, intptr_t default_cid)
void StoreNonPointer(const FieldType *addr, ValueType value) const
static ClassPtr loadingunit_class()
static ClassPtr type_parameters_class()
type LoadPointer(type const *addr) const
static ClassPtr ffi_trampoline_data_class()
static ClassPtr class_class()
static ClassPtr exception_handlers_class()
static void InitNullAndBool(IsolateGroup *isolate_group)
static ClassPtr namespace_class()
void ClearCanonical() const
void AddCommonObjectProperties(JSONObject *jsobj, const char *protocol_type, bool ref) const
static const ClassId kClassId
void PrintJSON(JSONStream *stream, bool ref=true) const
static ClassPtr instructions_class()
void StoreCompressedPointer(compressed_type const *addr, type value) const
static ClassPtr instructions_table_class()
static ClassPtr weak_serialization_reference_class()
static DART_FORCE_INLINE T::ObjectPtrType AllocateVariant(intptr_t class_id, Heap::Space space, intptr_t elements)
static DART_FORCE_INLINE T::ObjectPtrType AllocateVariant(intptr_t class_id, Heap::Space space)
static Object & Handle(Zone *zone)
static Object & ZoneHandle(ObjectPtr ptr)
intptr_t GetClassId() const
bool Contains(uword addr) const
static ClassPtr type_arguments_class()
FieldType LoadNonPointer(const FieldType *addr) const
static DART_FORCE_INLINE T::ObjectPtrType Allocate(Heap::Space space)
static Object * ReadOnlyHandle()
virtual const char * JSONType() const
void StorePointerUnaligned(type const *addr, type value, Thread *thread) const
static ClassPtr language_error_class()
bool InVMIsolateHeap() const
static ClassPtr megamorphic_cache_class()
virtual StringPtr DictionaryName() const
void set_vtable(cpp_vtable value)
void StorePointer(type const *addr, type value) const
void UnimplementedMethod() const
static ClassPtr unhandled_exception_class()
void StoreSmi(SmiPtr const *addr, SmiPtr value) const
static ClassPtr sentinel_class()
static bool ShouldHaveImmutabilityBitSet(classid_t class_id)
static ClassPtr object_pool_class()
static Object & Handle(Zone *zone, ObjectPtr ptr)
static void FinishInit(IsolateGroup *isolate_group)
static ClassPtr var_descriptors_class()
static ClassPtr weak_array_class()
static DART_FORCE_INLINE uword from_offset()
CLASS_LIST_FOR_HANDLES(DEFINE_CLASS_TESTER)
static void FinalizeVMIsolate(IsolateGroup *isolate_group)
static ClassPtr singletargetcache_class()
void SetImmutable() const
static ClassPtr context_class()
static ClassPtr patch_class_class()
static ClassPtr code_class()
static void InitVtables()
static ClassPtr unlinkedcall_class()
friend class TwoByteString
static void MakeUnusedSpaceTraversable(const Object &obj, intptr_t original_size, intptr_t used_size)
static void set_vm_isolate_snapshot_object_table(const Array &table)
void SetCanonical() const
static void FinalizeReadOnlyObject(ObjectPtr object)
virtual const char * ToCString() const
static constexpr bool ContainsCompressedPointers()
static ClassPtr library_class()
static ClassPtr unwind_error_class()
cpp_vtable vtable() const
CLASS_LIST(STORE_NON_POINTER_ILLEGAL_TYPE)
static ClassPtr field_class()
FieldType * UnsafeMutableNonPointer(const FieldType *addr) const
static DART_NOINLINE Object & HandleImpl(Zone *zone, ObjectPtr ptr, intptr_t default_cid)
static constexpr intptr_t RoundedAllocationSize(intptr_t size)
static ClassPtr script_class()
virtual void PrintImplementationFieldsImpl(const JSONArray &jsarr_fields) const
void StoreNonPointer(const FieldType *addr, ValueType value) const
friend ObjectPtr AllocateObject(intptr_t, intptr_t, intptr_t)
virtual void PrintJSONImpl(JSONStream *stream, bool ref) const
static intptr_t InstanceSize()
static ClassPtr context_scope_class()
static ClassPtr instructions_section_class()
static DART_NOINLINE Object * ReadOnlyHandleImpl(intptr_t cid)
static ObjectPtr RawCast(ObjectPtr obj)
static DART_NOINLINE Object & ZoneHandleImpl(Zone *zone, ObjectPtr ptr, intptr_t default_cid)
static ClassPtr void_class()
static Object & ZoneHandle()
static ClassPtr dynamic_class()
static intptr_t tags_offset()
static ClassPtr function_class()
friend class OneByteString
void operator=(ObjectPtr value)
static ClassPtr code_source_map_class()
FieldType LoadNonPointer(const FieldType *addr) const
static void VerifyBuiltinVtable(intptr_t cid)
static ClassPtr monomorphicsmiablecall_class()
static constexpr intptr_t kHashBits
void PrintImplementationFields(JSONStream *stream) const
static DART_FORCE_INLINE uword to_offset(intptr_t length=0)
static ClassPtr closure_data_class()
static ClassPtr api_error_class()
void StoreSimd128(const FieldType *addr, simd128_value_t value) const
static ClassPtr compressed_stackmaps_class()
static ClassPtr kernel_program_info_class()
static ClassPtr subtypetestcache_class()
static void VerifyBuiltinVtables()
static Object & Handle(ObjectPtr ptr)
static Object & ZoneHandle(Zone *zone)
static Object & ZoneHandle(Zone *zone, ObjectPtr ptr)
static DART_FORCE_INLINE T::ObjectPtrType Allocate(Heap::Space space, intptr_t elements)
void ClearImmutable() const
static void SetCharAt(const String &str, intptr_t index, uint8_t code_unit)
static intptr_t UnroundedSize(OneByteStringPtr str)
static intptr_t data_offset()
static intptr_t InstanceSize(intptr_t len)
static OneByteStringPtr New(const char *c_string, Heap::Space space=Heap::kNew)
static intptr_t InstanceSize()
static OneByteStringPtr null()
static intptr_t UnroundedSize(intptr_t len)
static uint16_t CharAt(OneByteStringPtr str, intptr_t index)
static uint16_t CharAt(const String &str, intptr_t index)
static PassiveObject & ZoneHandle(Zone *zone, ObjectPtr ptr)
void operator=(ObjectPtr value)
void operator^=(ObjectPtr value)
static PassiveObject & ZoneHandle(Zone *zone)
static PassiveObject & ZoneHandle(ObjectPtr ptr)
static PassiveObject & Handle(Zone *zone)
static PassiveObject & Handle(Zone *zone, ObjectPtr ptr)
static PassiveObject & ZoneHandle()
static PassiveObject & Handle(ObjectPtr ptr)
static PassiveObject & Handle()
ClassPtr wrapped_class() const
KernelProgramInfoPtr kernel_program_info() const
void set_kernel_program_info(const KernelProgramInfo &info) const
static bool IsInFullSnapshot(PatchClassPtr cls)
void set_kernel_library_index(intptr_t index) const
intptr_t kernel_library_index() const
static intptr_t InstanceSize()
Iterator(const PcDescriptors &descriptors, intptr_t kind_mask)
intptr_t YieldIndex() const
TokenPosition TokenPos() const
intptr_t TryIndex() const
UntaggedPcDescriptors::Kind Kind() const
static intptr_t UnroundedSize(PcDescriptorsPtr desc)
static intptr_t HeaderSize()
bool Equals(const PcDescriptors &other) const
static void PrintHeaderString()
static intptr_t InstanceSize(intptr_t len)
static intptr_t InstanceSize()
static intptr_t UnroundedSize(intptr_t len)
static intptr_t data_offset()
static intptr_t type_arguments_offset()
size_t NativeAddress() const
void SetNativeAddress(size_t address) const
static intptr_t InstanceSize()
AbstractTypePtr type_argument() const
StringPtr debug_name() const
StackTracePtr allocation_location() const
InstancePtr handler() const
static intptr_t InstanceSize()
void set_handler(const Instance &value) const
void set_keep_isolate_alive(bool value) const
void set_is_open(bool value) const
static intptr_t handler_offset()
static intptr_t send_port_offset()
SendPortPtr send_port() const
bool keep_isolate_alive() const
static RecordShape ForUnnamed(intptr_t num_fields)
bool operator!=(const RecordShape &other) const
RecordShape(SmiPtr smi_value)
RecordShape(intptr_t num_fields, intptr_t field_names_index)
intptr_t field_names_index() const
intptr_t num_fields() const
bool operator==(const RecordShape &other) const
bool HasNamedFields() const
RecordShape(intptr_t value)
RecordShape shape() const
virtual classid_t type_class_id() const
intptr_t NumFields() const
static intptr_t InstanceSize()
ArrayPtr field_types() const
virtual bool HasTypeClass() const
ArrayPtr GetFieldNames(Thread *thread) const
static intptr_t InstanceSize(intptr_t num_fields)
static intptr_t shape_offset()
RecordShape shape() const
static intptr_t InstanceSize()
static intptr_t NumFields(RecordPtr ptr)
intptr_t num_fields() const
static intptr_t field_index_at_offset(intptr_t offset_in_bytes)
void SetFieldAt(intptr_t field_index, const Object &value) const
static intptr_t field_offset(intptr_t index)
ObjectPtr FieldAt(intptr_t field_index) const
bool NeedsUnicodeCaseEquivalents()
bool operator!=(const RegExpFlags &other) const
bool operator==(const RegExpFlags &other) const
TypedDataPtr bytecode(bool is_one_byte, bool sticky) const
void set_is_simple() const
void set_is_multi_line() const
void set_is_unicode() const
StringPtr pattern() const
void set_num_bracket_expressions(const Smi &value) const
bool is_initialized() const
ArrayPtr capture_name_map() const
void set_is_complex() const
void set_is_dot_all() const
static intptr_t function_offset(intptr_t cid, bool sticky)
void set_num_bracket_expressions(SmiPtr value) const
static intptr_t InstanceSize()
intptr_t num_bracket_expressions() const
void set_is_ignore_case() const
void set_flags(RegExpFlags flags) const
RegExpFlags flags() const
FunctionPtr function(intptr_t cid, bool sticky) const
intptr_t num_registers(bool is_one_byte) const
void set_num_registers(bool is_one_byte, intptr_t value) const
void set_is_global() const
static intptr_t line_starts_offset()
intptr_t kernel_script_index() const
intptr_t col_offset() const
int64_t load_timestamp() const
static intptr_t InstanceSize()
intptr_t line_offset() const
static intptr_t InstanceSize()
Dart_Port origin_id() const
void set_origin_id(Dart_Port id) const
static intptr_t InstanceSize()
ObjectPtr CurrentKey() const
static intptr_t InstanceSize()
static SingleTargetCachePtr New()
void set_target(const Code &target) const
static intptr_t InstanceSize()
DEFINE_NON_POINTER_FIELD_ACCESSORS(intptr_t, lower_limit)
DEFINE_NON_POINTER_FIELD_ACCESSORS(intptr_t, upper_limit)
static intptr_t target_offset()
DEFINE_NON_POINTER_FIELD_ACCESSORS(uword, entry_point)
static bool IsMatch(const Object &a, const Object &b)
static uword Hash(const Object &obj)
static bool ReportStats()
static const char * Name()
static SmiPtr New(intptr_t value)
static intptr_t InstanceSize()
static intptr_t RawValue(intptr_t value)
static bool IsValid(int64_t value)
virtual bool IsZero() const
virtual bool IsNegative() const
static intptr_t Value(const SmiPtr raw_smi)
void operator^=(ObjectPtr value)
virtual bool FitsIntoSmi() const
void operator=(SmiPtr value)
TypedDataPtr pc_offset_array() const
static intptr_t InstanceSize()
ArrayPtr code_array() const
StackTracePtr async_link() const
static StaticTypeExactnessState NotTracking()
void Add(const uint8_t *code_units, intptr_t len)
void Add(uint16_t code_unit)
void Add(const uint16_t *code_units, intptr_t len)
CodePointIterator(const String &str)
CodePointIterator(const String &str, intptr_t start, intptr_t length)
virtual bool OperatorEquals(const Instance &other) const
static constexpr intptr_t kSizeofRawString
static constexpr intptr_t kMaxElements
static StringPtr NewExternal(const uint8_t *utf8_array, intptr_t array_len, void *peer, intptr_t external_allocation_size, Dart_HandleFinalizer callback, Heap::Space=Heap::kNew)
bool IsOneByteString() const
static uword Hash(const int32_t *characters, intptr_t len)
static uint32_t SetCachedHashIfNotSet(StringPtr obj, uint32_t hash)
virtual ObjectPtr HashCode() const
static uword HashRawSymbol(const StringPtr symbol)
void SetHash(intptr_t value) const
static intptr_t HeaderSize()
virtual uint32_t CanonicalizeHash() const
void SetLength(intptr_t value) const
bool Equals(const String &str) const
static intptr_t length_offset()
static intptr_t InstanceSize()
static intptr_t hash_offset()
bool IsTwoByteString() const
static uint32_t SetCachedHash(StringPtr obj, uint32_t hash)
static StringPtr SubString(const String &str, intptr_t begin_index, intptr_t length, Heap::Space space=Heap::kNew)
uint16_t CharAt(intptr_t index) const
bool StartsWith(const String &other) const
virtual bool CanonicalizeEquals(const Instance &other) const
bool EqualsLatin1(const uint8_t *characters, intptr_t len) const
static StringPtr NewExternal(const uint16_t *utf16_array, intptr_t array_len, void *peer, intptr_t external_allocation_size, Dart_HandleFinalizer callback, Heap::Space=Heap::kNew)
static uint32_t GetCachedHash(const StringPtr obj)
static intptr_t LengthOf(StringPtr obj)
FINAL_HEAP_OBJECT_IMPLEMENTATION(String, Instance)
intptr_t num_occupied() const
static intptr_t num_inputs_offset()
static intptr_t cache_offset()
static constexpr intptr_t MaxEntriesForCacheAllocatedFor(intptr_t count)
intptr_t num_inputs() const
static intptr_t InstanceSize()
static intptr_t frame_size_offset()
static intptr_t error_callback_offset()
static intptr_t function_data_offset()
ClosurePtr error_callback() const
static intptr_t then_callback_offset()
static intptr_t InstanceSize(intptr_t frame_capacity)
static intptr_t FrameSizeGrowthGap()
static intptr_t HeaderSize()
static intptr_t payload_offset()
static intptr_t UnroundedSize(SuspendStatePtr ptr)
ClosurePtr then_callback() const
static intptr_t InstanceSize()
static intptr_t pc_offset()
InstancePtr function_data() const
static intptr_t frame_capacity_offset()
intptr_t frame_size() const
static intptr_t UnroundedSize(intptr_t frame_capacity)
static Thread * Current()
~TransferableTypedDataPeer()
void set_handle(FinalizablePersistentHandle *handle)
FinalizablePersistentHandle * handle() const
TransferableTypedDataPeer(uint8_t *data, intptr_t length)
static intptr_t InstanceSize()
static uint16_t CharAt(const String &str, intptr_t index)
static intptr_t UnroundedSize(TwoByteStringPtr str)
static uint16_t CharAt(TwoByteStringPtr str, intptr_t index)
static intptr_t InstanceSize(intptr_t len)
static intptr_t InstanceSize()
static intptr_t data_offset()
static TwoByteStringPtr null()
static intptr_t UnroundedSize(intptr_t len)
static void SetCharAt(const String &str, intptr_t index, uint16_t ch)
KeyLocation FindKeyOrUnused(const TypeArguments &instantiator_tav, const TypeArguments &function_tav) const
@ kInstantiatedTypeArgsIndex
static const Array & EmptyStorage()
intptr_t NumOccupied() const
intptr_t NumEntries() const
bool IsEquivalent(const TypeArguments &other, TypeEquality kind, FunctionTypeMapping *function_type_equivalence=nullptr) const
static intptr_t instantiations_offset()
bool IsInstantiated(Genericity genericity=kAny, intptr_t num_free_fun_type_params=kAllFree) const
virtual uint32_t CanonicalizeHash() const
static intptr_t types_offset()
bool Equals(const TypeArguments &other) const
static intptr_t InstanceSize()
static intptr_t InstanceSize(intptr_t len)
static intptr_t hash_offset()
AbstractTypePtr TypeAtNullSafe(intptr_t index) const
virtual InstancePtr CanonicalizeLocked(Thread *thread) const
static intptr_t type_at_offset(intptr_t index)
bool IsRaw(intptr_t from_index, intptr_t len) const
bool IsRawWhenInstantiatedFromRaw(intptr_t len) const
static intptr_t nullability_offset()
static intptr_t length_offset()
virtual classid_t type_class_id() const
bool IsClassTypeParameter() const
static intptr_t index_offset()
virtual bool HasTypeClass() const
virtual void EnumerateURIs(URIs *uris) const
static intptr_t InstanceSize()
const char * CanonicalNameCString() const
bool IsFunctionTypeParameter() const
static intptr_t defaults_offset()
static intptr_t flags_offset()
static intptr_t names_offset()
static intptr_t InstanceSize()
COMPILE_ASSERT(kFlagsPerSmi< kSmiBits)
static intptr_t bounds_offset()
static intptr_t arguments_offset()
static intptr_t InstanceSize()
virtual TypeArgumentsPtr arguments() const
virtual bool HasTypeClass() const
TypedDataElementType ElementType() const
virtual uint8_t * Validate(uint8_t *data) const
intptr_t ElementSizeInBytes() const
static TypedDataElementType ElementType(classid_t cid)
static intptr_t length_offset()
intptr_t LengthInBytes() const
static intptr_t ElementSizeInBytes(classid_t cid)
void SetLength(intptr_t value) const
void * DataAddr(intptr_t byte_offset) const
TypedDataBasePtr typed_data() const
static intptr_t typed_data_offset()
static intptr_t offset_in_bytes_offset()
static SmiPtr OffsetInBytes(const TypedDataView &view)
static intptr_t InstanceSize()
virtual uint8_t * Validate(uint8_t *data) const
static InstancePtr Data(const TypedDataView &view)
void InitializeWith(const TypedDataBase &typed_data, intptr_t offset_in_bytes, intptr_t length)
SmiPtr offset_in_bytes() const
static bool IsExternalTypedDataView(const TypedDataView &view_obj)
static intptr_t payload_offset()
static bool IsTypedData(const Instance &obj)
static intptr_t InstanceSize(intptr_t lengthInBytes)
static intptr_t MaxNewSpaceElements(intptr_t class_id)
static intptr_t MaxElements(intptr_t class_id)
void RecomputeDataField()
static intptr_t InstanceSize()
static intptr_t stacktrace_offset()
InstancePtr exception() const
static intptr_t exception_offset()
static intptr_t InstanceSize()
InstancePtr stacktrace() const
static intptr_t InstanceSize()
bool can_patch_to_monomorphic() const
void StoreSmi(type const *addr, type value)
void StorePointer(type const *addr, type value)
void Validate(IsolateGroup *isolate_group) const
static uword ToAddr(const UntaggedObject *raw_obj)
bool InVMIsolateHeap() const
type LoadPointer(type const *addr) const
bool Contains(uword addr) const
void StoreCompressedPointer(compressed_type const *addr, type value)
intptr_t GetClassId() const
void StorePointerUnaligned(type const *addr, type value, Thread *thread)
static constexpr bool kContainsCompressedPointers
static intptr_t InstanceSize()
bool is_user_initiated() const
StringPtr message() const
static intptr_t tag_offset()
void set_streamable(bool streamable)
void set_tag(uword t) const
static intptr_t InstanceSize()
static constexpr T RoundUp(T x, uintptr_t alignment, uintptr_t offset=0)
static constexpr bool IsAligned(T x, uintptr_t alignment, uintptr_t offset=0)
static uword AllocateZoneHandle(Zone *zone)
static uword AllocateHandle(Zone *zone)
void SetAt(intptr_t index, const Object &value) const
static intptr_t InstanceSize()
static intptr_t LengthOf(const WeakArrayPtr array)
static constexpr intptr_t InstanceSize(intptr_t len)
ObjectPtr AtAcquire(intptr_t index) const
static intptr_t element_offset(intptr_t index)
static intptr_t length_offset()
ObjectPtr At(intptr_t index) const
static constexpr bool IsValidLength(intptr_t length)
static intptr_t index_at_offset(intptr_t offset_in_bytes)
static intptr_t data_offset()
void SetAtRelease(intptr_t index, const Object &value) const
static intptr_t key_offset()
void set_key(const Object &key) const
static intptr_t value_offset()
static intptr_t InstanceSize()
void set_value(const Object &value) const
static intptr_t InstanceSize()
static intptr_t type_arguments_offset()
static intptr_t target_offset()
void set_target(const Object &target) const
static ObjectPtr UnwrapIfTarget(const Object &obj)
static ObjectPtr Unwrap(ObjectPtr obj)
static ObjectPtr UnwrapIfTarget(ObjectPtr obj)
static ObjectPtr TargetOf(const WeakSerializationReferencePtr obj)
static intptr_t InstanceSize()
static ObjectPtr Unwrap(const Object &obj)
#define DART_WARN_UNUSED_RESULT
Dart_NativeFunction(* Dart_NativeEntryResolver)(Dart_Handle name, int num_of_arguments, bool *auto_setup_scope)
void(* Dart_HandleFinalizer)(void *isolate_callback_data, void *peer)
const uint8_t *(* Dart_NativeEntrySymbol)(Dart_NativeFunction nf)
void *(* Dart_FfiNativeResolver)(const char *name, uintptr_t args_n)
const EmbeddedViewParams * params
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
FlutterSemanticsFlag flags
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
static const uint8_t buffer[]
static void set_value(FlSettingsPortal *portal, const FlSetting *setting, GVariant *value)
void PrintTo(FlValue *v, std::ostream *os)
uint32_t uint32_t * format
Dart_NativeFunction function
#define DECLARE_BIT(Name)
#define REUSABLE_FRIEND_DECLARATION(name)
#define DEFINE_ENUM_LIST(class_name, function_name, enum_name, fp)
Optional< SkRect > bounds
static constexpr intptr_t kNullIdentityHash
const intptr_t kOffsetOfPtr
const int kNumTypedDataCidRemainders
void DumpStackFrame(intptr_t frame_index, uword pc, uword fp)
static bool Equals(const Object &expected, const Object &actual)
bool IsTypedDataViewClassId(intptr_t index)
bool IsTypedDataClassId(intptr_t index)
static constexpr intptr_t kFalseIdentityHash
constexpr intptr_t kBitsPerWordLog2
constexpr intptr_t kBitsPerByteLog2
bool IsFfiDynamicLibraryClassId(intptr_t index)
ZoneGrowableHandlePtrArray< const String > URIs
const int kTypedDataCidRemainderUnmodifiable
constexpr intptr_t kBitsPerWord
DART_WARN_UNUSED_RESULT ErrorPtr EntryPointFieldInvocationError(const String &getter_name)
DART_EXPORT bool IsNull(Dart_Handle object)
intptr_t RawSmiValue(const SmiPtr raw_value)
uint32_t CombineHashes(uint32_t hash, uint32_t other_hash)
const int kTypedDataCidRemainderInternal
@ kIsolateLocalClosureCallback
@ kIsolateLocalStaticCallback
DART_WARN_UNUSED_RESULT ErrorPtr EntryPointMemberInvocationError(const Object &member)
bool IsUnmodifiableTypedDataViewClassId(intptr_t index)
@ kUnmodifiableByteDataViewCid
constexpr uint32_t kMaxUint32
constexpr intptr_t kBitsPerByte
EntryPointPragma FindEntryPointPragma(IsolateGroup *IG, const Array &metadata, Field *reusable_field_handle, Object *pragma)
ObjectPtr Invoke(const Library &lib, const char *name)
FunctionPtr GetFunction(const Library &lib, const char *name)
constexpr uword kUwordMax
DART_WARN_UNUSED_RESULT ErrorPtr VerifyEntryPoint(const Library &lib, const Object &member, const Object &annotated, std::initializer_list< EntryPointPragma > allowed_kinds)
const int kTypedDataCidRemainderExternal
static const char * Concat(const char *a, const char *b)
const int kTypedDataCidRemainderView
bool IsZero(char *begin, char *end)
uint32_t HashBytes(const uint8_t *bytes, intptr_t size)
@ kCurrentAndEnclosingFree
bool FindPragmaInMetadata(Thread *T, const Object &metadata_obj, const String &pragma_name, bool multiple, Object *options)
void Validate(const Table &table)
constexpr intptr_t kBitsPerInt32
static constexpr intptr_t kTrueIdentityHash
static constexpr intptr_t kCompressedWordSize
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)
uint32_t FinalizeHash(uint32_t hash, intptr_t hashbits=kBitsPerInt32)
static uint32_t Hash(uint32_t key)
void DumpTypeTable(Isolate *isolate)
constexpr int32_t kMaxInt32
constexpr intptr_t kWordSize
static constexpr intptr_t kObjectAlignment
void DFLRT_ExitSafepoint(NativeArguments __unusable_)
const intptr_t kPreferredLoopAlignment
void DumpTypeParameterTable(Isolate *isolate)
static int8_t data[kExtLength]
void DumpTypeArgumentsTable(Isolate *isolate)
static constexpr intptr_t kNewAllocatableSize
bool IsExternalTypedDataClassId(intptr_t index)
ObjectPtr CompressedObjectPtr
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
#define SHARED_READONLY_HANDLES_LIST(V)
#define DEFINE_INSTRUCTIONS_FLAG_HANDLING(Name)
#define BASE_OBJECT_IMPLEMENTATION(object, super)
#define ASSERT_FUNCTION_KIND_IN_RANGE(Name)
#define MINT_OBJECT_IMPLEMENTATION(object, rettype, super)
#define REUSABLE_FORWARD_DECLARATION(name)
#define OBJECT_SERVICE_SUPPORT(object)
#define ALLSTATIC_CONTAINS_COMPRESSED_IMPLEMENTATION(object, handle)
#define DEFINE_CLASS_TESTER(clazz)
#define DEFINE_BIT(name, _)
#define DECLARE_FLAG_POS(Name)
#define HEAP_OBJECT_IMPLEMENTATION(object, super)
#define DEFINE_ACCESSORS(name, accessor_name)
#define DECLARE_SHARED_READONLY_HANDLE(Type, name)
#define PRECOMPILER_WSR_FIELD_DECLARATION(Type, Name)
#define FOR_EACH_FUNCTION_KIND_BIT(V)
#define FOR_EACH_REBIND_RULE(V)
#define DECLARE_FLAG_ACCESSORS(Name)
#define FINAL_HEAP_OBJECT_IMPLEMENTATION(object, super)
#define TYPED_GETTER_SETTER(name, type)
#define STORE_NON_POINTER_ILLEGAL_TYPE(type)
#define REBIND_ENUM_DEF(name)
#define DEFINE_GETTERS_AND_SETTERS(return_type, type, name)
#define OBJECT_IMPLEMENTATION(object, super)
#define DEFINE_FLAG_BIT(Name)
#define DEFINE_FORWARD_DECLARATION(clazz)
#define FOR_EACH_FUNCTION_VOLATILE_KIND_BIT(V)
#define DEFINE_INSTRUCTIONS_FLAG(Name)
#define INSTRUCTIONS_FLAGS_LIST(V)
#define DEFINE_SHARED_READONLY_HANDLE_GETTER(Type, name)
#define STATE_BITS_LIST(V)
#define FOR_EACH_RAW_FUNCTION_KIND(V)
#define JIT_FUNCTION_COUNTERS(F)
#define CONTEXT_SCOPE_VARIABLE_DESC_FLAG_LIST(V)
static intptr_t elements_start_offset()
static intptr_t elements_start_offset()
static intptr_t elements_start_offset()
static intptr_t elements_start_offset()
static intptr_t elements_start_offset()
static intptr_t elements_start_offset()
Entry(uword value, EntryType info)
static intptr_t elements_start_offset()
static intptr_t elements_start_offset()
static intptr_t elements_start_offset()
static intptr_t elements_start_offset()
uint32_t FlagsAndSizeHeader
static intptr_t elements_start_offset()
#define REUSABLE_HANDLE_LIST(V)
#define NOT_IN_PRECOMPILED(code)
#define OFFSET_OF(type, field)
#define ONLY_IN_PRECOMPILED(code)
#define OFFSET_OF_RETURNED_VALUE(type, accessor)
#define DEFINE_FLAG_ACCESSORS(Name)