diff options
| author | 2015-12-16 08:45:07 +0000 | |
|---|---|---|
| committer | 2015-12-16 08:45:07 +0000 | |
| commit | 13cd5cad6e51f52d7e2ef38c9415d6d03fd994e3 (patch) | |
| tree | 6f87852b9d14e479ea2c7ef92de35c3118a0fd1e /compiler/optimizing/optimizing_compiler.cc | |
| parent | 6e4753f0bc55655e2e178cb16d6a232ebd055543 (diff) | |
| parent | b059c8a044ed3ede1a0eea4b1e92008ced90c013 (diff) | |
Merge "Revert "ART: Refactor SsaBuilder for more precise typing info""
am: b059c8a044
* commit 'b059c8a044ed3ede1a0eea4b1e92008ced90c013':
  Revert "ART: Refactor SsaBuilder for more precise typing info"
Diffstat (limited to 'compiler/optimizing/optimizing_compiler.cc')
| -rw-r--r-- | compiler/optimizing/optimizing_compiler.cc | 51 | 
1 files changed, 22 insertions, 29 deletions
| diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc index ba435180e5..831b626c4f 100644 --- a/compiler/optimizing/optimizing_compiler.cc +++ b/compiler/optimizing/optimizing_compiler.cc @@ -501,8 +501,11 @@ static void RunOptimizations(HGraph* graph,                               CompilerDriver* driver,                               OptimizingCompilerStats* stats,                               const DexCompilationUnit& dex_compilation_unit, -                             PassObserver* pass_observer, -                             StackHandleScopeCollection* handles) { +                             PassObserver* pass_observer) { +  ScopedObjectAccess soa(Thread::Current()); +  StackHandleScopeCollection handles(soa.Self()); +  ScopedThreadSuspension sts(soa.Self(), kNative); +    ArenaAllocator* arena = graph->GetArena();    HDeadCodeElimination* dce1 = new (arena) HDeadCodeElimination(        graph, stats, HDeadCodeElimination::kInitialDeadCodeEliminationPassName); @@ -519,23 +522,29 @@ static void RunOptimizations(HGraph* graph,    LoadStoreElimination* lse = new (arena) LoadStoreElimination(graph, *side_effects);    HInductionVarAnalysis* induction = new (arena) HInductionVarAnalysis(graph);    BoundsCheckElimination* bce = new (arena) BoundsCheckElimination(graph, *side_effects, induction); +  ReferenceTypePropagation* type_propagation = +      new (arena) ReferenceTypePropagation(graph, &handles);    HSharpening* sharpening = new (arena) HSharpening(graph, codegen, dex_compilation_unit, driver);    InstructionSimplifier* simplify2 = new (arena) InstructionSimplifier( -      graph, stats, "instruction_simplifier_after_bce"); +      graph, stats, "instruction_simplifier_after_types");    InstructionSimplifier* simplify3 = new (arena) InstructionSimplifier( +      graph, stats, "instruction_simplifier_after_bce"); +  InstructionSimplifier* simplify4 = new (arena) InstructionSimplifier(        graph, stats, "instruction_simplifier_before_codegen");    IntrinsicsRecognizer* intrinsics = new (arena) IntrinsicsRecognizer(graph, driver);    HOptimization* optimizations1[] = {      intrinsics, -    sharpening,      fold1,      simplify1, +    type_propagation, +    sharpening,      dce1, +    simplify2    };    RunOptimizations(optimizations1, arraysize(optimizations1), pass_observer); -  MaybeRunInliner(graph, codegen, driver, stats, dex_compilation_unit, pass_observer, handles); +  MaybeRunInliner(graph, codegen, driver, stats, dex_compilation_unit, pass_observer, &handles);    HOptimization* optimizations2[] = {      // BooleanSimplifier depends on the InstructionSimplifier removing @@ -548,13 +557,13 @@ static void RunOptimizations(HGraph* graph,      induction,      bce,      fold3,  // evaluates code generated by dynamic bce -    simplify2, +    simplify3,      lse,      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, +    simplify4,    };    RunOptimizations(optimizations2, arraysize(optimizations2), pass_observer); @@ -759,29 +768,14 @@ CodeGenerator* OptimizingCompiler::TryCompile(ArenaAllocator* arena,    }    VLOG(compiler) << "Optimizing " << pass_observer.GetMethodName(); -    if (run_optimizations_) { -    ScopedObjectAccess soa(Thread::Current()); -    StackHandleScopeCollection handles(soa.Self()); -    ScopedThreadSuspension sts(soa.Self(), kNative); -      {        PassScope scope(SsaBuilder::kSsaBuilderPassName, &pass_observer); -      BuildSsaResult result = graph->TryBuildingSsa(&handles); -      if (result != kBuildSsaSuccess) { -        switch (result) { -          case kBuildSsaFailNonNaturalLoop: -            MaybeRecordStat(MethodCompilationStat::kNotCompiledNonNaturalLoop); -            break; -          case kBuildSsaFailThrowCatchLoop: -            MaybeRecordStat(MethodCompilationStat::kNotCompiledThrowCatchLoop); -            break; -          case kBuildSsaFailAmbiguousArrayGet: -            MaybeRecordStat(MethodCompilationStat::kNotCompiledAmbiguousArrayGet); -            break; -          case kBuildSsaSuccess: -            UNREACHABLE(); -        } +      if (!graph->TryBuildingSsa()) { +        // We could not transform the graph to SSA, bailout. +        LOG(INFO) << "Skipping compilation of " << pass_observer.GetMethodName() +            << ": it contains a non natural loop"; +        MaybeRecordStat(MethodCompilationStat::kNotCompiledCannotBuildSSA);          pass_observer.SetGraphInBadState();          return nullptr;        } @@ -792,8 +786,7 @@ CodeGenerator* OptimizingCompiler::TryCompile(ArenaAllocator* arena,                       compiler_driver,                       compilation_stats_.get(),                       dex_compilation_unit, -                     &pass_observer, -                     &handles); +                     &pass_observer);      codegen->CompileOptimized(code_allocator);    } else {      codegen->CompileBaseline(code_allocator); |