Skip to content

Commit

Permalink
[VM] Allow including disassembler in product mode if FORCE_INCLUDE_DI…
Browse files Browse the repository at this point in the history
…SASSEMBLER is defined

This helps VM developers working with product mode.

Issue #33274

Change-Id: I1933dea6f2d88c4745c63be772cfe301259f4a9c
Reviewed-on: https://dart-review.googlesource.com/c/82583
Reviewed-by: Vyacheslav Egorov <[email protected]>
Commit-Queue: Martin Kustermann <[email protected]>
  • Loading branch information
mkustermann authored and [email protected] committed Nov 2, 2018
1 parent 33c3218 commit a01513c
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 25 deletions.
7 changes: 2 additions & 5 deletions runtime/vm/compiler/assembler/disassembler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -154,8 +153,6 @@ void DisassembleToMemory::Print(const char* format, ...) {
*buffer_ = '\0';
}

#endif

void Disassembler::Disassemble(uword start,
uword end,
DisassemblyFormatter* formatter,
Expand Down Expand Up @@ -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
8 changes: 4 additions & 4 deletions runtime/vm/compiler/assembler/disassembler.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions runtime/vm/compiler/assembler/disassembler_arm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace dart {

#ifndef PRODUCT
#if !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER)

class ARMDecoder : public ValueObject {
public:
Expand Down Expand Up @@ -1512,7 +1512,7 @@ void Disassembler::DecodeInstruction(char* hex_buffer,
}
}

#endif // !PRODUCT
#endif // !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER)

} // namespace dart

Expand Down
4 changes: 2 additions & 2 deletions runtime/vm/compiler/assembler/disassembler_arm64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

namespace dart {

#ifndef PRODUCT
#if !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER)

class ARM64Decoder : public ValueObject {
public:
Expand Down Expand Up @@ -1574,7 +1574,7 @@ void Disassembler::DecodeInstruction(char* hex_buffer,
}
}

#endif // !PRODUCT
#endif // !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER)

} // namespace dart

Expand Down
4 changes: 2 additions & 2 deletions runtime/vm/compiler/assembler/disassembler_x86.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

namespace dart {

#ifndef PRODUCT
#if !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER)

enum OperandType {
UNSET_OP_ORDER = 0,
Expand Down Expand Up @@ -1991,7 +1991,7 @@ void Disassembler::DecodeInstruction(char* hex_buffer,
#endif
}

#endif // !PRODUCT
#endif // !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER)

} // namespace dart

Expand Down
10 changes: 5 additions & 5 deletions runtime/vm/compiler/backend/il.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions runtime/vm/compiler/backend/il_printer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace dart {

#ifndef PRODUCT
#if !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER)

DEFINE_FLAG(bool,
display_sorted_ic_data,
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -1196,7 +1196,7 @@ bool FlowGraphPrinter::ShouldPrint(const Function& function) {
return false;
}

#endif // !PRODUCT
#endif // !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER)

} // namespace dart

Expand Down
4 changes: 2 additions & 2 deletions runtime/vm/object.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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 {
Expand Down

0 comments on commit a01513c

Please sign in to comment.