63 {
64
65
66
67
68
69
70
71
72
73#define PRINT_ARRAY_SIZEOF(Class, Name, ElementOffset)
74#define PRINT_PAYLOAD_SIZEOF(Class, Name, HeaderSize)
75
76#if defined(DART_PRECOMPILED_RUNTIME)
77
78#define PRINT_FIELD_OFFSET(Class, Name) \
79 std::cout << "static constexpr dart::compiler::target::word AOT_" #Class \
80 "_" #Name " = 0x" \
81 << Class::Name() << ";\n";
82
83#define PRINT_ARRAY_LAYOUT(Class, Name) \
84 std::cout << "static constexpr dart::compiler::target::word AOT_" #Class \
85 "_elements_start_offset = 0x" \
86 << Class::ArrayTraits::elements_start_offset() << ";\n"; \
87 std::cout << "static constexpr dart::compiler::target::word AOT_" #Class \
88 "_element_size = 0x" \
89 << Class::ArrayTraits::kElementSize << ";\n";
90
91#define PRINT_SIZEOF(Class, Name, What) \
92 std::cout << "static constexpr dart::compiler::target::word AOT_" #Class \
93 "_" #Name " = 0x" \
94 << sizeof(What) << ";\n";
95
96#define PRINT_RANGE(Class, Name, Type, First, Last, Filter) \
97 { \
98 auto filter = Filter; \
99 bool comma = false; \
100 std::cout << "static constexpr dart::compiler::target::word AOT_" #Class \
101 "_" #Name "[] = {"; \
102 for (intptr_t i = static_cast<intptr_t>(First); \
103 i <= static_cast<intptr_t>(Last); i++) { \
104 auto v = static_cast<Type>(i); \
105 std::cout << (comma ? ", " : ""); \
106 if (filter(v)) { \
107 std::cout << "0x" << Class::Name(v); \
108 } else { \
109 std::cout << "-1"; \
110 } \
111 comma = true; \
112 } \
113 std::cout << "};\n"; \
114 }
115
116#define PRINT_CONSTANT(Class, Name) \
117 std::cout << "static constexpr dart::compiler::target::word AOT_" #Class \
118 "_" #Name " = 0x" \
119 << Class::Name << ";\n";
120
124
125#else
126
127#define PRINT_FIELD_OFFSET(Class, Name) \
128 std::cout << "static constexpr dart::compiler::target::word " #Class \
129 "_" #Name " = 0x" \
130 << Class::Name() << ";\n";
131
132#define PRINT_ARRAY_LAYOUT(Class, Name) \
133 std::cout << "static constexpr dart::compiler::target::word " #Class \
134 "_elements_start_offset = 0x" \
135 << Class::ArrayTraits::elements_start_offset() << ";\n"; \
136 std::cout << "static constexpr dart::compiler::target::word " #Class \
137 "_element_size = 0x" \
138 << Class::ArrayTraits::kElementSize << ";\n";
139
140#define PRINT_SIZEOF(Class, Name, What) \
141 std::cout << "static constexpr dart::compiler::target::word " #Class \
142 "_" #Name " = 0x" \
143 << sizeof(What) << ";\n";
144
145#define PRINT_RANGE(Class, Name, Type, First, Last, Filter) \
146 { \
147 auto filter = Filter; \
148 bool comma = false; \
149 std::cout << "static constexpr dart::compiler::target::word " #Class \
150 "_" #Name "[] = {"; \
151 for (intptr_t i = static_cast<intptr_t>(First); \
152 i <= static_cast<intptr_t>(Last); i++) { \
153 auto v = static_cast<Type>(i); \
154 std::cout << (comma ? ", " : ""); \
155 if (filter(v)) { \
156 std::cout << "0x" << Class::Name(v); \
157 } else { \
158 std::cout << "-1"; \
159 } \
160 comma = true; \
161 } \
162 std::cout << "};\n"; \
163 }
164
165#define PRINT_CONSTANT(Class, Name) \
166 std::cout << "static constexpr dart::compiler::target::word " #Class \
167 "_" #Name " = 0x" \
168 << Class::Name << ";\n";
169
173
174#endif
175
179
180#undef PRINT_FIELD_OFFSET
181#undef PRINT_ARRAY_LAYOUT
182#undef PRINT_SIZEOF
183#undef PRINT_RANGE
184#undef PRINT_CONSTANT
185#undef PRINT_ARRAY_SIZEOF
186#undef PRINT_PAYLOAD_SIZEOF
187 }
#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)