diff options
author | Vladimir Marko <vmarko@google.com> | 2015-06-12 14:30:53 +0100 |
---|---|---|
committer | Linux Build Service Account <lnxbuild@localhost> | 2015-10-06 03:20:36 -0600 |
commit | 22983bd723dcc57e62bbc21d052e11ff8d1d218f (patch) | |
tree | 88ce0be05bf0fc3b23c291f14f2a9312333d30af /compiler | |
parent | d8e28505f0be821475c7b18a416aa4f1a9e2871d (diff) | |
download | art-22983bd723dcc57e62bbc21d052e11ff8d1d218f.zip art-22983bd723dcc57e62bbc21d052e11ff8d1d218f.tar.gz art-22983bd723dcc57e62bbc21d052e11ff8d1d218f.tar.bz2 |
Optimizing: Move optimization objects to Arena.
This should reduce the stack size needed by the
OptimizingCompiler::CompileOptimized() which was very
close to our limits for clang builds, causing repeated
build breakages on otherwise healthy changes:
art/compiler/optimizing/optimizing_compiler.cc:395:37:
error: stack frame size of 1760 bytes in function
'art::OptimizingCompiler::CompileOptimized'
[-Werror,-Wframe-larger-than=]
Change-Id: I2f4ab0235f4eac61823a4a320bb4fe78942a23c2
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/optimizing/instruction_simplifier.h | 3 | ||||
-rw-r--r-- | compiler/optimizing/optimization.h | 3 | ||||
-rw-r--r-- | compiler/optimizing/optimizing_compiler.cc | 76 |
3 files changed, 46 insertions, 36 deletions
diff --git a/compiler/optimizing/instruction_simplifier.h b/compiler/optimizing/instruction_simplifier.h index 0244620..668956a 100644 --- a/compiler/optimizing/instruction_simplifier.h +++ b/compiler/optimizing/instruction_simplifier.h @@ -36,6 +36,9 @@ class InstructionSimplifier : public HOptimization { static constexpr const char* kInstructionSimplifierPassName = "instruction_simplifier"; void Run() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(InstructionSimplifier); }; } // namespace art diff --git a/compiler/optimizing/optimization.h b/compiler/optimizing/optimization.h index ccf8de9..2d1c0ba 100644 --- a/compiler/optimizing/optimization.h +++ b/compiler/optimizing/optimization.h @@ -17,6 +17,7 @@ #ifndef ART_COMPILER_OPTIMIZING_OPTIMIZATION_H_ #define ART_COMPILER_OPTIMIZING_OPTIMIZATION_H_ +#include "base/arena_object.h" #include "nodes.h" #include "optimizing_compiler_stats.h" @@ -25,7 +26,7 @@ namespace art { /** * Abstraction to implement an optimization pass. */ -class HOptimization : public ValueObject { +class HOptimization : public ArenaObject<kArenaAllocMisc> { public: HOptimization(HGraph* graph, bool is_in_ssa_form, diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc index 69c26f0..9a6e87a 100644 --- a/compiler/optimizing/optimizing_compiler.cc +++ b/compiler/optimizing/optimizing_compiler.cc @@ -321,48 +321,54 @@ static void RunOptimizations(HGraph* graph, const DexCompilationUnit& dex_compilation_unit, PassInfoPrinter* pass_info_printer, StackHandleScopeCollection* handles) { - HDeadCodeElimination dce1(graph, stats, - HDeadCodeElimination::kInitialDeadCodeEliminationPassName); - HDeadCodeElimination dce2(graph, stats, - HDeadCodeElimination::kFinalDeadCodeEliminationPassName); - HConstantFolding fold1(graph); - InstructionSimplifier simplify1(graph, stats); - HBooleanSimplifier boolean_simplify(graph); - - HInliner inliner(graph, dex_compilation_unit, dex_compilation_unit, driver, stats); - - HConstantFolding fold2(graph, "constant_folding_after_inlining"); - SideEffectsAnalysis side_effects(graph); - GVNOptimization gvn(graph, side_effects); - LICM licm(graph, side_effects); - BoundsCheckElimination bce(graph); - ReferenceTypePropagation type_propagation(graph, dex_file, dex_compilation_unit, handles); - InstructionSimplifier simplify2(graph, stats, "instruction_simplifier_after_types"); - InstructionSimplifier simplify3(graph, stats, "instruction_simplifier_before_codegen"); - - IntrinsicsRecognizer intrinsics(graph, dex_compilation_unit.GetDexFile(), driver); + ArenaAllocator* arena = graph->GetArena(); + HDeadCodeElimination* dce1 = new (arena) HDeadCodeElimination( + graph, stats, HDeadCodeElimination::kInitialDeadCodeEliminationPassName); + HDeadCodeElimination* dce2 = new (arena) HDeadCodeElimination( + graph, stats, HDeadCodeElimination::kFinalDeadCodeEliminationPassName); + HConstantFolding* fold1 = new (arena) HConstantFolding(graph); + InstructionSimplifier* simplify1 = new (arena) InstructionSimplifier(graph, stats); + HBooleanSimplifier* boolean_simplify = new (arena) HBooleanSimplifier(graph); + + HInliner* inliner = new (arena) HInliner( + graph, dex_compilation_unit, dex_compilation_unit, driver, stats); + + HConstantFolding* fold2 = new (arena) HConstantFolding(graph, "constant_folding_after_inlining"); + SideEffectsAnalysis* side_effects = new (arena) SideEffectsAnalysis(graph); + GVNOptimization* gvn = new (arena) GVNOptimization(graph, *side_effects); + LICM* licm = new (arena) LICM(graph, *side_effects); + BoundsCheckElimination* bce = new (arena) BoundsCheckElimination(graph); + ReferenceTypePropagation* type_propagation = + new (arena) ReferenceTypePropagation(graph, dex_file, dex_compilation_unit, handles); + InstructionSimplifier* simplify2 = new (arena) InstructionSimplifier( + graph, stats, "instruction_simplifier_after_types"); + + InstructionSimplifier* simplify3 = new (arena) InstructionSimplifier( + graph, stats, "instruction_simplifier_before_codegen"); + IntrinsicsRecognizer* intrinsics = new (arena) IntrinsicsRecognizer(graph, + dex_compilation_unit.GetDexFile(), driver); HOptimization* optimizations[] = { - &intrinsics, - &fold1, - &simplify1, - &dce1, - &inliner, + intrinsics, + fold1, + simplify1, + dce1, + inliner, // BooleanSimplifier depends on the InstructionSimplifier removing redundant // suspend checks to recognize empty blocks. - &boolean_simplify, - &fold2, - &side_effects, - &gvn, - &licm, - &bce, - &type_propagation, - &simplify2, - &dce2, + boolean_simplify, + fold2, + side_effects, + gvn, + licm, + bce, + type_propagation, + simplify2, + dce2, // The codegen has a few assumptions that only the instruction simplifier can // satisfy. For example, the code generator does not expect to see a // HTypeConversion from a type to the same type. - &simplify3, + simplify3, }; RunOptimizations(optimizations, arraysize(optimizations), pass_info_printer); |