54 {
55
56void Assert::Fail(
const char*
format, ...)
const {
57 abort();
58}
59
60class OffsetsExtractor : public AllStatic {
61 public:
62 static void DumpOffsets() {
63
64
65
66
67
68
69
70
71
72#define PRINT_ARRAY_SIZEOF(Class, Name, ElementOffset)
73#define PRINT_PAYLOAD_SIZEOF(Class, Name, HeaderSize)
74
75#if defined(DART_PRECOMPILED_RUNTIME)
76
77#define PRINT_FIELD_OFFSET(Class, Name) \
78 std::cout << "static constexpr dart::compiler::target::word AOT_" #Class \
79 "_" #Name " = 0x" \
80 << Class::Name() << ";\n";
81
82#define PRINT_ARRAY_LAYOUT(Class, Name) \
83 std::cout << "static constexpr dart::compiler::target::word AOT_" #Class \
84 "_elements_start_offset = 0x" \
85 << Class::ArrayTraits::elements_start_offset() << ";\n"; \
86 std::cout << "static constexpr dart::compiler::target::word AOT_" #Class \
87 "_element_size = 0x" \
88 << Class::ArrayTraits::kElementSize << ";\n";
89
90#define PRINT_SIZEOF(Class, Name, What) \
91 std::cout << "static constexpr dart::compiler::target::word AOT_" #Class \
92 "_" #Name " = 0x" \
93 << sizeof(What) << ";\n";
94
95#define PRINT_RANGE(Class, Name, Type, First, Last, Filter) \
96 { \
97 auto filter = Filter; \
98 bool comma = false; \
99 std::cout << "static constexpr dart::compiler::target::word AOT_" #Class \
100 "_" #Name "[] = {"; \
101 for (intptr_t i = static_cast<intptr_t>(First); \
102 i <= static_cast<intptr_t>(Last); i++) { \
103 auto v = static_cast<Type>(i); \
104 std::cout << (comma ? ", " : ""); \
105 if (filter(v)) { \
106 std::cout << "0x" << Class::Name(v); \
107 } else { \
108 std::cout << "-1"; \
109 } \
110 comma = true; \
111 } \
112 std::cout << "};\n"; \
113 }
114
115#define PRINT_CONSTANT(Class, Name) \
116 std::cout << "static constexpr dart::compiler::target::word AOT_" #Class \
117 "_" #Name " = 0x" \
118 << Class::Name << ";\n";
119
123
124#else
125
126#define PRINT_FIELD_OFFSET(Class, Name) \
127 std::cout << "static constexpr dart::compiler::target::word " #Class \
128 "_" #Name " = 0x" \
129 << Class::Name() << ";\n";
130
131#define PRINT_ARRAY_LAYOUT(Class, Name) \
132 std::cout << "static constexpr dart::compiler::target::word " #Class \
133 "_elements_start_offset = 0x" \
134 << Class::ArrayTraits::elements_start_offset() << ";\n"; \
135 std::cout << "static constexpr dart::compiler::target::word " #Class \
136 "_element_size = 0x" \
137 << Class::ArrayTraits::kElementSize << ";\n";
138
139#define PRINT_SIZEOF(Class, Name, What) \
140 std::cout << "static constexpr dart::compiler::target::word " #Class \
141 "_" #Name " = 0x" \
142 << sizeof(What) << ";\n";
143
144#define PRINT_RANGE(Class, Name, Type, First, Last, Filter) \
145 { \
146 auto filter = Filter; \
147 bool comma = false; \
148 std::cout << "static constexpr dart::compiler::target::word " #Class \
149 "_" #Name "[] = {"; \
150 for (intptr_t i = static_cast<intptr_t>(First); \
151 i <= static_cast<intptr_t>(Last); i++) { \
152 auto v = static_cast<Type>(i); \
153 std::cout << (comma ? ", " : ""); \
154 if (filter(v)) { \
155 std::cout << "0x" << Class::Name(v); \
156 } else { \
157 std::cout << "-1"; \
158 } \
159 comma = true; \
160 } \
161 std::cout << "};\n"; \
162 }
163
164#define PRINT_CONSTANT(Class, Name) \
165 std::cout << "static constexpr dart::compiler::target::word " #Class \
166 "_" #Name " = 0x" \
167 << Class::Name << ";\n";
168
172
173#endif
174
178
179#undef PRINT_FIELD_OFFSET
180#undef PRINT_ARRAY_LAYOUT
181#undef PRINT_SIZEOF
182#undef PRINT_RANGE
183#undef PRINT_CONSTANT
184#undef PRINT_ARRAY_SIZEOF
185#undef PRINT_PAYLOAD_SIZEOF
186 }
187};
188
189}
190
191int main(
int argc,
char* argv[]) {
193#if !defined(TARGET_ARCH_IA32) || !defined(DART_PRECOMPILED_RUNTIME)
195#endif
197 return 0;
198}
uint32_t uint32_t * format
#define JIT_OFFSETS_LIST(FIELD, ARRAY, SIZEOF, ARRAY_SIZEOF, PAYLOAD_SIZEOF, RANGE, CONSTANT)
#define AOT_OFFSETS_LIST(FIELD, ARRAY, SIZEOF, ARRAY_SIZEOF, PAYLOAD_SIZEOF, RANGE, CONSTANT)
#define COMMON_OFFSETS_LIST(FIELD, ARRAY, SIZEOF, ARRAY_SIZEOF, PAYLOAD_SIZEOF, RANGE, CONSTANT)