|
14 | 14 | //
|
15 | 15 | //===----------------------------------------------------------------------===//
|
16 | 16 |
|
17 |
| -#ifndef SWIFT_ABI_SYSTEM_H |
18 |
| -#define SWIFT_ABI_SYSTEM_H |
| 17 | +#ifndef __SWIFT_ABI_SYSTEM_H__ |
| 18 | +#define __SWIFT_ABI_SYSTEM_H__ |
19 | 19 |
|
20 |
| -// In general, these macros are expected to expand to host-independent |
21 |
| -// integer constant expressions. This allows the same data to feed |
22 |
| -// both the compiler and runtime implementation. |
| 20 | +#include "../../../stdlib/public/SwiftShims/System.h" |
23 | 21 |
|
24 |
| -/******************************* Default Rules ********************************/ |
25 |
| - |
26 |
| -/// The least valid pointer value for an actual pointer (as opposed to |
27 |
| -/// Objective-C pointers, which may be tagged pointers and are covered |
28 |
| -/// separately). Values up to this are "extra inhabitants" of the |
29 |
| -/// pointer representation, and payloaded enum types can take |
30 |
| -/// advantage of that as they see fit. |
31 |
| -/// |
32 |
| -/// By default, we assume that there's at least an unmapped page at |
33 |
| -/// the bottom of the address space. 4K is a reasonably likely page |
34 |
| -/// size. |
35 |
| -/// |
36 |
| -/// The minimum possible value for this macro is 1; we always assume |
37 |
| -/// that the null representation is available. |
38 |
| -#define SWIFT_ABI_DEFAULT_LEAST_VALID_POINTER 4096 |
39 |
| - |
40 |
| -/// The bitmask of spare bits in a function pointer. |
41 |
| -#define SWIFT_ABI_DEFAULT_FUNCTION_SPARE_BITS_MASK 0 |
42 |
| - |
43 |
| -/// The bitmask of spare bits in a Swift heap object pointer. A Swift |
44 |
| -/// heap object allocation will never set any of these bits. |
45 |
| -#define SWIFT_ABI_DEFAULT_SWIFT_SPARE_BITS_MASK 0 |
46 |
| - |
47 |
| -/// The bitmask of reserved bits in an Objective-C object pointer. |
48 |
| -/// By default we assume the ObjC runtime doesn't use tagged pointers. |
49 |
| -#define SWIFT_ABI_DEFAULT_OBJC_RESERVED_BITS_MASK 0 |
50 |
| - |
51 |
| -/// The number of low bits in an Objective-C object pointer that |
52 |
| -/// are reserved by the Objective-C runtime. |
53 |
| -#define SWIFT_ABI_DEFAULT_OBJC_NUM_RESERVED_LOW_BITS 0 |
54 |
| - |
55 |
| -/// The ObjC runtime will not use pointer values for which |
56 |
| -/// ``pointer & SWIFT_ABI_XXX_OBJC_RESERVED_BITS_MASK == 0 && |
57 |
| -/// pointer & SWIFT_ABI_XXX_SWIFT_SPARE_BITS_MASK != 0``. |
58 |
| - |
59 |
| -// Weak references use a marker to tell when they are controlled by |
60 |
| -// the ObjC runtime and when they are controlled by the Swift runtime. |
61 |
| -// Non-ObjC platforms don't use this marker. |
62 |
| -#define SWIFT_ABI_DEFAULT_OBJC_WEAK_REFERENCE_MARKER_MASK 0 |
63 |
| -#define SWIFT_ABI_DEFAULT_OBJC_WEAK_REFERENCE_MARKER_VALUE 0 |
64 |
| - |
65 |
| -/*********************************** i386 *************************************/ |
66 |
| - |
67 |
| -// Heap objects are pointer-aligned, so the low two bits are unused. |
68 |
| -#define SWIFT_ABI_I386_SWIFT_SPARE_BITS_MASK 0x00000003U |
69 |
| - |
70 |
| -// ObjC weak reference discriminator is the LSB. |
71 |
| -#define SWIFT_ABI_I386_OBJC_WEAK_REFERENCE_MARKER_MASK \ |
72 |
| - (SWIFT_ABI_DEFAULT_OBJC_RESERVED_BITS_MASK | \ |
73 |
| - 1<<SWIFT_ABI_DEFAULT_OBJC_NUM_RESERVED_LOW_BITS) |
74 |
| -#define SWIFT_ABI_I386_OBJC_WEAK_REFERENCE_MARKER_VALUE \ |
75 |
| - (1<<SWIFT_ABI_DEFAULT_OBJC_NUM_RESERVED_LOW_BITS) |
76 |
| - |
77 |
| -/*********************************** arm **************************************/ |
78 |
| - |
79 |
| -// Heap objects are pointer-aligned, so the low two bits are unused. |
80 |
| -#define SWIFT_ABI_ARM_SWIFT_SPARE_BITS_MASK 0x00000003U |
81 |
| - |
82 |
| -// ObjC weak reference discriminator is the LSB. |
83 |
| -#define SWIFT_ABI_ARM_OBJC_WEAK_REFERENCE_MARKER_MASK \ |
84 |
| - (SWIFT_ABI_DEFAULT_OBJC_RESERVED_BITS_MASK | \ |
85 |
| - 1<<SWIFT_ABI_DEFAULT_OBJC_NUM_RESERVED_LOW_BITS) |
86 |
| -#define SWIFT_ABI_ARM_OBJC_WEAK_REFERENCE_MARKER_VALUE \ |
87 |
| - (1<<SWIFT_ABI_DEFAULT_OBJC_NUM_RESERVED_LOW_BITS) |
88 |
| - |
89 |
| -/*********************************** x86-64 ***********************************/ |
90 |
| - |
91 |
| -/// Darwin reserves the low 4GB of address space. |
92 |
| -#define SWIFT_ABI_DARWIN_X86_64_LEAST_VALID_POINTER (4ULL*1024*1024*1024) |
93 |
| - |
94 |
| -// Only the bottom 56 bits are used, and heap objects are eight-byte-aligned. |
95 |
| -#define SWIFT_ABI_X86_64_SWIFT_SPARE_BITS_MASK 0xFF00000000000007ULL |
96 |
| - |
97 |
| -// Objective-C reserves the high and low bits for tagged pointers. |
98 |
| -// Systems exist which use either bit. |
99 |
| -#define SWIFT_ABI_X86_64_OBJC_RESERVED_BITS_MASK 0x8000000000000001ULL |
100 |
| -#define SWIFT_ABI_X86_64_OBJC_NUM_RESERVED_LOW_BITS 1 |
101 |
| - |
102 |
| -// ObjC weak reference discriminator is the two bits |
103 |
| -// reserved for ObjC tagged pointers plus one more low bit. |
104 |
| -#define SWIFT_ABI_X86_64_OBJC_WEAK_REFERENCE_MARKER_MASK \ |
105 |
| - (SWIFT_ABI_X86_64_OBJC_RESERVED_BITS_MASK | \ |
106 |
| - 1<<SWIFT_ABI_X86_64_OBJC_NUM_RESERVED_LOW_BITS) |
107 |
| -#define SWIFT_ABI_X86_64_OBJC_WEAK_REFERENCE_MARKER_VALUE \ |
108 |
| - (1<<SWIFT_ABI_X86_64_OBJC_NUM_RESERVED_LOW_BITS) |
109 |
| - |
110 |
| -/*********************************** arm64 ************************************/ |
111 |
| - |
112 |
| -/// Darwin reserves the low 4GB of address space. |
113 |
| -#define SWIFT_ABI_DARWIN_ARM64_LEAST_VALID_POINTER (4ULL*1024*1024*1024) |
114 |
| - |
115 |
| -// TBI guarantees the top byte of pointers is unused. |
116 |
| -// Heap objects are eight-byte aligned. |
117 |
| -#define SWIFT_ABI_ARM64_SWIFT_SPARE_BITS_MASK 0xFF00000000000007ULL |
118 |
| - |
119 |
| -// Objective-C reserves just the high bit for tagged pointers. |
120 |
| -#define SWIFT_ABI_ARM64_OBJC_RESERVED_BITS_MASK 0x8000000000000000ULL |
121 |
| -#define SWIFT_ABI_ARM64_OBJC_NUM_RESERVED_LOW_BITS 0 |
122 |
| - |
123 |
| -// ObjC weak reference discriminator is the high bit |
124 |
| -// reserved for ObjC tagged pointers plus the LSB. |
125 |
| -#define SWIFT_ABI_ARM64_OBJC_WEAK_REFERENCE_MARKER_MASK \ |
126 |
| - (SWIFT_ABI_ARM64_OBJC_RESERVED_BITS_MASK | \ |
127 |
| - 1<<SWIFT_ABI_ARM64_OBJC_NUM_RESERVED_LOW_BITS) |
128 |
| -#define SWIFT_ABI_ARM64_OBJC_WEAK_REFERENCE_MARKER_VALUE \ |
129 |
| - (1<<SWIFT_ABI_ARM64_OBJC_NUM_RESERVED_LOW_BITS) |
130 |
| - |
131 |
| -/*********************************** powerpc64 ********************************/ |
132 |
| - |
133 |
| -// Heap objects are pointer-aligned, so the low three bits are unused. |
134 |
| -#define SWIFT_ABI_POWERPC64_SWIFT_SPARE_BITS_MASK 0x0000000000000007ULL |
135 |
| - |
136 |
| -/*********************************** s390x ************************************/ |
137 |
| - |
138 |
| -// Top byte of pointers is unused, and heap objects are eight-byte aligned. |
139 |
| -#define SWIFT_ABI_S390X_SWIFT_SPARE_BITS_MASK 0x0000000000000007ULL |
140 |
| - |
141 |
| -#endif /* SWIFT_ABI_SYSTEM_H */ |
| 22 | +#endif // __SWIFT_ABI_SYSTEM_H__ |
0 commit comments