Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Namespaces | Macros | Typedefs | Enumerations | Functions | Variables
class_id.h File Reference
#include "platform/assert.h"
#include "vm/globals.h"

Go to the source code of this file.

Namespaces

namespace  dart
 

Macros

#define CLASS_LIST_INTERNAL_ONLY(V)
 
#define CLASS_LIST_INSTANCE_SINGLETONS(V)
 
#define CLASS_LIST_NO_OBJECT_NOR_STRING_NOR_ARRAY_NOR_MAP(V)    CLASS_LIST_INTERNAL_ONLY(V) CLASS_LIST_INSTANCE_SINGLETONS(V)
 
#define CLASS_LIST_MAPS(V)
 
#define CLASS_LIST_SETS(V)
 
#define CLASS_LIST_FIXED_LENGTH_ARRAYS(V)
 
#define CLASS_LIST_ARRAYS(V)
 
#define CLASS_LIST_STRINGS(V)
 
#define CLASS_LIST_TYPED_DATA(V)
 
#define CLASS_LIST_FFI_NUMERIC_FIXED_SIZE(V)
 
#define CLASS_LIST_FFI_TYPE_MARKER(V)
 
#define CLASS_LIST_FFI(V)
 
#define DART_CLASS_LIST_TYPED_DATA(V)
 
#define CLASS_LIST_FOR_HANDLES(V)
 
#define CLASS_LIST_NO_OBJECT(V)
 
#define CLASS_LIST(V)
 
#define DEFINE_OBJECT_KIND(clazz)   k##clazz##Cid,
 
#define DEFINE_OBJECT_KIND(clazz)   kFfi##clazz##Cid,
 
#define DEFINE_OBJECT_KIND(clazz)
 
#define CASE_FFI_CID(name)   case kFfi##name##Cid:
 
#define CASE_FFI_CID(name)   case kFfi##name##Cid:
 

Typedefs

typedef int32_t dart::ClassIdTagType
 

Enumerations

enum  dart::ClassId : intptr_t {
  dart::kIllegalCid = 0 , dart::kNativePointer , dart::kFreeListElement , dart::kForwardingCorpse ,
  dart::kByteDataViewCid , dart::kUnmodifiableByteDataViewCid , dart::kByteBufferCid , dart::kNullCid ,
  dart::kDynamicCid , dart::kVoidCid , dart::kNeverCid , dart::kNumPredefinedCids
}
 

Functions

bool dart::IsInternalOnlyClassId (intptr_t index)
 
bool dart::IsErrorClassId (intptr_t index)
 
bool dart::IsNumberClassId (intptr_t index)
 
bool dart::IsIntegerClassId (intptr_t index)
 
bool dart::IsStringClassId (intptr_t index)
 
bool dart::IsOneByteStringClassId (intptr_t index)
 
bool dart::IsBuiltinListClassId (intptr_t index)
 
bool dart::IsTypeClassId (intptr_t index)
 
bool dart::IsTypedDataBaseClassId (intptr_t index)
 
bool dart::IsTypedDataClassId (intptr_t index)
 
bool dart::IsTypedDataViewClassId (intptr_t index)
 
bool dart::IsExternalTypedDataClassId (intptr_t index)
 
bool dart::IsFfiPointerClassId (intptr_t index)
 
bool dart::IsFfiTypeClassId (intptr_t index)
 
bool dart::IsFfiDynamicLibraryClassId (intptr_t index)
 
bool dart::IsInternalVMdefinedClassId (intptr_t index)
 
bool dart::IsImplicitFieldClassId (intptr_t index)
 
 dart::COMPILE_ASSERT (kFirstInternalOnlyCid==kObjectCid+1)
 
 dart::COMPILE_ASSERT (kInstanceCid==kLastInternalOnlyCid+1)
 
 dart::COMPILE_ASSERT (kFirstErrorCid==kErrorCid &&kApiErrorCid==kFirstErrorCid+1 &&kLanguageErrorCid==kFirstErrorCid+2 &&kUnhandledExceptionCid==kFirstErrorCid+3 &&kUnwindErrorCid==kFirstErrorCid+4 &&kLastErrorCid==kUnwindErrorCid &&kLastInternalOnlyCid==kLastErrorCid)
 
bool dart::IsConcreteTypeClassId (intptr_t index)
 
 dart::COMPILE_ASSERT (kOneByteStringCid==kStringCid+1 &&kTwoByteStringCid==kStringCid+2)
 
bool dart::IsArrayClassId (intptr_t index)
 
 dart::COMPILE_ASSERT (kTypedDataCidRemainderInternal==0)
 
 dart::COMPILE_ASSERT (kTypedDataInt8ArrayCid+kTypedDataCidRemainderView==kTypedDataInt8ArrayViewCid)
 
 dart::COMPILE_ASSERT (kFirstTypedDataCid==kTypedDataInt8ArrayCid)
 
 dart::COMPILE_ASSERT (kFirstTypedDataCid+1 *kNumTypedDataCidRemainders==kTypedDataUint8ArrayCid)
 
 dart::COMPILE_ASSERT (kFirstTypedDataCid+2 *kNumTypedDataCidRemainders==kTypedDataUint8ClampedArrayCid)
 
 dart::COMPILE_ASSERT (kFirstTypedDataCid+3 *kNumTypedDataCidRemainders==kTypedDataInt16ArrayCid)
 
 dart::COMPILE_ASSERT (kFirstTypedDataCid+4 *kNumTypedDataCidRemainders==kTypedDataUint16ArrayCid)
 
 dart::COMPILE_ASSERT (kFirstTypedDataCid+5 *kNumTypedDataCidRemainders==kTypedDataInt32ArrayCid)
 
 dart::COMPILE_ASSERT (kFirstTypedDataCid+6 *kNumTypedDataCidRemainders==kTypedDataUint32ArrayCid)
 
 dart::COMPILE_ASSERT (kFirstTypedDataCid+7 *kNumTypedDataCidRemainders==kTypedDataInt64ArrayCid)
 
 dart::COMPILE_ASSERT (kFirstTypedDataCid+8 *kNumTypedDataCidRemainders==kTypedDataUint64ArrayCid)
 
 dart::COMPILE_ASSERT (kFirstTypedDataCid+9 *kNumTypedDataCidRemainders==kTypedDataFloat32ArrayCid)
 
 dart::COMPILE_ASSERT (kFirstTypedDataCid+10 *kNumTypedDataCidRemainders==kTypedDataFloat64ArrayCid)
 
 dart::COMPILE_ASSERT (kFirstTypedDataCid+11 *kNumTypedDataCidRemainders==kTypedDataFloat32x4ArrayCid)
 
 dart::COMPILE_ASSERT (kFirstTypedDataCid+12 *kNumTypedDataCidRemainders==kTypedDataInt32x4ArrayCid)
 
 dart::COMPILE_ASSERT (kFirstTypedDataCid+13 *kNumTypedDataCidRemainders==kTypedDataFloat64x2ArrayCid)
 
 dart::COMPILE_ASSERT (kFirstTypedDataCid+13 *kNumTypedDataCidRemainders+kTypedDataCidRemainderUnmodifiable==kLastTypedDataCid)
 
 dart::COMPILE_ASSERT (kFfiStructCid+1==kFirstTypedDataCid)
 
 dart::COMPILE_ASSERT (kLastTypedDataCid+1==kByteDataViewCid)
 
bool dart::IsUnmodifiableTypedDataViewClassId (intptr_t index)
 
bool dart::IsClampedTypedDataBaseClassId (intptr_t index)
 
bool dart::IsExternalPayloadClassId (classid_t cid)
 
bool dart::IsDeeplyImmutableCid (intptr_t predefined_cid)
 
bool dart::IsShallowlyImmutableCid (intptr_t predefined_cid)
 
bool dart::ShouldHaveImmutabilityBitSetCid (intptr_t predefined_cid)
 
bool dart::IsFfiPredefinedClassId (classid_t class_id)
 
 dart::COMPILE_ASSERT (kByteBufferCid+1==kNullCid)
 

Variables

static constexpr intptr_t dart::kClassIdTagMax = (1 << 20) - 1
 
const int dart::kTypedDataCidRemainderInternal = 0
 
const int dart::kTypedDataCidRemainderView = 1
 
const int dart::kTypedDataCidRemainderExternal = 2
 
const int dart::kTypedDataCidRemainderUnmodifiable = 3
 
const int dart::kNumTypedDataCidRemainders = kTypedDataCidRemainderUnmodifiable + 1
 
constexpr intptr_t dart::kFirstInternalOnlyCid = kClassCid
 
constexpr intptr_t dart::kLastInternalOnlyCid = kUnwindErrorCid
 
static const ClassId dart::kFirstErrorCid = kErrorCid
 
static const ClassId dart::kLastErrorCid = kUnwindErrorCid
 
static const ClassId dart::kFirstTypedDataCid = kTypedDataInt8ArrayCid
 
static const ClassId dart::kLastTypedDataCid
 

Macro Definition Documentation

◆ CASE_FFI_CID [1/2]

#define CASE_FFI_CID (   name)    case kFfi##name##Cid:

◆ CASE_FFI_CID [2/2]

#define CASE_FFI_CID (   name)    case kFfi##name##Cid:

◆ CLASS_LIST

#define CLASS_LIST (   V)
Value:
V(Object) \
CLASS_LIST_NO_OBJECT(V)
T __attribute__((ext_vector_type(N))) V
#define V(name)
Definition raw_object.h:124

Definition at line 208 of file class_id.h.

211 : intptr_t {
212 // Illegal class id.
213 kIllegalCid = 0,
214
215 // Pseudo class id for native pointers, the heap should never see an
216 // object with this class id.
218
219 // The following entries describes classes for pseudo-objects in the heap
220 // that should never be reachable from live objects. Free list elements
221 // maintain the free list for old space, and forwarding corpses are used to
222 // implement one-way become.
225
226// List of Ids for predefined classes.
227#define DEFINE_OBJECT_KIND(clazz) k##clazz##Cid,
229#undef DEFINE_OBJECT_KIND
230
231// clang-format off
232#define DEFINE_OBJECT_KIND(clazz) kFfi##clazz##Cid,
234#undef DEFINE_OBJECT_KIND
235
236#define DEFINE_OBJECT_KIND(clazz) \
237 kTypedData##clazz##Cid, \
238 kTypedData##clazz##ViewCid, \
239 kExternalTypedData##clazz##Cid, \
240 kUnmodifiableTypedData##clazz##ViewCid,
242#undef DEFINE_OBJECT_KIND
245
247 // clang-format on
248
249 // The following entries do not describe a predefined class, but instead
250 // are class indexes for pre-allocated instances (Null, dynamic, void, Never).
251 kNullCid,
253 kVoidCid,
254 kNeverCid,
255
257};
258
259// Keep these in sync with the cid numbering above.
261const int kTypedDataCidRemainderView = 1;
265
266// Class Id predicates.
267
268bool IsInternalOnlyClassId(intptr_t index);
269bool IsErrorClassId(intptr_t index);
270bool IsNumberClassId(intptr_t index);
271bool IsIntegerClassId(intptr_t index);
272bool IsStringClassId(intptr_t index);
273bool IsOneByteStringClassId(intptr_t index);
274bool IsBuiltinListClassId(intptr_t index);
275bool IsTypeClassId(intptr_t index);
276bool IsTypedDataBaseClassId(intptr_t index);
277bool IsTypedDataClassId(intptr_t index);
278bool IsTypedDataViewClassId(intptr_t index);
279bool IsExternalTypedDataClassId(intptr_t index);
280bool IsFfiPointerClassId(intptr_t index);
281bool IsFfiTypeClassId(intptr_t index);
282bool IsFfiDynamicLibraryClassId(intptr_t index);
283bool IsInternalVMdefinedClassId(intptr_t index);
284bool IsImplicitFieldClassId(intptr_t index);
285
286// Should be used for looping over non-Object internal-only cids.
287constexpr intptr_t kFirstInternalOnlyCid = kClassCid;
288constexpr intptr_t kLastInternalOnlyCid = kUnwindErrorCid;
289// Use the currently surrounding cids to check that no new classes have been
290// added to the beginning or end of CLASS_LIST_INTERNAL_ONLY without adjusting
291// the above definitions.
292COMPILE_ASSERT(kFirstInternalOnlyCid == kObjectCid + 1);
293COMPILE_ASSERT(kInstanceCid == kLastInternalOnlyCid + 1);
294
295// Returns true for any class id that either does not correspond to a real
296// class, like kIllegalCid or kForwardingCorpse, or that is internal to the VM
297// and should not be exposed directly to user code.
298inline bool IsInternalOnlyClassId(intptr_t index) {
299 // Fix the condition below if these become non-contiguous.
300 COMPILE_ASSERT(kIllegalCid + 1 == kNativePointer &&
301 kIllegalCid + 2 == kFreeListElement &&
302 kIllegalCid + 3 == kForwardingCorpse &&
303 kIllegalCid + 4 == kObjectCid &&
304 kIllegalCid + 5 == kFirstInternalOnlyCid);
305 return index <= kLastInternalOnlyCid;
306}
307
308// Make sure this function is updated when new Error types are added.
309static const ClassId kFirstErrorCid = kErrorCid;
310static const ClassId kLastErrorCid = kUnwindErrorCid;
311COMPILE_ASSERT(kFirstErrorCid == kErrorCid &&
312 kApiErrorCid == kFirstErrorCid + 1 &&
313 kLanguageErrorCid == kFirstErrorCid + 2 &&
314 kUnhandledExceptionCid == kFirstErrorCid + 3 &&
315 kUnwindErrorCid == kFirstErrorCid + 4 &&
316 kLastErrorCid == kUnwindErrorCid &&
317 // Change if needed for detecting a new error added at the end.
318 kLastInternalOnlyCid == kLastErrorCid);
319
320inline bool IsErrorClassId(intptr_t index) {
321 return (index >= kFirstErrorCid && index <= kLastErrorCid);
322}
323
324inline bool IsConcreteTypeClassId(intptr_t index) {
325 // Make sure to update when new AbstractType subclasses are added.
326 COMPILE_ASSERT(kFunctionTypeCid == kTypeCid + 1 &&
327 kRecordTypeCid == kTypeCid + 2 &&
328 kTypeParameterCid == kTypeCid + 3);
329 return (index >= kTypeCid && index <= kTypeParameterCid);
330}
331
332inline bool IsNumberClassId(intptr_t index) {
333 // Make sure this function is updated when new Number types are added.
334 COMPILE_ASSERT(kIntegerCid == kNumberCid + 1 && kSmiCid == kNumberCid + 2 &&
335 kMintCid == kNumberCid + 3 && kDoubleCid == kNumberCid + 4);
336 return (index >= kNumberCid && index <= kDoubleCid);
337}
338
339inline bool IsIntegerClassId(intptr_t index) {
340 // Make sure this function is updated when new Integer types are added.
341 COMPILE_ASSERT(kSmiCid == kIntegerCid + 1 && kMintCid == kIntegerCid + 2);
342 return (index >= kIntegerCid && index <= kMintCid);
343}
344
345// Make sure this check is updated when new StringCid types are added.
346COMPILE_ASSERT(kOneByteStringCid == kStringCid + 1 &&
347 kTwoByteStringCid == kStringCid + 2);
348
349inline bool IsStringClassId(intptr_t index) {
350 return (index >= kStringCid && index <= kTwoByteStringCid);
351}
352
353inline bool IsOneByteStringClassId(intptr_t index) {
354 return (index == kOneByteStringCid);
355}
356
357inline bool IsArrayClassId(intptr_t index) {
358 COMPILE_ASSERT(kImmutableArrayCid == kArrayCid + 1);
359 COMPILE_ASSERT(kGrowableObjectArrayCid == kArrayCid + 2);
360 return (index >= kArrayCid && index <= kGrowableObjectArrayCid);
361}
362
363inline bool IsBuiltinListClassId(intptr_t index) {
364 // Make sure this function is updated when new builtin List types are added.
365 return (IsArrayClassId(index) || IsTypedDataBaseClassId(index) ||
366 (index == kByteBufferCid));
367}
368
369inline bool IsTypeClassId(intptr_t index) {
370 // Only Type, FunctionType and RecordType can be encountered as instance
371 // types at runtime.
372 return index == kTypeCid || index == kFunctionTypeCid ||
373 index == kRecordTypeCid;
374}
375
376static const ClassId kFirstTypedDataCid = kTypedDataInt8ArrayCid;
377static const ClassId kLastTypedDataCid =
378 kUnmodifiableTypedDataFloat64x2ArrayViewCid;
379
380// Make sure the following checks are updated when adding new TypedData types.
381
382// The following asserts assume this.
383COMPILE_ASSERT(kTypedDataCidRemainderInternal == 0);
384// Ensure that each typed data type comes in internal/view/external variants
385// next to each other.
386COMPILE_ASSERT(kTypedDataInt8ArrayCid + kTypedDataCidRemainderView ==
387 kTypedDataInt8ArrayViewCid);
388COMPILE_ASSERT(kTypedDataInt8ArrayCid + kTypedDataCidRemainderExternal ==
389 kExternalTypedDataInt8ArrayCid);
390COMPILE_ASSERT(kTypedDataInt8ArrayCid + kTypedDataCidRemainderUnmodifiable ==
391 kUnmodifiableTypedDataInt8ArrayViewCid);
392// Ensure the order of the typed data members in 3-step.
393COMPILE_ASSERT(kFirstTypedDataCid == kTypedDataInt8ArrayCid);
394COMPILE_ASSERT(kFirstTypedDataCid + 1 * kNumTypedDataCidRemainders ==
395 kTypedDataUint8ArrayCid);
396COMPILE_ASSERT(kFirstTypedDataCid + 2 * kNumTypedDataCidRemainders ==
397 kTypedDataUint8ClampedArrayCid);
398COMPILE_ASSERT(kFirstTypedDataCid + 3 * kNumTypedDataCidRemainders ==
399 kTypedDataInt16ArrayCid);
400COMPILE_ASSERT(kFirstTypedDataCid + 4 * kNumTypedDataCidRemainders ==
401 kTypedDataUint16ArrayCid);
402COMPILE_ASSERT(kFirstTypedDataCid + 5 * kNumTypedDataCidRemainders ==
403 kTypedDataInt32ArrayCid);
404COMPILE_ASSERT(kFirstTypedDataCid + 6 * kNumTypedDataCidRemainders ==
405 kTypedDataUint32ArrayCid);
406COMPILE_ASSERT(kFirstTypedDataCid + 7 * kNumTypedDataCidRemainders ==
407 kTypedDataInt64ArrayCid);
408COMPILE_ASSERT(kFirstTypedDataCid + 8 * kNumTypedDataCidRemainders ==
409 kTypedDataUint64ArrayCid);
410COMPILE_ASSERT(kFirstTypedDataCid + 9 * kNumTypedDataCidRemainders ==
411 kTypedDataFloat32ArrayCid);
412COMPILE_ASSERT(kFirstTypedDataCid + 10 * kNumTypedDataCidRemainders ==
413 kTypedDataFloat64ArrayCid);
414COMPILE_ASSERT(kFirstTypedDataCid + 11 * kNumTypedDataCidRemainders ==
415 kTypedDataFloat32x4ArrayCid);
416COMPILE_ASSERT(kFirstTypedDataCid + 12 * kNumTypedDataCidRemainders ==
417 kTypedDataInt32x4ArrayCid);
418COMPILE_ASSERT(kFirstTypedDataCid + 13 * kNumTypedDataCidRemainders ==
419 kTypedDataFloat64x2ArrayCid);
420COMPILE_ASSERT(kFirstTypedDataCid + 13 * kNumTypedDataCidRemainders +
421 kTypedDataCidRemainderUnmodifiable ==
422 kLastTypedDataCid);
423// Checks for possible new typed data entries added before or after the current
424// entries.
425COMPILE_ASSERT(kFfiStructCid + 1 == kFirstTypedDataCid);
426COMPILE_ASSERT(kLastTypedDataCid + 1 == kByteDataViewCid);
427
428inline bool IsTypedDataBaseClassId(intptr_t index) {
429 return index >= kFirstTypedDataCid && index <= kLastTypedDataCid;
430}
431
432inline bool IsTypedDataClassId(intptr_t index) {
433 return IsTypedDataBaseClassId(index) &&
434 ((index - kFirstTypedDataCid) % kNumTypedDataCidRemainders) ==
436}
437
438inline bool IsTypedDataViewClassId(intptr_t index) {
439 const bool is_byte_data_view = index == kByteDataViewCid;
440 return is_byte_data_view ||
441 (IsTypedDataBaseClassId(index) &&
442 ((index - kFirstTypedDataCid) % kNumTypedDataCidRemainders) ==
444}
445
446inline bool IsExternalTypedDataClassId(intptr_t index) {
447 return IsTypedDataBaseClassId(index) &&
448 ((index - kFirstTypedDataCid) % kNumTypedDataCidRemainders) ==
450}
451
452inline bool IsUnmodifiableTypedDataViewClassId(intptr_t index) {
453 const bool is_byte_data_view = index == kUnmodifiableByteDataViewCid;
454 return is_byte_data_view ||
455 (IsTypedDataBaseClassId(index) &&
456 ((index - kFirstTypedDataCid) % kNumTypedDataCidRemainders) ==
458}
459
460inline bool IsClampedTypedDataBaseClassId(intptr_t index) {
461 if (!IsTypedDataBaseClassId(index)) return false;
462 const intptr_t internal_cid =
463 index - ((index - kFirstTypedDataCid) % kNumTypedDataCidRemainders) +
465 // Currently, the only clamped typed data arrays are Uint8.
466 return internal_cid == kTypedDataUint8ClampedArrayCid;
467}
468
469// Whether the given cid is an external array cid, that is, an array where
470// the payload is not in GC-managed memory.
471inline bool IsExternalPayloadClassId(classid_t cid) {
472 return cid == kPointerCid || IsExternalTypedDataClassId(cid);
473}
474
475// For predefined cids only. Refer to Class::is_deeply_immutable for
476// instances of non-predefined classes.
477//
478// Having the `@pragma('vm:deeply-immutable')`, which means statically proven
479// deeply immutable, implies true for this function. The other way around is not
480// guaranteed, predefined classes can be marked deeply immutable in the VM while
481// not having their subtypes or super type being deeply immutable.
482//
483// Keep consistent with runtime/docs/deeply_immutable.md.
484inline bool IsDeeplyImmutableCid(intptr_t predefined_cid) {
485 ASSERT(predefined_cid < kNumPredefinedCids);
486 return IsStringClassId(predefined_cid) || predefined_cid == kNumberCid ||
487 predefined_cid == kIntegerCid || predefined_cid == kSmiCid ||
488 predefined_cid == kMintCid || predefined_cid == kNeverCid ||
489 predefined_cid == kSentinelCid || predefined_cid == kStackTraceCid ||
490 predefined_cid == kDoubleCid || predefined_cid == kFloat32x4Cid ||
491 predefined_cid == kFloat64x2Cid || predefined_cid == kInt32x4Cid ||
492 predefined_cid == kSendPortCid || predefined_cid == kCapabilityCid ||
493 predefined_cid == kRegExpCid || predefined_cid == kBoolCid ||
494 predefined_cid == kNullCid || predefined_cid == kPointerCid ||
495 predefined_cid == kTypeCid || predefined_cid == kRecordTypeCid ||
496 predefined_cid == kFunctionTypeCid;
497}
498
499inline bool IsShallowlyImmutableCid(intptr_t predefined_cid) {
500 ASSERT(predefined_cid < kNumPredefinedCids);
501 // TODO(https://dartbug.com/55136): Mark kClosureCid as shallowly imutable.
502 return IsUnmodifiableTypedDataViewClassId(predefined_cid);
503}
504
505// See documentation on ImmutableBit in raw_object.h
506inline bool ShouldHaveImmutabilityBitSetCid(intptr_t predefined_cid) {
507 ASSERT(predefined_cid < kNumPredefinedCids);
508 return IsDeeplyImmutableCid(predefined_cid) ||
509 IsShallowlyImmutableCid(predefined_cid);
510}
511
512inline bool IsFfiTypeClassId(intptr_t index) {
513 switch (index) {
514 case kPointerCid:
515 case kFfiNativeFunctionCid:
516#define CASE_FFI_CID(name) case kFfi##name##Cid:
518#undef CASE_FFI_CID
519 return true;
520 default:
521 return false;
522 }
523 UNREACHABLE();
524}
525
526inline bool IsFfiPredefinedClassId(classid_t class_id) {
527 switch (class_id) {
528 case kPointerCid:
529 case kDynamicLibraryCid:
530#define CASE_FFI_CID(name) case kFfi##name##Cid:
532#undef CASE_FFI_CID
533 return true;
534 default:
535 return false;
536 }
537 UNREACHABLE();
538}
539
540inline bool IsFfiPointerClassId(intptr_t index) {
541 return index == kPointerCid;
542}
543
544inline bool IsFfiDynamicLibraryClassId(intptr_t index) {
545 return index == kDynamicLibraryCid;
546}
547
548inline bool IsInternalVMdefinedClassId(intptr_t index) {
549 return ((index < kNumPredefinedCids) && !IsImplicitFieldClassId(index));
550}
551
552// This is a set of classes that are not Dart classes whose representation
553// is defined by the VM but are used in the VM code by computing the
554// implicit field offsets of the various fields in the dart object.
555inline bool IsImplicitFieldClassId(intptr_t index) {
556 return index == kByteBufferCid;
557}
558
559COMPILE_ASSERT(kByteBufferCid + 1 == kNullCid);
560
561} // namespace dart
562
563#endif // RUNTIME_VM_CLASS_ID_H_
#define UNREACHABLE()
Definition assert.h:248
#define COMPILE_ASSERT(expr)
Definition assert.h:339
#define DEFINE_OBJECT_KIND(clazz)
Definition class_id.h:228
#define CASE_FFI_CID(name)
#define CLASS_LIST_FFI(V)
Definition class_id.h:171
#define CLASS_LIST_FFI_TYPE_MARKER(V)
Definition class_id.h:165
#define CLASS_LIST_TYPED_DATA(V)
Definition class_id.h:137
#define CLASS_LIST(V)
Definition class_id.h:208
#define ASSERT(E)
const int kNumTypedDataCidRemainders
Definition class_id.h:265
static const ClassId kLastTypedDataCid
Definition class_id.h:378
bool IsTypedDataViewClassId(intptr_t index)
Definition class_id.h:439
bool IsTypedDataClassId(intptr_t index)
Definition class_id.h:433
bool IsFfiPredefinedClassId(classid_t class_id)
Definition class_id.h:527
bool IsOneByteStringClassId(intptr_t index)
Definition class_id.h:354
bool IsFfiDynamicLibraryClassId(intptr_t index)
Definition class_id.h:545
bool IsShallowlyImmutableCid(intptr_t predefined_cid)
Definition class_id.h:500
bool IsConcreteTypeClassId(intptr_t index)
Definition class_id.h:325
const int kTypedDataCidRemainderUnmodifiable
Definition class_id.h:264
bool IsTypedDataBaseClassId(intptr_t index)
Definition class_id.h:429
bool IsImplicitFieldClassId(intptr_t index)
Definition class_id.h:556
bool IsNumberClassId(intptr_t index)
Definition class_id.h:333
bool IsTypeClassId(intptr_t index)
Definition class_id.h:370
const int kTypedDataCidRemainderInternal
Definition class_id.h:261
bool IsArrayClassId(intptr_t index)
Definition class_id.h:358
static const ClassId kLastErrorCid
Definition class_id.h:311
bool IsErrorClassId(intptr_t index)
Definition class_id.h:321
bool IsUnmodifiableTypedDataViewClassId(intptr_t index)
Definition class_id.h:453
ClassId
Definition class_id.h:212
@ kForwardingCorpse
Definition class_id.h:225
@ kIllegalCid
Definition class_id.h:214
@ kNullCid
Definition class_id.h:252
@ kNumPredefinedCids
Definition class_id.h:257
@ kNativePointer
Definition class_id.h:218
@ kByteDataViewCid
Definition class_id.h:244
@ kVoidCid
Definition class_id.h:254
@ kByteBufferCid
Definition class_id.h:247
@ kDynamicCid
Definition class_id.h:253
@ kNeverCid
Definition class_id.h:255
@ kFreeListElement
Definition class_id.h:224
@ kUnmodifiableByteDataViewCid
Definition class_id.h:245
bool IsFfiTypeClassId(intptr_t index)
Definition class_id.h:513
static const ClassId kFirstErrorCid
Definition class_id.h:310
bool IsClampedTypedDataBaseClassId(intptr_t index)
Definition class_id.h:461
const int kTypedDataCidRemainderExternal
Definition class_id.h:263
static const ClassId kFirstTypedDataCid
Definition class_id.h:377
const int kTypedDataCidRemainderView
Definition class_id.h:262
bool IsExternalPayloadClassId(classid_t cid)
Definition class_id.h:472
bool ShouldHaveImmutabilityBitSetCid(intptr_t predefined_cid)
Definition class_id.h:507
constexpr intptr_t kFirstInternalOnlyCid
Definition class_id.h:288
bool IsInternalVMdefinedClassId(intptr_t index)
Definition class_id.h:549
const intptr_t cid
bool IsFfiPointerClassId(intptr_t index)
Definition class_id.h:541
bool IsIntegerClassId(intptr_t index)
Definition class_id.h:340
bool IsInternalOnlyClassId(intptr_t index)
Definition class_id.h:299
bool IsDeeplyImmutableCid(intptr_t predefined_cid)
Definition class_id.h:485
bool IsBuiltinListClassId(intptr_t index)
Definition class_id.h:364
bool IsExternalTypedDataClassId(intptr_t index)
Definition class_id.h:447
constexpr intptr_t kLastInternalOnlyCid
Definition class_id.h:289
bool IsStringClassId(intptr_t index)
Definition class_id.h:350

◆ CLASS_LIST_ARRAYS

#define CLASS_LIST_ARRAYS (   V)
Value:
V(GrowableObjectArray)
#define CLASS_LIST_FIXED_LENGTH_ARRAYS(V)
Definition class_id.h:124

Definition at line 128 of file class_id.h.

◆ CLASS_LIST_FFI

#define CLASS_LIST_FFI (   V)
Value:
V(NativeFunction) \
CLASS_LIST_FFI_TYPE_MARKER(V) \
V(NativeType) \
V(Struct)

Definition at line 171 of file class_id.h.

◆ CLASS_LIST_FFI_NUMERIC_FIXED_SIZE

#define CLASS_LIST_FFI_NUMERIC_FIXED_SIZE (   V)
Value:
V(Int8) \
V(Int16) \
V(Int32) \
V(Int64) \
V(Uint8) \
V(Uint16) \
V(Uint32) \
V(Uint64) \
V(Float) \
V(Double)

Definition at line 153 of file class_id.h.

◆ CLASS_LIST_FFI_TYPE_MARKER

#define CLASS_LIST_FFI_TYPE_MARKER (   V)
Value:
V(Void) \
V(Handle) \
V(Bool)
#define CLASS_LIST_FFI_NUMERIC_FIXED_SIZE(V)
Definition class_id.h:153

Definition at line 165 of file class_id.h.

◆ CLASS_LIST_FIXED_LENGTH_ARRAYS

#define CLASS_LIST_FIXED_LENGTH_ARRAYS (   V)
Value:
V(Array) \
V(ImmutableArray)

Definition at line 124 of file class_id.h.

◆ CLASS_LIST_FOR_HANDLES

#define CLASS_LIST_FOR_HANDLES (   V)
Value:
V(Map) \
V(Set) \
V(Array) \
V(GrowableObjectArray) \
V(String)
#define CLASS_LIST_NO_OBJECT_NOR_STRING_NOR_ARRAY_NOR_MAP(V)
Definition class_id.h:113

Definition at line 193 of file class_id.h.

◆ CLASS_LIST_INSTANCE_SINGLETONS

#define CLASS_LIST_INSTANCE_SINGLETONS (   V)

Definition at line 70 of file class_id.h.

◆ CLASS_LIST_INTERNAL_ONLY

#define CLASS_LIST_INTERNAL_ONLY (   V)

Definition at line 26 of file class_id.h.

◆ CLASS_LIST_MAPS

#define CLASS_LIST_MAPS (   V)
Value:
V(Map) \
V(ConstMap)

Definition at line 116 of file class_id.h.

◆ CLASS_LIST_NO_OBJECT

#define CLASS_LIST_NO_OBJECT (   V)
Value:
CLASS_LIST_MAPS(V) \
CLASS_LIST_SETS(V) \
CLASS_LIST_ARRAYS(V) \
CLASS_LIST_STRINGS(V)

Definition at line 201 of file class_id.h.

◆ CLASS_LIST_NO_OBJECT_NOR_STRING_NOR_ARRAY_NOR_MAP

#define CLASS_LIST_NO_OBJECT_NOR_STRING_NOR_ARRAY_NOR_MAP (   V)     CLASS_LIST_INTERNAL_ONLY(V) CLASS_LIST_INSTANCE_SINGLETONS(V)

Definition at line 113 of file class_id.h.

◆ CLASS_LIST_SETS

#define CLASS_LIST_SETS (   V)
Value:
V(Set) \
V(ConstSet)

Definition at line 120 of file class_id.h.

◆ CLASS_LIST_STRINGS

#define CLASS_LIST_STRINGS (   V)
Value:
V(String) \
V(OneByteString) \
V(TwoByteString)

Definition at line 132 of file class_id.h.

◆ CLASS_LIST_TYPED_DATA

#define CLASS_LIST_TYPED_DATA (   V)
Value:
V(Int8Array) \
V(Uint8ClampedArray) \
V(Int16Array) \
V(Int32Array) \
V(Int64Array) \
V(Uint64Array) \
V(Float64Array) \
V(Float32x4Array) \
V(Int32x4Array) \
V(Float64x2Array)
emscripten::val Uint32Array
Definition WasmCommon.h:34
emscripten::val Uint16Array
Definition WasmCommon.h:33
emscripten::val Float32Array
Definition WasmCommon.h:35
emscripten::val Uint8Array
Definition WasmCommon.h:32

Definition at line 137 of file class_id.h.

◆ DART_CLASS_LIST_TYPED_DATA

#define DART_CLASS_LIST_TYPED_DATA (   V)
Value:
V(Int8) \
V(Uint8) \
V(Uint8Clamped) \
V(Int16) \
V(Uint16) \
V(Int32) \
V(Uint32) \
V(Int64) \
V(Uint64) \
V(Float32) \
V(Float64) \
V(Float32x4) \
V(Int32x4) \
V(Float64x2)

Definition at line 177 of file class_id.h.

◆ DEFINE_OBJECT_KIND [1/3]

#define DEFINE_OBJECT_KIND (   clazz)    k##clazz##Cid,

Definition at line 228 of file class_id.h.

◆ DEFINE_OBJECT_KIND [2/3]

#define DEFINE_OBJECT_KIND (   clazz)    kFfi##clazz##Cid,

Definition at line 228 of file class_id.h.

◆ DEFINE_OBJECT_KIND [3/3]

#define DEFINE_OBJECT_KIND (   clazz)
Value:
kTypedData##clazz##Cid, \
kTypedData##clazz##ViewCid, \
kExternalTypedData##clazz##Cid, \
kUnmodifiableTypedData##clazz##ViewCid,

Definition at line 228 of file class_id.h.