mirror of
https://github.com/dart-lang/sdk
synced 2024-10-03 00:45:16 +00:00
[vm] Rewrite tools/offset_extractors.sh in Dart
Also * Make C++ offset_extractor binaries emit entire if/def condition (including product vs non-product) => This makes it much nicer to look up offsets, as the preceding #if condition will be the whole condition. * Run the builds & offset extractions in parallel This will make it easier to extend the cross product of our configurations that require different offsets (e.g. sanitizers) TEST=Manually run. Change-Id: I458deb7a1c9403ab3624dd6b6ca51df72d6a6b28 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312442 Commit-Queue: Martin Kustermann <kustermann@google.com> Reviewed-by: Tess Strickland <sstrickl@google.com>
This commit is contained in:
parent
3911ef982d
commit
8c60c4e70f
|
@ -17,6 +17,12 @@
|
|||
#include "vm/symbols.h"
|
||||
#include "vm/timeline.h"
|
||||
|
||||
#if defined(PRODUCT)
|
||||
#define PRODUCT_DEF "defined(PRODUCT)"
|
||||
#else
|
||||
#define PRODUCT_DEF "!defined(PRODUCT)"
|
||||
#endif
|
||||
|
||||
#if defined(TARGET_ARCH_ARM)
|
||||
#define ARCH_DEF_CPU "defined(TARGET_ARCH_ARM)"
|
||||
#elif defined(TARGET_ARCH_X64)
|
||||
|
@ -34,11 +40,18 @@
|
|||
#endif
|
||||
|
||||
#if defined(DART_COMPRESSED_POINTERS)
|
||||
#define ARCH_DEF ARCH_DEF_CPU " && defined(DART_COMPRESSED_POINTERS)"
|
||||
#define COMPRESSED_DEF "defined(DART_COMPRESSED_POINTERS)"
|
||||
#else
|
||||
#define ARCH_DEF ARCH_DEF_CPU " && !defined(DART_COMPRESSED_POINTERS)"
|
||||
#define COMPRESSED_DEF "!defined(DART_COMPRESSED_POINTERS)"
|
||||
#endif
|
||||
|
||||
#define PREPROCESSOR_CONDITION \
|
||||
"#if " PRODUCT_DEF " && " ARCH_DEF_CPU " && " COMPRESSED_DEF
|
||||
|
||||
#define PREPROCESSOR_CONDITION_END \
|
||||
"#endif // " PRODUCT_DEF " && \n // " ARCH_DEF_CPU \
|
||||
" && \n // " COMPRESSED_DEF
|
||||
|
||||
namespace dart {
|
||||
|
||||
void Assert::Fail(const char* format, ...) const {
|
||||
|
@ -177,10 +190,10 @@ class OffsetsExtractor : public AllStatic {
|
|||
} // namespace dart
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
std::cout << std::hex << "#if " << ARCH_DEF << std::endl;
|
||||
std::cout << std::hex << PREPROCESSOR_CONDITION << std::endl;
|
||||
#if !defined(TARGET_ARCH_IA32) || !defined(DART_PRECOMPILED_RUNTIME)
|
||||
dart::OffsetsExtractor::DumpOffsets();
|
||||
#endif
|
||||
std::cout << "#endif // " << ARCH_DEF << std::endl;
|
||||
std::cout << PREPROCESSOR_CONDITION_END << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -8,16 +8,15 @@
|
|||
|
||||
// The constants below correspond to the macros in runtime_offsets_list.h.
|
||||
|
||||
// This file was generated by run_offsets_extractor.sh. It's checked in, rather
|
||||
// than being generated as part of the build, because simarm_x64 needs 32-bit
|
||||
// arm offsets, but is built on a 64-bit machine and offsets_extractor only
|
||||
// extracts offsets for the host architecture. This file needs to be regenerated
|
||||
// when the offsets change, which is usually detected by CheckOffsets() in
|
||||
// dart.cc.
|
||||
// This file was generated by ./tools/run_offsets_extractor.dart.
|
||||
// It's checked in, rather than being generated as part of the build, because
|
||||
// simarm_x64 needs 32-bit arm offsets, but is built on a 64-bit machine and
|
||||
// offsets_extractor only extracts offsets for the host architecture. This
|
||||
// file needs to be regenerated when the offsets change, which is usually
|
||||
// detected by CheckOffsets() in dart.cc.
|
||||
|
||||
#if !defined(PRODUCT)
|
||||
|
||||
#if defined(TARGET_ARCH_ARM) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#if !defined(PRODUCT) && defined(TARGET_ARCH_ARM) && \
|
||||
!defined(DART_COMPRESSED_POINTERS)
|
||||
static constexpr dart::compiler::target::word Code_active_instructions_offset =
|
||||
0x38;
|
||||
static constexpr dart::compiler::target::word Function_usage_counter_offset =
|
||||
|
@ -721,9 +720,12 @@ static constexpr dart::compiler::target::word WeakProperty_InstanceSize = 0x10;
|
|||
static constexpr dart::compiler::target::word WeakReference_InstanceSize = 0x10;
|
||||
static constexpr dart::compiler::target::word
|
||||
WeakSerializationReference_InstanceSize = 0xc;
|
||||
#endif // defined(TARGET_ARCH_ARM) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#endif // !defined(PRODUCT) && \
|
||||
// defined(TARGET_ARCH_ARM) && \
|
||||
// !defined(DART_COMPRESSED_POINTERS)
|
||||
|
||||
#if defined(TARGET_ARCH_X64) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#if !defined(PRODUCT) && defined(TARGET_ARCH_X64) && \
|
||||
!defined(DART_COMPRESSED_POINTERS)
|
||||
static constexpr dart::compiler::target::word Code_active_instructions_offset =
|
||||
0x70;
|
||||
static constexpr dart::compiler::target::word Function_usage_counter_offset =
|
||||
|
@ -1437,9 +1439,12 @@ static constexpr dart::compiler::target::word WeakProperty_InstanceSize = 0x20;
|
|||
static constexpr dart::compiler::target::word WeakReference_InstanceSize = 0x20;
|
||||
static constexpr dart::compiler::target::word
|
||||
WeakSerializationReference_InstanceSize = 0x18;
|
||||
#endif // defined(TARGET_ARCH_X64) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#endif // !defined(PRODUCT) && \
|
||||
// defined(TARGET_ARCH_X64) && \
|
||||
// !defined(DART_COMPRESSED_POINTERS)
|
||||
|
||||
#if defined(TARGET_ARCH_IA32) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#if !defined(PRODUCT) && defined(TARGET_ARCH_IA32) && \
|
||||
!defined(DART_COMPRESSED_POINTERS)
|
||||
static constexpr dart::compiler::target::word Code_active_instructions_offset =
|
||||
0x38;
|
||||
static constexpr dart::compiler::target::word Function_usage_counter_offset =
|
||||
|
@ -2142,9 +2147,12 @@ static constexpr dart::compiler::target::word WeakProperty_InstanceSize = 0x10;
|
|||
static constexpr dart::compiler::target::word WeakReference_InstanceSize = 0x10;
|
||||
static constexpr dart::compiler::target::word
|
||||
WeakSerializationReference_InstanceSize = 0xc;
|
||||
#endif // defined(TARGET_ARCH_IA32) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#endif // !defined(PRODUCT) && \
|
||||
// defined(TARGET_ARCH_IA32) && \
|
||||
// !defined(DART_COMPRESSED_POINTERS)
|
||||
|
||||
#if defined(TARGET_ARCH_ARM64) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#if !defined(PRODUCT) && defined(TARGET_ARCH_ARM64) && \
|
||||
!defined(DART_COMPRESSED_POINTERS)
|
||||
static constexpr dart::compiler::target::word Code_active_instructions_offset =
|
||||
0x70;
|
||||
static constexpr dart::compiler::target::word Function_usage_counter_offset =
|
||||
|
@ -2860,9 +2868,12 @@ static constexpr dart::compiler::target::word WeakProperty_InstanceSize = 0x20;
|
|||
static constexpr dart::compiler::target::word WeakReference_InstanceSize = 0x20;
|
||||
static constexpr dart::compiler::target::word
|
||||
WeakSerializationReference_InstanceSize = 0x18;
|
||||
#endif // defined(TARGET_ARCH_ARM64) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#endif // !defined(PRODUCT) && \
|
||||
// defined(TARGET_ARCH_ARM64) && \
|
||||
// !defined(DART_COMPRESSED_POINTERS)
|
||||
|
||||
#if defined(TARGET_ARCH_X64) && defined(DART_COMPRESSED_POINTERS)
|
||||
#if !defined(PRODUCT) && defined(TARGET_ARCH_X64) && \
|
||||
defined(DART_COMPRESSED_POINTERS)
|
||||
static constexpr dart::compiler::target::word Code_active_instructions_offset =
|
||||
0x70;
|
||||
static constexpr dart::compiler::target::word Function_usage_counter_offset =
|
||||
|
@ -3572,9 +3583,12 @@ static constexpr dart::compiler::target::word WeakProperty_InstanceSize = 0x18;
|
|||
static constexpr dart::compiler::target::word WeakReference_InstanceSize = 0x18;
|
||||
static constexpr dart::compiler::target::word
|
||||
WeakSerializationReference_InstanceSize = 0x10;
|
||||
#endif // defined(TARGET_ARCH_X64) && defined(DART_COMPRESSED_POINTERS)
|
||||
#endif // !defined(PRODUCT) && \
|
||||
// defined(TARGET_ARCH_X64) && \
|
||||
// defined(DART_COMPRESSED_POINTERS)
|
||||
|
||||
#if defined(TARGET_ARCH_ARM64) && defined(DART_COMPRESSED_POINTERS)
|
||||
#if !defined(PRODUCT) && defined(TARGET_ARCH_ARM64) && \
|
||||
defined(DART_COMPRESSED_POINTERS)
|
||||
static constexpr dart::compiler::target::word Code_active_instructions_offset =
|
||||
0x70;
|
||||
static constexpr dart::compiler::target::word Function_usage_counter_offset =
|
||||
|
@ -4286,9 +4300,12 @@ static constexpr dart::compiler::target::word WeakProperty_InstanceSize = 0x18;
|
|||
static constexpr dart::compiler::target::word WeakReference_InstanceSize = 0x18;
|
||||
static constexpr dart::compiler::target::word
|
||||
WeakSerializationReference_InstanceSize = 0x10;
|
||||
#endif // defined(TARGET_ARCH_ARM64) && defined(DART_COMPRESSED_POINTERS)
|
||||
#endif // !defined(PRODUCT) && \
|
||||
// defined(TARGET_ARCH_ARM64) && \
|
||||
// defined(DART_COMPRESSED_POINTERS)
|
||||
|
||||
#if defined(TARGET_ARCH_RISCV32) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#if !defined(PRODUCT) && defined(TARGET_ARCH_RISCV32) && \
|
||||
!defined(DART_COMPRESSED_POINTERS)
|
||||
static constexpr dart::compiler::target::word Code_active_instructions_offset =
|
||||
0x38;
|
||||
static constexpr dart::compiler::target::word Function_usage_counter_offset =
|
||||
|
@ -4993,9 +5010,12 @@ static constexpr dart::compiler::target::word WeakProperty_InstanceSize = 0x10;
|
|||
static constexpr dart::compiler::target::word WeakReference_InstanceSize = 0x10;
|
||||
static constexpr dart::compiler::target::word
|
||||
WeakSerializationReference_InstanceSize = 0xc;
|
||||
#endif // defined(TARGET_ARCH_RISCV32) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#endif // !defined(PRODUCT) && \
|
||||
// defined(TARGET_ARCH_RISCV32) && \
|
||||
// !defined(DART_COMPRESSED_POINTERS)
|
||||
|
||||
#if defined(TARGET_ARCH_RISCV64) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#if !defined(PRODUCT) && defined(TARGET_ARCH_RISCV64) && \
|
||||
!defined(DART_COMPRESSED_POINTERS)
|
||||
static constexpr dart::compiler::target::word Code_active_instructions_offset =
|
||||
0x70;
|
||||
static constexpr dart::compiler::target::word Function_usage_counter_offset =
|
||||
|
@ -5710,11 +5730,12 @@ static constexpr dart::compiler::target::word WeakProperty_InstanceSize = 0x20;
|
|||
static constexpr dart::compiler::target::word WeakReference_InstanceSize = 0x20;
|
||||
static constexpr dart::compiler::target::word
|
||||
WeakSerializationReference_InstanceSize = 0x18;
|
||||
#endif // defined(TARGET_ARCH_RISCV64) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#endif // !defined(PRODUCT) && \
|
||||
// defined(TARGET_ARCH_RISCV64) && \
|
||||
// !defined(DART_COMPRESSED_POINTERS)
|
||||
|
||||
#else // !defined(PRODUCT)
|
||||
|
||||
#if defined(TARGET_ARCH_ARM) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#if defined(PRODUCT) && defined(TARGET_ARCH_ARM) && \
|
||||
!defined(DART_COMPRESSED_POINTERS)
|
||||
static constexpr dart::compiler::target::word Code_active_instructions_offset =
|
||||
0x38;
|
||||
static constexpr dart::compiler::target::word Function_usage_counter_offset =
|
||||
|
@ -6410,9 +6431,12 @@ static constexpr dart::compiler::target::word WeakProperty_InstanceSize = 0x10;
|
|||
static constexpr dart::compiler::target::word WeakReference_InstanceSize = 0x10;
|
||||
static constexpr dart::compiler::target::word
|
||||
WeakSerializationReference_InstanceSize = 0xc;
|
||||
#endif // defined(TARGET_ARCH_ARM) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#endif // defined(PRODUCT) && \
|
||||
// defined(TARGET_ARCH_ARM) && \
|
||||
// !defined(DART_COMPRESSED_POINTERS)
|
||||
|
||||
#if defined(TARGET_ARCH_X64) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#if defined(PRODUCT) && defined(TARGET_ARCH_X64) && \
|
||||
!defined(DART_COMPRESSED_POINTERS)
|
||||
static constexpr dart::compiler::target::word Code_active_instructions_offset =
|
||||
0x70;
|
||||
static constexpr dart::compiler::target::word Function_usage_counter_offset =
|
||||
|
@ -7118,9 +7142,12 @@ static constexpr dart::compiler::target::word WeakProperty_InstanceSize = 0x20;
|
|||
static constexpr dart::compiler::target::word WeakReference_InstanceSize = 0x20;
|
||||
static constexpr dart::compiler::target::word
|
||||
WeakSerializationReference_InstanceSize = 0x18;
|
||||
#endif // defined(TARGET_ARCH_X64) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#endif // defined(PRODUCT) && \
|
||||
// defined(TARGET_ARCH_X64) && \
|
||||
// !defined(DART_COMPRESSED_POINTERS)
|
||||
|
||||
#if defined(TARGET_ARCH_IA32) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#if defined(PRODUCT) && defined(TARGET_ARCH_IA32) && \
|
||||
!defined(DART_COMPRESSED_POINTERS)
|
||||
static constexpr dart::compiler::target::word Code_active_instructions_offset =
|
||||
0x38;
|
||||
static constexpr dart::compiler::target::word Function_usage_counter_offset =
|
||||
|
@ -7815,9 +7842,12 @@ static constexpr dart::compiler::target::word WeakProperty_InstanceSize = 0x10;
|
|||
static constexpr dart::compiler::target::word WeakReference_InstanceSize = 0x10;
|
||||
static constexpr dart::compiler::target::word
|
||||
WeakSerializationReference_InstanceSize = 0xc;
|
||||
#endif // defined(TARGET_ARCH_IA32) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#endif // defined(PRODUCT) && \
|
||||
// defined(TARGET_ARCH_IA32) && \
|
||||
// !defined(DART_COMPRESSED_POINTERS)
|
||||
|
||||
#if defined(TARGET_ARCH_ARM64) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#if defined(PRODUCT) && defined(TARGET_ARCH_ARM64) && \
|
||||
!defined(DART_COMPRESSED_POINTERS)
|
||||
static constexpr dart::compiler::target::word Code_active_instructions_offset =
|
||||
0x70;
|
||||
static constexpr dart::compiler::target::word Function_usage_counter_offset =
|
||||
|
@ -8525,9 +8555,12 @@ static constexpr dart::compiler::target::word WeakProperty_InstanceSize = 0x20;
|
|||
static constexpr dart::compiler::target::word WeakReference_InstanceSize = 0x20;
|
||||
static constexpr dart::compiler::target::word
|
||||
WeakSerializationReference_InstanceSize = 0x18;
|
||||
#endif // defined(TARGET_ARCH_ARM64) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#endif // defined(PRODUCT) && \
|
||||
// defined(TARGET_ARCH_ARM64) && \
|
||||
// !defined(DART_COMPRESSED_POINTERS)
|
||||
|
||||
#if defined(TARGET_ARCH_X64) && defined(DART_COMPRESSED_POINTERS)
|
||||
#if defined(PRODUCT) && defined(TARGET_ARCH_X64) && \
|
||||
defined(DART_COMPRESSED_POINTERS)
|
||||
static constexpr dart::compiler::target::word Code_active_instructions_offset =
|
||||
0x70;
|
||||
static constexpr dart::compiler::target::word Function_usage_counter_offset =
|
||||
|
@ -9229,9 +9262,12 @@ static constexpr dart::compiler::target::word WeakProperty_InstanceSize = 0x18;
|
|||
static constexpr dart::compiler::target::word WeakReference_InstanceSize = 0x18;
|
||||
static constexpr dart::compiler::target::word
|
||||
WeakSerializationReference_InstanceSize = 0x10;
|
||||
#endif // defined(TARGET_ARCH_X64) && defined(DART_COMPRESSED_POINTERS)
|
||||
#endif // defined(PRODUCT) && \
|
||||
// defined(TARGET_ARCH_X64) && \
|
||||
// defined(DART_COMPRESSED_POINTERS)
|
||||
|
||||
#if defined(TARGET_ARCH_ARM64) && defined(DART_COMPRESSED_POINTERS)
|
||||
#if defined(PRODUCT) && defined(TARGET_ARCH_ARM64) && \
|
||||
defined(DART_COMPRESSED_POINTERS)
|
||||
static constexpr dart::compiler::target::word Code_active_instructions_offset =
|
||||
0x70;
|
||||
static constexpr dart::compiler::target::word Function_usage_counter_offset =
|
||||
|
@ -9935,9 +9971,12 @@ static constexpr dart::compiler::target::word WeakProperty_InstanceSize = 0x18;
|
|||
static constexpr dart::compiler::target::word WeakReference_InstanceSize = 0x18;
|
||||
static constexpr dart::compiler::target::word
|
||||
WeakSerializationReference_InstanceSize = 0x10;
|
||||
#endif // defined(TARGET_ARCH_ARM64) && defined(DART_COMPRESSED_POINTERS)
|
||||
#endif // defined(PRODUCT) && \
|
||||
// defined(TARGET_ARCH_ARM64) && \
|
||||
// defined(DART_COMPRESSED_POINTERS)
|
||||
|
||||
#if defined(TARGET_ARCH_RISCV32) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#if defined(PRODUCT) && defined(TARGET_ARCH_RISCV32) && \
|
||||
!defined(DART_COMPRESSED_POINTERS)
|
||||
static constexpr dart::compiler::target::word Code_active_instructions_offset =
|
||||
0x38;
|
||||
static constexpr dart::compiler::target::word Function_usage_counter_offset =
|
||||
|
@ -10634,9 +10673,12 @@ static constexpr dart::compiler::target::word WeakProperty_InstanceSize = 0x10;
|
|||
static constexpr dart::compiler::target::word WeakReference_InstanceSize = 0x10;
|
||||
static constexpr dart::compiler::target::word
|
||||
WeakSerializationReference_InstanceSize = 0xc;
|
||||
#endif // defined(TARGET_ARCH_RISCV32) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#endif // defined(PRODUCT) && \
|
||||
// defined(TARGET_ARCH_RISCV32) && \
|
||||
// !defined(DART_COMPRESSED_POINTERS)
|
||||
|
||||
#if defined(TARGET_ARCH_RISCV64) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#if defined(PRODUCT) && defined(TARGET_ARCH_RISCV64) && \
|
||||
!defined(DART_COMPRESSED_POINTERS)
|
||||
static constexpr dart::compiler::target::word Code_active_instructions_offset =
|
||||
0x70;
|
||||
static constexpr dart::compiler::target::word Function_usage_counter_offset =
|
||||
|
@ -11343,13 +11385,12 @@ static constexpr dart::compiler::target::word WeakProperty_InstanceSize = 0x20;
|
|||
static constexpr dart::compiler::target::word WeakReference_InstanceSize = 0x20;
|
||||
static constexpr dart::compiler::target::word
|
||||
WeakSerializationReference_InstanceSize = 0x18;
|
||||
#endif // defined(TARGET_ARCH_RISCV64) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#endif // defined(PRODUCT) && \
|
||||
// defined(TARGET_ARCH_RISCV64) && \
|
||||
// !defined(DART_COMPRESSED_POINTERS)
|
||||
|
||||
#endif // !defined(PRODUCT)
|
||||
|
||||
#if !defined(PRODUCT)
|
||||
|
||||
#if defined(TARGET_ARCH_ARM) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#if !defined(PRODUCT) && defined(TARGET_ARCH_ARM) && \
|
||||
!defined(DART_COMPRESSED_POINTERS)
|
||||
static constexpr dart::compiler::target::word AOT_Closure_entry_point_offset =
|
||||
0x1c;
|
||||
static constexpr dart::compiler::target::word AOT_Array_elements_start_offset =
|
||||
|
@ -12133,9 +12174,12 @@ static constexpr dart::compiler::target::word AOT_WeakReference_InstanceSize =
|
|||
0x10;
|
||||
static constexpr dart::compiler::target::word
|
||||
AOT_WeakSerializationReference_InstanceSize = 0xc;
|
||||
#endif // defined(TARGET_ARCH_ARM) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#endif // !defined(PRODUCT) && \
|
||||
// defined(TARGET_ARCH_ARM) && \
|
||||
// !defined(DART_COMPRESSED_POINTERS)
|
||||
|
||||
#if defined(TARGET_ARCH_X64) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#if !defined(PRODUCT) && defined(TARGET_ARCH_X64) && \
|
||||
!defined(DART_COMPRESSED_POINTERS)
|
||||
static constexpr dart::compiler::target::word AOT_Closure_entry_point_offset =
|
||||
0x38;
|
||||
static constexpr dart::compiler::target::word AOT_Array_elements_start_offset =
|
||||
|
@ -12920,12 +12964,18 @@ static constexpr dart::compiler::target::word AOT_WeakReference_InstanceSize =
|
|||
0x20;
|
||||
static constexpr dart::compiler::target::word
|
||||
AOT_WeakSerializationReference_InstanceSize = 0x18;
|
||||
#endif // defined(TARGET_ARCH_X64) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#endif // !defined(PRODUCT) && \
|
||||
// defined(TARGET_ARCH_X64) && \
|
||||
// !defined(DART_COMPRESSED_POINTERS)
|
||||
|
||||
#if defined(TARGET_ARCH_IA32) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#endif // defined(TARGET_ARCH_IA32) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#if !defined(PRODUCT) && defined(TARGET_ARCH_IA32) && \
|
||||
!defined(DART_COMPRESSED_POINTERS)
|
||||
#endif // !defined(PRODUCT) && \
|
||||
// defined(TARGET_ARCH_IA32) && \
|
||||
// !defined(DART_COMPRESSED_POINTERS)
|
||||
|
||||
#if defined(TARGET_ARCH_ARM64) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#if !defined(PRODUCT) && defined(TARGET_ARCH_ARM64) && \
|
||||
!defined(DART_COMPRESSED_POINTERS)
|
||||
static constexpr dart::compiler::target::word AOT_Closure_entry_point_offset =
|
||||
0x38;
|
||||
static constexpr dart::compiler::target::word AOT_Array_elements_start_offset =
|
||||
|
@ -13712,9 +13762,12 @@ static constexpr dart::compiler::target::word AOT_WeakReference_InstanceSize =
|
|||
0x20;
|
||||
static constexpr dart::compiler::target::word
|
||||
AOT_WeakSerializationReference_InstanceSize = 0x18;
|
||||
#endif // defined(TARGET_ARCH_ARM64) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#endif // !defined(PRODUCT) && \
|
||||
// defined(TARGET_ARCH_ARM64) && \
|
||||
// !defined(DART_COMPRESSED_POINTERS)
|
||||
|
||||
#if defined(TARGET_ARCH_X64) && defined(DART_COMPRESSED_POINTERS)
|
||||
#if !defined(PRODUCT) && defined(TARGET_ARCH_X64) && \
|
||||
defined(DART_COMPRESSED_POINTERS)
|
||||
static constexpr dart::compiler::target::word AOT_Closure_entry_point_offset =
|
||||
0x20;
|
||||
static constexpr dart::compiler::target::word AOT_Array_elements_start_offset =
|
||||
|
@ -14501,9 +14554,12 @@ static constexpr dart::compiler::target::word AOT_WeakReference_InstanceSize =
|
|||
0x18;
|
||||
static constexpr dart::compiler::target::word
|
||||
AOT_WeakSerializationReference_InstanceSize = 0x10;
|
||||
#endif // defined(TARGET_ARCH_X64) && defined(DART_COMPRESSED_POINTERS)
|
||||
#endif // !defined(PRODUCT) && \
|
||||
// defined(TARGET_ARCH_X64) && \
|
||||
// defined(DART_COMPRESSED_POINTERS)
|
||||
|
||||
#if defined(TARGET_ARCH_ARM64) && defined(DART_COMPRESSED_POINTERS)
|
||||
#if !defined(PRODUCT) && defined(TARGET_ARCH_ARM64) && \
|
||||
defined(DART_COMPRESSED_POINTERS)
|
||||
static constexpr dart::compiler::target::word AOT_Closure_entry_point_offset =
|
||||
0x20;
|
||||
static constexpr dart::compiler::target::word AOT_Array_elements_start_offset =
|
||||
|
@ -15292,9 +15348,12 @@ static constexpr dart::compiler::target::word AOT_WeakReference_InstanceSize =
|
|||
0x18;
|
||||
static constexpr dart::compiler::target::word
|
||||
AOT_WeakSerializationReference_InstanceSize = 0x10;
|
||||
#endif // defined(TARGET_ARCH_ARM64) && defined(DART_COMPRESSED_POINTERS)
|
||||
#endif // !defined(PRODUCT) && \
|
||||
// defined(TARGET_ARCH_ARM64) && \
|
||||
// defined(DART_COMPRESSED_POINTERS)
|
||||
|
||||
#if defined(TARGET_ARCH_RISCV32) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#if !defined(PRODUCT) && defined(TARGET_ARCH_RISCV32) && \
|
||||
!defined(DART_COMPRESSED_POINTERS)
|
||||
static constexpr dart::compiler::target::word AOT_Closure_entry_point_offset =
|
||||
0x1c;
|
||||
static constexpr dart::compiler::target::word AOT_Array_elements_start_offset =
|
||||
|
@ -16079,9 +16138,12 @@ static constexpr dart::compiler::target::word AOT_WeakReference_InstanceSize =
|
|||
0x10;
|
||||
static constexpr dart::compiler::target::word
|
||||
AOT_WeakSerializationReference_InstanceSize = 0xc;
|
||||
#endif // defined(TARGET_ARCH_RISCV32) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#endif // !defined(PRODUCT) && \
|
||||
// defined(TARGET_ARCH_RISCV32) && \
|
||||
// !defined(DART_COMPRESSED_POINTERS)
|
||||
|
||||
#if defined(TARGET_ARCH_RISCV64) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#if !defined(PRODUCT) && defined(TARGET_ARCH_RISCV64) && \
|
||||
!defined(DART_COMPRESSED_POINTERS)
|
||||
static constexpr dart::compiler::target::word AOT_Closure_entry_point_offset =
|
||||
0x38;
|
||||
static constexpr dart::compiler::target::word AOT_Array_elements_start_offset =
|
||||
|
@ -16867,11 +16929,12 @@ static constexpr dart::compiler::target::word AOT_WeakReference_InstanceSize =
|
|||
0x20;
|
||||
static constexpr dart::compiler::target::word
|
||||
AOT_WeakSerializationReference_InstanceSize = 0x18;
|
||||
#endif // defined(TARGET_ARCH_RISCV64) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#endif // !defined(PRODUCT) && \
|
||||
// defined(TARGET_ARCH_RISCV64) && \
|
||||
// !defined(DART_COMPRESSED_POINTERS)
|
||||
|
||||
#else // !defined(PRODUCT)
|
||||
|
||||
#if defined(TARGET_ARCH_ARM) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#if defined(PRODUCT) && defined(TARGET_ARCH_ARM) && \
|
||||
!defined(DART_COMPRESSED_POINTERS)
|
||||
static constexpr dart::compiler::target::word AOT_Closure_entry_point_offset =
|
||||
0x1c;
|
||||
static constexpr dart::compiler::target::word AOT_Array_elements_start_offset =
|
||||
|
@ -17646,9 +17709,12 @@ static constexpr dart::compiler::target::word AOT_WeakReference_InstanceSize =
|
|||
0x10;
|
||||
static constexpr dart::compiler::target::word
|
||||
AOT_WeakSerializationReference_InstanceSize = 0xc;
|
||||
#endif // defined(TARGET_ARCH_ARM) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#endif // defined(PRODUCT) && \
|
||||
// defined(TARGET_ARCH_ARM) && \
|
||||
// !defined(DART_COMPRESSED_POINTERS)
|
||||
|
||||
#if defined(TARGET_ARCH_X64) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#if defined(PRODUCT) && defined(TARGET_ARCH_X64) && \
|
||||
!defined(DART_COMPRESSED_POINTERS)
|
||||
static constexpr dart::compiler::target::word AOT_Closure_entry_point_offset =
|
||||
0x38;
|
||||
static constexpr dart::compiler::target::word AOT_Array_elements_start_offset =
|
||||
|
@ -18424,12 +18490,18 @@ static constexpr dart::compiler::target::word AOT_WeakReference_InstanceSize =
|
|||
0x20;
|
||||
static constexpr dart::compiler::target::word
|
||||
AOT_WeakSerializationReference_InstanceSize = 0x18;
|
||||
#endif // defined(TARGET_ARCH_X64) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#endif // defined(PRODUCT) && \
|
||||
// defined(TARGET_ARCH_X64) && \
|
||||
// !defined(DART_COMPRESSED_POINTERS)
|
||||
|
||||
#if defined(TARGET_ARCH_IA32) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#endif // defined(TARGET_ARCH_IA32) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#if defined(PRODUCT) && defined(TARGET_ARCH_IA32) && \
|
||||
!defined(DART_COMPRESSED_POINTERS)
|
||||
#endif // defined(PRODUCT) && \
|
||||
// defined(TARGET_ARCH_IA32) && \
|
||||
// !defined(DART_COMPRESSED_POINTERS)
|
||||
|
||||
#if defined(TARGET_ARCH_ARM64) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#if defined(PRODUCT) && defined(TARGET_ARCH_ARM64) && \
|
||||
!defined(DART_COMPRESSED_POINTERS)
|
||||
static constexpr dart::compiler::target::word AOT_Closure_entry_point_offset =
|
||||
0x38;
|
||||
static constexpr dart::compiler::target::word AOT_Array_elements_start_offset =
|
||||
|
@ -19207,9 +19279,12 @@ static constexpr dart::compiler::target::word AOT_WeakReference_InstanceSize =
|
|||
0x20;
|
||||
static constexpr dart::compiler::target::word
|
||||
AOT_WeakSerializationReference_InstanceSize = 0x18;
|
||||
#endif // defined(TARGET_ARCH_ARM64) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#endif // defined(PRODUCT) && \
|
||||
// defined(TARGET_ARCH_ARM64) && \
|
||||
// !defined(DART_COMPRESSED_POINTERS)
|
||||
|
||||
#if defined(TARGET_ARCH_X64) && defined(DART_COMPRESSED_POINTERS)
|
||||
#if defined(PRODUCT) && defined(TARGET_ARCH_X64) && \
|
||||
defined(DART_COMPRESSED_POINTERS)
|
||||
static constexpr dart::compiler::target::word AOT_Closure_entry_point_offset =
|
||||
0x20;
|
||||
static constexpr dart::compiler::target::word AOT_Array_elements_start_offset =
|
||||
|
@ -19987,9 +20062,12 @@ static constexpr dart::compiler::target::word AOT_WeakReference_InstanceSize =
|
|||
0x18;
|
||||
static constexpr dart::compiler::target::word
|
||||
AOT_WeakSerializationReference_InstanceSize = 0x10;
|
||||
#endif // defined(TARGET_ARCH_X64) && defined(DART_COMPRESSED_POINTERS)
|
||||
#endif // defined(PRODUCT) && \
|
||||
// defined(TARGET_ARCH_X64) && \
|
||||
// defined(DART_COMPRESSED_POINTERS)
|
||||
|
||||
#if defined(TARGET_ARCH_ARM64) && defined(DART_COMPRESSED_POINTERS)
|
||||
#if defined(PRODUCT) && defined(TARGET_ARCH_ARM64) && \
|
||||
defined(DART_COMPRESSED_POINTERS)
|
||||
static constexpr dart::compiler::target::word AOT_Closure_entry_point_offset =
|
||||
0x20;
|
||||
static constexpr dart::compiler::target::word AOT_Array_elements_start_offset =
|
||||
|
@ -20769,9 +20847,12 @@ static constexpr dart::compiler::target::word AOT_WeakReference_InstanceSize =
|
|||
0x18;
|
||||
static constexpr dart::compiler::target::word
|
||||
AOT_WeakSerializationReference_InstanceSize = 0x10;
|
||||
#endif // defined(TARGET_ARCH_ARM64) && defined(DART_COMPRESSED_POINTERS)
|
||||
#endif // defined(PRODUCT) && \
|
||||
// defined(TARGET_ARCH_ARM64) && \
|
||||
// defined(DART_COMPRESSED_POINTERS)
|
||||
|
||||
#if defined(TARGET_ARCH_RISCV32) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#if defined(PRODUCT) && defined(TARGET_ARCH_RISCV32) && \
|
||||
!defined(DART_COMPRESSED_POINTERS)
|
||||
static constexpr dart::compiler::target::word AOT_Closure_entry_point_offset =
|
||||
0x1c;
|
||||
static constexpr dart::compiler::target::word AOT_Array_elements_start_offset =
|
||||
|
@ -21547,9 +21628,12 @@ static constexpr dart::compiler::target::word AOT_WeakReference_InstanceSize =
|
|||
0x10;
|
||||
static constexpr dart::compiler::target::word
|
||||
AOT_WeakSerializationReference_InstanceSize = 0xc;
|
||||
#endif // defined(TARGET_ARCH_RISCV32) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#endif // defined(PRODUCT) && \
|
||||
// defined(TARGET_ARCH_RISCV32) && \
|
||||
// !defined(DART_COMPRESSED_POINTERS)
|
||||
|
||||
#if defined(TARGET_ARCH_RISCV64) && !defined(DART_COMPRESSED_POINTERS)
|
||||
#if defined(PRODUCT) && defined(TARGET_ARCH_RISCV64) && \
|
||||
!defined(DART_COMPRESSED_POINTERS)
|
||||
static constexpr dart::compiler::target::word AOT_Closure_entry_point_offset =
|
||||
0x38;
|
||||
static constexpr dart::compiler::target::word AOT_Array_elements_start_offset =
|
||||
|
@ -22326,8 +22410,8 @@ static constexpr dart::compiler::target::word AOT_WeakReference_InstanceSize =
|
|||
0x20;
|
||||
static constexpr dart::compiler::target::word
|
||||
AOT_WeakSerializationReference_InstanceSize = 0x18;
|
||||
#endif // defined(TARGET_ARCH_RISCV64) && !defined(DART_COMPRESSED_POINTERS)
|
||||
|
||||
#endif // !defined(PRODUCT)
|
||||
#endif // defined(PRODUCT) && \
|
||||
// defined(TARGET_ARCH_RISCV64) && \
|
||||
// !defined(DART_COMPRESSED_POINTERS)
|
||||
|
||||
#endif // RUNTIME_VM_COMPILER_RUNTIME_OFFSETS_EXTRACTED_H_
|
||||
|
|
96
tools/run_offsets_extractor.dart
Executable file
96
tools/run_offsets_extractor.dart
Executable file
|
@ -0,0 +1,96 @@
|
|||
#!tools/sdks/dart-sdk/bin/dart
|
||||
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:pool/pool.dart';
|
||||
|
||||
final pool = Pool(Platform.numberOfProcessors);
|
||||
|
||||
main() async {
|
||||
final sdkRoot = Platform.script.resolve('../').toFilePath();
|
||||
Directory.current = Directory(sdkRoot);
|
||||
|
||||
final extractedOffsetsFile =
|
||||
'runtime/vm/compiler/runtime_offsets_extracted.h';
|
||||
|
||||
final old = File(extractedOffsetsFile).readAsStringSync();
|
||||
final header = old.substring(0, old.indexOf('\n#if '));
|
||||
final footer = old.substring(old.lastIndexOf('\n#endif '));
|
||||
|
||||
// Build all configurations
|
||||
await forAllConfigurationsMode(
|
||||
(String buildDir, String mode, String arch) async {
|
||||
print('Building $buildDir');
|
||||
await run([
|
||||
'tools/build.py',
|
||||
'-a$arch',
|
||||
'-m$mode',
|
||||
'offsets_extractor',
|
||||
'offsets_extractor_precompiled_runtime'
|
||||
]);
|
||||
print('Building $buildDir - done');
|
||||
});
|
||||
|
||||
final (jit, aot) = await (
|
||||
forAllConfigurationsMode((String buildDir, _, __) async {
|
||||
return await run(['$buildDir/offsets_extractor']);
|
||||
}).then<String>((lines) => lines.join('\n')),
|
||||
forAllConfigurationsMode((String buildDir, _, __) async {
|
||||
return await run(['$buildDir/offsets_extractor_precompiled_runtime']);
|
||||
}).then<String>((lines) => lines.join('\n')),
|
||||
).wait;
|
||||
|
||||
if (exitCode == 0) {
|
||||
final output = StringBuffer();
|
||||
output.writeln(header);
|
||||
output.writeln(jit);
|
||||
output.writeln(aot);
|
||||
output.writeln(footer);
|
||||
File(extractedOffsetsFile).writeAsStringSync(output.toString());
|
||||
print('Written $extractedOffsetsFile');
|
||||
print('Running `git cl format $extractedOffsetsFile');
|
||||
await run(['git', 'cl', 'format', extractedOffsetsFile]);
|
||||
}
|
||||
}
|
||||
|
||||
Future<List<T>> forAllConfigurationsMode<T>(
|
||||
Future<T> Function(String buildDir, String mode, String arch) fun) async {
|
||||
final archs = [
|
||||
'simarm',
|
||||
'x64',
|
||||
'ia32',
|
||||
'simarm64',
|
||||
'x64c',
|
||||
'simarm64c',
|
||||
'simriscv32',
|
||||
'simriscv64',
|
||||
];
|
||||
final futures = <Future<T>>[];
|
||||
for (final mode in ['release', 'product']) {
|
||||
for (final arch in archs) {
|
||||
final buildDir = 'out/${mode.capitalized}${arch.upper}/';
|
||||
futures.add(pool.withResource(() => fun(buildDir, mode, arch)));
|
||||
}
|
||||
}
|
||||
return await Future.wait(futures);
|
||||
}
|
||||
|
||||
Future<String> run(List<String> args) async {
|
||||
final result =
|
||||
await Process.run(args.first, args.skip(1).toList(), runInShell: true);
|
||||
if (result.exitCode != 0) {
|
||||
exitCode = result.exitCode;
|
||||
print('Running ${args.join(' ')} has failed with exit code $exitCode:');
|
||||
print('${result.stdout}');
|
||||
print('${result.stderr}');
|
||||
}
|
||||
return result.stdout;
|
||||
}
|
||||
|
||||
extension on String {
|
||||
String get capitalized => substring(0, 1).toUpperCase() + substring(1);
|
||||
String get upper => toUpperCase();
|
||||
}
|
|
@ -1,80 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
|
||||
# for details. All rights reserved. Use of this source code is governed by a
|
||||
# BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
set -e
|
||||
|
||||
FILE="runtime/vm/compiler/runtime_offsets_extracted.h"
|
||||
|
||||
# Make sure we're running in the SDK directory.
|
||||
if ! test -f "$FILE"; then
|
||||
echo "Couldn't find $FILE"
|
||||
echo "Make sure to run this script from the Dart SDK directory."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TEMP="${FILE}.temp"
|
||||
TEMP_HEADER="${FILE}.header.temp"
|
||||
TEMP_JIT="${FILE}.jit.temp"
|
||||
TEMP_AOT="${FILE}.aot.temp"
|
||||
|
||||
# Remove old temp files if the previous run was stopped prematurely.
|
||||
rm -rf "${TEMP}" "${TEMP_HEADER}" "${TEMP_JIT}" "${TEMP_AOT}"
|
||||
|
||||
# We're regenerating the file, but we want to keep all the comments etc at the
|
||||
# top of the file. So just delete everything after the first "#if ".
|
||||
LINE=$(grep "#if " "$FILE" -n | head -n 1 | sed "s/^\([0-9]*\):.*/\1/")
|
||||
head -n $(expr $LINE - 1) "$FILE" >"$TEMP_HEADER"
|
||||
|
||||
# Run offsets_extractor for every architecture and append the results.
|
||||
run() {
|
||||
tools/build.py --mode=$1 --arch=$2 offsets_extractor offsets_extractor_precompiled_runtime
|
||||
echo "" >>"$TEMP_JIT"
|
||||
out/$3/offsets_extractor >>"$TEMP_JIT"
|
||||
echo "" >>"$TEMP_AOT"
|
||||
out/$3/offsets_extractor_precompiled_runtime >>"$TEMP_AOT"
|
||||
}
|
||||
echo "" >>"$TEMP_JIT"
|
||||
echo "" >>"$TEMP_AOT"
|
||||
echo "#if !defined(PRODUCT)" >>"$TEMP_JIT"
|
||||
echo "#if !defined(PRODUCT)" >>"$TEMP_AOT"
|
||||
run release simarm ReleaseSIMARM
|
||||
run release x64 ReleaseX64
|
||||
run release ia32 ReleaseIA32
|
||||
run release simarm64 ReleaseSIMARM64
|
||||
run release x64c ReleaseX64C
|
||||
run release simarm64c ReleaseSIMARM64C
|
||||
run release simriscv32 ReleaseSIMRISCV32
|
||||
run release simriscv64 ReleaseSIMRISCV64
|
||||
echo "" >>"$TEMP_JIT"
|
||||
echo "" >>"$TEMP_AOT"
|
||||
echo "#else // !defined(PRODUCT)" >>"$TEMP_JIT"
|
||||
echo "#else // !defined(PRODUCT)" >>"$TEMP_AOT"
|
||||
run product simarm ProductSIMARM
|
||||
run product x64 ProductX64
|
||||
run product ia32 ProductIA32
|
||||
run product simarm64 ProductSIMARM64
|
||||
run product x64c ProductX64C
|
||||
run product simarm64c ProductSIMARM64C
|
||||
run product simriscv32 ProductSIMRISCV32
|
||||
run product simriscv64 ProductSIMRISCV64
|
||||
echo "" >>"$TEMP_JIT"
|
||||
echo "" >>"$TEMP_AOT"
|
||||
echo "#endif // !defined(PRODUCT)" >>"$TEMP_JIT"
|
||||
echo "#endif // !defined(PRODUCT)" >>"$TEMP_AOT"
|
||||
|
||||
cat $TEMP_HEADER >>"$TEMP"
|
||||
cat $TEMP_JIT >>"$TEMP"
|
||||
cat $TEMP_AOT >>"$TEMP"
|
||||
|
||||
echo "" >>"$TEMP"
|
||||
echo "#endif // RUNTIME_VM_COMPILER_RUNTIME_OFFSETS_EXTRACTED_H_" >>"$TEMP"
|
||||
mv "$TEMP" "$FILE"
|
||||
|
||||
# Cleanup.
|
||||
git cl format "$FILE"
|
||||
rm "$TEMP_HEADER"
|
||||
rm "$TEMP_JIT"
|
||||
rm "$TEMP_AOT"
|
||||
echo -e "\n\nSuccessfully generated $FILE :)"
|
Loading…
Reference in a new issue