Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
dart::OffsetsExtractor Class Reference
Inheritance diagram for dart::OffsetsExtractor:
dart::AllStatic

Static Public Member Functions

static void DumpOffsets ()
 

Detailed Description

Definition at line 61 of file offsets_extractor.cc.

Member Function Documentation

◆ DumpOffsets()

static void dart::OffsetsExtractor::DumpOffsets ( )
inlinestatic

Definition at line 63 of file offsets_extractor.cc.

63 {
64// Currently we have two different axes for offset generation:
65//
66// * Target architecture
67// * DART_PRECOMPILED_RUNTIME (i.e, AOT vs. JIT)
68//
69// TODO(dartbug.com/43646): Add DART_PRECOMPILER as another axis.
70
71// These macros don't use any special constants, just method calls, so no
72// output.
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 // defined(DART_PRECOMPILED_RUNTIME)
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 // defined(DART_PRECOMPILED_RUNTIME)
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 PRINT_CONSTANT(Class, Name)
#define PRINT_FIELD_OFFSET(Class, Name)
#define PRINT_ARRAY_SIZEOF(Class, Name, ElementOffset)
#define PRINT_SIZEOF(Class, Name, What)
#define PRINT_PAYLOAD_SIZEOF(Class, Name, HeaderSize)
#define PRINT_ARRAY_LAYOUT(Class, Name)
#define PRINT_RANGE(Class, Name, Type, First, Last, Filter)
#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)

The documentation for this class was generated from the following file: