From a01513c6854de505449ab7ea035340a1426bfa1e Mon Sep 17 00:00:00 2001 From: Martin Kustermann Date: Fri, 2 Nov 2018 13:02:25 +0000 Subject: [PATCH] [VM] Allow including disassembler in product mode if FORCE_INCLUDE_DISASSEMBLER is defined This helps VM developers working with product mode. Issue https://github.com/dart-lang/sdk/issues/33274 Change-Id: I1933dea6f2d88c4745c63be772cfe301259f4a9c Reviewed-on: https://dart-review.googlesource.com/c/82583 Reviewed-by: Vyacheslav Egorov Commit-Queue: Martin Kustermann --- runtime/vm/compiler/assembler/disassembler.cc | 7 ++----- runtime/vm/compiler/assembler/disassembler.h | 8 ++++---- runtime/vm/compiler/assembler/disassembler_arm.cc | 4 ++-- runtime/vm/compiler/assembler/disassembler_arm64.cc | 4 ++-- runtime/vm/compiler/assembler/disassembler_x86.cc | 4 ++-- runtime/vm/compiler/backend/il.h | 10 +++++----- runtime/vm/compiler/backend/il_printer.cc | 6 +++--- runtime/vm/object.cc | 4 ++-- 8 files changed, 22 insertions(+), 25 deletions(-) diff --git a/runtime/vm/compiler/assembler/disassembler.cc b/runtime/vm/compiler/assembler/disassembler.cc index 28dca3ffe8c8..cd90a0284e35 100644 --- a/runtime/vm/compiler/assembler/disassembler.cc +++ b/runtime/vm/compiler/assembler/disassembler.cc @@ -16,7 +16,7 @@ namespace dart { -#ifndef PRODUCT +#if !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER) DECLARE_FLAG(bool, trace_inlining_intervals); DEFINE_FLAG(bool, trace_source_positions, false, "Source position diagnostics"); @@ -97,7 +97,6 @@ void DisassembleToJSONStream::Print(const char* format, ...) { free(p); } -#if !defined(PRODUCT) void DisassembleToMemory::ConsumeInstruction(const Code& code, char* hex_buffer, intptr_t hex_size, @@ -154,8 +153,6 @@ void DisassembleToMemory::Print(const char* format, ...) { *buffer_ = '\0'; } -#endif - void Disassembler::Disassemble(uword start, uword end, DisassemblyFormatter* formatter, @@ -396,6 +393,6 @@ void Disassembler::DisassembleCode(const Function& function, DisassembleCodeHelper(function_fullname, code, optimized); } -#endif // !PRODUCT +#endif // !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER) } // namespace dart diff --git a/runtime/vm/compiler/assembler/disassembler.h b/runtime/vm/compiler/assembler/disassembler.h index b43f89463151..071cd14eca37 100644 --- a/runtime/vm/compiler/assembler/disassembler.h +++ b/runtime/vm/compiler/assembler/disassembler.h @@ -81,7 +81,7 @@ class DisassembleToJSONStream : public DisassemblyFormatter { DISALLOW_COPY_AND_ASSIGN(DisassembleToJSONStream); }; -#if !defined(PRODUCT) +#if !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER) // Basic disassembly formatter that outputs the disassembled instruction // to a memory buffer. This is only intended for test writing. class DisassembleToMemory : public DisassemblyFormatter { @@ -130,7 +130,7 @@ class Disassembler : public AllStatic { } static void Disassemble(uword start, uword end, const Code& code) { -#if !defined(PRODUCT) +#if !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER) DisassembleToStdout stdout_formatter; LogBlock lb; Disassemble(start, end, &stdout_formatter, code); @@ -140,7 +140,7 @@ class Disassembler : public AllStatic { } static void Disassemble(uword start, uword end) { -#if !defined(PRODUCT) +#if !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER) DisassembleToStdout stdout_formatter; LogBlock lb; Disassemble(start, end, &stdout_formatter); @@ -153,7 +153,7 @@ class Disassembler : public AllStatic { uword end, char* buffer, uintptr_t buffer_size) { -#if !defined(PRODUCT) +#if !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER) DisassembleToMemory memory_formatter(buffer, buffer_size); LogBlock lb; Disassemble(start, end, &memory_formatter); diff --git a/runtime/vm/compiler/assembler/disassembler_arm.cc b/runtime/vm/compiler/assembler/disassembler_arm.cc index 491a2b405e3d..d3880c09ee62 100644 --- a/runtime/vm/compiler/assembler/disassembler_arm.cc +++ b/runtime/vm/compiler/assembler/disassembler_arm.cc @@ -13,7 +13,7 @@ namespace dart { -#ifndef PRODUCT +#if !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER) class ARMDecoder : public ValueObject { public: @@ -1512,7 +1512,7 @@ void Disassembler::DecodeInstruction(char* hex_buffer, } } -#endif // !PRODUCT +#endif // !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER) } // namespace dart diff --git a/runtime/vm/compiler/assembler/disassembler_arm64.cc b/runtime/vm/compiler/assembler/disassembler_arm64.cc index 14fb8a658625..2abe750baac7 100644 --- a/runtime/vm/compiler/assembler/disassembler_arm64.cc +++ b/runtime/vm/compiler/assembler/disassembler_arm64.cc @@ -12,7 +12,7 @@ namespace dart { -#ifndef PRODUCT +#if !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER) class ARM64Decoder : public ValueObject { public: @@ -1574,7 +1574,7 @@ void Disassembler::DecodeInstruction(char* hex_buffer, } } -#endif // !PRODUCT +#endif // !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER) } // namespace dart diff --git a/runtime/vm/compiler/assembler/disassembler_x86.cc b/runtime/vm/compiler/assembler/disassembler_x86.cc index b6c2324c3e8e..01e0c0c7e699 100644 --- a/runtime/vm/compiler/assembler/disassembler_x86.cc +++ b/runtime/vm/compiler/assembler/disassembler_x86.cc @@ -19,7 +19,7 @@ namespace dart { -#ifndef PRODUCT +#if !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER) enum OperandType { UNSET_OP_ORDER = 0, @@ -1991,7 +1991,7 @@ void Disassembler::DecodeInstruction(char* hex_buffer, #endif } -#endif // !PRODUCT +#endif // !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER) } // namespace dart diff --git a/runtime/vm/compiler/backend/il.h b/runtime/vm/compiler/backend/il.h index b0ce0e7ac096..0c02bcfa1822 100644 --- a/runtime/vm/compiler/backend/il.h +++ b/runtime/vm/compiler/backend/il.h @@ -658,18 +658,18 @@ FOR_EACH_ABSTRACT_INSTRUCTION(FORWARD_DECLARATION) DECLARE_INSTRUCTION_NO_BACKEND(type) \ DECLARE_COMPARISON_METHODS -#ifndef PRODUCT +#if !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER) #define PRINT_TO_SUPPORT virtual void PrintTo(BufferFormatter* f) const; #else #define PRINT_TO_SUPPORT -#endif // !PRODUCT +#endif // !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER) -#ifndef PRODUCT +#if !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER) #define PRINT_OPERANDS_TO_SUPPORT \ virtual void PrintOperandsTo(BufferFormatter* f) const; #else #define PRINT_OPERANDS_TO_SUPPORT -#endif // !PRODUCT +#endif // !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER) // Together with CidRange, this represents a mapping from a range of class-ids // to a method for a given selector (method name). Also can contain an @@ -892,7 +892,7 @@ class Instruction : public ZoneAllocated { // Printing support. const char* ToCString() const; -#ifndef PRODUCT +#if !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER) virtual void PrintTo(BufferFormatter* f) const; virtual void PrintOperandsTo(BufferFormatter* f) const; #endif diff --git a/runtime/vm/compiler/backend/il_printer.cc b/runtime/vm/compiler/backend/il_printer.cc index d18ee6f9928e..0ad2ab201445 100644 --- a/runtime/vm/compiler/backend/il_printer.cc +++ b/runtime/vm/compiler/backend/il_printer.cc @@ -13,7 +13,7 @@ namespace dart { -#ifndef PRODUCT +#if !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER) DEFINE_FLAG(bool, display_sorted_ic_data, @@ -1158,7 +1158,7 @@ const char* Environment::ToCString() const { return Thread::Current()->zone()->MakeCopyOfString(buffer); } -#else // PRODUCT +#else // !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER) const char* Instruction::ToCString() const { return DebugName(); @@ -1196,7 +1196,7 @@ bool FlowGraphPrinter::ShouldPrint(const Function& function) { return false; } -#endif // !PRODUCT +#endif // !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER) } // namespace dart diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc index 06bb1718b0e1..ebeaae144b67 100644 --- a/runtime/vm/object.cc +++ b/runtime/vm/object.cc @@ -14738,7 +14738,7 @@ void Code::SetStubCallTargetCodeAt(uword pc, const Code& code) const { } void Code::Disassemble(DisassemblyFormatter* formatter) const { -#if !defined(PRODUCT) +#if !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER) if (!FLAG_support_disassembler) { return; } @@ -14749,7 +14749,7 @@ void Code::Disassemble(DisassemblyFormatter* formatter) const { } else { Disassembler::Disassemble(start, start + instr.Size(), formatter, *this); } -#endif +#endif // !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER) } const Code::Comments& Code::comments() const {