Flutter Engine
The Flutter Engine
runtime_api.h
Go to the documentation of this file.
1// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
2// for details. All rights reserved. Use of this source code is governed by a
3// BSD-style license that can be found in the LICENSE file.
4
5#ifndef RUNTIME_VM_COMPILER_RUNTIME_API_H_
6#define RUNTIME_VM_COMPILER_RUNTIME_API_H_
7
8// This header defines the API that compiler can use to interact with the
9// underlying Dart runtime that it is embedded into.
10//
11// Compiler is not allowed to directly interact with any objects - it can only
12// use classes like dart::Object, dart::Code, dart::Function and similar as
13// opaque handles. All interactions should be done through helper methods
14// provided by this header.
15//
16// This header also provides ways to get word sizes, frame layout, field
17// offsets for the target runtime. Note that these can be different from
18// those on the host. Helpers providing access to these values live
19// in compiler::target namespace.
20
21#include "platform/globals.h"
23#include "platform/utils.h"
24
25#include "vm/allocation.h"
26#include "vm/bitfield.h"
27#include "vm/bss_relocs.h"
28#include "vm/class_id.h"
29#include "vm/code_entry_kind.h"
30#include "vm/constants.h"
31#include "vm/frame_layout.h"
32#include "vm/pointer_tagging.h"
34#include "vm/token.h"
35
36namespace dart {
37
38// Forward declarations.
39class LocalVariable;
40class Object;
41class RuntimeEntry;
42class Zone;
43
44#define DO(clazz) \
45 class Untagged##clazz; \
46 class clazz;
48#undef DO
49
50namespace compiler {
51class Assembler;
52}
53
54namespace compiler {
55
56// Host word sizes.
57//
58// Code in the compiler namespace should not use kWordSize and derived
59// constants directly because the word size on host and target might
60// be different.
61//
62// To prevent this we introduce variables that would shadow these
63// constants and introduce compilation errors when used.
64//
65// target::kWordSize and target::ObjectAlignment give access to
66// word size and object alignment offsets for the target.
67//
68// Similarly kHostWordSize gives access to the host word size.
69class InvalidClass {};
89
90static constexpr intptr_t kHostWordSize = dart::kWordSize;
91static constexpr intptr_t kHostWordSizeLog2 = dart::kWordSizeLog2;
92
93//
94// Object handles.
95//
96
97// Create an empty handle.
99
100// Clone the given handle.
101Object& NewZoneHandle(Zone* zone, const Object&);
102
103//
104// Constant objects.
105//
106
107const Object& NullObject();
108const Object& SentinelObject();
109const Bool& TrueObject();
110const Bool& FalseObject();
112const Type& DynamicType();
113const Type& ObjectType();
114const Type& VoidType();
115const Type& IntType();
117const Class& MintClass();
118const Class& DoubleClass();
119const Class& Float32x4Class();
120const Class& Float64x2Class();
121const Class& Int32x4Class();
122const Class& ClosureClass();
123const Array& ArgumentsDescriptorBoxed(intptr_t type_args_len,
124 intptr_t num_arguments);
125
126template <typename To, typename From>
127const To& CastHandle(const From& from) {
128 return reinterpret_cast<const To&>(from);
129}
130
131// Returns true if [a] and [b] are the same object.
132bool IsSameObject(const Object& a, const Object& b);
133
134// Returns true if [a] and [b] represent the same type (are equal).
135bool IsEqualType(const AbstractType& a, const AbstractType& b);
136
137// Returns true if [type] is a subtype of the "int" type (_Smi, _Mint, int or
138// _IntegerImplementation).
139bool IsSubtypeOfInt(const AbstractType& type);
140
141// Returns true if [type] is the "double" type.
142bool IsDoubleType(const AbstractType& type);
143
144// Returns true if [type] is the "double" type.
145bool IsBoolType(const AbstractType& type);
146
147// Returns true if [type] is the "_Smi" type.
148bool IsSmiType(const AbstractType& type);
149
150#if defined(DEBUG)
151// Returns true if the given handle is a zone handle or one of the global
152// cached handles.
153bool IsNotTemporaryScopedHandle(const Object& obj);
154#endif
155
156// Returns true if [obj] resides in old space.
157bool IsInOldSpace(const Object& obj);
158
159// Returns true if [obj] is not a Field/ICData clone.
160//
161// Used to assert that we are not embedding pointers to cloned objects that are
162// used by background compiler into object pools / code.
163bool IsOriginalObject(const Object& object);
164
165// Clear the given handle.
166void SetToNull(Object* obj);
167
168// Helper functions to upcast handles.
169//
170// Note: compiler code cannot include object.h so it cannot see that Object is
171// a superclass of Code or Function - thus we have to cast these pointers using
172// reinterpret_cast.
173inline const Object& ToObject(const Code& handle) {
174 return *reinterpret_cast<const Object*>(&handle);
175}
176
177inline const Object& ToObject(const Function& handle) {
178 return *reinterpret_cast<const Object*>(&handle);
179}
180
181// Returns some hash value for the given object.
182//
183// Note: the given hash value does not necessarily match Object.get:hashCode,
184// or canonical hash.
185intptr_t ObjectHash(const Object& obj);
186
187// Prints the given object into a C string.
188const char* ObjectToCString(const Object& obj);
189
190// If the given object represents a Dart integer returns true and sets [value]
191// to the value of the integer.
192bool HasIntegerValue(const dart::Object& obj, int64_t* value);
193
194// Creates a random cookie to be used for masking constants embedded in the
195// generated code.
196int32_t CreateJitCookie();
197
198// Returns the size in bytes for the given class id.
200
201// Returns the size in bytes for the given class id.
203
204// Looks up the dart:math's _Random._A field.
206
207// Looks up the dart:convert's _Utf8Decoder._scanFlags field.
209
210// Returns the offset in bytes of [field].
212
213#if defined(TARGET_ARCH_IA32)
214uword SymbolsPredefinedAddress();
215#endif
216
223
224class RuntimeEntry : public ValueObject {
225 public:
226 virtual ~RuntimeEntry() {}
227
228 word OffsetFromThread() const;
229
230 bool is_leaf() const;
231 intptr_t argument_count() const;
232
233 protected:
234 explicit RuntimeEntry(const dart::RuntimeEntry* runtime_entry)
235 : runtime_entry_(runtime_entry) {}
236
237 private:
238 const dart::RuntimeEntry* runtime_entry_;
239};
240
241#define DECLARE_RUNTIME_ENTRY(name) \
242 extern const RuntimeEntry& k##name##RuntimeEntry;
244#undef DECLARE_RUNTIME_ENTRY
245
246#define DECLARE_RUNTIME_ENTRY(type, name, ...) \
247 extern const RuntimeEntry& k##name##RuntimeEntry;
249#undef DECLARE_RUNTIME_ENTRY
250
251// Allocate a string object with the given content in the runtime heap.
252const String& AllocateString(const char* buffer);
253
254DART_NORETURN void BailoutWithBranchOffsetError();
255
256// compiler::target namespace contains information about the target platform:
257//
258// - word sizes and derived constants
259// - offsets of fields
260// - sizes of structures
261namespace target {
262
263#if defined(TARGET_ARCH_IS_32_BIT)
264typedef int32_t word;
265typedef uint32_t uword;
266static constexpr intptr_t kWordSizeLog2 = 2;
267#elif defined(TARGET_ARCH_IS_64_BIT)
268typedef int64_t word;
269typedef uint64_t uword;
270static constexpr intptr_t kWordSizeLog2 = 3;
271#else
272#error "Unsupported architecture"
273#endif
274static constexpr intptr_t kWordSize = 1 << kWordSizeLog2;
275static_assert(kWordSize == sizeof(word), "kWordSize should match sizeof(word)");
276// Our compiler code currently assumes this, so formally check it.
277#if !defined(FFI_UNIT_TESTS)
278static_assert(dart::kWordSize >= kWordSize,
279 "Host word size smaller than target word size");
280#endif
281
282#if defined(DART_COMPRESSED_POINTERS)
283static constexpr intptr_t kCompressedWordSize = kInt32Size;
284static constexpr intptr_t kCompressedWordSizeLog2 = kInt32SizeLog2;
285#else
286static constexpr intptr_t kCompressedWordSize = kWordSize;
287static constexpr intptr_t kCompressedWordSizeLog2 = kWordSizeLog2;
288#endif
289
291static constexpr word kBitsPerWord = 1 << kBitsPerWordLog2;
292
294
295constexpr word kWordMax = (static_cast<uword>(1) << (kBitsPerWord - 1)) - 1;
296constexpr word kWordMin = -(static_cast<uword>(1) << (kBitsPerWord - 1));
297constexpr uword kUwordMax = static_cast<word>(-1);
298
299// The number of bits in the _magnitude_ of a Smi, not counting the sign bit.
300#if !defined(DART_COMPRESSED_POINTERS)
301constexpr intptr_t kSmiBits = kBitsPerWord - 2;
302#else
303constexpr intptr_t kSmiBits = 30;
304#endif
305constexpr word kSmiMax = (static_cast<uword>(1) << kSmiBits) - 1;
306constexpr word kSmiMin = -(static_cast<uword>(1) << kSmiBits);
307
308// Information about heap pages.
309extern const word kPageSize;
310extern const word kPageSizeInWords;
311extern const word kPageMask;
312
314
315// Note: if other flags are added, then change the check for required parameters
316// when no named arguments are provided in
317// FlowGraphBuilder::BuildClosureCallHasRequiredNamedArgumentsCheck, since it
318// assumes there are no flag slots when no named parameters are required.
322};
323// Parameter flags are stored in Smis. To ensure shifts and masks can be used to
324// calculate both the parameter flag index in the parameter names array and
325// which bit to check, kNumParameterFlagsPerElement should be a power of two.
326static constexpr intptr_t kNumParameterFlagsPerElementLog2 =
328static constexpr intptr_t kNumParameterFlagsPerElement =
331 "kNumParameterFlagsPerElement should fit in a Smi");
332
333inline intptr_t RoundedAllocationSize(intptr_t size) {
335}
336// Information about frame_layout that compiler should be targeting.
338
339constexpr intptr_t kIntSpillFactor = sizeof(int64_t) / kWordSize;
340constexpr intptr_t kDoubleSpillFactor = sizeof(double) / kWordSize;
341
342// Returns the FP-relative index where [variable] can be found (assumes
343// [variable] is not captured), in bytes.
344inline intptr_t FrameOffsetInBytesForVariable(const LocalVariable* variable) {
346}
347
348// Check whether instance_size is small enough to be encoded in the size tag.
349bool SizeFitsInSizeTag(uword instance_size);
350
351// Encode tag word for a heap allocated object with the given class id and
352// size.
353//
354// Note: even on 64-bit platforms we only use lower 32-bits of the tag word.
356
357//
358// Target specific information about objects.
359//
360
361// Returns true if the given object can be represented as a Smi on the target
362// platform.
363bool IsSmi(const dart::Object& a);
364
365// Returns true if the given value can be represented as a Smi on the target
366// platform.
367bool IsSmi(int64_t value);
368
369// Return raw Smi representation of the given object for the target platform.
371
372// Return raw Smi representation of the given integer value for the target
373// platform.
374//
375// Note: method assumes that caller has validated that value is representable
376// as a Smi.
377word ToRawSmi(intptr_t value);
378
380
381bool IsDouble(const dart::Object& a);
382double DoubleValue(const dart::Object& a);
383
384// If the given object can be loaded from the thread on the target then
385// return true and set offset (if provided) to the offset from the
386// thread pointer to a field that contains the object.
387bool CanLoadFromThread(const dart::Object& object, intptr_t* offset = nullptr);
388
389// On IA32 we can embed raw pointers into generated code.
390#if defined(TARGET_ARCH_IA32)
391// Returns true if the pointer to the given object can be directly embedded
392// into the generated code (because the object is immortal and immovable).
393bool CanEmbedAsRawPointerInGeneratedCode(const dart::Object& obj);
394
395// Returns raw pointer value for the given object. Should only be invoked
396// if CanEmbedAsRawPointerInGeneratedCode returns true.
397word ToRawPointer(const dart::Object& a);
398#endif // defined(TARGET_ARCH_IA32)
399
400bool WillAllocateNewOrRememberedObject(intptr_t instance_size);
401
402bool WillAllocateNewOrRememberedContext(intptr_t num_context_variables);
403
405
406#define FINAL_CLASS() \
407 static word NextFieldOffset() { \
408 return -kWordSize; \
409 }
410
411//
412// Target specific offsets and constants.
413//
414// Currently we use the same names for classes, constants and getters to make
415// migration easier.
416
417class UntaggedObject : public AllStatic {
418 public:
420 static const word kCanonicalBit;
423 static const word kNotMarkedBit;
424 static const word kImmutableBit;
425 static const word kSizeTagPos;
426 static const word kSizeTagSize;
427 static const word kClassIdTagPos;
428 static const word kClassIdTagSize;
429 static const word kHashTagPos;
430 static const word kHashTagSize;
436
437 static bool IsTypedDataClassId(intptr_t cid);
438};
439
441 public:
443 static const word kTypeStateShift;
444 static const word kTypeStateBits;
445 static const word kNullabilityMask;
446};
447
448class UntaggedType : public AllStatic {
449 public:
451};
452
454 public:
456};
457
458class Object : public AllStatic {
459 public:
460 // Offset of the tags word.
461 static word tags_offset();
463};
464
465class ObjectPool : public AllStatic {
466 public:
467 // Return offset to the element with the given [index] in the object pool.
468 static word element_offset(intptr_t index);
469 static word InstanceSize(intptr_t length);
472};
473
474class Class : public AllStatic {
475 public:
477
479
481
482 // The offset of the UntaggedObject::num_type_arguments_ field in bytes.
484
485 // The value used if no type arguments vector is present.
486 static const word kNoTypeArguments;
487
489
491
492 // Return class id of the given class on the target.
493 static classid_t GetId(const dart::Class& handle);
494
495 // Return instance size for the given class on the target.
496 static uword GetInstanceSize(const dart::Class& handle);
497
498 // Return whether objects of the class on the target contain compressed
499 // pointers.
500 static bool HasCompressedPointers(const dart::Class& handle);
501
502 // Returns the number of type arguments.
503 static intptr_t NumTypeArguments(const dart::Class& klass);
504
505 // Whether [klass] has a type arguments vector field.
506 static bool HasTypeArgumentsField(const dart::Class& klass);
507
508 // Returns the offset (in bytes) of the type arguments vector.
509 static intptr_t TypeArgumentsFieldOffset(const dart::Class& klass);
510
511 // Whether to trace allocation for this klass.
512 static bool TraceAllocation(const dart::Class& klass);
513};
514
515class Instance : public AllStatic {
516 public:
517 // Returns the offset to the first field of [UntaggedInstance].
518 static word first_field_offset();
520 static word DataOffsetFor(intptr_t cid);
521 static word ElementSizeFor(intptr_t cid);
523 static word NextFieldOffset();
524};
525
526class Function : public AllStatic {
527 public:
536};
537
538class CallSiteData : public AllStatic {
539 public:
541};
542
543class ICData : public AllStatic {
544 public:
549
550 static word CodeIndexFor(word num_args);
551 static word CountIndexFor(word num_args);
552 static word TargetIndexFor(word num_args);
553 static word ExactnessIndexFor(word num_args);
554 static word TestEntryLengthFor(word num_args, bool exactness_check);
555 static word EntryPointIndexFor(word num_args);
560};
561
563 public:
564 static const word kSpreadFactor;
569};
570
572 public:
579};
580
581class Array : public AllStatic {
582 public:
588 static word element_offset(intptr_t index);
589 static intptr_t index_at_offset(intptr_t offset_in_bytes);
590 static word InstanceSize(intptr_t length);
593
594 static const word kMaxElements;
596};
597
599 public:
605};
606
607class RecordShape : public AllStatic {
608 public:
609 static const word kNumFieldsMask;
610 static const word kMaxNumFields;
614};
615
616class Record : public AllStatic {
617 public:
619 static word field_offset(intptr_t index);
620 static intptr_t field_index_at_offset(intptr_t offset_in_bytes);
621 static word InstanceSize(intptr_t length);
624
625 static const word kMaxElements;
626};
627
628class PointerBase : public AllStatic {
629 public:
631};
632
633class TypedDataBase : public AllStatic {
634 public:
638};
639
640class TypedData : public AllStatic {
641 public:
643 static word HeaderSize();
645 static word InstanceSize(word lengthInBytes);
647};
648
650 public:
653};
654
655class TypedDataView : public AllStatic {
656 public:
661};
662
663class LinkedHashBase : public AllStatic {
664 public:
672};
673
675 public:
676 // The data slot is an immutable list and final in immutable maps and sets.
678};
679
680class Map : public LinkedHashBase {
681 public:
683};
684
685class Set : public LinkedHashBase {
686 public:
688};
689
690class FutureOr : public AllStatic {
691 public:
695};
696
698 public:
707};
708
709class LocalHandle : public AllStatic {
710 public:
711 static word ptr_offset();
713};
714
716 public:
717 static word ptr_offset();
718};
719
720class Pointer : public AllStatic {
721 public:
725};
726
727class AbstractType : public AllStatic {
728 public:
734};
735
736class Type : public AllStatic {
737 public:
741};
742
743class FunctionType : public AllStatic {
744 public:
752};
753
754class RecordType : public AllStatic {
755 public:
758};
759
760class Nullability : public AllStatic {
761 public:
762 static const uint8_t kNullable;
763 static const uint8_t kNonNullable;
764};
765
766class Double : public AllStatic {
767 public:
771};
772
773class Mint : public AllStatic {
774 public:
778};
779
780class String : public AllStatic {
781 public:
782 static const word kHashBits;
783 static const word kMaxElements;
787 static word InstanceSize(word payload_size);
789};
790
791class OneByteString : public AllStatic {
792 public:
794 static word InstanceSize(intptr_t length);
797
799
800 private:
801 static word element_offset(intptr_t index);
802};
803
804class TwoByteString : public AllStatic {
805 public:
807 static word InstanceSize(intptr_t length);
810
812
813 private:
814 static word element_offset(intptr_t index);
815};
816
817class Int32x4 : public AllStatic {
818 public:
822};
823
824class Float32x4 : public AllStatic {
825 public:
829};
830
831class Float64x2 : public AllStatic {
832 public:
836};
837
838class DynamicLibrary : public AllStatic {
839 public:
842};
843
844class PatchClass : public AllStatic {
845 public:
848};
849
851 public:
854};
855
856class Script : public AllStatic {
857 public:
860};
861
862class Library : public AllStatic {
863 public:
866};
867
868class Namespace : public AllStatic {
869 public:
872};
873
875 public:
878};
879
880class PcDescriptors : public AllStatic {
881 public:
882 static word HeaderSize();
884 static word InstanceSize(word payload_size);
886};
887
888class CodeSourceMap : public AllStatic {
889 public:
890 static word HeaderSize();
892 static word InstanceSize(word payload_size);
894};
895
897 public:
898 static word HeaderSize() { return ObjectHeaderSize() + PayloadHeaderSize(); }
900 static word InstanceSize(word payload_size);
902
903 private:
904 static word ObjectHeaderSize();
905 static word PayloadHeaderSize();
906};
907
909 public:
910 static word InstanceSize();
912};
913
915 public:
916 static word element_offset(intptr_t index);
917 static word InstanceSize(intptr_t length);
920};
921
922class ContextScope : public AllStatic {
923 public:
924 static word element_offset(intptr_t index);
925 static word InstanceSize(intptr_t length);
928};
929
930class Sentinel : public AllStatic {
931 public:
934};
935
936class UnlinkedCall : public AllStatic {
937 public:
940};
941
942class ApiError : public AllStatic {
943 public:
946};
947
948class LanguageError : public AllStatic {
949 public:
952};
953
955 public:
960};
961
962class UnwindError : public AllStatic {
963 public:
966};
967
968class Bool : public AllStatic {
969 public:
972};
973
974class TypeParameter : public AllStatic {
975 public:
979};
980
981class LibraryPrefix : public AllStatic {
982 public:
985};
986
987class Capability : public AllStatic {
988 public:
991};
992
993class ReceivePort : public AllStatic {
994 public:
999};
1000
1001class SendPort : public AllStatic {
1002 public:
1005};
1006
1008 public:
1011};
1012
1013class StackTrace : public AllStatic {
1014 public:
1017};
1018
1019class SuspendState : public AllStatic {
1020 public:
1023 static word pc_offset();
1028
1031 static word InstanceSize(word payload_size);
1033
1035};
1036
1037class Integer : public AllStatic {
1038 public:
1040 static word NextFieldOffset();
1041};
1042
1043class Smi : public AllStatic {
1044 public:
1045 static word InstanceSize();
1047};
1048
1049class WeakProperty : public AllStatic {
1050 public:
1055};
1056
1057class WeakReference : public AllStatic {
1058 public:
1063};
1064
1065class FinalizerBase : public AllStatic {
1066 public:
1072};
1073
1074class Finalizer : public AllStatic {
1075 public:
1080};
1081
1083 public:
1087};
1088
1090 public:
1099};
1100
1102 public:
1105};
1106
1107class Number : public AllStatic {
1108 public:
1110 static word NextFieldOffset();
1111};
1112
1114 public:
1116};
1117
1118class StreamInfo : public AllStatic {
1119 public:
1121};
1122
1124 public:
1130};
1131
1132class TsanUtils : public AllStatic {
1133 public:
1139};
1140
1141class Thread : public AllStatic {
1142 public:
1147 static uword exit_through_ffi();
1188 static uword vm_tag_dart_id();
1189
1193
1195 static uword vm_execution_state();
1203
1206
1212
1253
1257
1258#define THREAD_XMM_CONSTANT_LIST(V) \
1259 V(float_not) \
1260 V(float_negate) \
1261 V(float_absolute) \
1262 V(float_zerow) \
1263 V(double_negate) \
1264 V(double_abs)
1265
1266#define DECLARE_CONSTANT_OFFSET_GETTER(name) \
1267 static word name##_address_offset();
1269#undef DECLARE_CONSTANT_OFFSET_GETTER
1270
1273
1279
1283
1286
1288
1289 static word OffsetFromThread(const dart::Object& object);
1290 static intptr_t OffsetFromThread(const dart::RuntimeEntry* runtime_entry);
1291};
1292
1294 public:
1297 static const word kSize;
1298};
1299
1301 public:
1304 static const word kSize;
1305};
1306
1307class ObjectStore : public AllStatic {
1308 public:
1314
1316
1328};
1329
1330class Isolate : public AllStatic {
1331 public:
1336#if !defined(PRODUCT)
1339#endif // !defined(PRODUCT)
1340};
1341
1342class IsolateGroup : public AllStatic {
1343 public:
1347};
1348
1349class ClassTable : public AllStatic {
1350 public:
1351#if !defined(PRODUCT)
1354#endif // !defined(PRODUCT)
1355};
1356
1358 public:
1362 static word InstanceSize(word payload_size);
1364};
1365
1367 public:
1370 static word InstanceSize(intptr_t length);
1372
1373 private:
1374 static word element_offset(intptr_t index);
1375};
1376
1377class Instructions : public AllStatic {
1378 public:
1386 static word HeaderSize();
1387 static word InstanceSize();
1388 static word InstanceSize(word payload_size);
1390};
1391
1392class Code : public AllStatic {
1393 public:
1394#if defined(TARGET_ARCH_IA32)
1395 static uword EntryPointOf(const dart::Code& code);
1396#endif // defined(TARGET_ARCH_IA32)
1397
1405 static word InstanceSize(intptr_t length);
1407
1408 private:
1409 static word element_offset(intptr_t index);
1410};
1411
1413 public:
1416};
1417
1418class WeakArray : public AllStatic {
1419 public:
1421 static word element_offset(intptr_t index);
1422 static word InstanceSize(intptr_t length);
1425};
1426
1428 public:
1431
1432 static const word kMaxInputs;
1441 static const word kTestResult;
1444};
1445
1446class LoadingUnit : public AllStatic {
1447 public:
1450};
1451
1452class Context : public AllStatic {
1453 public:
1457 static word variable_offset(intptr_t index);
1458 static word InstanceSize(intptr_t length);
1461
1462 static const word kMaxElements;
1463};
1464
1465class Closure : public AllStatic {
1466 public:
1476};
1477
1478class ClosureData : public AllStatic {
1479 public:
1483};
1484
1485class Page : public AllStatic {
1486 public:
1488
1492};
1493
1494class Heap : public AllStatic {
1495 public:
1496 // Return true if an object with the given instance size is allocatable
1497 // in new space on the target.
1498 static bool IsAllocatableInNewSpace(intptr_t instance_size);
1499};
1500
1502 public:
1507
1509};
1510
1512 public:
1514};
1515
1516class RegExp : public AllStatic {
1517 public:
1518 static word function_offset(classid_t cid, bool sticky);
1521};
1522
1523class UserTag : public AllStatic {
1524 public:
1528};
1529
1530class Symbols : public AllStatic {
1531 public:
1534};
1535
1536class Field : public AllStatic {
1537 public:
1538 static word OffsetOf(const dart::Field& field);
1539
1549};
1550
1552 public:
1559};
1560
1561class TypeArguments : public AllStatic {
1562 public:
1567 static word type_at_offset(intptr_t i);
1569 static word InstanceSize(intptr_t length);
1572
1573 static const word kMaxElements;
1574};
1575
1577 public:
1578 class FakeInstance : public AllStatic {
1579 public:
1580 static word InstanceSize();
1582 };
1583};
1584
1586 public:
1587 class FakeInstance : public AllStatic {
1588 public:
1589 static word InstanceSize();
1591 };
1592};
1593
1594class FieldTable : public AllStatic {
1595 public:
1596 static word OffsetOf(const dart::Field& field);
1597};
1598
1599void UnboxFieldIfSupported(const dart::Field& field,
1600 const dart::AbstractType& type);
1601
1602} // namespace target
1603} // namespace compiler
1604} // namespace dart
1605
1606#endif // RUNTIME_VM_COMPILER_RUNTIME_API_H_
GLenum type
#define CLASS_LIST_FOR_HANDLES(V)
Definition: class_id.h:193
static constexpr T RoundUp(T x, uintptr_t alignment, uintptr_t offset=0)
Definition: utils.h:120
intptr_t argument_count() const
Definition: runtime_api.cc:340
RuntimeEntry(const dart::RuntimeEntry *runtime_entry)
Definition: runtime_api.h:234
static word type_arguments_offset()
static intptr_t index_at_offset(intptr_t offset_in_bytes)
static const word kMaxNewSpaceElements
Definition: runtime_api.h:595
static word InstanceSize(intptr_t length)
static word element_offset(intptr_t index)
static const word kMaxElements
Definition: runtime_api.h:594
static word AllocationTracingStateSlotOffsetFor(intptr_t cid)
static word allocation_tracing_state_table_offset()
static bool TraceAllocation(const dart::Class &klass)
Definition: runtime_api.cc:543
static word declaration_type_offset()
static word host_type_arguments_field_offset_in_words_offset()
static bool HasTypeArgumentsField(const dart::Class &klass)
Definition: runtime_api.cc:534
static intptr_t NumTypeArguments(const dart::Class &klass)
Definition: runtime_api.cc:530
static uword GetInstanceSize(const dart::Class &handle)
Definition: runtime_api.cc:515
static const word kNoTypeArguments
Definition: runtime_api.h:486
static bool HasCompressedPointers(const dart::Class &handle)
Definition: runtime_api.cc:526
static word num_type_arguments_offset()
static classid_t GetId(const dart::Class &handle)
Definition: runtime_api.cc:441
static intptr_t TypeArgumentsFieldOffset(const dart::Class &klass)
Definition: runtime_api.cc:539
static word delayed_type_arguments_offset()
static word function_type_arguments_offset()
static word instantiator_type_arguments_offset()
static word InstanceSize(word payload_size)
static word entry_point_offset(CodeEntryKind kind=CodeEntryKind::kNormal)
static word object_pool_offset()
static word active_instructions_offset()
static word InstanceSize(intptr_t length)
static word instructions_offset()
static word InstanceSize(word payload_size)
static word element_offset(intptr_t index)
static word InstanceSize(intptr_t length)
static word variable_offset(intptr_t index)
static const word kMaxElements
Definition: runtime_api.h:1462
static word InstanceSize(intptr_t length)
static word InstanceSize(intptr_t length)
static word element_offset(intptr_t index)
static word OffsetOf(const dart::Field &field)
static word guarded_list_length_in_object_offset_offset()
static word OffsetOf(const dart::Field &field)
static word guarded_list_length_offset()
static word host_offset_or_field_id_offset()
static word initializer_function_offset()
static word packed_type_parameter_counts_offset()
static word entry_point_offset(CodeEntryKind kind=CodeEntryKind::kNormal)
static bool IsAllocatableInNewSpace(intptr_t instance_size)
static word ExactnessIndexFor(word num_args)
Definition: runtime_api.cc:615
static word TestEntryLengthFor(word num_args, bool exactness_check)
Definition: runtime_api.cc:619
static word receivers_static_type_offset()
static word CodeIndexFor(word num_args)
Definition: runtime_api.cc:603
static word TargetIndexFor(word num_args)
Definition: runtime_api.cc:611
static word CountIndexFor(word num_args)
Definition: runtime_api.cc:607
static word EntryPointIndexFor(word num_args)
Definition: runtime_api.cc:623
static word ElementSizeFor(intptr_t cid)
Definition: runtime_api.cc:581
static word native_fields_array_offset()
Definition: runtime_api.cc:551
static word DataOffsetFor(intptr_t cid)
Definition: runtime_api.cc:555
static word InstanceSize(word payload_size)
static word InstanceSize(intptr_t length)
static const word kNonBarePayloadAlignment
Definition: runtime_api.h:1384
static const word kMonomorphicEntryOffsetJIT
Definition: runtime_api.h:1379
static const word kPolymorphicEntryOffsetAOT
Definition: runtime_api.h:1382
static const word kMonomorphicEntryOffsetAOT
Definition: runtime_api.h:1381
static const word kPolymorphicEntryOffsetJIT
Definition: runtime_api.h:1380
static word has_resumption_breakpoints_offset()
static const word kNumCallWrapperArguments
Definition: runtime_api.h:1513
static const uint8_t kNullable
Definition: runtime_api.h:762
static const uint8_t kNonNullable
Definition: runtime_api.h:763
static word InstanceSize(intptr_t length)
static word element_offset(intptr_t index)
static word suspend_state_handle_exception_offset()
static word suspend_state_init_sync_star_offset()
static word suspend_state_return_async_offset()
static word suspend_state_init_async_star_offset()
static word suspend_state_return_async_not_future_offset()
static word suspend_state_await_with_type_check_offset()
static word suspend_state_return_async_star_offset()
static word suspend_state_yield_async_star_offset()
static word suspend_state_suspend_sync_star_at_start_offset()
static word InstanceSize(intptr_t length)
static word original_top_offset()
static const word kBytesPerCardLog2
Definition: runtime_api.h:1487
static word original_end_offset()
static word InstanceSize(word payload_size)
static const word kMaxFieldNamesIndex
Definition: runtime_api.h:613
static const word kFieldNamesIndexShift
Definition: runtime_api.h:611
static const word kFieldNamesIndexMask
Definition: runtime_api.h:612
static word field_offset(intptr_t index)
static const word kMaxElements
Definition: runtime_api.h:625
static intptr_t field_index_at_offset(intptr_t offset_in_bytes)
static word InstanceSize(intptr_t length)
static word function_offset(classid_t cid, bool sticky)
static const word kHashBits
Definition: runtime_api.h:782
static const word kMaxElements
Definition: runtime_api.h:783
static const word kInstanceDelayedFunctionTypeArguments
Definition: runtime_api.h:1440
static const word kInstanceParentFunctionTypeArguments
Definition: runtime_api.h:1439
static word InstanceSize(word payload_size)
static const word kNullCharCodeSymbolOffset
Definition: runtime_api.h:1533
static const word kNumberOfOneCharCodeSymbols
Definition: runtime_api.h:1532
static word unboxed_runtime_arg_offset()
static word megamorphic_call_checked_entry_offset()
static word suspend_state_yield_async_star_entry_point_offset()
static word async_exception_handler_stub_offset()
static word call_native_through_safepoint_entry_point_offset()
static word allocate_mint_without_fpu_regs_stub_offset()
static word shared_field_table_values_offset()
static word suspend_state_suspend_sync_star_at_start_entry_point_offset()
static word suspend_state_return_async_not_future_entry_point_offset()
static word allocate_object_slow_entry_point_offset()
static word stack_overflow_shared_stub_entry_point_offset(bool fpu_regs)
Definition: runtime_api.cc:890
static word auto_scope_native_wrapper_entry_point_offset()
static word suspend_state_init_async_entry_point_offset()
static word null_cast_error_shared_without_fpu_regs_stub_offset()
static word OffsetFromThread(const dart::Object &object)
Definition: runtime_api.cc:927
static uword full_safepoint_state_acquired()
Definition: runtime_api.cc:899
static word allocate_object_parameterized_stub_offset()
static word lazy_deopt_from_throw_stub_offset()
static word null_error_shared_with_fpu_regs_stub_offset()
static word null_arg_error_shared_with_fpu_regs_stub_offset()
static word suspend_state_return_async_entry_point_offset()
static word stack_overflow_shared_without_fpu_regs_stub_offset()
static word allocate_mint_without_fpu_regs_entry_point_offset()
static word suspend_state_init_async_star_entry_point_offset()
static word write_barrier_code_offset()
static word allocate_object_stub_offset()
static word AllocateArray_entry_point_offset()
static word null_error_shared_without_fpu_regs_stub_offset()
static word allocate_mint_with_fpu_regs_entry_point_offset()
static word field_table_values_offset()
static word lazy_specialize_type_test_stub_offset()
static word predefined_symbols_address_offset()
static word service_extension_stream_offset()
static word exit_safepoint_ignore_unwind_in_progress_stub_offset()
static word call_native_through_safepoint_stub_offset()
static word array_write_barrier_entry_point_offset()
static word null_arg_error_shared_without_fpu_regs_stub_offset()
static word allocate_object_parameterized_entry_point_offset()
static word saved_stack_limit_offset()
static word stack_overflow_flags_offset()
static word slow_type_test_entry_point_offset()
static word late_initialization_error_shared_without_fpu_regs_stub_offset()
static word active_exception_offset()
static word exit_through_ffi_offset()
static uword exit_through_runtime_call()
Definition: runtime_api.cc:919
static word jump_to_frame_entry_point_offset()
static word new_marking_stack_block_offset()
static word stack_overflow_shared_with_fpu_regs_entry_point_offset()
static word global_object_pool_offset()
static word invoke_dart_code_stub_offset()
static word saved_shadow_call_stack_offset()
static word write_error_shared_without_fpu_regs_stub_offset()
static word stack_overflow_shared_without_fpu_regs_entry_point_offset()
static word no_scope_native_wrapper_entry_point_offset()
static word late_initialization_error_shared_with_fpu_regs_stub_offset()
static word return_async_stub_offset()
static uword native_execution_state()
Definition: runtime_api.cc:907
static word suspend_state_handle_exception_entry_point_offset()
static word call_to_runtime_entry_point_offset()
static word top_exit_frame_info_offset()
static word range_error_shared_without_fpu_regs_stub_offset()
static word range_error_shared_with_fpu_regs_stub_offset()
static word slow_type_test_stub_offset()
static word write_barrier_wrappers_thread_offset(Register regno)
static word allocate_object_slow_stub_offset()
static word double_truncate_round_supported_offset()
static word fix_allocation_stub_code_offset()
static word switchable_call_miss_stub_offset()
static uword generated_execution_state()
Definition: runtime_api.cc:903
static word safepoint_state_offset()
static word fix_callers_target_code_offset()
static word store_buffer_block_offset()
static word deoptimize_stub_offset()
static word write_barrier_entry_point_offset()
static word suspend_state_return_async_star_entry_point_offset()
static word lazy_deopt_from_return_stub_offset()
static word allocate_object_entry_point_offset()
static word switchable_call_miss_entry_offset()
static word suspend_state_await_with_type_check_entry_point_offset()
static word active_stacktrace_offset()
static word suspend_state_await_entry_point_offset()
static word dispatch_table_array_offset()
static word allocate_mint_with_fpu_regs_stub_offset()
static word return_async_not_future_stub_offset()
static uword full_safepoint_state_unacquired()
Definition: runtime_api.cc:895
static word bootstrap_native_wrapper_entry_point_offset()
static word write_error_shared_with_fpu_regs_stub_offset()
static word exit_safepoint_stub_offset()
static word suspend_state_init_sync_star_entry_point_offset()
static word enter_safepoint_stub_offset()
static word deoptimize_entry_offset()
static word write_barrier_mask_offset()
static word stack_overflow_shared_with_fpu_regs_stub_offset()
static word array_write_barrier_code_offset()
static word null_cast_error_shared_with_fpu_regs_stub_offset()
static word call_to_runtime_stub_offset()
static word return_async_star_stub_offset()
static word execution_state_offset()
static word old_marking_stack_block_offset()
static word InstanceSize(intptr_t length)
static word InstanceSize(intptr_t length)
static word type_at_offset(intptr_t i)
static word InstanceSize(word lengthInBytes)
static const word kGenerationalBarrierMask
Definition: runtime_api.h:434
static bool IsTypedDataClassId(intptr_t cid)
static const word kNewOrEvacuationCandidateBit
Definition: runtime_api.h:421
static word InstanceSize(intptr_t length)
static word element_offset(intptr_t index)
static bool b
struct MyStruct a[10]
uint8_t value
uint32_t * target
size_t length
constexpr intptr_t kDoubleSpillFactor
Definition: runtime_api.h:340
uword MakeTagWordForNewSpaceObject(classid_t cid, uword instance_size)
Definition: runtime_api.cc:360
static constexpr intptr_t kCompressedWordSizeLog2
Definition: runtime_api.h:287
static constexpr word kBitsPerWordLog2
Definition: runtime_api.h:290
constexpr word kSmiMin
Definition: runtime_api.h:306
constexpr uword kUwordMax
Definition: runtime_api.h:297
bool WillAllocateNewOrRememberedContext(intptr_t num_context_variables)
Definition: runtime_api.cc:40
void UnboxFieldIfSupported(const dart::Field &field, const dart::AbstractType &type)
static constexpr intptr_t kNumParameterFlagsPerElementLog2
Definition: runtime_api.h:326
bool CanLoadFromThread(const dart::Object &object, intptr_t *offset)
Definition: runtime_api.cc:941
bool WillAllocateNewOrRememberedArray(intptr_t length)
Definition: runtime_api.cc:46
double DoubleValue(const dart::Object &a)
Definition: runtime_api.cc:978
word ToRawSmi(const dart::Object &a)
Definition: runtime_api.cc:960
intptr_t FrameOffsetInBytesForVariable(const LocalVariable *variable)
Definition: runtime_api.h:344
static constexpr intptr_t kWordSize
Definition: runtime_api.h:274
bool IsDouble(const dart::Object &a)
Definition: runtime_api.cc:974
static constexpr word kBitsPerWord
Definition: runtime_api.h:291
static constexpr intptr_t kCompressedWordSize
Definition: runtime_api.h:286
bool IsSmi(int64_t v)
Definition: runtime_api.cc:31
constexpr intptr_t kIntSpillFactor
Definition: runtime_api.h:339
constexpr word kSmiMax
Definition: runtime_api.h:305
bool SizeFitsInSizeTag(uword instance_size)
Definition: runtime_api.cc:355
constexpr word kWordMin
Definition: runtime_api.h:296
static constexpr intptr_t kObjectAlignment
Definition: runtime_api.h:313
constexpr word kWordMax
Definition: runtime_api.h:295
constexpr intptr_t kSmiBits
Definition: runtime_api.h:301
bool WillAllocateNewOrRememberedObject(intptr_t instance_size)
Definition: runtime_api.cc:35
static constexpr intptr_t kNumParameterFlagsPerElement
Definition: runtime_api.h:328
word SmiValue(const dart::Object &a)
Definition: runtime_api.cc:969
FrameLayout frame_layout
Definition: stack_frame.cc:76
const word kPageSizeInWords
Definition: runtime_api.cc:347
intptr_t RoundedAllocationSize(intptr_t size)
Definition: runtime_api.h:333
InvalidClass kSmiMax
static constexpr intptr_t kHostWordSizeLog2
Definition: runtime_api.h:91
const Type & ObjectType()
Definition: runtime_api.cc:173
InvalidClass kNewObjectAlignmentOffset
void BailoutWithBranchOffsetError()
Definition: runtime_api.cc:328
const Field & LookupConvertUtf8DecoderScanFlagsField()
Definition: runtime_api.cc:271
const Class & Int32x4Class()
Definition: runtime_api.cc:210
Object & NewZoneHandle(Zone *zone)
Definition: runtime_api.cc:141
static constexpr intptr_t kHostWordSize
Definition: runtime_api.h:90
InvalidClass kWordMax
const Class & Float64x2Class()
Definition: runtime_api.cc:205
bool IsBoolType(const AbstractType &type)
Definition: runtime_api.cc:75
InvalidClass kWordMin
InvalidClass kUWordMax
InvalidClass kWordSizeLog2
const Type & VoidType()
Definition: runtime_api.cc:177
word LookupFieldOffsetInBytes(const Field &field)
Definition: runtime_api.cc:284
word TypedDataMaxNewSpaceElements(classid_t cid)
Definition: runtime_api.cc:255
const Class & GrowableObjectArrayClass()
Definition: runtime_api.cc:185
const Type & IntType()
Definition: runtime_api.cc:181
const Class & Float32x4Class()
Definition: runtime_api.cc:200
intptr_t ObjectHash(const Object &obj)
Definition: runtime_api.cc:105
word TypedDataElementSizeInBytes(classid_t cid)
Definition: runtime_api.cc:251
bool IsOriginalObject(const Object &object)
Definition: runtime_api.cc:226
InvalidClass kObjectAlignment
int32_t CreateJitCookie()
Definition: runtime_api.cc:247
void SetToNull(Object *obj)
Definition: runtime_api.cc:137
const String & AllocateString(const char *buffer)
Definition: runtime_api.cc:235
InvalidClass kObjectAlignmentLog2
InvalidClass kPageSize
const Array & ArgumentsDescriptorBoxed(intptr_t type_args_len, intptr_t num_arguments)
Definition: runtime_api.cc:220
InvalidClass kBitsPerWord
const Code & StubCodeSubtype2TestCache()
Definition: runtime_api.cc:298
InvalidClass kPageMask
const Bool & TrueObject()
Definition: runtime_api.cc:157
bool IsDoubleType(const AbstractType &type)
Definition: runtime_api.cc:71
const Code & StubCodeSubtype6TestCache()
Definition: runtime_api.cc:310
const Code & StubCodeSubtype7TestCache()
Definition: runtime_api.cc:314
const Code & StubCodeSubtype3TestCache()
Definition: runtime_api.cc:302
bool IsInOldSpace(const Object &obj)
Definition: runtime_api.cc:101
InvalidClass kObjectAlignmentMask
const Object & SentinelObject()
Definition: runtime_api.cc:153
bool IsEqualType(const AbstractType &a, const AbstractType &b)
Definition: runtime_api.cc:67
bool IsSubtypeOfInt(const AbstractType &type)
Definition: runtime_api.cc:79
bool IsSameObject(const Object &a, const Object &b)
Definition: runtime_api.cc:60
const Class & ClosureClass()
Definition: runtime_api.cc:215
InvalidClass kOldObjectAlignmentOffset
InvalidClass kNewObjectBitPosition
const Bool & FalseObject()
Definition: runtime_api.cc:161
const Object & NullObject()
Definition: runtime_api.cc:149
InvalidClass kBitsPerWordLog2
const Class & DoubleClass()
Definition: runtime_api.cc:195
InvalidClass kSmiBits
const Field & LookupMathRandomStateFieldOffset()
Definition: runtime_api.cc:260
const Object & EmptyTypeArguments()
Definition: runtime_api.cc:165
bool IsSmiType(const AbstractType &type)
Definition: runtime_api.cc:84
const char * ObjectToCString(const Object &obj)
Definition: runtime_api.cc:133
const Code & StubCodeAllocateArray()
Definition: runtime_api.cc:294
const Class & MintClass()
Definition: runtime_api.cc:190
const To & CastHandle(const From &from)
Definition: runtime_api.h:127
const Code & StubCodeSubtype4TestCache()
Definition: runtime_api.cc:306
InvalidClass kWordSize
const Object & ToObject(const Code &handle)
Definition: runtime_api.h:173
bool HasIntegerValue(const dart::Object &object, int64_t *value)
Definition: runtime_api.cc:239
const Type & DynamicType()
Definition: runtime_api.cc:169
InvalidClass kPageSizeInWords
InvalidClass kSmiMin
Definition: dart_vm.cc:33
constexpr intptr_t kBitsPerByteLog2
Definition: globals.h:462
int32_t classid_t
Definition: globals.h:524
constexpr intptr_t kInt32SizeLog2
Definition: globals.h:449
constexpr intptr_t kWordSizeLog2
Definition: globals.h:507
uintptr_t uword
Definition: globals.h:501
intptr_t word
Definition: globals.h:500
constexpr intptr_t kInt32Size
Definition: globals.h:450
const intptr_t cid
constexpr intptr_t kWordSize
Definition: globals.h:509
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition: switches.h:126
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
#define DECLARE_CONSTANT_OFFSET_GETTER(name)
Definition: runtime_api.h:1266
#define THREAD_XMM_CONSTANT_LIST(V)
Definition: runtime_api.h:1258
#define DO(clazz)
Definition: runtime_api.h:44
#define DECLARE_RUNTIME_ENTRY(name)
Definition: runtime_api.h:246
#define RUNTIME_ENTRY_LIST(V)
#define LEAF_RUNTIME_ENTRY_LIST(V)
SeparatedVector2 offset
intptr_t FrameSlotForVariable(const LocalVariable *variable) const
Definition: stack_frame.cc:83
static constexpr intptr_t kObjectAlignment