[vm] Expose predefined class ids via runtime offsets
TEST=ci Change-Id: Ie0627c6c1ef32e1c21ee04aba84b05534f1f752b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/486862 Reviewed-by: Ryan Macnak <rmacnak@google.com> Reviewed-by: Slava Egorov <vegorov@google.com> Commit-Queue: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
committed by
Commit Queue
parent
085ed51099
commit
bcbc47d99c
@@ -2653,3 +2653,181 @@ enum LeafRuntimeEntry {
|
||||
TryDoubleAsInteger,
|
||||
MemoryMove,
|
||||
}
|
||||
|
||||
enum ClassId {
|
||||
IllegalCid,
|
||||
NativePointer,
|
||||
FreeListElement,
|
||||
ForwardingCorpse,
|
||||
ObjectCid,
|
||||
ClassCid,
|
||||
PatchClassCid,
|
||||
FunctionCid,
|
||||
TypeParametersCid,
|
||||
ClosureDataCid,
|
||||
FfiTrampolineDataCid,
|
||||
FieldCid,
|
||||
ScriptCid,
|
||||
LibraryCid,
|
||||
NamespaceCid,
|
||||
KernelProgramInfoCid,
|
||||
WeakSerializationReferenceCid,
|
||||
WeakArrayCid,
|
||||
CodeCid,
|
||||
BytecodeCid,
|
||||
InstructionsCid,
|
||||
InstructionsSectionCid,
|
||||
InstructionsTableCid,
|
||||
ObjectPoolCid,
|
||||
PcDescriptorsCid,
|
||||
CodeSourceMapCid,
|
||||
CompressedStackMapsCid,
|
||||
LocalVarDescriptorsCid,
|
||||
ExceptionHandlersCid,
|
||||
ContextCid,
|
||||
ContextScopeCid,
|
||||
SentinelCid,
|
||||
SingleTargetCacheCid,
|
||||
MonomorphicSmiableCallCid,
|
||||
CallSiteDataCid,
|
||||
UnlinkedCallCid,
|
||||
ICDataCid,
|
||||
MegamorphicCacheCid,
|
||||
SubtypeTestCacheCid,
|
||||
LoadingUnitCid,
|
||||
ErrorCid,
|
||||
ApiErrorCid,
|
||||
LanguageErrorCid,
|
||||
UnhandledExceptionCid,
|
||||
UnwindErrorCid,
|
||||
InstanceCid,
|
||||
LibraryPrefixCid,
|
||||
TypeArgumentsCid,
|
||||
AbstractTypeCid,
|
||||
TypeCid,
|
||||
FunctionTypeCid,
|
||||
RecordTypeCid,
|
||||
TypeParameterCid,
|
||||
FinalizerBaseCid,
|
||||
FinalizerCid,
|
||||
NativeFinalizerCid,
|
||||
FinalizerEntryCid,
|
||||
ClosureCid,
|
||||
NumberCid,
|
||||
IntegerCid,
|
||||
SmiCid,
|
||||
MintCid,
|
||||
DoubleCid,
|
||||
BoolCid,
|
||||
Float32x4Cid,
|
||||
Int32x4Cid,
|
||||
Float64x2Cid,
|
||||
RecordCid,
|
||||
TypedDataBaseCid,
|
||||
TypedDataCid,
|
||||
ExternalTypedDataCid,
|
||||
TypedDataViewCid,
|
||||
PointerCid,
|
||||
DynamicLibraryCid,
|
||||
CapabilityCid,
|
||||
ReceivePortCid,
|
||||
SendPortCid,
|
||||
StackTraceCid,
|
||||
SuspendStateCid,
|
||||
RegExpCid,
|
||||
WeakPropertyCid,
|
||||
WeakReferenceCid,
|
||||
MirrorReferenceCid,
|
||||
FutureOrCid,
|
||||
UserTagCid,
|
||||
TransferableTypedDataCid,
|
||||
MapCid,
|
||||
ConstMapCid,
|
||||
SetCid,
|
||||
ConstSetCid,
|
||||
ArrayCid,
|
||||
ImmutableArrayCid,
|
||||
GrowableObjectArrayCid,
|
||||
StringCid,
|
||||
OneByteStringCid,
|
||||
TwoByteStringCid,
|
||||
FfiNativeFunctionCid,
|
||||
FfiInt8Cid,
|
||||
FfiInt16Cid,
|
||||
FfiInt32Cid,
|
||||
FfiInt64Cid,
|
||||
FfiUint8Cid,
|
||||
FfiUint16Cid,
|
||||
FfiUint32Cid,
|
||||
FfiUint64Cid,
|
||||
FfiFloatCid,
|
||||
FfiDoubleCid,
|
||||
FfiVoidCid,
|
||||
FfiHandleCid,
|
||||
FfiBoolCid,
|
||||
FfiNativeTypeCid,
|
||||
FfiStructCid,
|
||||
TypedDataInt8ArrayCid,
|
||||
TypedDataInt8ArrayViewCid,
|
||||
ExternalTypedDataInt8ArrayCid,
|
||||
UnmodifiableTypedDataInt8ArrayViewCid,
|
||||
TypedDataUint8ArrayCid,
|
||||
TypedDataUint8ArrayViewCid,
|
||||
ExternalTypedDataUint8ArrayCid,
|
||||
UnmodifiableTypedDataUint8ArrayViewCid,
|
||||
TypedDataUint8ClampedArrayCid,
|
||||
TypedDataUint8ClampedArrayViewCid,
|
||||
ExternalTypedDataUint8ClampedArrayCid,
|
||||
UnmodifiableTypedDataUint8ClampedArrayViewCid,
|
||||
TypedDataInt16ArrayCid,
|
||||
TypedDataInt16ArrayViewCid,
|
||||
ExternalTypedDataInt16ArrayCid,
|
||||
UnmodifiableTypedDataInt16ArrayViewCid,
|
||||
TypedDataUint16ArrayCid,
|
||||
TypedDataUint16ArrayViewCid,
|
||||
ExternalTypedDataUint16ArrayCid,
|
||||
UnmodifiableTypedDataUint16ArrayViewCid,
|
||||
TypedDataInt32ArrayCid,
|
||||
TypedDataInt32ArrayViewCid,
|
||||
ExternalTypedDataInt32ArrayCid,
|
||||
UnmodifiableTypedDataInt32ArrayViewCid,
|
||||
TypedDataUint32ArrayCid,
|
||||
TypedDataUint32ArrayViewCid,
|
||||
ExternalTypedDataUint32ArrayCid,
|
||||
UnmodifiableTypedDataUint32ArrayViewCid,
|
||||
TypedDataInt64ArrayCid,
|
||||
TypedDataInt64ArrayViewCid,
|
||||
ExternalTypedDataInt64ArrayCid,
|
||||
UnmodifiableTypedDataInt64ArrayViewCid,
|
||||
TypedDataUint64ArrayCid,
|
||||
TypedDataUint64ArrayViewCid,
|
||||
ExternalTypedDataUint64ArrayCid,
|
||||
UnmodifiableTypedDataUint64ArrayViewCid,
|
||||
TypedDataFloat32ArrayCid,
|
||||
TypedDataFloat32ArrayViewCid,
|
||||
ExternalTypedDataFloat32ArrayCid,
|
||||
UnmodifiableTypedDataFloat32ArrayViewCid,
|
||||
TypedDataFloat64ArrayCid,
|
||||
TypedDataFloat64ArrayViewCid,
|
||||
ExternalTypedDataFloat64ArrayCid,
|
||||
UnmodifiableTypedDataFloat64ArrayViewCid,
|
||||
TypedDataFloat32x4ArrayCid,
|
||||
TypedDataFloat32x4ArrayViewCid,
|
||||
ExternalTypedDataFloat32x4ArrayCid,
|
||||
UnmodifiableTypedDataFloat32x4ArrayViewCid,
|
||||
TypedDataInt32x4ArrayCid,
|
||||
TypedDataInt32x4ArrayViewCid,
|
||||
ExternalTypedDataInt32x4ArrayCid,
|
||||
UnmodifiableTypedDataInt32x4ArrayViewCid,
|
||||
TypedDataFloat64x2ArrayCid,
|
||||
TypedDataFloat64x2ArrayViewCid,
|
||||
ExternalTypedDataFloat64x2ArrayCid,
|
||||
UnmodifiableTypedDataFloat64x2ArrayViewCid,
|
||||
ByteDataViewCid,
|
||||
UnmodifiableByteDataViewCid,
|
||||
ByteBufferCid,
|
||||
NullCid,
|
||||
DynamicCid,
|
||||
VoidCid,
|
||||
NeverCid,
|
||||
}
|
||||
|
||||
+50
-45
@@ -290,54 +290,59 @@ static constexpr intptr_t kClassIdTagMax = (1 << 20) - 1;
|
||||
V(GrowableObjectArray) \
|
||||
V(String)
|
||||
|
||||
#undef CID
|
||||
#define DEFINE_CLASS_ID(clazz) CID(clazz##Cid)
|
||||
#define DEFINE_FFI_CLASS_ID(clazz) CID(Ffi##clazz##Cid)
|
||||
#define DEFINE_TYPED_DATA_CLASS_ID(clazz) \
|
||||
CID(TypedData##clazz##Cid) \
|
||||
CID(TypedData##clazz##ViewCid) \
|
||||
CID(ExternalTypedData##clazz##Cid) \
|
||||
CID(UnmodifiableTypedData##clazz##ViewCid)
|
||||
|
||||
#define CLASS_ID_LIST \
|
||||
/* Illegal class id. */ \
|
||||
CID(IllegalCid) \
|
||||
/* Pseudo class id for native pointers, the heap should never see an */ \
|
||||
/* object with this class id. */ \
|
||||
CID(NativePointer) \
|
||||
/* The following entries describes classes for pseudo-objects in the heap */ \
|
||||
/* that should never be reachable from live objects. Free list elements */ \
|
||||
/* maintain the free list for old space, and forwarding corpses are used */ \
|
||||
/* to implement one-way become. */ \
|
||||
CID(FreeListElement) \
|
||||
CID(ForwardingCorpse) \
|
||||
CLASS_LIST(DEFINE_CLASS_ID) \
|
||||
CLASS_LIST_FFI(DEFINE_FFI_CLASS_ID) \
|
||||
CLASS_LIST_TYPED_DATA(DEFINE_TYPED_DATA_CLASS_ID) \
|
||||
CID(ByteDataViewCid) \
|
||||
CID(UnmodifiableByteDataViewCid) \
|
||||
CID(ByteBufferCid) \
|
||||
/* The following entries do not describe a predefined class, but instead */ \
|
||||
/* are class indexes for pre-allocated instances */ \
|
||||
/* (Null, dynamic, void, Never). */ \
|
||||
CID(NullCid) \
|
||||
CID(DynamicCid) \
|
||||
CID(VoidCid) \
|
||||
CID(NeverCid)
|
||||
|
||||
enum ClassId : intptr_t {
|
||||
// Illegal class id.
|
||||
kIllegalCid = 0,
|
||||
|
||||
// Pseudo class id for native pointers, the heap should never see an
|
||||
// object with this class id.
|
||||
kNativePointer,
|
||||
|
||||
// The following entries describes classes for pseudo-objects in the heap
|
||||
// that should never be reachable from live objects. Free list elements
|
||||
// maintain the free list for old space, and forwarding corpses are used to
|
||||
// implement one-way become.
|
||||
kFreeListElement,
|
||||
kForwardingCorpse,
|
||||
|
||||
// List of Ids for predefined classes.
|
||||
#define DEFINE_OBJECT_KIND(clazz) k##clazz##Cid,
|
||||
CLASS_LIST(DEFINE_OBJECT_KIND)
|
||||
#undef DEFINE_OBJECT_KIND
|
||||
|
||||
// clang-format off
|
||||
#define DEFINE_OBJECT_KIND(clazz) kFfi##clazz##Cid,
|
||||
CLASS_LIST_FFI(DEFINE_OBJECT_KIND)
|
||||
#undef DEFINE_OBJECT_KIND
|
||||
|
||||
#define DEFINE_OBJECT_KIND(clazz) \
|
||||
kTypedData##clazz##Cid, \
|
||||
kTypedData##clazz##ViewCid, \
|
||||
kExternalTypedData##clazz##Cid, \
|
||||
kUnmodifiableTypedData##clazz##ViewCid,
|
||||
CLASS_LIST_TYPED_DATA(DEFINE_OBJECT_KIND)
|
||||
#undef DEFINE_OBJECT_KIND
|
||||
kByteDataViewCid,
|
||||
kUnmodifiableByteDataViewCid,
|
||||
|
||||
kByteBufferCid,
|
||||
// clang-format on
|
||||
|
||||
// The following entries do not describe a predefined class, but instead
|
||||
// are class indexes for pre-allocated instances (Null, dynamic, void, Never).
|
||||
kNullCid,
|
||||
kDynamicCid,
|
||||
kVoidCid,
|
||||
kNeverCid,
|
||||
|
||||
kNumPredefinedCids,
|
||||
#define CID(cid) k##cid,
|
||||
CLASS_ID_LIST
|
||||
#undef CID
|
||||
kNumPredefinedCids,
|
||||
};
|
||||
|
||||
static constexpr const char* kClassIdNames[] = {
|
||||
#define CID(cid) #cid,
|
||||
CLASS_ID_LIST
|
||||
#undef CID
|
||||
};
|
||||
|
||||
#undef DEFINE_CLASS_ID
|
||||
#undef DEFINE_FFI_CLASS_ID
|
||||
#undef DEFINE_TYPED_DATA_CLASS_ID
|
||||
#undef CLASS_ID_LIST
|
||||
|
||||
// Keep these in sync with the cid numbering above.
|
||||
const int kTypedDataCidRemainderInternal = 0;
|
||||
const int kTypedDataCidRemainderView = 1;
|
||||
|
||||
@@ -502,7 +502,8 @@
|
||||
PAYLOAD_SIZEOF(TypedData, InstanceSize, HeaderSize) \
|
||||
ENUM(StubCode, StubCode::StubNames) \
|
||||
ENUM(RuntimeEntry, RuntimeEntry::RuntimeEntryNames) \
|
||||
ENUM(LeafRuntimeEntry, RuntimeEntry::LeafRuntimeEntryNames)
|
||||
ENUM(LeafRuntimeEntry, RuntimeEntry::LeafRuntimeEntryNames) \
|
||||
ENUM(ClassId, kClassIdNames)
|
||||
|
||||
#define JIT_OFFSETS_LIST(FIELD, ARRAY, SIZEOF, ARRAY_SIZEOF, PAYLOAD_SIZEOF, \
|
||||
RANGE, CONSTANT, ENUM) \
|
||||
|
||||
Reference in New Issue
Block a user