forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runtime.d
42 lines (36 loc) · 1.08 KB
/
runtime.d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* DTrace types and macros for runtime data structures */
enum MetadataKind {
StructMetadataKind = 1,
EnumMetadataKind = 2,
OpaqueMetadataKind = 8,
TupleMetadataKind = 9,
FunctionMetadataKind = 10,
ExistentialMetadataKind = 12,
MetatypeMetadataKind = 13,
ObjCClassWrapperKind = 14,
HeapLocalVariableKind = 64,
HeapArrayKind = 65
};
typedef struct NominalTypeDescriptor {
unsigned long kind;
const char *name;
unsigned long numFields;
unsigned long fieldOffsetVectorOffset;
const char *fieldNames;
} NominalTypeDescriptor;
typedef struct Metadata {
void *valueWitnessTable;
unsigned long kind;
} Metadata;
typedef struct ClassMetadata {
void *valueWitnessTable;
struct ClassMetadata *isa;
struct ClassMetadata *super;
void *data[3];
NominalTypeDescriptor *descriptor;
unsigned long instanceSize, instanceAlign;
} ClassMetadata;
#define copyinMetadata(T, ptr) \
((T*)copyin((unsigned long)(ptr) - sizeof(void*), sizeof(T)))
#define copyinNominalTypeDescriptor(ptr) \
((NominalTypeDescriptor*)copyin((unsigned long)(ptr), sizeof(NominalTypeDescriptor)))