Fix CompilationUnit's UniquePtr usage.
CompilationUnit defined in compiler_ir.h uses UniquePtr with
forward-declared MIRGraph, so the ctor/dtor must be defined
in a compilation unit that actually includes MIRGraph's
definition. Otherwise the build would depend on the order of
includes.
Change-Id: I53096c5f1c975843bad3c375d4ce72a9c0656264
diff --git a/compiler/dex/compiler_ir.h b/compiler/dex/compiler_ir.h
index fd46975..546ce4a 100644
--- a/compiler/dex/compiler_ir.h
+++ b/compiler/dex/compiler_ir.h
@@ -20,7 +20,6 @@
#include <vector>
#include <llvm/IR/Module.h>
#include "arena_allocator.h"
-#include "backend.h"
#include "compiler_enums.h"
#include "dex/quick/mir_to_lir.h"
#include "dex_instruction.h"
@@ -39,39 +38,14 @@
} // namespace llvm
struct ArenaMemBlock;
+class Backend;
struct Memstats;
class MIRGraph;
class Mir2Lir;
struct CompilationUnit {
- explicit CompilationUnit(ArenaPool* pool)
- : compiler_driver(NULL),
- class_linker(NULL),
- dex_file(NULL),
- class_loader(NULL),
- class_def_idx(0),
- method_idx(0),
- code_item(NULL),
- access_flags(0),
- invoke_type(kDirect),
- shorty(NULL),
- disable_opt(0),
- enable_debug(0),
- verbose(false),
- compiler_backend(kNoBackend),
- instruction_set(kNone),
- num_dalvik_registers(0),
- insns(NULL),
- num_ins(0),
- num_outs(0),
- num_regs(0),
- num_compiler_temps(0),
- compiler_flip_match(false),
- arena(pool),
- mir_graph(NULL),
- cg(NULL),
- timings("QuickCompiler", true, false) {
- }
+ explicit CompilationUnit(ArenaPool* pool);
+ ~CompilationUnit();
void StartTimingSplit(const char* label);
void NewTimingSplit(const char* label);
diff --git a/compiler/dex/frontend.cc b/compiler/dex/frontend.cc
index 2f8521f..b8cd67e 100644
--- a/compiler/dex/frontend.cc
+++ b/compiler/dex/frontend.cc
@@ -108,6 +108,38 @@
// (1 << kDebugTimings) |
0;
+CompilationUnit::CompilationUnit(ArenaPool* pool)
+ : compiler_driver(NULL),
+ class_linker(NULL),
+ dex_file(NULL),
+ class_loader(NULL),
+ class_def_idx(0),
+ method_idx(0),
+ code_item(NULL),
+ access_flags(0),
+ invoke_type(kDirect),
+ shorty(NULL),
+ disable_opt(0),
+ enable_debug(0),
+ verbose(false),
+ compiler_backend(kNoBackend),
+ instruction_set(kNone),
+ num_dalvik_registers(0),
+ insns(NULL),
+ num_ins(0),
+ num_outs(0),
+ num_regs(0),
+ num_compiler_temps(0),
+ compiler_flip_match(false),
+ arena(pool),
+ mir_graph(NULL),
+ cg(NULL),
+ timings("QuickCompiler", true, false) {
+}
+
+CompilationUnit::~CompilationUnit() {
+}
+
// TODO: Add a cumulative version of logging, and combine with dex2oat --dump-timing
void CompilationUnit::StartTimingSplit(const char* label) {
if (enable_debug & (1 << kDebugTimings)) {