diff options
273 files changed, 1452 insertions, 977 deletions
diff --git a/Android.bp b/Android.bp index e09b7740c1..32a96e13ba 100644 --- a/Android.bp +++ b/Android.bp @@ -37,6 +37,7 @@ subdirs = [ "imgdiag", "libartbase", "libdexfile", + "libprofile", "oatdump", "openjdkjvm", "openjdkjvmti", diff --git a/Android.mk b/Android.mk index 47bcaac343..64b9400f66 100644 --- a/Android.mk +++ b/Android.mk @@ -471,10 +471,11 @@ build-art-target-golem: dex2oat dalvikvm patchoat linker libstdc++ \ $(ART_TARGET_SHARED_LIBRARY_BENCHMARK) \ $(TARGET_CORE_IMG_OUT_BASE).art \ $(TARGET_CORE_IMG_OUT_BASE)-interpreter.art - # remove libartd.so and libdexfiled.so from public.libraries.txt because golem builds + # remove debug libraries from public.libraries.txt because golem builds # won't have it. sed -i '/libartd.so/d' $(TARGET_OUT)/etc/public.libraries.txt sed -i '/libdexfiled.so/d' $(TARGET_OUT)/etc/public.libraries.txt + sed -i '/libprofiled.so/d' $(TARGET_OUT)/etc/public.libraries.txt ######################################################################## # Phony target for building what go/lem requires on host. diff --git a/compiler/Android.bp b/compiler/Android.bp index ec9fef7492..5884a548be 100644 --- a/compiler/Android.bp +++ b/compiler/Android.bp @@ -244,6 +244,7 @@ art_cc_library { }, shared_libs: [ "libart", + "libprofile", "libdexfile", ], @@ -292,6 +293,7 @@ art_cc_library { }, shared_libs: [ "libartd", + "libprofiled", "libdexfiled", ], } @@ -408,6 +410,7 @@ art_cc_test { ], shared_libs: [ + "libprofiled", "libartd-compiler", "libartd-simulator-container", "libvixld-arm", diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc index 41b7e7be47..fbbb4e960f 100644 --- a/compiler/driver/compiler_driver.cc +++ b/compiler/driver/compiler_driver.cc @@ -57,7 +57,6 @@ #include "gc/space/space.h" #include "handle_scope-inl.h" #include "intrinsics_enum.h" -#include "jit/profile_compilation_info.h" #include "jni_internal.h" #include "linker/linker_patch.h" #include "mirror/class-inl.h" @@ -69,6 +68,7 @@ #include "mirror/throwable.h" #include "nativehelper/ScopedLocalRef.h" #include "object_lock.h" +#include "profile/profile_compilation_info.h" #include "runtime.h" #include "runtime_intrinsics.h" #include "scoped_thread_state_change-inl.h" diff --git a/compiler/driver/compiler_driver_test.cc b/compiler/driver/compiler_driver_test.cc index 1332280d20..856cb36266 100644 --- a/compiler/driver/compiler_driver_test.cc +++ b/compiler/driver/compiler_driver_test.cc @@ -30,12 +30,12 @@ #include "dex/dex_file_types.h" #include "gc/heap.h" #include "handle_scope-inl.h" -#include "jit/profile_compilation_info.h" #include "mirror/class-inl.h" #include "mirror/class_loader.h" #include "mirror/dex_cache-inl.h" #include "mirror/object-inl.h" #include "mirror/object_array-inl.h" +#include "profile/profile_compilation_info.h" #include "scoped_thread_state_change-inl.h" namespace art { diff --git a/compiler/driver/compiler_options.h b/compiler/driver/compiler_options.h index 05d8805e81..cdd9d4de00 100644 --- a/compiler/driver/compiler_options.h +++ b/compiler/driver/compiler_options.h @@ -21,10 +21,10 @@ #include <string> #include <vector> +#include "base/globals.h" #include "base/macros.h" #include "base/utils.h" #include "compiler_filter.h" -#include "globals.h" #include "optimizing/register_allocator.h" namespace art { diff --git a/compiler/linker/buffered_output_stream.h b/compiler/linker/buffered_output_stream.h index 66994e82a1..512409cb2f 100644 --- a/compiler/linker/buffered_output_stream.h +++ b/compiler/linker/buffered_output_stream.h @@ -21,7 +21,7 @@ #include "output_stream.h" -#include "globals.h" +#include "base/globals.h" namespace art { namespace linker { diff --git a/compiler/optimizing/bounds_check_elimination.cc b/compiler/optimizing/bounds_check_elimination.cc index d893cc88c4..dfefa524bf 100644 --- a/compiler/optimizing/bounds_check_elimination.cc +++ b/compiler/optimizing/bounds_check_elimination.cc @@ -1938,9 +1938,9 @@ class BCEVisitor : public HGraphVisitor { DISALLOW_COPY_AND_ASSIGN(BCEVisitor); }; -void BoundsCheckElimination::Run() { +bool BoundsCheckElimination::Run() { if (!graph_->HasBoundsChecks()) { - return; + return false; } // Reverse post order guarantees a node's dominators are visited first. @@ -1968,6 +1968,8 @@ void BoundsCheckElimination::Run() { // Perform cleanup. visitor.Finish(); + + return true; } } // namespace art diff --git a/compiler/optimizing/bounds_check_elimination.h b/compiler/optimizing/bounds_check_elimination.h index 79c67a8c7a..92ab7984c8 100644 --- a/compiler/optimizing/bounds_check_elimination.h +++ b/compiler/optimizing/bounds_check_elimination.h @@ -34,7 +34,7 @@ class BoundsCheckElimination : public HOptimization { side_effects_(side_effects), induction_analysis_(induction_analysis) {} - void Run() OVERRIDE; + bool Run() OVERRIDE; static constexpr const char* kBoundsCheckEliminationPassName = "BCE"; diff --git a/compiler/optimizing/cha_guard_optimization.cc b/compiler/optimizing/cha_guard_optimization.cc index 3addaeecd9..bdc395b52d 100644 --- a/compiler/optimizing/cha_guard_optimization.cc +++ b/compiler/optimizing/cha_guard_optimization.cc @@ -241,14 +241,15 @@ void CHAGuardVisitor::VisitShouldDeoptimizeFlag(HShouldDeoptimizeFlag* flag) { GetGraph()->IncrementNumberOfCHAGuards(); } -void CHAGuardOptimization::Run() { +bool CHAGuardOptimization::Run() { if (graph_->GetNumberOfCHAGuards() == 0) { - return; + return false; } CHAGuardVisitor visitor(graph_); for (HBasicBlock* block : graph_->GetReversePostOrder()) { visitor.VisitBasicBlock(block); } + return true; } } // namespace art diff --git a/compiler/optimizing/cha_guard_optimization.h b/compiler/optimizing/cha_guard_optimization.h index f14e07bd6c..d2c5a344b7 100644 --- a/compiler/optimizing/cha_guard_optimization.h +++ b/compiler/optimizing/cha_guard_optimization.h @@ -30,7 +30,7 @@ class CHAGuardOptimization : public HOptimization { const char* name = kCHAGuardOptimizationPassName) : HOptimization(graph, name) {} - void Run() OVERRIDE; + bool Run() OVERRIDE; static constexpr const char* kCHAGuardOptimizationPassName = "cha_guard_optimization"; diff --git a/compiler/optimizing/code_generator.h b/compiler/optimizing/code_generator.h index 62cacebaa1..f0c4ee01cc 100644 --- a/compiler/optimizing/code_generator.h +++ b/compiler/optimizing/code_generator.h @@ -25,10 +25,10 @@ #include "base/bit_field.h" #include "base/bit_utils.h" #include "base/enums.h" +#include "base/globals.h" #include "base/memory_region.h" #include "dex/string_reference.h" #include "dex/type_reference.h" -#include "globals.h" #include "graph_visualizer.h" #include "locations.h" #include "nodes.h" diff --git a/compiler/optimizing/code_sinking.cc b/compiler/optimizing/code_sinking.cc index 2e31d35584..d6c97552dc 100644 --- a/compiler/optimizing/code_sinking.cc +++ b/compiler/optimizing/code_sinking.cc @@ -25,11 +25,11 @@ namespace art { -void CodeSinking::Run() { +bool CodeSinking::Run() { HBasicBlock* exit = graph_->GetExitBlock(); if (exit == nullptr) { // Infinite loop, just bail. - return; + return false; } // TODO(ngeoffray): we do not profile branches yet, so use throw instructions // as an indicator of an uncommon branch. @@ -40,6 +40,7 @@ void CodeSinking::Run() { SinkCodeToUncommonBranch(exit_predecessor); } } + return true; } static bool IsInterestingInstruction(HInstruction* instruction) { diff --git a/compiler/optimizing/code_sinking.h b/compiler/optimizing/code_sinking.h index 836d9d4f67..5db0b6dcc5 100644 --- a/compiler/optimizing/code_sinking.h +++ b/compiler/optimizing/code_sinking.h @@ -33,7 +33,7 @@ class CodeSinking : public HOptimization { const char* name = kCodeSinkingPassName) : HOptimization(graph, name, stats) {} - void Run() OVERRIDE; + bool Run() OVERRIDE; static constexpr const char* kCodeSinkingPassName = "code_sinking"; diff --git a/compiler/optimizing/constant_folding.cc b/compiler/optimizing/constant_folding.cc index 6f11e628ee..bb78c2357e 100644 --- a/compiler/optimizing/constant_folding.cc +++ b/compiler/optimizing/constant_folding.cc @@ -68,13 +68,14 @@ class InstructionWithAbsorbingInputSimplifier : public HGraphVisitor { }; -void HConstantFolding::Run() { +bool HConstantFolding::Run() { HConstantFoldingVisitor visitor(graph_); // Process basic blocks in reverse post-order in the dominator tree, // so that an instruction turned into a constant, used as input of // another instruction, may possibly be used to turn that second // instruction into a constant as well. visitor.VisitReversePostOrder(); + return true; } diff --git a/compiler/optimizing/constant_folding.h b/compiler/optimizing/constant_folding.h index 05c6df4a93..f4dbc805c4 100644 --- a/compiler/optimizing/constant_folding.h +++ b/compiler/optimizing/constant_folding.h @@ -41,7 +41,7 @@ class HConstantFolding : public HOptimization { public: HConstantFolding(HGraph* graph, const char* name) : HOptimization(graph, name) {} - void Run() OVERRIDE; + bool Run() OVERRIDE; static constexpr const char* kConstantFoldingPassName = "constant_folding"; diff --git a/compiler/optimizing/constructor_fence_redundancy_elimination.cc b/compiler/optimizing/constructor_fence_redundancy_elimination.cc index 4a66cd2265..1a7f9266e9 100644 --- a/compiler/optimizing/constructor_fence_redundancy_elimination.cc +++ b/compiler/optimizing/constructor_fence_redundancy_elimination.cc @@ -250,13 +250,14 @@ class CFREVisitor : public HGraphVisitor { DISALLOW_COPY_AND_ASSIGN(CFREVisitor); }; -void ConstructorFenceRedundancyElimination::Run() { +bool ConstructorFenceRedundancyElimination::Run() { CFREVisitor cfre_visitor(graph_, stats_); // Arbitrarily visit in reverse-post order. // The exact block visit order does not matter, as the algorithm // only operates on a single block at a time. cfre_visitor.VisitReversePostOrder(); + return true; } } // namespace art diff --git a/compiler/optimizing/constructor_fence_redundancy_elimination.h b/compiler/optimizing/constructor_fence_redundancy_elimination.h index f4b06d5544..367d9f21a0 100644 --- a/compiler/optimizing/constructor_fence_redundancy_elimination.h +++ b/compiler/optimizing/constructor_fence_redundancy_elimination.h @@ -52,7 +52,7 @@ class ConstructorFenceRedundancyElimination : public HOptimization { const char* name = kCFREPassName) : HOptimization(graph, name, stats) {} - void Run() OVERRIDE; + bool Run() OVERRIDE; static constexpr const char* kCFREPassName = "constructor_fence_redundancy_elimination"; diff --git a/compiler/optimizing/dead_code_elimination.cc b/compiler/optimizing/dead_code_elimination.cc index 9fa0f72e80..1dc10948cc 100644 --- a/compiler/optimizing/dead_code_elimination.cc +++ b/compiler/optimizing/dead_code_elimination.cc @@ -508,7 +508,7 @@ void HDeadCodeElimination::RemoveDeadInstructions() { } } -void HDeadCodeElimination::Run() { +bool HDeadCodeElimination::Run() { // Do not eliminate dead blocks if the graph has irreducible loops. We could // support it, but that would require changes in our loop representation to handle // multiple entry points. We decided it was not worth the complexity. @@ -526,6 +526,7 @@ void HDeadCodeElimination::Run() { } SsaRedundantPhiElimination(graph_).Run(); RemoveDeadInstructions(); + return true; } } // namespace art diff --git a/compiler/optimizing/dead_code_elimination.h b/compiler/optimizing/dead_code_elimination.h index 92a7f562e1..90caa53764 100644 --- a/compiler/optimizing/dead_code_elimination.h +++ b/compiler/optimizing/dead_code_elimination.h @@ -32,7 +32,8 @@ class HDeadCodeElimination : public HOptimization { HDeadCodeElimination(HGraph* graph, OptimizingCompilerStats* stats, const char* name) : HOptimization(graph, name, stats) {} - void Run() OVERRIDE; + bool Run() OVERRIDE; + static constexpr const char* kDeadCodeEliminationPassName = "dead_code_elimination"; private: diff --git a/compiler/optimizing/gvn.cc b/compiler/optimizing/gvn.cc index f05159b735..4863718518 100644 --- a/compiler/optimizing/gvn.cc +++ b/compiler/optimizing/gvn.cc @@ -352,7 +352,7 @@ class GlobalValueNumberer : public ValueObject { visited_blocks_.ClearAllBits(); } - void Run(); + bool Run(); private: // Per-block GVN. Will also update the ValueSet of the dominated and @@ -397,7 +397,7 @@ class GlobalValueNumberer : public ValueObject { DISALLOW_COPY_AND_ASSIGN(GlobalValueNumberer); }; -void GlobalValueNumberer::Run() { +bool GlobalValueNumberer::Run() { DCHECK(side_effects_.HasRun()); sets_[graph_->GetEntryBlock()->GetBlockId()] = new (&allocator_) ValueSet(&allocator_); @@ -406,6 +406,7 @@ void GlobalValueNumberer::Run() { for (HBasicBlock* block : graph_->GetReversePostOrder()) { VisitBasicBlock(block); } + return true; } void GlobalValueNumberer::VisitBasicBlock(HBasicBlock* block) { @@ -557,9 +558,9 @@ HBasicBlock* GlobalValueNumberer::FindVisitedBlockWithRecyclableSet( return secondary_match; } -void GVNOptimization::Run() { +bool GVNOptimization::Run() { GlobalValueNumberer gvn(graph_, side_effects_); - gvn.Run(); + return gvn.Run(); } } // namespace art diff --git a/compiler/optimizing/gvn.h b/compiler/optimizing/gvn.h index 4fdba26ebd..75cfff2140 100644 --- a/compiler/optimizing/gvn.h +++ b/compiler/optimizing/gvn.h @@ -31,7 +31,7 @@ class GVNOptimization : public HOptimization { const char* pass_name = kGlobalValueNumberingPassName) : HOptimization(graph, pass_name), side_effects_(side_effects) {} - void Run() OVERRIDE; + bool Run() OVERRIDE; static constexpr const char* kGlobalValueNumberingPassName = "GVN"; diff --git a/compiler/optimizing/induction_var_analysis.cc b/compiler/optimizing/induction_var_analysis.cc index d270c6a28e..a4d638f4c6 100644 --- a/compiler/optimizing/induction_var_analysis.cc +++ b/compiler/optimizing/induction_var_analysis.cc @@ -243,7 +243,7 @@ HInductionVarAnalysis::HInductionVarAnalysis(HGraph* graph, const char* name) graph->GetAllocator()->Adapter(kArenaAllocInductionVarAnalysis)) { } -void HInductionVarAnalysis::Run() { +bool HInductionVarAnalysis::Run() { // Detects sequence variables (generalized induction variables) during an outer to inner // traversal of all loops using Gerlek's algorithm. The order is important to enable // range analysis on outer loop while visiting inner loops. @@ -253,6 +253,7 @@ void HInductionVarAnalysis::Run() { VisitLoop(graph_block->GetLoopInformation()); } } + return !induction_.empty(); } void HInductionVarAnalysis::VisitLoop(HLoopInformation* loop) { diff --git a/compiler/optimizing/induction_var_analysis.h b/compiler/optimizing/induction_var_analysis.h index acad77d35f..89fed2ec64 100644 --- a/compiler/optimizing/induction_var_analysis.h +++ b/compiler/optimizing/induction_var_analysis.h @@ -37,7 +37,7 @@ class HInductionVarAnalysis : public HOptimization { public: explicit HInductionVarAnalysis(HGraph* graph, const char* name = kInductionPassName); - void Run() OVERRIDE; + bool Run() OVERRIDE; static constexpr const char* kInductionPassName = "induction_var_analysis"; diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc index 8b10a78212..ffa000e34e 100644 --- a/compiler/optimizing/inliner.cc +++ b/compiler/optimizing/inliner.cc @@ -124,13 +124,18 @@ void HInliner::UpdateInliningBudget() { } } -void HInliner::Run() { - if (graph_->IsDebuggable()) { +bool HInliner::Run() { + if (compiler_driver_->GetCompilerOptions().GetInlineMaxCodeUnits() == 0) { + // Inlining effectively disabled. + return false; + } else if (graph_->IsDebuggable()) { // For simplicity, we currently never inline when the graph is debuggable. This avoids // doing some logic in the runtime to discover if a method could have been inlined. - return; + return false; } + bool didInline = false; + // Initialize the number of instructions for the method being compiled. Recursive calls // to HInliner::Run have already updated the instruction count. if (outermost_graph_ == graph_) { @@ -171,7 +176,9 @@ void HInliner::Run() { call->GetDexMethodIndex(), /* with_signature */ false); // Tests prevent inlining by having $noinline$ in their method names. if (callee_name.find("$noinline$") == std::string::npos) { - if (!TryInline(call) && honor_inline_directives) { + if (TryInline(call)) { + didInline = true; + } else if (honor_inline_directives) { bool should_have_inlined = (callee_name.find("$inline$") != std::string::npos); CHECK(!should_have_inlined) << "Could not inline " << callee_name; } @@ -179,12 +186,16 @@ void HInliner::Run() { } else { DCHECK(!honor_inline_directives); // Normal case: try to inline. - TryInline(call); + if (TryInline(call)) { + didInline = true; + } } } instruction = next; } } + + return didInline; } static bool IsMethodOrDeclaringClassFinal(ArtMethod* method) diff --git a/compiler/optimizing/inliner.h b/compiler/optimizing/inliner.h index 02465d37ba..2fdf6a1306 100644 --- a/compiler/optimizing/inliner.h +++ b/compiler/optimizing/inliner.h @@ -19,8 +19,8 @@ #include "dex/dex_file_types.h" #include "dex/invoke_type.h" -#include "jit/profile_compilation_info.h" #include "optimization.h" +#include "profile/profile_compilation_info.h" namespace art { @@ -60,7 +60,7 @@ class HInliner : public HOptimization { handles_(handles), inline_stats_(nullptr) {} - void Run() OVERRIDE; + bool Run() OVERRIDE; static constexpr const char* kInlinerPassName = "inliner"; diff --git a/compiler/optimizing/instruction_simplifier.cc b/compiler/optimizing/instruction_simplifier.cc index d3cf9568c2..0fe16725f3 100644 --- a/compiler/optimizing/instruction_simplifier.cc +++ b/compiler/optimizing/instruction_simplifier.cc @@ -42,7 +42,7 @@ class InstructionSimplifierVisitor : public HGraphDelegateVisitor { compiler_driver_(compiler_driver), stats_(stats) {} - void Run(); + bool Run(); private: void RecordSimplification() { @@ -136,17 +136,18 @@ class InstructionSimplifierVisitor : public HGraphDelegateVisitor { static constexpr int kMaxSamePositionSimplifications = 50; }; -void InstructionSimplifier::Run() { +bool InstructionSimplifier::Run() { if (kTestInstructionClonerExhaustively) { CloneAndReplaceInstructionVisitor visitor(graph_); visitor.VisitReversePostOrder(); } InstructionSimplifierVisitor visitor(graph_, codegen_, compiler_driver_, stats_); - visitor.Run(); + return visitor.Run(); } -void InstructionSimplifierVisitor::Run() { +bool InstructionSimplifierVisitor::Run() { + bool didSimplify = false; // Iterate in reverse post order to open up more simplifications to users // of instructions that got simplified. for (HBasicBlock* block : GetGraph()->GetReversePostOrder()) { @@ -156,10 +157,14 @@ void InstructionSimplifierVisitor::Run() { do { simplification_occurred_ = false; VisitBasicBlock(block); + if (simplification_occurred_) { + didSimplify = true; + } } while (simplification_occurred_ && (simplifications_at_current_position_ < kMaxSamePositionSimplifications)); simplifications_at_current_position_ = 0; } + return didSimplify; } namespace { diff --git a/compiler/optimizing/instruction_simplifier.h b/compiler/optimizing/instruction_simplifier.h index 5e2045580b..f409e873de 100644 --- a/compiler/optimizing/instruction_simplifier.h +++ b/compiler/optimizing/instruction_simplifier.h @@ -49,7 +49,7 @@ class InstructionSimplifier : public HOptimization { static constexpr const char* kInstructionSimplifierPassName = "instruction_simplifier"; - void Run() OVERRIDE; + bool Run() OVERRIDE; private: CodeGenerator* codegen_; diff --git a/compiler/optimizing/instruction_simplifier_arm.cc b/compiler/optimizing/instruction_simplifier_arm.cc index 92081e30b1..37fcdb9d5c 100644 --- a/compiler/optimizing/instruction_simplifier_arm.cc +++ b/compiler/optimizing/instruction_simplifier_arm.cc @@ -283,9 +283,10 @@ void InstructionSimplifierArmVisitor::VisitUShr(HUShr* instruction) { } } -void InstructionSimplifierArm::Run() { +bool InstructionSimplifierArm::Run() { InstructionSimplifierArmVisitor visitor(graph_, stats_); visitor.VisitReversePostOrder(); + return true; } } // namespace arm diff --git a/compiler/optimizing/instruction_simplifier_arm.h b/compiler/optimizing/instruction_simplifier_arm.h index 2f6572931f..f1a16efc61 100644 --- a/compiler/optimizing/instruction_simplifier_arm.h +++ b/compiler/optimizing/instruction_simplifier_arm.h @@ -30,7 +30,7 @@ class InstructionSimplifierArm : public HOptimization { static constexpr const char* kInstructionSimplifierArmPassName = "instruction_simplifier_arm"; - void Run() OVERRIDE; + bool Run() OVERRIDE; }; } // namespace arm diff --git a/compiler/optimizing/instruction_simplifier_arm64.cc b/compiler/optimizing/instruction_simplifier_arm64.cc index 1c44e5ac49..e0a627994d 100644 --- a/compiler/optimizing/instruction_simplifier_arm64.cc +++ b/compiler/optimizing/instruction_simplifier_arm64.cc @@ -278,9 +278,10 @@ void InstructionSimplifierArm64Visitor::VisitVecStore(HVecStore* instruction) { } } -void InstructionSimplifierArm64::Run() { +bool InstructionSimplifierArm64::Run() { InstructionSimplifierArm64Visitor visitor(graph_, stats_); visitor.VisitReversePostOrder(); + return true; } } // namespace arm64 diff --git a/compiler/optimizing/instruction_simplifier_arm64.h b/compiler/optimizing/instruction_simplifier_arm64.h index d180a8dc46..8659c1f5f4 100644 --- a/compiler/optimizing/instruction_simplifier_arm64.h +++ b/compiler/optimizing/instruction_simplifier_arm64.h @@ -30,7 +30,7 @@ class InstructionSimplifierArm64 : public HOptimization { static constexpr const char* kInstructionSimplifierArm64PassName = "instruction_simplifier_arm64"; - void Run() OVERRIDE; + bool Run() OVERRIDE; }; } // namespace arm64 diff --git a/compiler/optimizing/instruction_simplifier_mips.cc b/compiler/optimizing/instruction_simplifier_mips.cc index fa97401a0c..3bdf90f652 100644 --- a/compiler/optimizing/instruction_simplifier_mips.cc +++ b/compiler/optimizing/instruction_simplifier_mips.cc @@ -131,9 +131,10 @@ void InstructionSimplifierMipsVisitor::VisitArraySet(HArraySet* instruction) { } } -void InstructionSimplifierMips::Run() { +bool InstructionSimplifierMips::Run() { InstructionSimplifierMipsVisitor visitor(graph_, codegen_, stats_); visitor.VisitReversePostOrder(); + return true; } } // namespace mips diff --git a/compiler/optimizing/instruction_simplifier_mips.h b/compiler/optimizing/instruction_simplifier_mips.h index 6cb8affe85..94ef73d425 100644 --- a/compiler/optimizing/instruction_simplifier_mips.h +++ b/compiler/optimizing/instruction_simplifier_mips.h @@ -35,7 +35,7 @@ class InstructionSimplifierMips : public HOptimization { static constexpr const char* kInstructionSimplifierMipsPassName = "instruction_simplifier_mips"; - void Run() OVERRIDE; + bool Run() OVERRIDE; private: CodeGeneratorMIPS* codegen_; diff --git a/compiler/optimizing/intrinsics.cc b/compiler/optimizing/intrinsics.cc index f8dc316e45..dfe6d791c6 100644 --- a/compiler/optimizing/intrinsics.cc +++ b/compiler/optimizing/intrinsics.cc @@ -178,7 +178,8 @@ bool IntrinsicsRecognizer::Recognize(HInvoke* invoke, return true; } -void IntrinsicsRecognizer::Run() { +bool IntrinsicsRecognizer::Run() { + bool didRecognize = false; ScopedObjectAccess soa(Thread::Current()); for (HBasicBlock* block : graph_->GetReversePostOrder()) { for (HInstructionIterator inst_it(block->GetInstructions()); !inst_it.Done(); @@ -187,6 +188,7 @@ void IntrinsicsRecognizer::Run() { if (inst->IsInvoke()) { bool wrong_invoke_type = false; if (Recognize(inst->AsInvoke(), /* art_method */ nullptr, &wrong_invoke_type)) { + didRecognize = true; MaybeRecordStat(stats_, MethodCompilationStat::kIntrinsicRecognized); } else if (wrong_invoke_type) { LOG(WARNING) @@ -197,6 +199,7 @@ void IntrinsicsRecognizer::Run() { } } } + return didRecognize; } std::ostream& operator<<(std::ostream& os, const Intrinsics& intrinsic) { diff --git a/compiler/optimizing/intrinsics.h b/compiler/optimizing/intrinsics.h index 1035cbc2c4..30cffac015 100644 --- a/compiler/optimizing/intrinsics.h +++ b/compiler/optimizing/intrinsics.h @@ -42,7 +42,7 @@ class IntrinsicsRecognizer : public HOptimization { const char* name = kIntrinsicsRecognizerPassName) : HOptimization(graph, name, stats) {} - void Run() OVERRIDE; + bool Run() OVERRIDE; // Static helper that recognizes intrinsic call. Returns true on success. // If it fails due to invoke type mismatch, wrong_invoke_type is set. diff --git a/compiler/optimizing/licm.cc b/compiler/optimizing/licm.cc index d3a0376e9c..0edb23b857 100644 --- a/compiler/optimizing/licm.cc +++ b/compiler/optimizing/licm.cc @@ -78,7 +78,8 @@ static void UpdateLoopPhisIn(HEnvironment* environment, HLoopInformation* info) } } -void LICM::Run() { +bool LICM::Run() { + bool didLICM = false; DCHECK(side_effects_.HasRun()); // Only used during debug. @@ -157,6 +158,7 @@ void LICM::Run() { } instruction->MoveBefore(pre_header->GetLastInstruction()); MaybeRecordStat(stats_, MethodCompilationStat::kLoopInvariantMoved); + didLICM = true; } if (!can_move && (instruction->CanThrow() || instruction->DoesAnyWrite())) { @@ -167,6 +169,7 @@ void LICM::Run() { } } } + return didLICM; } } // namespace art diff --git a/compiler/optimizing/licm.h b/compiler/optimizing/licm.h index ee567aeb20..f72d195ab2 100644 --- a/compiler/optimizing/licm.h +++ b/compiler/optimizing/licm.h @@ -33,7 +33,7 @@ class LICM : public HOptimization { : HOptimization(graph, name, stats), side_effects_(side_effects) {} - void Run() OVERRIDE; + bool Run() OVERRIDE; static constexpr const char* kLoopInvariantCodeMotionPassName = "licm"; diff --git a/compiler/optimizing/load_store_analysis.cc b/compiler/optimizing/load_store_analysis.cc index 8b1812a6de..7d7bb94933 100644 --- a/compiler/optimizing/load_store_analysis.cc +++ b/compiler/optimizing/load_store_analysis.cc @@ -152,7 +152,7 @@ bool HeapLocationCollector::CanArrayElementsAlias(const HInstruction* idx1, return true; } -void LoadStoreAnalysis::Run() { +bool LoadStoreAnalysis::Run() { for (HBasicBlock* block : graph_->GetReversePostOrder()) { heap_location_collector_.VisitBasicBlock(block); } @@ -160,22 +160,23 @@ void LoadStoreAnalysis::Run() { if (heap_location_collector_.GetNumberOfHeapLocations() > kMaxNumberOfHeapLocations) { // Bail out if there are too many heap locations to deal with. heap_location_collector_.CleanUp(); - return; + return false; } if (!heap_location_collector_.HasHeapStores()) { // Without heap stores, this pass would act mostly as GVN on heap accesses. heap_location_collector_.CleanUp(); - return; + return false; } if (heap_location_collector_.HasVolatile() || heap_location_collector_.HasMonitorOps()) { // Don't do load/store elimination if the method has volatile field accesses or // monitor operations, for now. // TODO: do it right. heap_location_collector_.CleanUp(); - return; + return false; } heap_location_collector_.BuildAliasingMatrix(); + return true; } } // namespace art diff --git a/compiler/optimizing/load_store_analysis.h b/compiler/optimizing/load_store_analysis.h index 437e6be418..f84846d1b0 100644 --- a/compiler/optimizing/load_store_analysis.h +++ b/compiler/optimizing/load_store_analysis.h @@ -572,7 +572,7 @@ class LoadStoreAnalysis : public HOptimization { return heap_location_collector_; } - void Run() OVERRIDE; + bool Run() OVERRIDE; static constexpr const char* kLoadStoreAnalysisPassName = "load_store_analysis"; diff --git a/compiler/optimizing/load_store_elimination.cc b/compiler/optimizing/load_store_elimination.cc index 237ecd3c10..d598ff592d 100644 --- a/compiler/optimizing/load_store_elimination.cc +++ b/compiler/optimizing/load_store_elimination.cc @@ -948,22 +948,22 @@ class LSEVisitor : public HGraphDelegateVisitor { DISALLOW_COPY_AND_ASSIGN(LSEVisitor); }; -void LoadStoreElimination::Run() { +bool LoadStoreElimination::Run() { if (graph_->IsDebuggable() || graph_->HasTryCatch()) { // Debugger may set heap values or trigger deoptimization of callers. // Try/catch support not implemented yet. // Skip this optimization. - return; + return false; } const HeapLocationCollector& heap_location_collector = lsa_.GetHeapLocationCollector(); if (heap_location_collector.GetNumberOfHeapLocations() == 0) { // No HeapLocation information from LSA, skip this optimization. - return; + return false; } // TODO: analyze VecLoad/VecStore better. if (graph_->HasSIMD()) { - return; + return false; } LSEVisitor lse_visitor(graph_, heap_location_collector, side_effects_, stats_); @@ -971,6 +971,7 @@ void LoadStoreElimination::Run() { lse_visitor.VisitBasicBlock(block); } lse_visitor.RemoveInstructions(); + return true; } } // namespace art diff --git a/compiler/optimizing/load_store_elimination.h b/compiler/optimizing/load_store_elimination.h index 7153541baf..408386bd82 100644 --- a/compiler/optimizing/load_store_elimination.h +++ b/compiler/optimizing/load_store_elimination.h @@ -35,7 +35,7 @@ class LoadStoreElimination : public HOptimization { side_effects_(side_effects), lsa_(lsa) {} - void Run() OVERRIDE; + bool Run() OVERRIDE; static constexpr const char* kLoadStoreEliminationPassName = "load_store_elimination"; diff --git a/compiler/optimizing/loop_optimization.cc b/compiler/optimizing/loop_optimization.cc index 1462404932..7f1b319c12 100644 --- a/compiler/optimizing/loop_optimization.cc +++ b/compiler/optimizing/loop_optimization.cc @@ -608,11 +608,11 @@ HLoopOptimization::HLoopOptimization(HGraph* graph, global_allocator_)) { } -void HLoopOptimization::Run() { +bool HLoopOptimization::Run() { // Skip if there is no loop or the graph has try-catch/irreducible loops. // TODO: make this less of a sledgehammer. if (!graph_->HasLoops() || graph_->HasTryCatch() || graph_->HasIrreducibleLoops()) { - return; + return false; } // Phase-local allocator. @@ -620,7 +620,7 @@ void HLoopOptimization::Run() { loop_allocator_ = &allocator; // Perform loop optimizations. - LocalRun(); + bool didLoopOpt = LocalRun(); if (top_loop_ == nullptr) { graph_->SetHasLoops(false); // no more loops } @@ -628,13 +628,16 @@ void HLoopOptimization::Run() { // Detach. loop_allocator_ = nullptr; last_loop_ = top_loop_ = nullptr; + + return didLoopOpt; } // // Loop setup and traversal. // -void HLoopOptimization::LocalRun() { +bool HLoopOptimization::LocalRun() { + bool didLoopOpt = false; // Build the linear order using the phase-local allocator. This step enables building // a loop hierarchy that properly reflects the outer-inner and previous-next relation. ScopedArenaVector<HBasicBlock*> linear_order(loop_allocator_->Adapter(kArenaAllocLinearOrder)); @@ -666,7 +669,7 @@ void HLoopOptimization::LocalRun() { vector_map_ = ↦ vector_permanent_map_ = &perm; // Traverse. - TraverseLoopsInnerToOuter(top_loop_); + didLoopOpt = TraverseLoopsInnerToOuter(top_loop_); // Detach. iset_ = nullptr; reductions_ = nullptr; @@ -674,6 +677,7 @@ void HLoopOptimization::LocalRun() { vector_map_ = nullptr; vector_permanent_map_ = nullptr; } + return didLoopOpt; } void HLoopOptimization::AddLoop(HLoopInformation* loop_info) { diff --git a/compiler/optimizing/loop_optimization.h b/compiler/optimizing/loop_optimization.h index f9a31a34d4..11e969875e 100644 --- a/compiler/optimizing/loop_optimization.h +++ b/compiler/optimizing/loop_optimization.h @@ -43,7 +43,7 @@ class HLoopOptimization : public HOptimization { OptimizingCompilerStats* stats, const char* name = kLoopOptimizationPassName); - void Run() OVERRIDE; + bool Run() OVERRIDE; static constexpr const char* kLoopOptimizationPassName = "loop_optimization"; @@ -123,7 +123,7 @@ class HLoopOptimization : public HOptimization { // Loop setup and traversal. // - void LocalRun(); + bool LocalRun(); void AddLoop(HLoopInformation* loop_info); void RemoveLoop(LoopNode* node); diff --git a/compiler/optimizing/optimization.cc b/compiler/optimizing/optimization.cc index 57db7a634c..d37c43db81 100644 --- a/compiler/optimizing/optimization.cc +++ b/compiler/optimizing/optimization.cc @@ -121,12 +121,15 @@ const char* OptimizationPassName(OptimizationPass pass) { case OptimizationPass::kX86MemoryOperandGeneration: return x86::X86MemoryOperandGeneration::kX86MemoryOperandGenerationPassName; #endif + case OptimizationPass::kNone: + LOG(FATAL) << "kNone does not represent an actual pass"; + UNREACHABLE(); } } -#define X(x) if (name == OptimizationPassName((x))) return (x) +#define X(x) if (pass_name == OptimizationPassName((x))) return (x) -OptimizationPass OptimizationPassByName(const std::string& name) { +OptimizationPass OptimizationPassByName(const std::string& pass_name) { X(OptimizationPass::kBoundsCheckElimination); X(OptimizationPass::kCHAGuardOptimization); X(OptimizationPass::kCodeSinking); @@ -160,7 +163,7 @@ OptimizationPass OptimizationPassByName(const std::string& name) { X(OptimizationPass::kPcRelativeFixupsX86); X(OptimizationPass::kX86MemoryOperandGeneration); #endif - LOG(FATAL) << "Cannot find optimization " << name; + LOG(FATAL) << "Cannot find optimization " << pass_name; UNREACHABLE(); } @@ -187,9 +190,9 @@ ArenaVector<HOptimization*> ConstructOptimizations( // Loop over the requested optimizations. for (size_t i = 0; i < length; i++) { - OptimizationPass pass = definitions[i].first; - const char* alt_name = definitions[i].second; - const char* name = alt_name != nullptr + OptimizationPass pass = definitions[i].pass; + const char* alt_name = definitions[i].pass_name; + const char* pass_name = alt_name != nullptr ? alt_name : OptimizationPassName(pass); HOptimization* opt = nullptr; @@ -199,47 +202,48 @@ ArenaVector<HOptimization*> ConstructOptimizations( // Analysis passes (kept in most recent for subsequent passes). // case OptimizationPass::kSideEffectsAnalysis: - opt = most_recent_side_effects = new (allocator) SideEffectsAnalysis(graph, name); + opt = most_recent_side_effects = new (allocator) SideEffectsAnalysis(graph, pass_name); break; case OptimizationPass::kInductionVarAnalysis: - opt = most_recent_induction = new (allocator) HInductionVarAnalysis(graph, name); + opt = most_recent_induction = new (allocator) HInductionVarAnalysis(graph, pass_name); break; case OptimizationPass::kLoadStoreAnalysis: - opt = most_recent_lsa = new (allocator) LoadStoreAnalysis(graph, name); + opt = most_recent_lsa = new (allocator) LoadStoreAnalysis(graph, pass_name); break; // // Passes that need prior analysis. // case OptimizationPass::kGlobalValueNumbering: CHECK(most_recent_side_effects != nullptr); - opt = new (allocator) GVNOptimization(graph, *most_recent_side_effects, name); + opt = new (allocator) GVNOptimization(graph, *most_recent_side_effects, pass_name); break; case OptimizationPass::kInvariantCodeMotion: CHECK(most_recent_side_effects != nullptr); - opt = new (allocator) LICM(graph, *most_recent_side_effects, stats, name); + opt = new (allocator) LICM(graph, *most_recent_side_effects, stats, pass_name); break; case OptimizationPass::kLoopOptimization: CHECK(most_recent_induction != nullptr); - opt = new (allocator) HLoopOptimization(graph, driver, most_recent_induction, stats, name); + opt = new (allocator) HLoopOptimization( + graph, driver, most_recent_induction, stats, pass_name); break; case OptimizationPass::kBoundsCheckElimination: CHECK(most_recent_side_effects != nullptr && most_recent_induction != nullptr); opt = new (allocator) BoundsCheckElimination( - graph, *most_recent_side_effects, most_recent_induction, name); + graph, *most_recent_side_effects, most_recent_induction, pass_name); break; case OptimizationPass::kLoadStoreElimination: CHECK(most_recent_side_effects != nullptr && most_recent_induction != nullptr); opt = new (allocator) LoadStoreElimination( - graph, *most_recent_side_effects, *most_recent_lsa, stats, name); + graph, *most_recent_side_effects, *most_recent_lsa, stats, pass_name); break; // // Regular passes. // case OptimizationPass::kConstantFolding: - opt = new (allocator) HConstantFolding(graph, name); + opt = new (allocator) HConstantFolding(graph, pass_name); break; case OptimizationPass::kDeadCodeElimination: - opt = new (allocator) HDeadCodeElimination(graph, stats, name); + opt = new (allocator) HDeadCodeElimination(graph, stats, pass_name); break; case OptimizationPass::kInliner: { CodeItemDataAccessor accessor(*dex_compilation_unit.GetDexFile(), @@ -256,33 +260,33 @@ ArenaVector<HOptimization*> ConstructOptimizations( /* total_number_of_instructions */ 0, /* parent */ nullptr, /* depth */ 0, - name); + pass_name); break; } case OptimizationPass::kSharpening: - opt = new (allocator) HSharpening(graph, codegen, driver, name); + opt = new (allocator) HSharpening(graph, codegen, driver, pass_name); break; case OptimizationPass::kSelectGenerator: - opt = new (allocator) HSelectGenerator(graph, handles, stats, name); + opt = new (allocator) HSelectGenerator(graph, handles, stats, pass_name); break; case OptimizationPass::kInstructionSimplifier: - opt = new (allocator) InstructionSimplifier(graph, codegen, driver, stats, name); + opt = new (allocator) InstructionSimplifier(graph, codegen, driver, stats, pass_name); break; case OptimizationPass::kIntrinsicsRecognizer: - opt = new (allocator) IntrinsicsRecognizer(graph, stats, name); + opt = new (allocator) IntrinsicsRecognizer(graph, stats, pass_name); break; case OptimizationPass::kCHAGuardOptimization: - opt = new (allocator) CHAGuardOptimization(graph, name); + opt = new (allocator) CHAGuardOptimization(graph, pass_name); break; case OptimizationPass::kCodeSinking: - opt = new (allocator) CodeSinking(graph, stats, name); + opt = new (allocator) CodeSinking(graph, stats, pass_name); break; case OptimizationPass::kConstructorFenceRedundancyElimination: - opt = new (allocator) ConstructorFenceRedundancyElimination(graph, stats, name); + opt = new (allocator) ConstructorFenceRedundancyElimination(graph, stats, pass_name); break; case OptimizationPass::kScheduling: opt = new (allocator) HInstructionScheduling( - graph, driver->GetInstructionSet(), codegen, name); + graph, driver->GetInstructionSet(), codegen, pass_name); break; // // Arch-specific passes. @@ -319,11 +323,14 @@ ArenaVector<HOptimization*> ConstructOptimizations( opt = new (allocator) x86::X86MemoryOperandGeneration(graph, codegen, stats); break; #endif + case OptimizationPass::kNone: + LOG(FATAL) << "kNone does not represent an actual pass"; + UNREACHABLE(); } // switch // Add each next optimization to result vector. CHECK(opt != nullptr); - DCHECK_STREQ(name, opt->GetPassName()); // sanity + DCHECK_STREQ(pass_name, opt->GetPassName()); // sanity optimizations.push_back(opt); } diff --git a/compiler/optimizing/optimization.h b/compiler/optimizing/optimization.h index c170f155fa..88b283cebf 100644 --- a/compiler/optimizing/optimization.h +++ b/compiler/optimizing/optimization.h @@ -47,8 +47,9 @@ class HOptimization : public ArenaObject<kArenaAllocOptimization> { // 'instruction_simplifier$before_codegen'. const char* GetPassName() const { return pass_name_; } - // Perform the analysis itself. - virtual void Run() = 0; + // Perform the pass or analysis. Returns false if no optimizations occurred or no useful + // information was computed (this is best effort, returning true is always ok). + virtual bool Run() = 0; protected: HGraph* const graph_; @@ -101,21 +102,32 @@ enum class OptimizationPass { #if defined(ART_ENABLE_CODEGEN_x86) || defined(ART_ENABLE_CODEGEN_x86_64) kX86MemoryOperandGeneration, #endif + kNone, + kLast = kNone }; // Lookup name of optimization pass. const char* OptimizationPassName(OptimizationPass pass); // Lookup optimization pass by name. -OptimizationPass OptimizationPassByName(const std::string& name); +OptimizationPass OptimizationPassByName(const std::string& pass_name); // Optimization definition consisting of an optimization pass -// and an optional alternative name (nullptr denotes default). -typedef std::pair<OptimizationPass, const char*> OptimizationDef; +// an optional alternative name (nullptr denotes default), and +// an optional pass dependence (kNone denotes no dependence). +struct OptimizationDef { + OptimizationDef(OptimizationPass p, const char* pn, OptimizationPass d) + : pass(p), pass_name(pn), depends_on(d) {} + OptimizationPass pass; + const char* pass_name; + OptimizationPass depends_on; +}; // Helper method for optimization definition array entries. -inline OptimizationDef OptDef(OptimizationPass pass, const char* name = nullptr) { - return std::make_pair(pass, name); +inline OptimizationDef OptDef(OptimizationPass pass, + const char* pass_name = nullptr, + OptimizationPass depends_on = OptimizationPass::kNone) { + return OptimizationDef(pass, pass_name, depends_on); } // Helper method to construct series of optimization passes. diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc index cadefc3b01..a6163a7fcf 100644 --- a/compiler/optimizing/optimizing_compiler.cc +++ b/compiler/optimizing/optimizing_compiler.cc @@ -294,7 +294,7 @@ class OptimizingCompiler FINAL : public Compiler { REQUIRES_SHARED(Locks::mutator_lock_); private: - void RunOptimizations(HGraph* graph, + bool RunOptimizations(HGraph* graph, CodeGenerator* codegen, const DexCompilationUnit& dex_compilation_unit, PassObserver* pass_observer, @@ -313,21 +313,34 @@ class OptimizingCompiler FINAL : public Compiler { dex_compilation_unit, handles); DCHECK_EQ(length, optimizations.size()); - // Run the optimization passes one by one. + // Run the optimization passes one by one. Any "depends_on" pass refers back to + // the most recent occurrence of that pass, skipped or executed. + std::bitset<static_cast<size_t>(OptimizationPass::kLast) + 1u> pass_changes; + pass_changes[static_cast<size_t>(OptimizationPass::kNone)] = true; + bool change = false; for (size_t i = 0; i < length; ++i) { - PassScope scope(optimizations[i]->GetPassName(), pass_observer); - optimizations[i]->Run(); + if (pass_changes[static_cast<size_t>(definitions[i].depends_on)]) { + // Execute the pass and record whether it changed anything. + PassScope scope(optimizations[i]->GetPassName(), pass_observer); + bool pass_change = optimizations[i]->Run(); + pass_changes[static_cast<size_t>(definitions[i].pass)] = pass_change; + change |= pass_change; + } else { + // Skip the pass and record that nothing changed. + pass_changes[static_cast<size_t>(definitions[i].pass)] = false; + } } + return change; } - template <size_t length> void RunOptimizations( + template <size_t length> bool RunOptimizations( HGraph* graph, CodeGenerator* codegen, const DexCompilationUnit& dex_compilation_unit, PassObserver* pass_observer, VariableSizedHandleScope* handles, const OptimizationDef (&definitions)[length]) const { - RunOptimizations( + return RunOptimizations( graph, codegen, dex_compilation_unit, pass_observer, handles, definitions, length); } @@ -366,13 +379,7 @@ class OptimizingCompiler FINAL : public Compiler { ArtMethod* method, VariableSizedHandleScope* handles) const; - void MaybeRunInliner(HGraph* graph, - CodeGenerator* codegen, - const DexCompilationUnit& dex_compilation_unit, - PassObserver* pass_observer, - VariableSizedHandleScope* handles) const; - - void RunArchOptimizations(HGraph* graph, + bool RunArchOptimizations(HGraph* graph, CodeGenerator* codegen, const DexCompilationUnit& dex_compilation_unit, PassObserver* pass_observer, @@ -435,28 +442,7 @@ static bool IsInstructionSetSupported(InstructionSet instruction_set) { || instruction_set == InstructionSet::kX86_64; } -void OptimizingCompiler::MaybeRunInliner(HGraph* graph, - CodeGenerator* codegen, - const DexCompilationUnit& dex_compilation_unit, - PassObserver* pass_observer, - VariableSizedHandleScope* handles) const { - const CompilerOptions& compiler_options = GetCompilerDriver()->GetCompilerOptions(); - bool should_inline = (compiler_options.GetInlineMaxCodeUnits() > 0); - if (!should_inline) { - return; - } - OptimizationDef optimizations[] = { - OptDef(OptimizationPass::kInliner) - }; - RunOptimizations(graph, - codegen, - dex_compilation_unit, - pass_observer, - handles, - optimizations); -} - -void OptimizingCompiler::RunArchOptimizations(HGraph* graph, +bool OptimizingCompiler::RunArchOptimizations(HGraph* graph, CodeGenerator* codegen, const DexCompilationUnit& dex_compilation_unit, PassObserver* pass_observer, @@ -471,13 +457,12 @@ void OptimizingCompiler::RunArchOptimizations(HGraph* graph, OptDef(OptimizationPass::kGlobalValueNumbering, "GVN$after_arch"), OptDef(OptimizationPass::kScheduling) }; - RunOptimizations(graph, - codegen, - dex_compilation_unit, - pass_observer, - handles, - arm_optimizations); - break; + return RunOptimizations(graph, + codegen, + dex_compilation_unit, + pass_observer, + handles, + arm_optimizations); } #endif #ifdef ART_ENABLE_CODEGEN_arm64 @@ -488,13 +473,12 @@ void OptimizingCompiler::RunArchOptimizations(HGraph* graph, OptDef(OptimizationPass::kGlobalValueNumbering, "GVN$after_arch"), OptDef(OptimizationPass::kScheduling) }; - RunOptimizations(graph, - codegen, - dex_compilation_unit, - pass_observer, - handles, - arm64_optimizations); - break; + return RunOptimizations(graph, + codegen, + dex_compilation_unit, + pass_observer, + handles, + arm64_optimizations); } #endif #ifdef ART_ENABLE_CODEGEN_mips @@ -505,13 +489,12 @@ void OptimizingCompiler::RunArchOptimizations(HGraph* graph, OptDef(OptimizationPass::kGlobalValueNumbering, "GVN$after_arch"), OptDef(OptimizationPass::kPcRelativeFixupsMips) }; - RunOptimizations(graph, - codegen, - dex_compilation_unit, - pass_observer, - handles, - mips_optimizations); - break; + return RunOptimizations(graph, + codegen, + dex_compilation_unit, + pass_observer, + handles, + mips_optimizations); } #endif #ifdef ART_ENABLE_CODEGEN_mips64 @@ -520,13 +503,12 @@ void OptimizingCompiler::RunArchOptimizations(HGraph* graph, OptDef(OptimizationPass::kSideEffectsAnalysis), OptDef(OptimizationPass::kGlobalValueNumbering, "GVN$after_arch") }; - RunOptimizations(graph, - codegen, - dex_compilation_unit, - pass_observer, - handles, - mips64_optimizations); - break; + return RunOptimizations(graph, + codegen, + dex_compilation_unit, + pass_observer, + handles, + mips64_optimizations); } #endif #ifdef ART_ENABLE_CODEGEN_x86 @@ -537,13 +519,12 @@ void OptimizingCompiler::RunArchOptimizations(HGraph* graph, OptDef(OptimizationPass::kPcRelativeFixupsX86), OptDef(OptimizationPass::kX86MemoryOperandGeneration) }; - RunOptimizations(graph, - codegen, - dex_compilation_unit, - pass_observer, - handles, - x86_optimizations); - break; + return RunOptimizations(graph, + codegen, + dex_compilation_unit, + pass_observer, + handles, + x86_optimizations); } #endif #ifdef ART_ENABLE_CODEGEN_x86_64 @@ -553,17 +534,16 @@ void OptimizingCompiler::RunArchOptimizations(HGraph* graph, OptDef(OptimizationPass::kGlobalValueNumbering, "GVN$after_arch"), OptDef(OptimizationPass::kX86MemoryOperandGeneration) }; - RunOptimizations(graph, - codegen, - dex_compilation_unit, - pass_observer, - handles, - x86_64_optimizations); - break; + return RunOptimizations(graph, + codegen, + dex_compilation_unit, + pass_observer, + handles, + x86_64_optimizations); } #endif default: - break; + return false; } } @@ -610,6 +590,7 @@ void OptimizingCompiler::RunOptimizations(HGraph* graph, if (pass_names != nullptr) { // If passes were defined on command-line, build the optimization // passes and run these instead of the built-in optimizations. + // TODO: a way to define depends_on via command-line? const size_t length = pass_names->size(); std::vector<OptimizationDef> optimizations; for (const std::string& pass_name : *pass_names) { @@ -626,47 +607,64 @@ void OptimizingCompiler::RunOptimizations(HGraph* graph, return; } - OptimizationDef optimizations1[] = { + OptimizationDef optimizations[] = { + // Initial optimizations. OptDef(OptimizationPass::kIntrinsicsRecognizer), OptDef(OptimizationPass::kSharpening), OptDef(OptimizationPass::kConstantFolding), OptDef(OptimizationPass::kInstructionSimplifier), - OptDef(OptimizationPass::kDeadCodeElimination, "dead_code_elimination$initial") - }; - RunOptimizations(graph, - codegen, - dex_compilation_unit, - pass_observer, - handles, - optimizations1); - - MaybeRunInliner(graph, codegen, dex_compilation_unit, pass_observer, handles); - - OptimizationDef optimizations2[] = { - OptDef(OptimizationPass::kSideEffectsAnalysis, "side_effects$before_gvn"), + OptDef(OptimizationPass::kDeadCodeElimination, + "dead_code_elimination$initial"), + // Inlining. + OptDef(OptimizationPass::kInliner), + // Simplification (only if inlining occurred). + OptDef(OptimizationPass::kConstantFolding, + "constant_folding$after_inlining", + OptimizationPass::kInliner), + OptDef(OptimizationPass::kInstructionSimplifier, + "instruction_simplifier$after_inlining", + OptimizationPass::kInliner), + OptDef(OptimizationPass::kDeadCodeElimination, + "dead_code_elimination$after_inlining", + OptimizationPass::kInliner), + // GVN. + OptDef(OptimizationPass::kSideEffectsAnalysis, + "side_effects$before_gvn"), OptDef(OptimizationPass::kGlobalValueNumbering), + // Simplification (TODO: only if GVN occurred). OptDef(OptimizationPass::kSelectGenerator), - OptDef(OptimizationPass::kConstantFolding, "constant_folding$after_inlining"), - OptDef(OptimizationPass::kInstructionSimplifier, "instruction_simplifier$after_inlining"), - OptDef(OptimizationPass::kDeadCodeElimination, "dead_code_elimination$after_inlining"), - OptDef(OptimizationPass::kSideEffectsAnalysis, "side_effects$before_licm"), + OptDef(OptimizationPass::kConstantFolding, + "constant_folding$after_gvn"), + OptDef(OptimizationPass::kInstructionSimplifier, + "instruction_simplifier$after_gvn"), + OptDef(OptimizationPass::kDeadCodeElimination, + "dead_code_elimination$after_gvn"), + // High-level optimizations. + OptDef(OptimizationPass::kSideEffectsAnalysis, + "side_effects$before_licm"), OptDef(OptimizationPass::kInvariantCodeMotion), OptDef(OptimizationPass::kInductionVarAnalysis), OptDef(OptimizationPass::kBoundsCheckElimination), OptDef(OptimizationPass::kLoopOptimization), - // Evaluates code generated by dynamic bce. - OptDef(OptimizationPass::kConstantFolding, "constant_folding$after_bce"), - OptDef(OptimizationPass::kInstructionSimplifier, "instruction_simplifier$after_bce"), - OptDef(OptimizationPass::kSideEffectsAnalysis, "side_effects$before_lse"), + // Simplification. + OptDef(OptimizationPass::kConstantFolding, + "constant_folding$after_bce"), + OptDef(OptimizationPass::kInstructionSimplifier, + "instruction_simplifier$after_bce"), + // Other high-level optimizations. + OptDef(OptimizationPass::kSideEffectsAnalysis, + "side_effects$before_lse"), OptDef(OptimizationPass::kLoadStoreAnalysis), OptDef(OptimizationPass::kLoadStoreElimination), OptDef(OptimizationPass::kCHAGuardOptimization), - OptDef(OptimizationPass::kDeadCodeElimination, "dead_code_elimination$final"), + OptDef(OptimizationPass::kDeadCodeElimination, + "dead_code_elimination$final"), OptDef(OptimizationPass::kCodeSinking), // 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. - OptDef(OptimizationPass::kInstructionSimplifier, "instruction_simplifier$before_codegen"), + OptDef(OptimizationPass::kInstructionSimplifier, + "instruction_simplifier$before_codegen"), // Eliminate constructor fences after code sinking to avoid // complicated sinking logic to split a fence with many inputs. OptDef(OptimizationPass::kConstructorFenceRedundancyElimination) @@ -676,7 +674,7 @@ void OptimizingCompiler::RunOptimizations(HGraph* graph, dex_compilation_unit, pass_observer, handles, - optimizations2); + optimizations); RunArchOptimizations(graph, codegen, dex_compilation_unit, pass_observer, handles); } diff --git a/compiler/optimizing/optimizing_compiler.h b/compiler/optimizing/optimizing_compiler.h index d8cea30a6b..6ee9c70fdb 100644 --- a/compiler/optimizing/optimizing_compiler.h +++ b/compiler/optimizing/optimizing_compiler.h @@ -17,8 +17,8 @@ #ifndef ART_COMPILER_OPTIMIZING_OPTIMIZING_COMPILER_H_ #define ART_COMPILER_OPTIMIZING_OPTIMIZING_COMPILER_H_ +#include "base/globals.h" #include "base/mutex.h" -#include "globals.h" namespace art { diff --git a/compiler/optimizing/pc_relative_fixups_mips.cc b/compiler/optimizing/pc_relative_fixups_mips.cc index 0102254206..f18ecc1458 100644 --- a/compiler/optimizing/pc_relative_fixups_mips.cc +++ b/compiler/optimizing/pc_relative_fixups_mips.cc @@ -128,20 +128,21 @@ class PCRelativeHandlerVisitor : public HGraphVisitor { HMipsComputeBaseMethodAddress* base_; }; -void PcRelativeFixups::Run() { +bool PcRelativeFixups::Run() { CodeGeneratorMIPS* mips_codegen = down_cast<CodeGeneratorMIPS*>(codegen_); if (mips_codegen->GetInstructionSetFeatures().IsR6()) { // Do nothing for R6 because it has PC-relative addressing. - return; + return false; } if (graph_->HasIrreducibleLoops()) { // Do not run this optimization, as irreducible loops do not work with an instruction // that can be live-in at the irreducible loop header. - return; + return false; } PCRelativeHandlerVisitor visitor(graph_, codegen_); visitor.VisitInsertionOrder(); visitor.MoveBaseIfNeeded(); + return true; } } // namespace mips diff --git a/compiler/optimizing/pc_relative_fixups_mips.h b/compiler/optimizing/pc_relative_fixups_mips.h index ec2c711f8d..6dd1ee0db2 100644 --- a/compiler/optimizing/pc_relative_fixups_mips.h +++ b/compiler/optimizing/pc_relative_fixups_mips.h @@ -34,7 +34,7 @@ class PcRelativeFixups : public HOptimization { static constexpr const char* kPcRelativeFixupsMipsPassName = "pc_relative_fixups_mips"; - void Run() OVERRIDE; + bool Run() OVERRIDE; private: CodeGenerator* codegen_; diff --git a/compiler/optimizing/pc_relative_fixups_x86.cc b/compiler/optimizing/pc_relative_fixups_x86.cc index 647336b6b9..9049457da5 100644 --- a/compiler/optimizing/pc_relative_fixups_x86.cc +++ b/compiler/optimizing/pc_relative_fixups_x86.cc @@ -256,10 +256,11 @@ class PCRelativeHandlerVisitor : public HGraphVisitor { HX86ComputeBaseMethodAddress* base_; }; -void PcRelativeFixups::Run() { +bool PcRelativeFixups::Run() { PCRelativeHandlerVisitor visitor(graph_, codegen_); visitor.VisitInsertionOrder(); visitor.MoveBaseIfNeeded(); + return true; } } // namespace x86 diff --git a/compiler/optimizing/pc_relative_fixups_x86.h b/compiler/optimizing/pc_relative_fixups_x86.h index 72fa71ea94..db56b7f053 100644 --- a/compiler/optimizing/pc_relative_fixups_x86.h +++ b/compiler/optimizing/pc_relative_fixups_x86.h @@ -34,7 +34,7 @@ class PcRelativeFixups : public HOptimization { static constexpr const char* kPcRelativeFixupsX86PassName = "pc_relative_fixups_x86"; - void Run() OVERRIDE; + bool Run() OVERRIDE; private: CodeGenerator* codegen_; diff --git a/compiler/optimizing/reference_type_propagation.cc b/compiler/optimizing/reference_type_propagation.cc index 4030883a57..c47c69af67 100644 --- a/compiler/optimizing/reference_type_propagation.cc +++ b/compiler/optimizing/reference_type_propagation.cc @@ -348,7 +348,7 @@ static void BoundTypeForClassCheck(HInstruction* check) { } } -void ReferenceTypePropagation::Run() { +bool ReferenceTypePropagation::Run() { RTPVisitor visitor(graph_, class_loader_, hint_dex_cache_, &handle_cache_, is_first_run_); // To properly propagate type info we need to visit in the dominator-based order. @@ -360,6 +360,7 @@ void ReferenceTypePropagation::Run() { visitor.ProcessWorklist(); ValidateTypes(); + return true; } void ReferenceTypePropagation::RTPVisitor::VisitBasicBlock(HBasicBlock* block) { diff --git a/compiler/optimizing/reference_type_propagation.h b/compiler/optimizing/reference_type_propagation.h index fd4dad2b45..400852f4dc 100644 --- a/compiler/optimizing/reference_type_propagation.h +++ b/compiler/optimizing/reference_type_propagation.h @@ -40,7 +40,7 @@ class ReferenceTypePropagation : public HOptimization { // Visit a single instruction. void Visit(HInstruction* instruction); - void Run() OVERRIDE; + bool Run() OVERRIDE; // Returns true if klass is admissible to the propagation: non-null and resolved. // For an array type, we also check if the component type is admissible. diff --git a/compiler/optimizing/scheduler.cc b/compiler/optimizing/scheduler.cc index bca538fb17..e014efaf5c 100644 --- a/compiler/optimizing/scheduler.cc +++ b/compiler/optimizing/scheduler.cc @@ -774,7 +774,7 @@ bool HScheduler::IsSchedulingBarrier(const HInstruction* instr) const { instr->IsSuspendCheck(); } -void HInstructionScheduling::Run(bool only_optimize_loop_blocks, +bool HInstructionScheduling::Run(bool only_optimize_loop_blocks, bool schedule_randomly) { #if defined(ART_ENABLE_CODEGEN_arm64) || defined(ART_ENABLE_CODEGEN_arm) // Phase-local allocator that allocates scheduler internal data structures like @@ -814,6 +814,7 @@ void HInstructionScheduling::Run(bool only_optimize_loop_blocks, default: break; } + return true; } } // namespace art diff --git a/compiler/optimizing/scheduler.h b/compiler/optimizing/scheduler.h index dfa077f7de..51cd20aea9 100644 --- a/compiler/optimizing/scheduler.h +++ b/compiler/optimizing/scheduler.h @@ -508,10 +508,11 @@ class HInstructionScheduling : public HOptimization { codegen_(cg), instruction_set_(instruction_set) {} - void Run() { - Run(/*only_optimize_loop_blocks*/ true, /*schedule_randomly*/ false); + bool Run() OVERRIDE { + return Run(/*only_optimize_loop_blocks*/ true, /*schedule_randomly*/ false); } - void Run(bool only_optimize_loop_blocks, bool schedule_randomly); + + bool Run(bool only_optimize_loop_blocks, bool schedule_randomly); static constexpr const char* kInstructionSchedulingPassName = "scheduler"; diff --git a/compiler/optimizing/select_generator.cc b/compiler/optimizing/select_generator.cc index f9acf5aa9a..0d0f7cc748 100644 --- a/compiler/optimizing/select_generator.cc +++ b/compiler/optimizing/select_generator.cc @@ -90,7 +90,8 @@ static HPhi* GetSingleChangedPhi(HBasicBlock* block, size_t index1, size_t index return select_phi; } -void HSelectGenerator::Run() { +bool HSelectGenerator::Run() { + bool didSelect = false; // Select cache with local allocator. ScopedArenaAllocator allocator(graph_->GetArenaStack()); ScopedArenaSafeMap<HInstruction*, HSelect*> cache( @@ -211,7 +212,9 @@ void HSelectGenerator::Run() { // entry block. Any following blocks would have had the join block // as a dominator, and `MergeWith` handles changing that to the // entry block. + didSelect = true; } + return didSelect; } } // namespace art diff --git a/compiler/optimizing/select_generator.h b/compiler/optimizing/select_generator.h index bda57fd5c8..d24d2264b2 100644 --- a/compiler/optimizing/select_generator.h +++ b/compiler/optimizing/select_generator.h @@ -68,7 +68,7 @@ class HSelectGenerator : public HOptimization { OptimizingCompilerStats* stats, const char* name = kSelectGeneratorPassName); - void Run() OVERRIDE; + bool Run() OVERRIDE; static constexpr const char* kSelectGeneratorPassName = "select_generator"; diff --git a/compiler/optimizing/sharpening.cc b/compiler/optimizing/sharpening.cc index 70b45763af..6541043046 100644 --- a/compiler/optimizing/sharpening.cc +++ b/compiler/optimizing/sharpening.cc @@ -36,7 +36,7 @@ namespace art { -void HSharpening::Run() { +bool HSharpening::Run() { // We don't care about the order of the blocks here. for (HBasicBlock* block : graph_->GetReversePostOrder()) { for (HInstructionIterator it(block->GetInstructions()); !it.Done(); it.Advance()) { @@ -51,6 +51,7 @@ void HSharpening::Run() { // because we know the type better when inlining. } } + return true; } static bool IsInBootImage(ArtMethod* method) { diff --git a/compiler/optimizing/sharpening.h b/compiler/optimizing/sharpening.h index fa3e948eeb..9ccbcaf220 100644 --- a/compiler/optimizing/sharpening.h +++ b/compiler/optimizing/sharpening.h @@ -40,7 +40,7 @@ class HSharpening : public HOptimization { codegen_(codegen), compiler_driver_(compiler_driver) { } - void Run() OVERRIDE; + bool Run() OVERRIDE; static constexpr const char* kSharpeningPassName = "sharpening"; diff --git a/compiler/optimizing/side_effects_analysis.cc b/compiler/optimizing/side_effects_analysis.cc index 6d82e8e06d..ba97b43de9 100644 --- a/compiler/optimizing/side_effects_analysis.cc +++ b/compiler/optimizing/side_effects_analysis.cc @@ -18,7 +18,7 @@ namespace art { -void SideEffectsAnalysis::Run() { +bool SideEffectsAnalysis::Run() { // Inlining might have created more blocks, so we need to increase the size // if needed. block_effects_.resize(graph_->GetBlocks().size()); @@ -69,6 +69,7 @@ void SideEffectsAnalysis::Run() { } } has_run_ = true; + return true; } SideEffects SideEffectsAnalysis::GetLoopEffects(HBasicBlock* block) const { diff --git a/compiler/optimizing/side_effects_analysis.h b/compiler/optimizing/side_effects_analysis.h index c0f81a9c54..56a01e63f1 100644 --- a/compiler/optimizing/side_effects_analysis.h +++ b/compiler/optimizing/side_effects_analysis.h @@ -37,7 +37,7 @@ class SideEffectsAnalysis : public HOptimization { SideEffects GetBlockEffects(HBasicBlock* block) const; // Compute side effects of individual blocks and loops. - void Run(); + bool Run(); bool HasRun() const { return has_run_; } diff --git a/compiler/optimizing/ssa_phi_elimination.cc b/compiler/optimizing/ssa_phi_elimination.cc index cb27ded17a..5370f43b4f 100644 --- a/compiler/optimizing/ssa_phi_elimination.cc +++ b/compiler/optimizing/ssa_phi_elimination.cc @@ -23,9 +23,10 @@ namespace art { -void SsaDeadPhiElimination::Run() { +bool SsaDeadPhiElimination::Run() { MarkDeadPhis(); EliminateDeadPhis(); + return true; } void SsaDeadPhiElimination::MarkDeadPhis() { @@ -122,7 +123,7 @@ void SsaDeadPhiElimination::EliminateDeadPhis() { } } -void SsaRedundantPhiElimination::Run() { +bool SsaRedundantPhiElimination::Run() { // Use local allocator for allocating memory used by this optimization. ScopedArenaAllocator allocator(graph_->GetArenaStack()); @@ -255,6 +256,7 @@ void SsaRedundantPhiElimination::Run() { current->GetBlock()->RemovePhi(current); } } + return true; } } // namespace art diff --git a/compiler/optimizing/ssa_phi_elimination.h b/compiler/optimizing/ssa_phi_elimination.h index 11d5837eb5..ee859e834c 100644 --- a/compiler/optimizing/ssa_phi_elimination.h +++ b/compiler/optimizing/ssa_phi_elimination.h @@ -31,7 +31,7 @@ class SsaDeadPhiElimination : public HOptimization { explicit SsaDeadPhiElimination(HGraph* graph) : HOptimization(graph, kSsaDeadPhiEliminationPassName) {} - void Run() OVERRIDE; + bool Run() OVERRIDE; void MarkDeadPhis(); void EliminateDeadPhis(); @@ -53,7 +53,7 @@ class SsaRedundantPhiElimination : public HOptimization { explicit SsaRedundantPhiElimination(HGraph* graph) : HOptimization(graph, kSsaRedundantPhiEliminationPassName) {} - void Run() OVERRIDE; + bool Run() OVERRIDE; static constexpr const char* kSsaRedundantPhiEliminationPassName = "redundant_phi_elimination"; diff --git a/compiler/optimizing/x86_memory_gen.cc b/compiler/optimizing/x86_memory_gen.cc index 0271850f29..f0069c0e09 100644 --- a/compiler/optimizing/x86_memory_gen.cc +++ b/compiler/optimizing/x86_memory_gen.cc @@ -76,9 +76,10 @@ X86MemoryOperandGeneration::X86MemoryOperandGeneration(HGraph* graph, do_implicit_null_checks_(codegen->GetCompilerOptions().GetImplicitNullChecks()) { } -void X86MemoryOperandGeneration::Run() { +bool X86MemoryOperandGeneration::Run() { MemoryOperandVisitor visitor(graph_, do_implicit_null_checks_); visitor.VisitInsertionOrder(); + return true; } } // namespace x86 diff --git a/compiler/optimizing/x86_memory_gen.h b/compiler/optimizing/x86_memory_gen.h index 5f15d9f1e6..b254000f28 100644 --- a/compiler/optimizing/x86_memory_gen.h +++ b/compiler/optimizing/x86_memory_gen.h @@ -31,7 +31,7 @@ class X86MemoryOperandGeneration : public HOptimization { CodeGenerator* codegen, OptimizingCompilerStats* stats); - void Run() OVERRIDE; + bool Run() OVERRIDE; static constexpr const char* kX86MemoryOperandGenerationPassName = "x86_memory_operand_generation"; diff --git a/compiler/utils/arm/constants_arm.h b/compiler/utils/arm/constants_arm.h index 66252bed86..3e316c8e84 100644 --- a/compiler/utils/arm/constants_arm.h +++ b/compiler/utils/arm/constants_arm.h @@ -25,7 +25,7 @@ #include "arch/arm/registers_arm.h" #include "base/casts.h" -#include "globals.h" +#include "base/globals.h" namespace art { namespace arm { diff --git a/compiler/utils/arm/managed_register_arm.cc b/compiler/utils/arm/managed_register_arm.cc index 1fdc110dcf..deff658b4f 100644 --- a/compiler/utils/arm/managed_register_arm.cc +++ b/compiler/utils/arm/managed_register_arm.cc @@ -16,7 +16,7 @@ #include "managed_register_arm.h" -#include "globals.h" +#include "base/globals.h" namespace art { namespace arm { diff --git a/compiler/utils/arm/managed_register_arm_test.cc b/compiler/utils/arm/managed_register_arm_test.cc index 43b0b516dc..6f440a7c81 100644 --- a/compiler/utils/arm/managed_register_arm_test.cc +++ b/compiler/utils/arm/managed_register_arm_test.cc @@ -15,7 +15,7 @@ */ #include "managed_register_arm.h" -#include "globals.h" +#include "base/globals.h" #include "gtest/gtest.h" namespace art { diff --git a/compiler/utils/arm64/managed_register_arm64.cc b/compiler/utils/arm64/managed_register_arm64.cc index 47924bf99f..5632265646 100644 --- a/compiler/utils/arm64/managed_register_arm64.cc +++ b/compiler/utils/arm64/managed_register_arm64.cc @@ -15,7 +15,7 @@ */ #include "managed_register_arm64.h" -#include "globals.h" +#include "base/globals.h" namespace art { namespace arm64 { diff --git a/compiler/utils/arm64/managed_register_arm64_test.cc b/compiler/utils/arm64/managed_register_arm64_test.cc index 2a79313be5..d151ac99e7 100644 --- a/compiler/utils/arm64/managed_register_arm64_test.cc +++ b/compiler/utils/arm64/managed_register_arm64_test.cc @@ -17,7 +17,7 @@ #include "managed_register_arm64.h" #include "assembler_arm64.h" -#include "globals.h" +#include "base/globals.h" #include "gtest/gtest.h" namespace art { diff --git a/compiler/utils/assembler.cc b/compiler/utils/assembler.cc index 421c1b6089..d1d2a3d556 100644 --- a/compiler/utils/assembler.cc +++ b/compiler/utils/assembler.cc @@ -20,8 +20,8 @@ #include <vector> #include "base/casts.h" +#include "base/globals.h" #include "base/memory_region.h" -#include "globals.h" namespace art { diff --git a/compiler/utils/jni_macro_assembler.cc b/compiler/utils/jni_macro_assembler.cc index 0c34aa4f1d..5f405f348c 100644 --- a/compiler/utils/jni_macro_assembler.cc +++ b/compiler/utils/jni_macro_assembler.cc @@ -38,8 +38,8 @@ #include "x86_64/jni_macro_assembler_x86_64.h" #endif #include "base/casts.h" +#include "base/globals.h" #include "base/memory_region.h" -#include "globals.h" namespace art { diff --git a/compiler/utils/mips/assembler_mips.h b/compiler/utils/mips/assembler_mips.h index c6ce62b4f4..af3d7a06ba 100644 --- a/compiler/utils/mips/assembler_mips.h +++ b/compiler/utils/mips/assembler_mips.h @@ -24,10 +24,10 @@ #include "arch/mips/instruction_set_features_mips.h" #include "base/arena_containers.h" #include "base/enums.h" +#include "base/globals.h" #include "base/macros.h" #include "base/stl_util_identity.h" #include "constants_mips.h" -#include "globals.h" #include "heap_poisoning.h" #include "managed_register_mips.h" #include "offsets.h" diff --git a/compiler/utils/mips/constants_mips.h b/compiler/utils/mips/constants_mips.h index 016c0dbb2e..07d8b7de0e 100644 --- a/compiler/utils/mips/constants_mips.h +++ b/compiler/utils/mips/constants_mips.h @@ -22,8 +22,8 @@ #include <android-base/logging.h> #include "arch/mips/registers_mips.h" +#include "base/globals.h" #include "base/macros.h" -#include "globals.h" namespace art { namespace mips { diff --git a/compiler/utils/mips/managed_register_mips.cc b/compiler/utils/mips/managed_register_mips.cc index 5a8c0481a5..9b3ed79d2f 100644 --- a/compiler/utils/mips/managed_register_mips.cc +++ b/compiler/utils/mips/managed_register_mips.cc @@ -16,7 +16,7 @@ #include "managed_register_mips.h" -#include "globals.h" +#include "base/globals.h" namespace art { namespace mips { diff --git a/compiler/utils/mips64/assembler_mips64.h b/compiler/utils/mips64/assembler_mips64.h index 542dbafc87..19f23b7e95 100644 --- a/compiler/utils/mips64/assembler_mips64.h +++ b/compiler/utils/mips64/assembler_mips64.h @@ -24,10 +24,10 @@ #include "arch/mips64/instruction_set_features_mips64.h" #include "base/arena_containers.h" #include "base/enums.h" +#include "base/globals.h" #include "base/macros.h" #include "base/stl_util_identity.h" #include "constants_mips64.h" -#include "globals.h" #include "heap_poisoning.h" #include "managed_register_mips64.h" #include "offsets.h" diff --git a/compiler/utils/mips64/constants_mips64.h b/compiler/utils/mips64/constants_mips64.h index 310f23c287..41eb77c9ae 100644 --- a/compiler/utils/mips64/constants_mips64.h +++ b/compiler/utils/mips64/constants_mips64.h @@ -22,8 +22,8 @@ #include <android-base/logging.h> #include "arch/mips64/registers_mips64.h" +#include "base/globals.h" #include "base/macros.h" -#include "globals.h" namespace art { namespace mips64 { diff --git a/compiler/utils/mips64/managed_register_mips64.cc b/compiler/utils/mips64/managed_register_mips64.cc index 42d061ec15..01cb6ddfe2 100644 --- a/compiler/utils/mips64/managed_register_mips64.cc +++ b/compiler/utils/mips64/managed_register_mips64.cc @@ -16,7 +16,7 @@ #include "managed_register_mips64.h" -#include "globals.h" +#include "base/globals.h" namespace art { namespace mips64 { diff --git a/compiler/utils/mips64/managed_register_mips64_test.cc b/compiler/utils/mips64/managed_register_mips64_test.cc index 8b72d7e61d..bbfeeee20f 100644 --- a/compiler/utils/mips64/managed_register_mips64_test.cc +++ b/compiler/utils/mips64/managed_register_mips64_test.cc @@ -15,7 +15,8 @@ */ #include "managed_register_mips64.h" -#include "globals.h" + +#include "base/globals.h" #include "gtest/gtest.h" namespace art { diff --git a/compiler/utils/x86/assembler_x86.h b/compiler/utils/x86/assembler_x86.h index 22eaedce61..e42c4c986a 100644 --- a/compiler/utils/x86/assembler_x86.h +++ b/compiler/utils/x86/assembler_x86.h @@ -23,9 +23,9 @@ #include "base/array_ref.h" #include "base/bit_utils.h" #include "base/enums.h" +#include "base/globals.h" #include "base/macros.h" #include "constants_x86.h" -#include "globals.h" #include "heap_poisoning.h" #include "managed_register_x86.h" #include "offsets.h" diff --git a/compiler/utils/x86/constants_x86.h b/compiler/utils/x86/constants_x86.h index 2e03b9fc3c..73ef028075 100644 --- a/compiler/utils/x86/constants_x86.h +++ b/compiler/utils/x86/constants_x86.h @@ -22,8 +22,8 @@ #include <android-base/logging.h> #include "arch/x86/registers_x86.h" +#include "base/globals.h" #include "base/macros.h" -#include "globals.h" namespace art { namespace x86 { diff --git a/compiler/utils/x86/managed_register_x86.cc b/compiler/utils/x86/managed_register_x86.cc index 69e6fce5c4..cc7cedf93e 100644 --- a/compiler/utils/x86/managed_register_x86.cc +++ b/compiler/utils/x86/managed_register_x86.cc @@ -16,7 +16,7 @@ #include "managed_register_x86.h" -#include "globals.h" +#include "base/globals.h" namespace art { namespace x86 { diff --git a/compiler/utils/x86/managed_register_x86_test.cc b/compiler/utils/x86/managed_register_x86_test.cc index 0ed5c36fe4..28af5313c7 100644 --- a/compiler/utils/x86/managed_register_x86_test.cc +++ b/compiler/utils/x86/managed_register_x86_test.cc @@ -16,7 +16,7 @@ #include "managed_register_x86.h" -#include "globals.h" +#include "base/globals.h" #include "gtest/gtest.h" namespace art { diff --git a/compiler/utils/x86_64/assembler_x86_64.h b/compiler/utils/x86_64/assembler_x86_64.h index ab761fb1fc..e4d72a7ba2 100644 --- a/compiler/utils/x86_64/assembler_x86_64.h +++ b/compiler/utils/x86_64/assembler_x86_64.h @@ -22,9 +22,9 @@ #include "base/arena_containers.h" #include "base/array_ref.h" #include "base/bit_utils.h" +#include "base/globals.h" #include "base/macros.h" #include "constants_x86_64.h" -#include "globals.h" #include "heap_poisoning.h" #include "managed_register_x86_64.h" #include "offsets.h" diff --git a/compiler/utils/x86_64/constants_x86_64.h b/compiler/utils/x86_64/constants_x86_64.h index 2af3e7be16..b02e246842 100644 --- a/compiler/utils/x86_64/constants_x86_64.h +++ b/compiler/utils/x86_64/constants_x86_64.h @@ -22,8 +22,8 @@ #include <android-base/logging.h> #include "arch/x86_64/registers_x86_64.h" +#include "base/globals.h" #include "base/macros.h" -#include "globals.h" namespace art { namespace x86_64 { diff --git a/compiler/utils/x86_64/managed_register_x86_64.cc b/compiler/utils/x86_64/managed_register_x86_64.cc index b8c2db2d2e..c0eec9d86c 100644 --- a/compiler/utils/x86_64/managed_register_x86_64.cc +++ b/compiler/utils/x86_64/managed_register_x86_64.cc @@ -16,7 +16,7 @@ #include "managed_register_x86_64.h" -#include "globals.h" +#include "base/globals.h" namespace art { namespace x86_64 { diff --git a/compiler/utils/x86_64/managed_register_x86_64_test.cc b/compiler/utils/x86_64/managed_register_x86_64_test.cc index e43d717385..46a405ffaf 100644 --- a/compiler/utils/x86_64/managed_register_x86_64_test.cc +++ b/compiler/utils/x86_64/managed_register_x86_64_test.cc @@ -15,7 +15,7 @@ */ #include "managed_register_x86_64.h" -#include "globals.h" +#include "base/globals.h" #include "gtest/gtest.h" namespace art { diff --git a/dex2oat/Android.bp b/dex2oat/Android.bp index 623732f9ad..4fafca9e1b 100644 --- a/dex2oat/Android.bp +++ b/dex2oat/Android.bp @@ -70,6 +70,7 @@ art_cc_defaults { }, generated_sources: ["art_dex2oat_operator_srcs"], shared_libs: [ + "libprofile", "libbase", "liblz4", "liblzma", @@ -196,6 +197,7 @@ art_cc_binary { "dex2oat-pgo-defaults", ], shared_libs: [ + "libprofile", "libart-compiler", "libart-dexlayout", "libart", @@ -232,6 +234,7 @@ art_cc_binary { "dex2oat-defaults", ], shared_libs: [ + "libprofiled", "libartd-compiler", "libartd-dexlayout", "libartd", @@ -264,6 +267,7 @@ art_cc_binary { "-z muldefs", ], static_libs: [ + "libprofile", "libart-dex2oat", "libart-compiler", "libart-dexlayout", @@ -303,6 +307,7 @@ art_cc_binary { "libartd-compiler", "libartd-dexlayout", "libartd", + "libprofiled", "libdexfiled", "libvixld-arm", "libvixld-arm64", @@ -364,6 +369,7 @@ art_cc_test { "external/zlib", ], shared_libs: [ + "libprofiled", "libartd-compiler", "libartd-dexlayout", "libbase", diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc index 3fe9c477d5..df38ee3a34 100644 --- a/dex2oat/dex2oat.cc +++ b/dex2oat/dex2oat.cc @@ -79,7 +79,6 @@ #include "gc/verification.h" #include "interpreter/unstarted_runtime.h" #include "java_vm_ext.h" -#include "jit/profile_compilation_info.h" #include "linker/buffered_output_stream.h" #include "linker/elf_writer.h" #include "linker/elf_writer_quick.h" @@ -93,6 +92,7 @@ #include "mirror/object_array-inl.h" #include "oat_file.h" #include "oat_file_assistant.h" +#include "profile/profile_compilation_info.h" #include "runtime.h" #include "runtime_options.h" #include "scoped_thread_state_change-inl.h" diff --git a/dex2oat/dex2oat_image_test.cc b/dex2oat/dex2oat_image_test.cc index 11c0c95060..03664673c3 100644 --- a/dex2oat/dex2oat_image_test.cc +++ b/dex2oat/dex2oat_image_test.cc @@ -34,7 +34,7 @@ #include "dex/dex_file-inl.h" #include "dex/dex_file_loader.h" #include "dex/method_reference.h" -#include "jit/profile_compilation_info.h" +#include "profile/profile_compilation_info.h" #include "runtime.h" namespace art { diff --git a/dex2oat/dex2oat_test.cc b/dex2oat/dex2oat_test.cc index bc8468e12f..2fe16f7cb7 100644 --- a/dex2oat/dex2oat_test.cc +++ b/dex2oat/dex2oat_test.cc @@ -38,9 +38,9 @@ #include "dex/dex_file_loader.h" #include "dex2oat_environment_test.h" #include "dex2oat_return_codes.h" -#include "jit/profile_compilation_info.h" #include "oat.h" #include "oat_file.h" +#include "profile/profile_compilation_info.h" #include "vdex_file.h" #include "ziparchive/zip_writer.h" @@ -135,7 +135,8 @@ class Dex2oatTest : public Dex2oatEnvironmentTest { ASSERT_TRUE(success) << error_msg << std::endl << output_; // Verify the odex file was generated as expected. - std::unique_ptr<OatFile> odex_file(OatFile::Open(odex_location.c_str(), + std::unique_ptr<OatFile> odex_file(OatFile::Open(/* zip_fd */ -1, + odex_location.c_str(), odex_location.c_str(), nullptr, nullptr, @@ -154,7 +155,8 @@ class Dex2oatTest : public Dex2oatEnvironmentTest { if (!test_accepts_odex_file_on_failure) { // Verify there's no loadable odex file. - std::unique_ptr<OatFile> odex_file(OatFile::Open(odex_location.c_str(), + std::unique_ptr<OatFile> odex_file(OatFile::Open(/* zip_fd */ -1, + odex_location.c_str(), odex_location.c_str(), nullptr, nullptr, @@ -542,7 +544,8 @@ class Dex2oatVeryLargeTest : public Dex2oatTest { } // Host/target independent checks. std::string error_msg; - std::unique_ptr<OatFile> odex_file(OatFile::Open(odex_location.c_str(), + std::unique_ptr<OatFile> odex_file(OatFile::Open(/* zip_fd */ -1, + odex_location.c_str(), odex_location.c_str(), nullptr, nullptr, @@ -812,7 +815,8 @@ class Dex2oatLayoutTest : public Dex2oatTest { const std::string& app_image_file_name) { // Host/target independent checks. std::string error_msg; - std::unique_ptr<OatFile> odex_file(OatFile::Open(odex_location.c_str(), + std::unique_ptr<OatFile> odex_file(OatFile::Open(/* zip_fd */ -1, + odex_location.c_str(), odex_location.c_str(), nullptr, nullptr, @@ -973,7 +977,8 @@ class Dex2oatUnquickenTest : public Dex2oatTest { void CheckResult(const std::string& dex_location, const std::string& odex_location) { std::string error_msg; - std::unique_ptr<OatFile> odex_file(OatFile::Open(odex_location.c_str(), + std::unique_ptr<OatFile> odex_file(OatFile::Open(/* zip_fd */ -1, + odex_location.c_str(), odex_location.c_str(), nullptr, nullptr, @@ -1366,7 +1371,8 @@ TEST_F(Dex2oatTest, LayoutSections) { EXPECT_EQ(res, 0); // Open our generated oat file. - std::unique_ptr<OatFile> odex_file(OatFile::Open(oat_filename.c_str(), + std::unique_ptr<OatFile> odex_file(OatFile::Open(/* zip_fd */ -1, + oat_filename.c_str(), oat_filename.c_str(), nullptr, nullptr, @@ -1479,7 +1485,8 @@ TEST_F(Dex2oatTest, GenerateCompactDex) { {"--compact-dex-level=fast"}); EXPECT_EQ(res, 0); // Open our generated oat file. - std::unique_ptr<OatFile> odex_file(OatFile::Open(oat_filename.c_str(), + std::unique_ptr<OatFile> odex_file(OatFile::Open(/* zip_fd */ -1, + oat_filename.c_str(), oat_filename.c_str(), nullptr, nullptr, @@ -1724,7 +1731,8 @@ TEST_F(Dex2oatTest, CompactDexGenerationFailure) { }); // Open our generated oat file. std::string error_msg; - std::unique_ptr<OatFile> odex_file(OatFile::Open(oat_filename.c_str(), + std::unique_ptr<OatFile> odex_file(OatFile::Open(/* zip_fd */ -1, + oat_filename.c_str(), oat_filename.c_str(), nullptr, nullptr, @@ -1801,7 +1809,8 @@ TEST_F(Dex2oatTest, VerifyCompilationReason) { { "--compilation-reason=install" }, true); std::string error_msg; - std::unique_ptr<OatFile> odex_file(OatFile::Open(odex_location.c_str(), + std::unique_ptr<OatFile> odex_file(OatFile::Open(/* zip_fd */ -1, + odex_location.c_str(), odex_location.c_str(), nullptr, nullptr, @@ -1826,7 +1835,8 @@ TEST_F(Dex2oatTest, VerifyNoCompilationReason) { {}, true); std::string error_msg; - std::unique_ptr<OatFile> odex_file(OatFile::Open(odex_location.c_str(), + std::unique_ptr<OatFile> odex_file(OatFile::Open(/* zip_fd */ -1, + odex_location.c_str(), odex_location.c_str(), nullptr, nullptr, @@ -1863,7 +1873,8 @@ TEST_F(Dex2oatTest, DontExtract) { ASSERT_TRUE(vdex != nullptr); EXPECT_FALSE(vdex->HasDexSection()) << output_; } - std::unique_ptr<OatFile> odex_file(OatFile::Open(odex_location.c_str(), + std::unique_ptr<OatFile> odex_file(OatFile::Open(/* zip_fd */ -1, + odex_location.c_str(), odex_location.c_str(), nullptr, nullptr, @@ -2106,7 +2117,8 @@ TEST_F(Dex2oatTest, AppImageNoProfile) { [](const OatFile&) {}); // Open our generated oat file. std::string error_msg; - std::unique_ptr<OatFile> odex_file(OatFile::Open(odex_location.c_str(), + std::unique_ptr<OatFile> odex_file(OatFile::Open(/* zip_fd */ -1, + odex_location.c_str(), odex_location.c_str(), nullptr, nullptr, diff --git a/dex2oat/linker/elf_writer_quick.cc b/dex2oat/linker/elf_writer_quick.cc index 4ab2012376..58bd1b0f1f 100644 --- a/dex2oat/linker/elf_writer_quick.cc +++ b/dex2oat/linker/elf_writer_quick.cc @@ -23,6 +23,7 @@ #include <android-base/logging.h> #include "base/casts.h" +#include "base/globals.h" #include "base/leb128.h" #include "base/utils.h" #include "compiled_method.h" @@ -31,7 +32,6 @@ #include "driver/compiler_options.h" #include "elf.h" #include "elf_utils.h" -#include "globals.h" #include "linker/buffered_output_stream.h" #include "linker/elf_builder.h" #include "linker/file_output_stream.h" diff --git a/dex2oat/linker/image_writer.cc b/dex2oat/linker/image_writer.cc index c7a30a06ed..bd1e6df93d 100644 --- a/dex2oat/linker/image_writer.cc +++ b/dex2oat/linker/image_writer.cc @@ -29,6 +29,7 @@ #include "art_method-inl.h" #include "base/callee_save_type.h" #include "base/enums.h" +#include "base/globals.h" #include "base/logging.h" // For VLOG. #include "base/unix_file/fd_file.h" #include "class_linker-inl.h" @@ -47,7 +48,6 @@ #include "gc/space/large_object_space.h" #include "gc/space/space-inl.h" #include "gc/verification.h" -#include "globals.h" #include "handle_scope-inl.h" #include "image.h" #include "imt_conflict_table.h" diff --git a/dex2oat/linker/multi_oat_relative_patcher.cc b/dex2oat/linker/multi_oat_relative_patcher.cc index 1449d478f9..a6797ffb8a 100644 --- a/dex2oat/linker/multi_oat_relative_patcher.cc +++ b/dex2oat/linker/multi_oat_relative_patcher.cc @@ -19,7 +19,7 @@ #include <android-base/logging.h> #include "base/bit_utils.h" -#include "globals.h" +#include "base/globals.h" #include "driver/compiled_method_storage.h" namespace art { diff --git a/dex2oat/linker/oat_writer.cc b/dex2oat/linker/oat_writer.cc index d3f4754bd5..4046dc101f 100644 --- a/dex2oat/linker/oat_writer.cc +++ b/dex2oat/linker/oat_writer.cc @@ -51,7 +51,6 @@ #include "gc/space/space.h" #include "handle_scope-inl.h" #include "image_writer.h" -#include "jit/profile_compilation_info.h" #include "linker/buffered_output_stream.h" #include "linker/file_output_stream.h" #include "linker/index_bss_mapping_encoder.h" @@ -63,6 +62,7 @@ #include "mirror/dex_cache-inl.h" #include "mirror/object-inl.h" #include "oat_quick_method_header.h" +#include "profile/profile_compilation_info.h" #include "quicken_info.h" #include "scoped_thread_state_change-inl.h" #include "utils/dex_cache_arrays_layout-inl.h" diff --git a/dex2oat/linker/oat_writer_test.cc b/dex2oat/linker/oat_writer_test.cc index 37e69f7706..1699153e7e 100644 --- a/dex2oat/linker/oat_writer_test.cc +++ b/dex2oat/linker/oat_writer_test.cc @@ -33,7 +33,6 @@ #include "driver/compiler_driver.h" #include "driver/compiler_options.h" #include "entrypoints/quick/quick_entrypoints.h" -#include "jit/profile_compilation_info.h" #include "linker/buffered_output_stream.h" #include "linker/elf_writer.h" #include "linker/elf_writer_quick.h" @@ -45,6 +44,7 @@ #include "mirror/object_array-inl.h" #include "oat_file-inl.h" #include "oat_writer.h" +#include "profile/profile_compilation_info.h" #include "scoped_thread_state_change-inl.h" #include "vdex_file.h" @@ -426,7 +426,8 @@ TEST_F(OatTest, WriteRead) { if (kCompile) { // OatWriter strips the code, regenerate to compare compiler_driver_->CompileAll(class_loader, class_linker->GetBootClassPath(), &timings); } - std::unique_ptr<OatFile> oat_file(OatFile::Open(tmp_oat.GetFilename(), + std::unique_ptr<OatFile> oat_file(OatFile::Open(/* zip_fd */ -1, + tmp_oat.GetFilename(), tmp_oat.GetFilename(), nullptr, nullptr, @@ -560,7 +561,8 @@ TEST_F(OatTest, EmptyTextSection) { /* verify */ false); ASSERT_TRUE(success); - std::unique_ptr<OatFile> oat_file(OatFile::Open(tmp_oat.GetFilename(), + std::unique_ptr<OatFile> oat_file(OatFile::Open(/* zip_fd */ -1, + tmp_oat.GetFilename(), tmp_oat.GetFilename(), nullptr, nullptr, @@ -637,7 +639,8 @@ void OatTest::TestDexFileInput(bool verify, bool low_4gb, bool use_profile) { ASSERT_TRUE(success); std::string error_msg; - std::unique_ptr<OatFile> opened_oat_file(OatFile::Open(tmp_oat.GetFilename(), + std::unique_ptr<OatFile> opened_oat_file(OatFile::Open(/* zip_fd */ -1, + tmp_oat.GetFilename(), tmp_oat.GetFilename(), nullptr, nullptr, @@ -767,7 +770,8 @@ void OatTest::TestZipFileInput(bool verify) { ASSERT_TRUE(success); std::string error_msg; - std::unique_ptr<OatFile> opened_oat_file(OatFile::Open(tmp_oat.GetFilename(), + std::unique_ptr<OatFile> opened_oat_file(OatFile::Open(/* zip_fd */ -1, + tmp_oat.GetFilename(), tmp_oat.GetFilename(), nullptr, nullptr, @@ -816,7 +820,8 @@ void OatTest::TestZipFileInput(bool verify) { ASSERT_TRUE(success); std::string error_msg; - std::unique_ptr<OatFile> opened_oat_file(OatFile::Open(tmp_oat.GetFilename(), + std::unique_ptr<OatFile> opened_oat_file(OatFile::Open(/* zip_fd */ -1, + tmp_oat.GetFilename(), tmp_oat.GetFilename(), nullptr, nullptr, diff --git a/dex2oat/linker/relative_patcher_test.h b/dex2oat/linker/relative_patcher_test.h index 9cd51e9b46..b4123eea3e 100644 --- a/dex2oat/linker/relative_patcher_test.h +++ b/dex2oat/linker/relative_patcher_test.h @@ -20,6 +20,7 @@ #include "arch/instruction_set.h" #include "arch/instruction_set_features.h" #include "base/array_ref.h" +#include "base/globals.h" #include "base/macros.h" #include "compiled_method-inl.h" #include "dex/verification_results.h" @@ -27,7 +28,6 @@ #include "dex/string_reference.h" #include "driver/compiler_driver.h" #include "driver/compiler_options.h" -#include "globals.h" #include "gtest/gtest.h" #include "linker/relative_patcher.h" #include "linker/vector_output_stream.h" diff --git a/dexlayout/Android.bp b/dexlayout/Android.bp index 33ba58f5f7..b009774582 100644 --- a/dexlayout/Android.bp +++ b/dexlayout/Android.bp @@ -41,6 +41,7 @@ art_cc_library { shared_libs: [ "libart", "libdexfile", + "libprofile", ], target: { @@ -61,6 +62,7 @@ art_cc_library { shared_libs: [ "libartd", "libdexfiled", + "libprofiled", ], } @@ -78,6 +80,7 @@ art_cc_binary { name: "dexlayout", defaults: ["dexlayout-defaults"], shared_libs: [ + "libprofile", "libart", "libart-dexlayout", ], @@ -90,6 +93,7 @@ art_cc_binary { "dexlayout-defaults", ], shared_libs: [ + "libprofiled", "libartd", "libartd-dexlayout", ], @@ -98,7 +102,10 @@ art_cc_binary { art_cc_test { name: "art_dexlayout_tests", defaults: ["art_gtest_defaults"], - shared_libs: ["libart-dexlayout"], + shared_libs: [ + "libprofiled", + "libartd-dexlayout", + ], srcs: ["dexlayout_test.cc"], } diff --git a/dexlayout/dex_visualize.cc b/dexlayout/dex_visualize.cc index 516a3382fd..c8aac941ff 100644 --- a/dexlayout/dex_visualize.cc +++ b/dexlayout/dex_visualize.cc @@ -33,7 +33,7 @@ #include "dex_ir.h" #include "dexlayout.h" -#include "jit/profile_compilation_info.h" +#include "profile/profile_compilation_info.h" namespace art { diff --git a/dexlayout/dexdiag_test.cc b/dexlayout/dexdiag_test.cc index 068949ceba..53145c22fa 100644 --- a/dexlayout/dexdiag_test.cc +++ b/dexlayout/dexdiag_test.cc @@ -68,7 +68,8 @@ class DexDiagTest : public CommonRuntimeTest { EXPECT_TRUE(!oat_location.empty()); std::cout << "==" << oat_location << std::endl; std::string error_msg; - std::unique_ptr<OatFile> oat(OatFile::Open(oat_location.c_str(), + std::unique_ptr<OatFile> oat(OatFile::Open(/* zip_fd */ -1, + oat_location.c_str(), oat_location.c_str(), nullptr, nullptr, diff --git a/dexlayout/dexlayout.cc b/dexlayout/dexlayout.cc index 7a8c31ba84..62dd1a9554 100644 --- a/dexlayout/dexlayout.cc +++ b/dexlayout/dexlayout.cc @@ -49,7 +49,7 @@ #include "dex_verify.h" #include "dex_visualize.h" #include "dex_writer.h" -#include "jit/profile_compilation_info.h" +#include "profile/profile_compilation_info.h" namespace art { diff --git a/dexlayout/dexlayout_main.cc b/dexlayout/dexlayout_main.cc index f81d16cbf5..185c1420ab 100644 --- a/dexlayout/dexlayout_main.cc +++ b/dexlayout/dexlayout_main.cc @@ -33,7 +33,7 @@ #include "base/logging.h" // For InitLogging. #include "base/mem_map.h" -#include "jit/profile_compilation_info.h" +#include "profile/profile_compilation_info.h" #include "runtime.h" namespace art { diff --git a/dexlayout/dexlayout_test.cc b/dexlayout/dexlayout_test.cc index 6719d0848c..f148b94f3d 100644 --- a/dexlayout/dexlayout_test.cc +++ b/dexlayout/dexlayout_test.cc @@ -31,7 +31,7 @@ #include "dex/dex_file_loader.h" #include "dexlayout.h" #include "exec_utils.h" -#include "jit/profile_compilation_info.h" +#include "profile/profile_compilation_info.h" namespace art { diff --git a/libartbase/base/allocator.cc b/libartbase/base/allocator.cc index c7be4e0161..c4ac180a15 100644 --- a/libartbase/base/allocator.cc +++ b/libartbase/base/allocator.cc @@ -21,7 +21,7 @@ #include <android-base/logging.h> -#include "base/atomic.h" +#include "atomic.h" namespace art { diff --git a/libartbase/base/allocator.h b/libartbase/base/allocator.h index 662f78e448..5eb6ea6b4c 100644 --- a/libartbase/base/allocator.h +++ b/libartbase/base/allocator.h @@ -19,8 +19,8 @@ #include <type_traits> -#include "base/atomic.h" -#include "base/macros.h" +#include "atomic.h" +#include "macros.h" namespace art { diff --git a/libartbase/base/arena_allocator.h b/libartbase/base/arena_allocator.h index 4d535df1d4..211ff4f6ad 100644 --- a/libartbase/base/arena_allocator.h +++ b/libartbase/base/arena_allocator.h @@ -20,11 +20,11 @@ #include <stddef.h> #include <stdint.h> -#include "base/bit_utils.h" -#include "base/debug_stack.h" -#include "base/dchecked_vector.h" -#include "base/macros.h" -#include "base/memory_tool.h" +#include "bit_utils.h" +#include "debug_stack.h" +#include "dchecked_vector.h" +#include "macros.h" +#include "memory_tool.h" namespace art { diff --git a/libartbase/base/arena_allocator_test.cc b/libartbase/base/arena_allocator_test.cc index 68e99f4be0..e358710ca6 100644 --- a/libartbase/base/arena_allocator_test.cc +++ b/libartbase/base/arena_allocator_test.cc @@ -14,11 +14,11 @@ * limitations under the License. */ -#include "base/arena_allocator-inl.h" -#include "base/arena_bit_vector.h" -#include "base/malloc_arena_pool.h" -#include "base/memory_tool.h" +#include "arena_allocator-inl.h" +#include "arena_bit_vector.h" #include "gtest/gtest.h" +#include "malloc_arena_pool.h" +#include "memory_tool.h" namespace art { diff --git a/libartbase/base/arena_bit_vector.cc b/libartbase/base/arena_bit_vector.cc index 1542e9d5f7..01f9013737 100644 --- a/libartbase/base/arena_bit_vector.cc +++ b/libartbase/base/arena_bit_vector.cc @@ -16,8 +16,8 @@ #include "arena_bit_vector.h" -#include "base/allocator.h" -#include "base/arena_allocator.h" +#include "allocator.h" +#include "arena_allocator.h" namespace art { diff --git a/libartbase/base/arena_bit_vector.h b/libartbase/base/arena_bit_vector.h index 2b2322e74f..0fb6bbf775 100644 --- a/libartbase/base/arena_bit_vector.h +++ b/libartbase/base/arena_bit_vector.h @@ -17,8 +17,8 @@ #ifndef ART_LIBARTBASE_BASE_ARENA_BIT_VECTOR_H_ #define ART_LIBARTBASE_BASE_ARENA_BIT_VECTOR_H_ -#include "base/arena_object.h" -#include "base/bit_vector.h" +#include "arena_object.h" +#include "bit_vector.h" namespace art { diff --git a/libartbase/base/arena_containers.h b/libartbase/base/arena_containers.h index 40cf23c9fb..bd57fb1cfc 100644 --- a/libartbase/base/arena_containers.h +++ b/libartbase/base/arena_containers.h @@ -25,10 +25,10 @@ #include <utility> #include "arena_allocator.h" -#include "base/dchecked_vector.h" -#include "base/hash_map.h" -#include "base/hash_set.h" -#include "base/safe_map.h" +#include "dchecked_vector.h" +#include "hash_map.h" +#include "hash_set.h" +#include "safe_map.h" namespace art { diff --git a/libartbase/base/arena_object.h b/libartbase/base/arena_object.h index de7cb64a75..ed0922546d 100644 --- a/libartbase/base/arena_object.h +++ b/libartbase/base/arena_object.h @@ -20,7 +20,7 @@ #include <android-base/logging.h> #include "arena_allocator.h" -#include "base/macros.h" +#include "macros.h" #include "scoped_arena_allocator.h" namespace art { diff --git a/libartbase/base/array_slice.h b/libartbase/base/array_slice.h index 1ef2fbad8b..fb3da6b476 100644 --- a/libartbase/base/array_slice.h +++ b/libartbase/base/array_slice.h @@ -17,9 +17,9 @@ #ifndef ART_LIBARTBASE_BASE_ARRAY_SLICE_H_ #define ART_LIBARTBASE_BASE_ARRAY_SLICE_H_ -#include "base/bit_utils.h" -#include "base/casts.h" -#include "base/iteration_range.h" +#include "bit_utils.h" +#include "casts.h" +#include "iteration_range.h" #include "stride_iterator.h" namespace art { diff --git a/libartbase/base/atomic.h b/libartbase/base/atomic.h index f736667ca8..b68f867bfa 100644 --- a/libartbase/base/atomic.h +++ b/libartbase/base/atomic.h @@ -24,7 +24,7 @@ #include <android-base/logging.h> -#include "base/macros.h" +#include "macros.h" namespace art { diff --git a/libartbase/base/bit_string.h b/libartbase/base/bit_string.h index 0e051f358b..d995f8dbb1 100644 --- a/libartbase/base/bit_string.h +++ b/libartbase/base/bit_string.h @@ -17,8 +17,8 @@ #ifndef ART_LIBARTBASE_BASE_BIT_STRING_H_ #define ART_LIBARTBASE_BASE_BIT_STRING_H_ -#include "base/bit_struct.h" -#include "base/bit_utils.h" +#include "bit_struct.h" +#include "bit_utils.h" #include <ostream> diff --git a/libartbase/base/bit_string_test.cc b/libartbase/base/bit_string_test.cc index 23274e3f2f..89a71a1894 100644 --- a/libartbase/base/bit_string_test.cc +++ b/libartbase/base/bit_string_test.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "base/bit_string.h" +#include "bit_string.h" #include "gtest/gtest.h" #include "android-base/logging.h" diff --git a/libartbase/base/bit_struct.h b/libartbase/base/bit_struct.h index 386b896073..9814fd4f3a 100644 --- a/libartbase/base/bit_struct.h +++ b/libartbase/base/bit_struct.h @@ -17,8 +17,8 @@ #ifndef ART_LIBARTBASE_BASE_BIT_STRUCT_H_ #define ART_LIBARTBASE_BASE_BIT_STRUCT_H_ -#include "base/bit_utils.h" #include "bit_struct_detail.h" +#include "bit_utils.h" // // Zero-cost, type-safe, well-defined "structs" of bit fields. diff --git a/libartbase/base/bit_struct_detail.h b/libartbase/base/bit_struct_detail.h index facfa61efb..68c2e4461f 100644 --- a/libartbase/base/bit_struct_detail.h +++ b/libartbase/base/bit_struct_detail.h @@ -17,7 +17,7 @@ #ifndef ART_LIBARTBASE_BASE_BIT_STRUCT_DETAIL_H_ #define ART_LIBARTBASE_BASE_BIT_STRUCT_DETAIL_H_ -#include "base/bit_utils.h" +#include "bit_utils.h" #include "globals.h" #include <type_traits> diff --git a/libartbase/base/bit_utils.h b/libartbase/base/bit_utils.h index ff6c160680..04f0e8518c 100644 --- a/libartbase/base/bit_utils.h +++ b/libartbase/base/bit_utils.h @@ -22,7 +22,7 @@ #include <android-base/logging.h> -#include "base/stl_util_identity.h" +#include "stl_util_identity.h" namespace art { diff --git a/libartbase/base/bit_utils_iterator.h b/libartbase/base/bit_utils_iterator.h index 3fab15a3db..4975ebfb44 100644 --- a/libartbase/base/bit_utils_iterator.h +++ b/libartbase/base/bit_utils_iterator.h @@ -23,9 +23,9 @@ #include <android-base/logging.h> -#include "base/bit_utils.h" -#include "base/iteration_range.h" -#include "base/stl_util.h" +#include "bit_utils.h" +#include "iteration_range.h" +#include "stl_util.h" namespace art { diff --git a/libartbase/base/bit_vector-inl.h b/libartbase/base/bit_vector-inl.h index 7a9f4650da..2bdc14ebe9 100644 --- a/libartbase/base/bit_vector-inl.h +++ b/libartbase/base/bit_vector-inl.h @@ -21,7 +21,7 @@ #include <android-base/logging.h> -#include "base/bit_utils.h" +#include "bit_utils.h" namespace art { diff --git a/libartbase/base/bit_vector.h b/libartbase/base/bit_vector.h index 2ffa2aa9c9..a930f4e556 100644 --- a/libartbase/base/bit_vector.h +++ b/libartbase/base/bit_vector.h @@ -20,7 +20,7 @@ #include <stdint.h> #include <iterator> -#include "base/bit_utils.h" +#include "bit_utils.h" #include "globals.h" namespace art { diff --git a/libartbase/base/bounded_fifo.h b/libartbase/base/bounded_fifo.h index 444f31a55b..43d14f4cef 100644 --- a/libartbase/base/bounded_fifo.h +++ b/libartbase/base/bounded_fifo.h @@ -19,7 +19,7 @@ #include <android-base/logging.h> -#include "base/bit_utils.h" +#include "bit_utils.h" namespace art { diff --git a/libartbase/base/dumpable.h b/libartbase/base/dumpable.h index 66213972f7..0c00505461 100644 --- a/libartbase/base/dumpable.h +++ b/libartbase/base/dumpable.h @@ -19,7 +19,7 @@ #include <ostream> -#include "base/macros.h" +#include "macros.h" namespace art { diff --git a/libartbase/base/file_magic.cc b/libartbase/base/file_magic.cc index 2b9bed0397..d8d843beeb 100644 --- a/libartbase/base/file_magic.cc +++ b/libartbase/base/file_magic.cc @@ -23,7 +23,7 @@ #include <android-base/logging.h> #include <android-base/stringprintf.h> -#include "base/unix_file/fd_file.h" +#include "unix_file/fd_file.h" namespace art { diff --git a/libartbase/base/file_magic.h b/libartbase/base/file_magic.h index 53f551cb3a..0d0322c470 100644 --- a/libartbase/base/file_magic.h +++ b/libartbase/base/file_magic.h @@ -20,7 +20,7 @@ #include <stdint.h> #include <string> -#include "base/os.h" +#include "os.h" namespace art { diff --git a/libartbase/base/hex_dump.h b/libartbase/base/hex_dump.h index 55f4d53c2e..d13595dc02 100644 --- a/libartbase/base/hex_dump.h +++ b/libartbase/base/hex_dump.h @@ -17,7 +17,7 @@ #ifndef ART_LIBARTBASE_BASE_HEX_DUMP_H_ #define ART_LIBARTBASE_BASE_HEX_DUMP_H_ -#include "base/macros.h" +#include "macros.h" #include <ostream> diff --git a/libartbase/base/histogram-inl.h b/libartbase/base/histogram-inl.h index 26d01b2883..9832f03d90 100644 --- a/libartbase/base/histogram-inl.h +++ b/libartbase/base/histogram-inl.h @@ -26,9 +26,9 @@ #include <android-base/logging.h> -#include "base/bit_utils.h" -#include "base/time_utils.h" -#include "base/utils.h" +#include "bit_utils.h" +#include "time_utils.h" +#include "utils.h" namespace art { diff --git a/libartbase/base/indenter.h b/libartbase/base/indenter.h index 850b7c4f73..06e7340d36 100644 --- a/libartbase/base/indenter.h +++ b/libartbase/base/indenter.h @@ -22,7 +22,7 @@ #include <android-base/logging.h> -#include "base/macros.h" +#include "macros.h" namespace art { diff --git a/libartbase/base/leb128.h b/libartbase/base/leb128.h index ab19daa108..d5847fd6c6 100644 --- a/libartbase/base/leb128.h +++ b/libartbase/base/leb128.h @@ -21,9 +21,9 @@ #include <android-base/logging.h> -#include "base/bit_utils.h" -#include "base/globals.h" -#include "base/macros.h" +#include "bit_utils.h" +#include "globals.h" +#include "macros.h" namespace art { diff --git a/libartbase/base/leb128_test.cc b/libartbase/base/leb128_test.cc index 747fc19f5d..58b0d07786 100644 --- a/libartbase/base/leb128_test.cc +++ b/libartbase/base/leb128_test.cc @@ -17,9 +17,8 @@ #include "leb128.h" #include "gtest/gtest.h" - -#include "base/histogram-inl.h" -#include "base/time_utils.h" +#include "histogram-inl.h" +#include "time_utils.h" namespace art { diff --git a/libartbase/base/length_prefixed_array.h b/libartbase/base/length_prefixed_array.h index 7c09bddd55..9238e81566 100644 --- a/libartbase/base/length_prefixed_array.h +++ b/libartbase/base/length_prefixed_array.h @@ -20,10 +20,10 @@ #include <stddef.h> // for offsetof() #include <string.h> // for memset() -#include "base/bit_utils.h" -#include "base/casts.h" -#include "base/iteration_range.h" -#include "base/stride_iterator.h" +#include "bit_utils.h" +#include "casts.h" +#include "iteration_range.h" +#include "stride_iterator.h" namespace art { diff --git a/libartbase/base/logging.cc b/libartbase/base/logging.cc index fd2cc20af2..a66a7e3635 100644 --- a/libartbase/base/logging.cc +++ b/libartbase/base/logging.cc @@ -21,8 +21,8 @@ #include <sstream> #include "aborting.h" -#include "base/os.h" -#include "base/unix_file/fd_file.h" +#include "os.h" +#include "unix_file/fd_file.h" // Headers for LogMessage::LogLine. #ifdef ART_TARGET_ANDROID diff --git a/libartbase/base/logging.h b/libartbase/base/logging.h index 986704ec98..d2c0a02399 100644 --- a/libartbase/base/logging.h +++ b/libartbase/base/logging.h @@ -21,7 +21,7 @@ #include <sstream> #include "android-base/logging.h" -#include "base/macros.h" +#include "macros.h" namespace art { diff --git a/libartbase/base/logging_test.cc b/libartbase/base/logging_test.cc index 1456eb30fa..46ba41bb1f 100644 --- a/libartbase/base/logging_test.cc +++ b/libartbase/base/logging_test.cc @@ -19,9 +19,9 @@ #include <type_traits> #include "android-base/logging.h" -#include "base/bit_utils.h" -#include "base/macros.h" +#include "bit_utils.h" #include "gtest/gtest.h" +#include "macros.h" #include "runtime_debug.h" namespace art { diff --git a/libartbase/base/malloc_arena_pool.cc b/libartbase/base/malloc_arena_pool.cc index 7df4aef25b..144b06ceb9 100644 --- a/libartbase/base/malloc_arena_pool.cc +++ b/libartbase/base/malloc_arena_pool.cc @@ -24,7 +24,7 @@ #include <numeric> #include <android-base/logging.h> -#include "base/arena_allocator-inl.h" +#include "arena_allocator-inl.h" namespace art { diff --git a/libartbase/base/malloc_arena_pool.h b/libartbase/base/malloc_arena_pool.h index 8720189343..c48be59eb5 100644 --- a/libartbase/base/malloc_arena_pool.h +++ b/libartbase/base/malloc_arena_pool.h @@ -19,7 +19,7 @@ #include <mutex> -#include "base/arena_allocator.h" +#include "arena_allocator.h" namespace art { diff --git a/libartbase/base/mem_map.cc b/libartbase/base/mem_map.cc index 21634f86b6..9a1392ceee 100644 --- a/libartbase/base/mem_map.cc +++ b/libartbase/base/mem_map.cc @@ -32,12 +32,12 @@ #include "backtrace/BacktraceMap.h" #include "cutils/ashmem.h" -#include "base/allocator.h" -#include "base/bit_utils.h" -#include "base/globals.h" -#include "base/logging.h" // For VLOG_IS_ON. -#include "base/memory_tool.h" -#include "base/utils.h" +#include "allocator.h" +#include "bit_utils.h" +#include "globals.h" +#include "logging.h" // For VLOG_IS_ON. +#include "memory_tool.h" +#include "utils.h" #ifndef MAP_ANONYMOUS #define MAP_ANONYMOUS MAP_ANON diff --git a/libartbase/base/mem_map.h b/libartbase/base/mem_map.h index b7beb08dbc..3a324b2dc5 100644 --- a/libartbase/base/mem_map.h +++ b/libartbase/base/mem_map.h @@ -25,7 +25,7 @@ #include <string> #include "android-base/thread_annotations.h" -#include "base/macros.h" +#include "macros.h" namespace art { diff --git a/libartbase/base/mem_map_test.cc b/libartbase/base/mem_map_test.cc index 3adbf18a7a..4408f5502a 100644 --- a/libartbase/base/mem_map_test.cc +++ b/libartbase/base/mem_map_test.cc @@ -21,9 +21,9 @@ #include <memory> #include <random> -#include "base/memory_tool.h" -#include "base/unix_file/fd_file.h" #include "common_runtime_test.h" +#include "memory_tool.h" +#include "unix_file/fd_file.h" namespace art { diff --git a/libartbase/base/memory_region.h b/libartbase/base/memory_region.h index 7add466cc7..3d00f5b939 100644 --- a/libartbase/base/memory_region.h +++ b/libartbase/base/memory_region.h @@ -22,12 +22,12 @@ #include <android-base/logging.h> -#include "base/bit_utils.h" -#include "base/casts.h" -#include "base/enums.h" -#include "base/macros.h" -#include "base/value_object.h" +#include "bit_utils.h" +#include "casts.h" +#include "enums.h" #include "globals.h" +#include "macros.h" +#include "value_object.h" namespace art { diff --git a/libartbase/base/os_linux.cc b/libartbase/base/os_linux.cc index cb228bd853..f8b31cf0d8 100644 --- a/libartbase/base/os_linux.cc +++ b/libartbase/base/os_linux.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "base/os.h" +#include "os.h" #include <fcntl.h> #include <sys/stat.h> @@ -25,7 +25,7 @@ #include <android-base/logging.h> -#include "base/unix_file/fd_file.h" +#include "unix_file/fd_file.h" namespace art { diff --git a/libartbase/base/safe_copy.cc b/libartbase/base/safe_copy.cc index 7ba5cbd3e6..b46b921307 100644 --- a/libartbase/base/safe_copy.cc +++ b/libartbase/base/safe_copy.cc @@ -24,7 +24,7 @@ #include <android-base/macros.h> -#include "base/bit_utils.h" +#include "bit_utils.h" namespace art { diff --git a/libartbase/base/safe_copy_test.cc b/libartbase/base/safe_copy_test.cc index f1d7c55e77..c23651f7a7 100644 --- a/libartbase/base/safe_copy_test.cc +++ b/libartbase/base/safe_copy_test.cc @@ -22,7 +22,7 @@ #include <sys/user.h> #include "android-base/logging.h" -#include "base/globals.h" +#include "globals.h" #include "gtest/gtest.h" diff --git a/libartbase/base/scoped_arena_allocator.cc b/libartbase/base/scoped_arena_allocator.cc index 7240842d55..ab05c6041a 100644 --- a/libartbase/base/scoped_arena_allocator.cc +++ b/libartbase/base/scoped_arena_allocator.cc @@ -17,7 +17,7 @@ #include "scoped_arena_allocator.h" #include "arena_allocator-inl.h" -#include "base/memory_tool.h" +#include "memory_tool.h" namespace art { diff --git a/libartbase/base/scoped_arena_allocator.h b/libartbase/base/scoped_arena_allocator.h index d5f6df82cc..7eaec5e3c3 100644 --- a/libartbase/base/scoped_arena_allocator.h +++ b/libartbase/base/scoped_arena_allocator.h @@ -20,9 +20,9 @@ #include <android-base/logging.h> #include "arena_allocator.h" -#include "base/debug_stack.h" -#include "base/globals.h" -#include "base/macros.h" +#include "debug_stack.h" +#include "globals.h" +#include "macros.h" namespace art { diff --git a/libartbase/base/scoped_arena_containers.h b/libartbase/base/scoped_arena_containers.h index 4df02b6205..41939816f5 100644 --- a/libartbase/base/scoped_arena_containers.h +++ b/libartbase/base/scoped_arena_containers.h @@ -25,8 +25,8 @@ #include <utility> #include "arena_containers.h" // For ArenaAllocatorAdapterKind. -#include "base/dchecked_vector.h" -#include "base/safe_map.h" +#include "dchecked_vector.h" +#include "safe_map.h" #include "scoped_arena_allocator.h" namespace art { diff --git a/libartbase/base/scoped_flock.cc b/libartbase/base/scoped_flock.cc index 514b97bfb1..d679328cef 100644 --- a/libartbase/base/scoped_flock.cc +++ b/libartbase/base/scoped_flock.cc @@ -22,7 +22,7 @@ #include <android-base/logging.h> #include <android-base/stringprintf.h> -#include "base/unix_file/fd_file.h" +#include "unix_file/fd_file.h" namespace art { diff --git a/libartbase/base/scoped_flock.h b/libartbase/base/scoped_flock.h index 476b25748b..39b36b4fdd 100644 --- a/libartbase/base/scoped_flock.h +++ b/libartbase/base/scoped_flock.h @@ -22,9 +22,9 @@ #include <android-base/unique_fd.h> -#include "base/macros.h" -#include "base/os.h" -#include "base/unix_file/fd_file.h" +#include "macros.h" +#include "os.h" +#include "unix_file/fd_file.h" namespace art { diff --git a/libartbase/base/time_utils.cc b/libartbase/base/time_utils.cc index 3c09d5a36f..89a1109a7e 100644 --- a/libartbase/base/time_utils.cc +++ b/libartbase/base/time_utils.cc @@ -22,7 +22,7 @@ #include "android-base/stringprintf.h" -#include "base/logging.h" +#include "logging.h" #if defined(__APPLE__) #include <sys/time.h> diff --git a/libartbase/base/time_utils.h b/libartbase/base/time_utils.h index 811af5d682..431d3e19ac 100644 --- a/libartbase/base/time_utils.h +++ b/libartbase/base/time_utils.h @@ -22,7 +22,7 @@ #include <string> -#include "base/macros.h" +#include "macros.h" namespace art { diff --git a/libartbase/base/tracking_safe_map.h b/libartbase/base/tracking_safe_map.h index 2750de1b94..9b015c4ea5 100644 --- a/libartbase/base/tracking_safe_map.h +++ b/libartbase/base/tracking_safe_map.h @@ -17,8 +17,8 @@ #ifndef ART_LIBARTBASE_BASE_TRACKING_SAFE_MAP_H_ #define ART_LIBARTBASE_BASE_TRACKING_SAFE_MAP_H_ -#include "base/allocator.h" -#include "base/safe_map.h" +#include "allocator.h" +#include "safe_map.h" namespace art { diff --git a/libartbase/base/transform_array_ref.h b/libartbase/base/transform_array_ref.h index de2739e2fc..ef2957332b 100644 --- a/libartbase/base/transform_array_ref.h +++ b/libartbase/base/transform_array_ref.h @@ -19,8 +19,8 @@ #include <type_traits> -#include "base/array_ref.h" -#include "base/transform_iterator.h" +#include "array_ref.h" +#include "transform_iterator.h" namespace art { diff --git a/libartbase/base/transform_array_ref_test.cc b/libartbase/base/transform_array_ref_test.cc index da0340d36b..fc73d56779 100644 --- a/libartbase/base/transform_array_ref_test.cc +++ b/libartbase/base/transform_array_ref_test.cc @@ -18,8 +18,7 @@ #include <vector> #include "gtest/gtest.h" - -#include "base/transform_array_ref.h" +#include "transform_array_ref.h" namespace art { diff --git a/libartbase/base/transform_iterator.h b/libartbase/base/transform_iterator.h index 82d9f9e325..92655438f4 100644 --- a/libartbase/base/transform_iterator.h +++ b/libartbase/base/transform_iterator.h @@ -20,7 +20,7 @@ #include <iterator> #include <type_traits> -#include "base/iteration_range.h" +#include "iteration_range.h" namespace art { diff --git a/libartbase/base/transform_iterator_test.cc b/libartbase/base/transform_iterator_test.cc index 63b6e4f531..5a5c37d11d 100644 --- a/libartbase/base/transform_iterator_test.cc +++ b/libartbase/base/transform_iterator_test.cc @@ -21,8 +21,7 @@ #include <vector> #include "gtest/gtest.h" - -#include "base/transform_iterator.h" +#include "transform_iterator.h" namespace art { diff --git a/libartbase/base/unix_file/fd_file.cc b/libartbase/base/unix_file/fd_file.cc index b2881b8ed0..c5313e969d 100644 --- a/libartbase/base/unix_file/fd_file.cc +++ b/libartbase/base/unix_file/fd_file.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "base/unix_file/fd_file.h" +#include "fd_file.h" #include <errno.h> #include <sys/stat.h> @@ -30,8 +30,8 @@ #include <sys/sendfile.h> #else #include <algorithm> -#include "base/stl_util.h" #include "base/globals.h" +#include "base/stl_util.h" #endif namespace unix_file { diff --git a/libartbase/base/unix_file/fd_file.h b/libartbase/base/unix_file/fd_file.h index fe3317f64e..d61dab6ce3 100644 --- a/libartbase/base/unix_file/fd_file.h +++ b/libartbase/base/unix_file/fd_file.h @@ -22,7 +22,7 @@ #include <string> #include "base/macros.h" -#include "base/unix_file/random_access_file.h" +#include "random_access_file.h" namespace unix_file { diff --git a/libartbase/base/unix_file/fd_file_test.cc b/libartbase/base/unix_file/fd_file_test.cc index 042fbc9284..7fc057b9e8 100644 --- a/libartbase/base/unix_file/fd_file_test.cc +++ b/libartbase/base/unix_file/fd_file_test.cc @@ -14,10 +14,10 @@ * limitations under the License. */ -#include "base/unix_file/fd_file.h" -#include "base/unix_file/random_access_file_test.h" #include "common_runtime_test.h" // For ScratchFile #include "gtest/gtest.h" +#include "fd_file.h" +#include "random_access_file_test.h" namespace unix_file { diff --git a/libartbase/base/unix_file/random_access_file_utils.cc b/libartbase/base/unix_file/random_access_file_utils.cc index aae65c1cde..10d829964c 100644 --- a/libartbase/base/unix_file/random_access_file_utils.cc +++ b/libartbase/base/unix_file/random_access_file_utils.cc @@ -14,11 +14,11 @@ * limitations under the License. */ -#include "base/unix_file/random_access_file_utils.h" +#include "random_access_file_utils.h" #include <vector> -#include "base/unix_file/random_access_file.h" +#include "random_access_file.h" namespace unix_file { diff --git a/libartbase/base/utils.cc b/libartbase/base/utils.cc index 029cffd3ab..b7a542fbbe 100644 --- a/libartbase/base/utils.cc +++ b/libartbase/base/utils.cc @@ -30,7 +30,7 @@ #include "android-base/stringprintf.h" #include "android-base/strings.h" -#include "base/os.h" +#include "os.h" #if defined(__APPLE__) #include <crt_externs.h> diff --git a/libartbase/base/utils.h b/libartbase/base/utils.h index c8c5b72bf7..73c1c226f9 100644 --- a/libartbase/base/utils.h +++ b/libartbase/base/utils.h @@ -25,11 +25,11 @@ #include <android-base/logging.h> -#include "base/casts.h" -#include "base/enums.h" -#include "base/globals.h" -#include "base/macros.h" -#include "base/stringpiece.h" +#include "casts.h" +#include "enums.h" +#include "globals.h" +#include "macros.h" +#include "stringpiece.h" namespace art { diff --git a/libartbase/base/value_object.h b/libartbase/base/value_object.h index 441bd1a384..dab6b76b26 100644 --- a/libartbase/base/value_object.h +++ b/libartbase/base/value_object.h @@ -17,7 +17,7 @@ #ifndef ART_LIBARTBASE_BASE_VALUE_OBJECT_H_ #define ART_LIBARTBASE_BASE_VALUE_OBJECT_H_ -#include "base/macros.h" +#include "macros.h" namespace art { diff --git a/libartbase/base/variant_map.h b/libartbase/base/variant_map.h index 4e02c54499..581bc234cc 100644 --- a/libartbase/base/variant_map.h +++ b/libartbase/base/variant_map.h @@ -23,7 +23,7 @@ #include <utility> #include "android-base/logging.h" -#include "base/stl_util_identity.h" +#include "stl_util_identity.h" namespace art { diff --git a/libartbase/base/zip_archive.cc b/libartbase/base/zip_archive.cc index 4185c227c8..b5f946e5a2 100644 --- a/libartbase/base/zip_archive.cc +++ b/libartbase/base/zip_archive.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "base/zip_archive.h" +#include "zip_archive.h" #include <fcntl.h> #include <stdio.h> @@ -27,8 +27,8 @@ #include "android-base/stringprintf.h" #include "ziparchive/zip_archive.h" -#include "base/bit_utils.h" -#include "base/unix_file/fd_file.h" +#include "bit_utils.h" +#include "unix_file/fd_file.h" namespace art { diff --git a/libartbase/base/zip_archive.h b/libartbase/base/zip_archive.h index 39c8168519..73495da96a 100644 --- a/libartbase/base/zip_archive.h +++ b/libartbase/base/zip_archive.h @@ -23,11 +23,11 @@ #include <android-base/logging.h> -#include "base/os.h" -#include "base/mem_map.h" -#include "base/safe_map.h" -#include "base/unix_file/random_access_file.h" #include "globals.h" +#include "mem_map.h" +#include "os.h" +#include "safe_map.h" +#include "unix_file/random_access_file.h" // system/core/zip_archive definitions. struct ZipEntry; diff --git a/libartbase/base/zip_archive_test.cc b/libartbase/base/zip_archive_test.cc index 03f4cd4d54..63743f754c 100644 --- a/libartbase/base/zip_archive_test.cc +++ b/libartbase/base/zip_archive_test.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "base/zip_archive.h" +#include "zip_archive.h" #include <fcntl.h> #include <sys/stat.h> @@ -22,9 +22,9 @@ #include <zlib.h> #include <memory> -#include "base/os.h" -#include "base/unix_file/fd_file.h" #include "common_runtime_test.h" +#include "os.h" +#include "unix_file/fd_file.h" namespace art { diff --git a/libdexfile/dex/dex_file.h b/libdexfile/dex/dex_file.h index 4098b4250a..4ca735ad66 100644 --- a/libdexfile/dex/dex_file.h +++ b/libdexfile/dex/dex_file.h @@ -1346,9 +1346,6 @@ class ClassDataItemIterator { uint32_t field_idx_delta_; // delta of index into the field_ids array for FieldId uint32_t access_flags_; // access flags for the field ClassDataField() : field_idx_delta_(0), access_flags_(0) {} - - private: - DISALLOW_COPY_AND_ASSIGN(ClassDataField); }; ClassDataField field_; @@ -1361,9 +1358,6 @@ class ClassDataItemIterator { uint32_t access_flags_; uint32_t code_off_; ClassDataMethod() : method_idx_delta_(0), access_flags_(0), code_off_(0) {} - - private: - DISALLOW_COPY_AND_ASSIGN(ClassDataMethod); }; ClassDataMethod method_; @@ -1374,7 +1368,6 @@ class ClassDataItemIterator { size_t pos_; // integral number of items passed const uint8_t* ptr_pos_; // pointer into stream of class_data_item uint32_t last_idx_; // last read field or method index to apply delta to - DISALLOW_IMPLICIT_CONSTRUCTORS(ClassDataItemIterator); }; class EncodedArrayValueIterator { diff --git a/libdexfile/dex/dex_file_verifier.cc b/libdexfile/dex/dex_file_verifier.cc index 68bd19ea86..5f7b4e8ba6 100644 --- a/libdexfile/dex/dex_file_verifier.cc +++ b/libdexfile/dex/dex_file_verifier.cc @@ -674,9 +674,9 @@ bool DexFileVerifier::CheckClassDataItemMethod(uint32_t idx, uint32_t class_access_flags, dex::TypeIndex class_type_index, uint32_t code_offset, - std::unordered_set<uint32_t>* direct_method_indexes, + ClassDataItemIterator* direct_it, bool expect_direct) { - DCHECK(direct_method_indexes != nullptr); + DCHECK(expect_direct || direct_it != nullptr); // Check for overflow. if (!CheckIndex(idx, header_->method_ids_size_, "class_data_item method_idx")) { return false; @@ -694,11 +694,19 @@ bool DexFileVerifier::CheckClassDataItemMethod(uint32_t idx, } // Check that it's not defined as both direct and virtual. - if (expect_direct) { - direct_method_indexes->insert(idx); - } else if (direct_method_indexes->find(idx) != direct_method_indexes->end()) { - ErrorStringPrintf("Found virtual method with same index as direct method: %d", idx); - return false; + if (!expect_direct) { + // The direct methods are already known to be in ascending index order. So just keep up + // with the current index. + for (; direct_it->HasNextDirectMethod(); direct_it->Next()) { + uint32_t direct_idx = direct_it->GetMemberIndex(); + if (direct_idx > idx) { + break; + } + if (direct_idx == idx) { + ErrorStringPrintf("Found virtual method with same index as direct method: %d", idx); + return false; + } + } } std::string error_msg; @@ -986,31 +994,16 @@ bool DexFileVerifier::FindClassIndexAndDef(uint32_t index, return false; } -bool DexFileVerifier::CheckOrderAndGetClassDef(bool is_field, - const char* type_descr, - uint32_t curr_index, - uint32_t prev_index, - bool* have_class, - dex::TypeIndex* class_type_index, - const DexFile::ClassDef** class_def) { - if (curr_index < prev_index) { +bool DexFileVerifier::CheckOrder(const char* type_descr, + uint32_t curr_index, + uint32_t prev_index) { + if (UNLIKELY(curr_index < prev_index)) { ErrorStringPrintf("out-of-order %s indexes %" PRIu32 " and %" PRIu32, type_descr, prev_index, curr_index); return false; } - - if (!*have_class) { - *have_class = FindClassIndexAndDef(curr_index, is_field, class_type_index, class_def); - if (!*have_class) { - // Should have really found one. - ErrorStringPrintf("could not find declaring class for %s index %" PRIu32, - type_descr, - curr_index); - return false; - } - } return true; } @@ -1115,20 +1108,29 @@ bool DexFileVerifier::CheckIntraClassDataItemFields(ClassDataItemIterator* it, dex::TypeIndex* class_type_index, const DexFile::ClassDef** class_def) { DCHECK(it != nullptr); + constexpr const char* kTypeDescr = kStatic ? "static field" : "instance field"; + // These calls use the raw access flags to check whether the whole dex field is valid. + + if (!*have_class && (kStatic ? it->HasNextStaticField() : it->HasNextInstanceField())) { + *have_class = FindClassIndexAndDef(it->GetMemberIndex(), true, class_type_index, class_def); + if (!*have_class) { + // Should have really found one. + ErrorStringPrintf("could not find declaring class for %s index %" PRIu32, + kTypeDescr, + it->GetMemberIndex()); + return false; + } + } + DCHECK(*class_def != nullptr || + !(kStatic ? it->HasNextStaticField() : it->HasNextInstanceField())); + uint32_t prev_index = 0; for (; kStatic ? it->HasNextStaticField() : it->HasNextInstanceField(); it->Next()) { uint32_t curr_index = it->GetMemberIndex(); - if (!CheckOrderAndGetClassDef(true, - kStatic ? "static field" : "instance field", - curr_index, - prev_index, - have_class, - class_type_index, - class_def)) { + if (!CheckOrder(kTypeDescr, curr_index, prev_index)) { return false; } - DCHECK(class_def != nullptr); if (!CheckClassDataItemField(curr_index, it->GetRawMemberAccessFlags(), (*class_def)->access_flags_, @@ -1146,29 +1148,38 @@ bool DexFileVerifier::CheckIntraClassDataItemFields(ClassDataItemIterator* it, template <bool kDirect> bool DexFileVerifier::CheckIntraClassDataItemMethods( ClassDataItemIterator* it, - std::unordered_set<uint32_t>* direct_method_indexes, + ClassDataItemIterator* direct_it, bool* have_class, dex::TypeIndex* class_type_index, const DexFile::ClassDef** class_def) { + DCHECK(it != nullptr); + constexpr const char* kTypeDescr = kDirect ? "direct method" : "virtual method"; + + if (!*have_class && (kDirect ? it->HasNextDirectMethod() : it->HasNextVirtualMethod())) { + *have_class = FindClassIndexAndDef(it->GetMemberIndex(), false, class_type_index, class_def); + if (!*have_class) { + // Should have really found one. + ErrorStringPrintf("could not find declaring class for %s index %" PRIu32, + kTypeDescr, + it->GetMemberIndex()); + return false; + } + } + DCHECK(*class_def != nullptr || + !(kDirect ? it->HasNextDirectMethod() : it->HasNextVirtualMethod())); + uint32_t prev_index = 0; for (; kDirect ? it->HasNextDirectMethod() : it->HasNextVirtualMethod(); it->Next()) { uint32_t curr_index = it->GetMemberIndex(); - if (!CheckOrderAndGetClassDef(false, - kDirect ? "direct method" : "virtual method", - curr_index, - prev_index, - have_class, - class_type_index, - class_def)) { + if (!CheckOrder(kTypeDescr, curr_index, prev_index)) { return false; } - DCHECK(class_def != nullptr); if (!CheckClassDataItemMethod(curr_index, it->GetRawMemberAccessFlags(), (*class_def)->access_flags_, *class_type_index, it->GetMethodCodeItemOffset(), - direct_method_indexes, + direct_it, kDirect)) { return false; } @@ -1181,7 +1192,6 @@ bool DexFileVerifier::CheckIntraClassDataItemMethods( bool DexFileVerifier::CheckIntraClassDataItem() { ClassDataItemIterator it(*dex_file_, ptr_); - std::unordered_set<uint32_t> direct_method_indexes; // This code is complicated by the fact that we don't directly know which class this belongs to. // So we need to explicitly search with the first item we find (either field or method), and then, @@ -1205,15 +1215,17 @@ bool DexFileVerifier::CheckIntraClassDataItem() { } // Check methods. + ClassDataItemIterator direct_it = it; + if (!CheckIntraClassDataItemMethods<true>(&it, - &direct_method_indexes, + nullptr /* direct_it */, &have_class, &class_type_index, &class_def)) { return false; } if (!CheckIntraClassDataItemMethods<false>(&it, - &direct_method_indexes, + &direct_it, &have_class, &class_type_index, &class_def)) { @@ -1288,7 +1300,19 @@ bool DexFileVerifier::CheckIntraCodeItem() { return false; } - std::unique_ptr<uint32_t[]> handler_offsets(new uint32_t[handlers_size]); + // Avoid an expensive allocation, if possible. + std::unique_ptr<uint32_t[]> handler_offsets_uptr; + uint32_t* handler_offsets; + constexpr size_t kAllocaMaxSize = 1024; + if (handlers_size < kAllocaMaxSize/sizeof(uint32_t)) { + handler_offsets = + AlignDown(reinterpret_cast<uint32_t*>(alloca((handlers_size + 1) * sizeof(uint32_t))), + alignof(uint32_t[])); + } else { + handler_offsets_uptr.reset(new uint32_t[handlers_size]); + handler_offsets = handler_offsets_uptr.get(); + } + if (!CheckAndGetHandlerOffsets(code_item, &handler_offsets[0], handlers_size)) { return false; } @@ -1613,11 +1637,11 @@ bool DexFileVerifier::CheckIntraAnnotationsDirectoryItem() { return true; } -bool DexFileVerifier::CheckIntraSectionIterate(size_t offset, uint32_t section_count, - DexFile::MapItemType type) { +template <DexFile::MapItemType kType> +bool DexFileVerifier::CheckIntraSectionIterate(size_t offset, uint32_t section_count) { // Get the right alignment mask for the type of section. size_t alignment_mask; - switch (type) { + switch (kType) { case DexFile::kDexTypeClassDataItem: case DexFile::kDexTypeStringDataItem: case DexFile::kDexTypeDebugInfoItem: @@ -1635,13 +1659,13 @@ bool DexFileVerifier::CheckIntraSectionIterate(size_t offset, uint32_t section_c size_t aligned_offset = (offset + alignment_mask) & ~alignment_mask; // Check the padding between items. - if (!CheckPadding(offset, aligned_offset, type)) { + if (!CheckPadding(offset, aligned_offset, kType)) { return false; } // Check depending on the section type. const uint8_t* start_ptr = ptr_; - switch (type) { + switch (kType) { case DexFile::kDexTypeStringIdItem: { if (!CheckListSize(ptr_, 1, sizeof(DexFile::StringId), "string_ids")) { return false; @@ -1764,17 +1788,17 @@ bool DexFileVerifier::CheckIntraSectionIterate(size_t offset, uint32_t section_c } if (start_ptr == ptr_) { - ErrorStringPrintf("Unknown map item type %x", type); + ErrorStringPrintf("Unknown map item type %x", kType); return false; } - if (IsDataSectionType(type)) { + if (IsDataSectionType(kType)) { if (aligned_offset == 0u) { ErrorStringPrintf("Item %d offset is 0", i); return false; } DCHECK(offset_to_type_map_.Find(aligned_offset) == offset_to_type_map_.end()); - offset_to_type_map_.Insert(std::pair<uint32_t, uint16_t>(aligned_offset, type)); + offset_to_type_map_.Insert(std::pair<uint32_t, uint16_t>(aligned_offset, kType)); } aligned_offset = ptr_ - begin_; @@ -1789,6 +1813,55 @@ bool DexFileVerifier::CheckIntraSectionIterate(size_t offset, uint32_t section_c return true; } +bool DexFileVerifier::CheckIntraSectionIterateByType(size_t offset, + uint32_t count, + DexFile::MapItemType type) { + switch (type) { + case DexFile::kDexTypeHeaderItem: + return CheckIntraSectionIterate<DexFile::kDexTypeHeaderItem>(offset, count); + case DexFile::kDexTypeStringIdItem: + return CheckIntraSectionIterate<DexFile::kDexTypeStringIdItem>(offset, count); + case DexFile::kDexTypeTypeIdItem: + return CheckIntraSectionIterate<DexFile::kDexTypeTypeIdItem>(offset, count); + case DexFile::kDexTypeProtoIdItem: + return CheckIntraSectionIterate<DexFile::kDexTypeProtoIdItem>(offset, count); + case DexFile::kDexTypeFieldIdItem: + return CheckIntraSectionIterate<DexFile::kDexTypeFieldIdItem>(offset, count); + case DexFile::kDexTypeMethodIdItem: + return CheckIntraSectionIterate<DexFile::kDexTypeMethodIdItem>(offset, count); + case DexFile::kDexTypeClassDefItem: + return CheckIntraSectionIterate<DexFile::kDexTypeClassDefItem>(offset, count); + case DexFile::kDexTypeCallSiteIdItem: + return CheckIntraSectionIterate<DexFile::kDexTypeCallSiteIdItem>(offset, count); + case DexFile::kDexTypeMethodHandleItem: + return CheckIntraSectionIterate<DexFile::kDexTypeMethodHandleItem>(offset, count); + case DexFile::kDexTypeMapList: + return CheckIntraSectionIterate<DexFile::kDexTypeMapList>(offset, count); + case DexFile::kDexTypeTypeList: + return CheckIntraSectionIterate<DexFile::kDexTypeTypeList>(offset, count); + case DexFile::kDexTypeAnnotationSetRefList: + return CheckIntraSectionIterate<DexFile::kDexTypeAnnotationSetRefList>(offset, count); + case DexFile::kDexTypeAnnotationSetItem: + return CheckIntraSectionIterate<DexFile::kDexTypeAnnotationSetItem>(offset, count); + case DexFile::kDexTypeClassDataItem: + return CheckIntraSectionIterate<DexFile::kDexTypeClassDataItem>(offset, count); + case DexFile::kDexTypeCodeItem: + return CheckIntraSectionIterate<DexFile::kDexTypeCodeItem>(offset, count); + case DexFile::kDexTypeStringDataItem: + return CheckIntraSectionIterate<DexFile::kDexTypeStringDataItem>(offset, count); + case DexFile::kDexTypeDebugInfoItem: + return CheckIntraSectionIterate<DexFile::kDexTypeDebugInfoItem>(offset, count); + case DexFile::kDexTypeAnnotationItem: + return CheckIntraSectionIterate<DexFile::kDexTypeAnnotationItem>(offset, count); + case DexFile::kDexTypeEncodedArrayItem: + return CheckIntraSectionIterate<DexFile::kDexTypeEncodedArrayItem>(offset, count); + case DexFile::kDexTypeAnnotationsDirectoryItem: + return CheckIntraSectionIterate<DexFile::kDexTypeAnnotationsDirectoryItem>(offset, count); + } + LOG(FATAL) << "Unreachable"; + UNREACHABLE(); +} + bool DexFileVerifier::CheckIntraIdSection(size_t offset, uint32_t count, DexFile::MapItemType type) { @@ -1836,12 +1909,11 @@ bool DexFileVerifier::CheckIntraIdSection(size_t offset, return false; } - return CheckIntraSectionIterate(offset, count, type); + return CheckIntraSectionIterateByType(offset, count, type); } -bool DexFileVerifier::CheckIntraDataSection(size_t offset, - uint32_t count, - DexFile::MapItemType type) { +template <DexFile::MapItemType kType> +bool DexFileVerifier::CheckIntraDataSection(size_t offset, uint32_t count) { size_t data_start = header_->data_off_; size_t data_end = data_start + header_->data_size_; @@ -1851,7 +1923,7 @@ bool DexFileVerifier::CheckIntraDataSection(size_t offset, return false; } - if (!CheckIntraSectionIterate(offset, count, type)) { + if (!CheckIntraSectionIterate<kType>(offset, count)) { return false; } @@ -1928,21 +2000,75 @@ bool DexFileVerifier::CheckIntraSection() { offset = section_offset + sizeof(uint32_t) + (map->size_ * sizeof(DexFile::MapItem)); break; case DexFile::kDexTypeMethodHandleItem: + CheckIntraSectionIterate<DexFile::kDexTypeMethodHandleItem>(section_offset, section_count); + offset = ptr_ - begin_; + break; case DexFile::kDexTypeCallSiteIdItem: - CheckIntraSectionIterate(section_offset, section_count, type); + CheckIntraSectionIterate<DexFile::kDexTypeCallSiteIdItem>(section_offset, section_count); offset = ptr_ - begin_; break; case DexFile::kDexTypeTypeList: + if (!CheckIntraDataSection<DexFile::kDexTypeTypeList>(section_offset, section_count)) { + return false; + } + offset = ptr_ - begin_; + break; case DexFile::kDexTypeAnnotationSetRefList: + if (!CheckIntraDataSection<DexFile::kDexTypeAnnotationSetRefList>(section_offset, + section_count)) { + return false; + } + offset = ptr_ - begin_; + break; case DexFile::kDexTypeAnnotationSetItem: + if (!CheckIntraDataSection<DexFile::kDexTypeAnnotationSetItem>(section_offset, + section_count)) { + return false; + } + offset = ptr_ - begin_; + break; case DexFile::kDexTypeClassDataItem: + if (!CheckIntraDataSection<DexFile::kDexTypeClassDataItem>(section_offset, section_count)) { + return false; + } + offset = ptr_ - begin_; + break; case DexFile::kDexTypeCodeItem: + if (!CheckIntraDataSection<DexFile::kDexTypeCodeItem>(section_offset, section_count)) { + return false; + } + offset = ptr_ - begin_; + break; case DexFile::kDexTypeStringDataItem: + if (!CheckIntraDataSection<DexFile::kDexTypeStringDataItem>(section_offset, + section_count)) { + return false; + } + offset = ptr_ - begin_; + break; case DexFile::kDexTypeDebugInfoItem: + if (!CheckIntraDataSection<DexFile::kDexTypeDebugInfoItem>(section_offset, section_count)) { + return false; + } + offset = ptr_ - begin_; + break; case DexFile::kDexTypeAnnotationItem: + if (!CheckIntraDataSection<DexFile::kDexTypeAnnotationItem>(section_offset, + section_count)) { + return false; + } + offset = ptr_ - begin_; + break; case DexFile::kDexTypeEncodedArrayItem: + if (!CheckIntraDataSection<DexFile::kDexTypeEncodedArrayItem>(section_offset, + section_count)) { + return false; + } + offset = ptr_ - begin_; + break; case DexFile::kDexTypeAnnotationsDirectoryItem: - if (!CheckIntraDataSection(section_offset, section_count, type)) { + if (!CheckIntraDataSection<DexFile::kDexTypeAnnotationsDirectoryItem>(section_offset, + section_count)) { return false; } offset = ptr_ - begin_; @@ -2889,11 +3015,14 @@ void DexFileVerifier::ErrorStringPrintf(const char* fmt, ...) { } // Fields and methods may have only one of public/protected/private. -static bool CheckAtMostOneOfPublicProtectedPrivate(uint32_t flags) { - size_t count = (((flags & kAccPublic) == 0) ? 0 : 1) + - (((flags & kAccProtected) == 0) ? 0 : 1) + - (((flags & kAccPrivate) == 0) ? 0 : 1); - return count <= 1; +ALWAYS_INLINE +static constexpr bool CheckAtMostOneOfPublicProtectedPrivate(uint32_t flags) { + // Semantically we want 'return POPCOUNT(flags & kAcc) <= 1;'. + static_assert(IsPowerOfTwo(0), "0 not marked as power of two"); + static_assert(IsPowerOfTwo(kAccPublic), "kAccPublic not marked as power of two"); + static_assert(IsPowerOfTwo(kAccProtected), "kAccProtected not marked as power of two"); + static_assert(IsPowerOfTwo(kAccPrivate), "kAccPrivate not marked as power of two"); + return IsPowerOfTwo(flags & (kAccPublic | kAccProtected | kAccPrivate)); } // Helper functions to retrieve names from the dex file. We do not want to rely on DexFile diff --git a/libdexfile/dex/dex_file_verifier.h b/libdexfile/dex/dex_file_verifier.h index a80a9d569a..a4c23bb08a 100644 --- a/libdexfile/dex/dex_file_verifier.h +++ b/libdexfile/dex/dex_file_verifier.h @@ -85,15 +85,10 @@ class DexFileVerifier { uint32_t class_access_flags, dex::TypeIndex class_type_index, uint32_t code_offset, - std::unordered_set<uint32_t>* direct_method_indexes, + ClassDataItemIterator* direct_it, bool expect_direct); - bool CheckOrderAndGetClassDef(bool is_field, - const char* type_descr, - uint32_t curr_index, - uint32_t prev_index, - bool* have_class, - dex::TypeIndex* class_type_index, - const DexFile::ClassDef** class_def); + ALWAYS_INLINE + bool CheckOrder(const char* type_descr, uint32_t curr_index, uint32_t prev_index); bool CheckStaticFieldTypes(const DexFile::ClassDef* class_def); bool CheckPadding(size_t offset, uint32_t aligned_offset, DexFile::MapItemType type); @@ -113,7 +108,7 @@ class DexFileVerifier { // method, if necessary (and return it), or use the given values. template <bool kDirect> bool CheckIntraClassDataItemMethods(ClassDataItemIterator* it, - std::unordered_set<uint32_t>* direct_method_indexes, + ClassDataItemIterator* direct_it, bool* have_class, dex::TypeIndex* class_type_index, const DexFile::ClassDef** class_def); @@ -124,9 +119,12 @@ class DexFileVerifier { bool CheckIntraAnnotationItem(); bool CheckIntraAnnotationsDirectoryItem(); - bool CheckIntraSectionIterate(size_t offset, uint32_t count, DexFile::MapItemType type); + template <DexFile::MapItemType kType> + bool CheckIntraSectionIterate(size_t offset, uint32_t count); + bool CheckIntraSectionIterateByType(size_t offset, uint32_t count, DexFile::MapItemType type); bool CheckIntraIdSection(size_t offset, uint32_t count, DexFile::MapItemType type); - bool CheckIntraDataSection(size_t offset, uint32_t count, DexFile::MapItemType type); + template <DexFile::MapItemType kType> + bool CheckIntraDataSection(size_t offset, uint32_t count); bool CheckIntraSection(); bool CheckOffsetToTypeMap(size_t offset, uint16_t type); diff --git a/libprofile/Android.bp b/libprofile/Android.bp new file mode 100644 index 0000000000..bcb90cb680 --- /dev/null +++ b/libprofile/Android.bp @@ -0,0 +1,102 @@ +// +// Copyright (C) 2018 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +cc_defaults { + name: "libprofile_defaults", + defaults: ["art_defaults"], + host_supported: true, + srcs: [ + "profile/profile_compilation_info.cc", + ], + target: { + android: { + static_libs: [ + // ZipArchive support, the order matters here to get all symbols. + "libziparchive", + "libz", + ], + shared_libs: [ + // For android::FileMap used by libziparchive. + "libutils", + ], + }, + host: { + shared_libs: [ + "libziparchive", + "libz", + ], + }, + }, + //generated_sources: ["art_libartbase_operator_srcs"], + cflags: ["-DBUILDING_LIBART=1"], + shared_libs: [ + "libartbase", + "libdexfile", + // For atrace. + "libcutils", + ], + export_include_dirs: ["."], + // ART's macros.h depends on libbase's macros.h. + // Note: runtime_options.h depends on cmdline. But we don't really want to export this + // generically. dex2oat takes care of it itself. + export_shared_lib_headers: ["libbase"], +} + +art_cc_library { + name: "libprofile", + defaults: ["libprofile_defaults"], + // Leave the symbols in the shared library so that stack unwinders can + // produce meaningful name resolution. + strip: { + keep_symbols: true, + }, + shared_libs: [ + "libbase", + "libziparchive", + ], + export_shared_lib_headers: ["libbase"], +} + +art_cc_library { + name: "libprofiled", + defaults: [ + "art_debug_defaults", + "libprofile_defaults", + ], + shared_libs: [ + "libbase", + "libziparchive", + ], + export_shared_lib_headers: ["libbase"], +} + +// For now many of these tests still use CommonRuntimeTest, almost universally because of +// ScratchFile and related. +// TODO: Remove CommonRuntimeTest dependency from these tests. +art_cc_test { + name: "art_libprofile_tests", + defaults: [ + "art_gtest_defaults", + ], + srcs: [ + "profile/profile_compilation_info_test.cc", + ], + shared_libs: [ + "libartbased", + "libdexfiled", + "libziparchive", + ], +} diff --git a/runtime/jit/profile_compilation_info.cc b/libprofile/profile/profile_compilation_info.cc index d27465dd6e..0e0c3c5116 100644 --- a/runtime/jit/profile_compilation_info.cc +++ b/libprofile/profile/profile_compilation_info.cc @@ -46,7 +46,6 @@ #include "base/utils.h" #include "base/zip_archive.h" #include "dex/dex_file_loader.h" -#include "jit/profiling_info.h" namespace art { @@ -70,12 +69,12 @@ static constexpr bool kDebugIgnoreChecksum = false; static constexpr uint8_t kIsMissingTypesEncoding = 6; static constexpr uint8_t kIsMegamorphicEncoding = 7; -static_assert(sizeof(InlineCache::kIndividualCacheSize) == sizeof(uint8_t), - "InlineCache::kIndividualCacheSize does not have the expect type size"); -static_assert(InlineCache::kIndividualCacheSize < kIsMegamorphicEncoding, - "InlineCache::kIndividualCacheSize is larger than expected"); -static_assert(InlineCache::kIndividualCacheSize < kIsMissingTypesEncoding, - "InlineCache::kIndividualCacheSize is larger than expected"); +static_assert(sizeof(ProfileCompilationInfo::kIndividualInlineCacheSize) == sizeof(uint8_t), + "InlineCache::kIndividualInlineCacheSize does not have the expect type size"); +static_assert(ProfileCompilationInfo::kIndividualInlineCacheSize < kIsMegamorphicEncoding, + "InlineCache::kIndividualInlineCacheSize is larger than expected"); +static_assert(ProfileCompilationInfo::kIndividualInlineCacheSize < kIsMissingTypesEncoding, + "InlineCache::kIndividualInlineCacheSize is larger than expected"); static bool ChecksumMatch(uint32_t dex_file_checksum, uint32_t checksum) { return kDebugIgnoreChecksum || dex_file_checksum == checksum; @@ -120,7 +119,7 @@ void ProfileCompilationInfo::DexPcData::AddClass(uint16_t dex_profile_idx, } // Check if the adding the type will cause the cache to become megamorphic. - if (classes.size() + 1 >= InlineCache::kIndividualCacheSize) { + if (classes.size() + 1 >= ProfileCompilationInfo::kIndividualInlineCacheSize) { is_megamorphic = true; classes.clear(); return; @@ -503,7 +502,7 @@ void ProfileCompilationInfo::AddInlineCacheToBuffer(std::vector<uint8_t>* buffer continue; } - DCHECK_LT(classes.size(), InlineCache::kIndividualCacheSize); + DCHECK_LT(classes.size(), ProfileCompilationInfo::kIndividualInlineCacheSize); DCHECK_NE(classes.size(), 0u) << "InlineCache contains a dex_pc with 0 classes"; SafeMap<uint8_t, std::vector<dex::TypeIndex>> dex_to_classes_map; diff --git a/runtime/jit/profile_compilation_info.h b/libprofile/profile/profile_compilation_info.h index f4c8c723b3..32c796c363 100644 --- a/runtime/jit/profile_compilation_info.h +++ b/libprofile/profile/profile_compilation_info.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_RUNTIME_JIT_PROFILE_COMPILATION_INFO_H_ -#define ART_RUNTIME_JIT_PROFILE_COMPILATION_INFO_H_ +#ifndef ART_LIBPROFILE_PROFILE_PROFILE_COMPILATION_INFO_H_ +#define ART_LIBPROFILE_PROFILE_PROFILE_COMPILATION_INFO_H_ #include <set> #include <vector> @@ -75,6 +75,8 @@ class ProfileCompilationInfo { static const char* kDexMetadataProfileEntry; + static constexpr uint8_t kIndividualInlineCacheSize = 5; + // Data structures for encoding the offline representation of inline caches. // This is exposed as public in order to make it available to dex2oat compilations // (see compiler/optimizing/inliner.cc). @@ -809,4 +811,4 @@ class ProfileCompilationInfo { } // namespace art -#endif // ART_RUNTIME_JIT_PROFILE_COMPILATION_INFO_H_ +#endif // ART_LIBPROFILE_PROFILE_PROFILE_COMPILATION_INFO_H_ diff --git a/runtime/jit/profile_compilation_info_test.cc b/libprofile/profile/profile_compilation_info_test.cc index 0ebadc00fe..b0f96492df 100644 --- a/runtime/jit/profile_compilation_info_test.cc +++ b/libprofile/profile/profile_compilation_info_test.cc @@ -26,10 +26,10 @@ #include "dex/method_reference.h" #include "dex/type_reference.h" #include "handle_scope-inl.h" -#include "jit/profile_compilation_info.h" #include "linear_alloc.h" #include "mirror/class-inl.h" #include "mirror/class_loader.h" +#include "profile/profile_compilation_info.h" #include "scoped_thread_state_change-inl.h" #include "ziparchive/zip_writer.h" diff --git a/oatdump/Android.bp b/oatdump/Android.bp index 8c21538f23..be12c8e406 100644 --- a/oatdump/Android.bp +++ b/oatdump/Android.bp @@ -37,6 +37,7 @@ art_cc_binary { "libart-compiler", "libart-disassembler", "libdexfile", + "libprofile", "libbase", ], } @@ -52,6 +53,7 @@ art_cc_binary { "libartd-compiler", "libartd-disassembler", "libdexfiled", + "libprofiled", "libbase", ], } @@ -77,6 +79,7 @@ art_cc_binary { static_libs: [ "libart", "libdexfile", + "libprofile", "libart-compiler", "libart-disassembler", "libvixl-arm", @@ -111,6 +114,7 @@ art_cc_binary { static_libs: [ "libartd", "libdexfiled", + "libprofiled", "libartd-compiler", "libartd-disassembler", "libvixld-arm", diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc index 6a68b55fad..44050ff8ed 100644 --- a/oatdump/oatdump.cc +++ b/oatdump/oatdump.cc @@ -2156,7 +2156,8 @@ class ImageDumper { oat_file = runtime->GetOatFileManager().FindOpenedOatFileFromOatLocation(oat_location); } if (oat_file == nullptr) { - oat_file = OatFile::Open(oat_location, + oat_file = OatFile::Open(/* zip_fd */ -1, + oat_location, oat_location, nullptr, nullptr, @@ -3044,7 +3045,8 @@ static int DumpImages(Runtime* runtime, OatDumperOptions* options, std::ostream* // We need to map the oat file in the low 4gb or else the fixup wont be able to fit oat file // pointers into 32 bit pointer sized ArtMethods. std::string error_msg; - std::unique_ptr<OatFile> oat_file(OatFile::Open(options->app_oat_, + std::unique_ptr<OatFile> oat_file(OatFile::Open(/* zip_fd */ -1, + options->app_oat_, options->app_oat_, nullptr, nullptr, @@ -3167,7 +3169,8 @@ static int DumpOat(Runtime* runtime, << "oatdump might fail if the oat file does not contain the dex code."; } std::string error_msg; - std::unique_ptr<OatFile> oat_file(OatFile::Open(oat_filename, + std::unique_ptr<OatFile> oat_file(OatFile::Open(/* zip_fd */ -1, + oat_filename, oat_filename, nullptr, nullptr, @@ -3192,7 +3195,8 @@ static int SymbolizeOat(const char* oat_filename, std::string& output_name, bool no_bits) { std::string error_msg; - std::unique_ptr<OatFile> oat_file(OatFile::Open(oat_filename, + std::unique_ptr<OatFile> oat_file(OatFile::Open(/* zip_fd */ -1, + oat_filename, oat_filename, nullptr, nullptr, @@ -3239,7 +3243,8 @@ class IMTDumper { if (oat_filename != nullptr) { std::string error_msg; - std::unique_ptr<OatFile> oat_file(OatFile::Open(oat_filename, + std::unique_ptr<OatFile> oat_file(OatFile::Open(/* zip_fd */ -1, + oat_filename, oat_filename, nullptr, nullptr, diff --git a/openjdkjvmti/jvmti_weak_table.h b/openjdkjvmti/jvmti_weak_table.h index 5a821c964b..cba8ef06a7 100644 --- a/openjdkjvmti/jvmti_weak_table.h +++ b/openjdkjvmti/jvmti_weak_table.h @@ -34,11 +34,11 @@ #include <unordered_map> +#include "base/globals.h" #include "base/macros.h" #include "base/mutex.h" #include "gc/system_weak.h" #include "gc_root-inl.h" -#include "globals.h" #include "jvmti.h" #include "jvmti_allocator.h" #include "mirror/object.h" diff --git a/openjdkjvmti/object_tagging.h b/openjdkjvmti/object_tagging.h index b474845566..1b8366a501 100644 --- a/openjdkjvmti/object_tagging.h +++ b/openjdkjvmti/object_tagging.h @@ -34,8 +34,8 @@ #include <unordered_map> +#include "base/globals.h" #include "base/mutex.h" -#include "globals.h" #include "jvmti.h" #include "jvmti_weak_table.h" #include "mirror/object.h" diff --git a/openjdkjvmti/ti_class_loader.h b/openjdkjvmti/ti_class_loader.h index dbe30da462..142e2e1588 100644 --- a/openjdkjvmti/ti_class_loader.h +++ b/openjdkjvmti/ti_class_loader.h @@ -39,12 +39,12 @@ #include "art_jvmti.h" #include "art_method.h" #include "base/array_slice.h" +#include "base/globals.h" #include "base/mem_map.h" #include "class_linker.h" #include "dex/dex_file.h" #include "dex/utf.h" #include "gc_root-inl.h" -#include "globals.h" #include "jni_env_ext-inl.h" #include "jvmti.h" #include "linear_alloc.h" diff --git a/openjdkjvmti/ti_redefine.h b/openjdkjvmti/ti_redefine.h index 03238565cc..e14b7ae1c8 100644 --- a/openjdkjvmti/ti_redefine.h +++ b/openjdkjvmti/ti_redefine.h @@ -39,12 +39,12 @@ #include "art_jvmti.h" #include "art_method.h" #include "base/array_ref.h" +#include "base/globals.h" #include "base/mem_map.h" #include "class_linker.h" #include "dex/dex_file.h" #include "dex/utf.h" #include "gc_root-inl.h" -#include "globals.h" #include "jni_env_ext-inl.h" #include "jvmti.h" #include "linear_alloc.h" diff --git a/openjdkjvmti/transform.cc b/openjdkjvmti/transform.cc index f31486ba58..29a9b10ca2 100644 --- a/openjdkjvmti/transform.cc +++ b/openjdkjvmti/transform.cc @@ -39,6 +39,7 @@ #include "art_method.h" #include "base/array_ref.h" +#include "base/globals.h" #include "base/mem_map.h" #include "class_linker.h" #include "dex/dex_file.h" @@ -47,7 +48,6 @@ #include "events-inl.h" #include "fault_handler.h" #include "gc_root-inl.h" -#include "globals.h" #include "jni_env_ext-inl.h" #include "jvalue.h" #include "jvmti.h" diff --git a/profman/Android.bp b/profman/Android.bp index 163be2b64f..3c8c72c34a 100644 --- a/profman/Android.bp +++ b/profman/Android.bp @@ -40,6 +40,7 @@ art_cc_binary { defaults: ["profman-defaults"], shared_libs: [ "libart", + "libprofile", "libdexfile", ], } @@ -52,6 +53,7 @@ art_cc_binary { ], shared_libs: [ "libartd", + "libprofiled", "libdexfiled", ], } @@ -61,5 +63,8 @@ art_cc_test { defaults: [ "art_gtest_defaults", ], + shared_libs: [ + "libprofiled", + ], srcs: ["profile_assistant_test.cc"], } diff --git a/profman/boot_image_profile.cc b/profman/boot_image_profile.cc index 60238e2082..89c9eb8b03 100644 --- a/profman/boot_image_profile.cc +++ b/profman/boot_image_profile.cc @@ -21,7 +21,7 @@ #include "dex/dex_file-inl.h" #include "dex/method_reference.h" #include "dex/type_reference.h" -#include "jit/profile_compilation_info.h" +#include "profile/profile_compilation_info.h" namespace art { diff --git a/profman/profile_assistant.h b/profman/profile_assistant.h index ee555840d7..c1d6f8e7a9 100644 --- a/profman/profile_assistant.h +++ b/profman/profile_assistant.h @@ -21,7 +21,7 @@ #include <vector> #include "base/scoped_flock.h" -#include "jit/profile_compilation_info.h" +#include "profile/profile_compilation_info.h" namespace art { diff --git a/profman/profile_assistant_test.cc b/profman/profile_assistant_test.cc index 3106384665..bd44e491b0 100644 --- a/profman/profile_assistant_test.cc +++ b/profman/profile_assistant_test.cc @@ -23,10 +23,10 @@ #include "common_runtime_test.h" #include "dex/descriptors_names.h" #include "exec_utils.h" -#include "jit/profile_compilation_info.h" #include "linear_alloc.h" #include "mirror/class-inl.h" #include "obj_ptr-inl.h" +#include "profile/profile_compilation_info.h" #include "profile_assistant.h" #include "scoped_thread_state_change-inl.h" diff --git a/profman/profman.cc b/profman/profman.cc index b9f0209346..cd88d03929 100644 --- a/profman/profman.cc +++ b/profman/profman.cc @@ -33,7 +33,6 @@ #include "base/dumpable.h" #include "base/logging.h" // For InitLogging. -#include "base/mutex.h" #include "base/scoped_flock.h" #include "base/stringpiece.h" #include "base/time_utils.h" @@ -48,7 +47,7 @@ #include "dex/dex_file_loader.h" #include "dex/dex_file_types.h" #include "dex/type_reference.h" -#include "jit/profile_compilation_info.h" +#include "profile/profile_compilation_info.h" #include "profile_assistant.h" #include "runtime.h" @@ -835,7 +834,8 @@ class ProfMan FINAL { bool found_invoke = false; for (const DexInstructionPcPair& inst : CodeItemInstructionAccessor(*dex_file, code_item)) { - if (inst->Opcode() == Instruction::INVOKE_VIRTUAL) { + if (inst->Opcode() == Instruction::INVOKE_VIRTUAL || + inst->Opcode() == Instruction::INVOKE_VIRTUAL_RANGE) { if (found_invoke) { LOG(ERROR) << "Multiple invoke INVOKE_VIRTUAL found: " << dex_file->PrettyMethod(method_index); @@ -1307,4 +1307,3 @@ static int profman(int argc, char** argv) { int main(int argc, char **argv) { return art::profman(argc, argv); } - diff --git a/runtime/Android.bp b/runtime/Android.bp index 6b432058d9..f39562313d 100644 --- a/runtime/Android.bp +++ b/runtime/Android.bp @@ -112,7 +112,6 @@ cc_defaults { "jit/debugger_interface.cc", "jit/jit.cc", "jit/jit_code_cache.cc", - "jit/profile_compilation_info.cc", "jit/profiling_info.cc", "jit/profile_saver.cc", "jni_internal.cc", @@ -471,6 +470,7 @@ art_cc_library { ], shared_libs: [ "libdexfile", + "libprofile", ], export_shared_lib_headers: [ "libdexfile", @@ -495,6 +495,7 @@ art_cc_library { ], shared_libs: [ "libdexfiled", + "libprofiled", ], export_shared_lib_headers: [ "libdexfiled", @@ -579,7 +580,6 @@ art_cc_test { "interpreter/unstarted_runtime_test.cc", "jdwp/jdwp_options_test.cc", "java_vm_ext_test.cc", - "jit/profile_compilation_info_test.cc", "method_handles_test.cc", "mirror/dex_cache_test.cc", "mirror/method_type_test.cc", diff --git a/runtime/arch/arm/entrypoints_init_arm.cc b/runtime/arch/arm/entrypoints_init_arm.cc index 80080e9832..b4e9036084 100644 --- a/runtime/arch/arm/entrypoints_init_arm.cc +++ b/runtime/arch/arm/entrypoints_init_arm.cc @@ -90,30 +90,34 @@ void UpdateReadBarrierEntrypoints(QuickEntryPoints* qpoints, bool is_active) { qpoints->pReadBarrierMarkReg10 = is_active ? art_quick_read_barrier_mark_reg10 : nullptr; qpoints->pReadBarrierMarkReg11 = is_active ? art_quick_read_barrier_mark_reg11 : nullptr; - // For the alignment check, strip the Thumb mode bit. - DCHECK_ALIGNED(reinterpret_cast<intptr_t>(art_quick_read_barrier_mark_introspection) - 1u, 256u); - // Check the field narrow entrypoint offset from the introspection entrypoint. - intptr_t narrow_diff = - reinterpret_cast<intptr_t>(art_quick_read_barrier_mark_introspection_narrow) - - reinterpret_cast<intptr_t>(art_quick_read_barrier_mark_introspection); - DCHECK_EQ(BAKER_MARK_INTROSPECTION_FIELD_LDR_NARROW_ENTRYPOINT_OFFSET, narrow_diff); - // Check array switch cases offsets from the introspection entrypoint. - intptr_t array_diff = - reinterpret_cast<intptr_t>(art_quick_read_barrier_mark_introspection_arrays) - - reinterpret_cast<intptr_t>(art_quick_read_barrier_mark_introspection); - DCHECK_EQ(BAKER_MARK_INTROSPECTION_ARRAY_SWITCH_OFFSET, array_diff); - // Check the GC root entrypoint offsets from the introspection entrypoint. - intptr_t gc_roots_wide_diff = - reinterpret_cast<intptr_t>(art_quick_read_barrier_mark_introspection_gc_roots_wide) - - reinterpret_cast<intptr_t>(art_quick_read_barrier_mark_introspection); - DCHECK_EQ(BAKER_MARK_INTROSPECTION_GC_ROOT_LDR_WIDE_ENTRYPOINT_OFFSET, gc_roots_wide_diff); - intptr_t gc_roots_narrow_diff = - reinterpret_cast<intptr_t>(art_quick_read_barrier_mark_introspection_gc_roots_narrow) - - reinterpret_cast<intptr_t>(art_quick_read_barrier_mark_introspection); - DCHECK_EQ(BAKER_MARK_INTROSPECTION_GC_ROOT_LDR_NARROW_ENTRYPOINT_OFFSET, gc_roots_narrow_diff); - // The register 12, i.e. IP, is reserved, so there is no art_quick_read_barrier_mark_reg12. - // We're using the entry to hold a pointer to the introspection entrypoint instead. - qpoints->pReadBarrierMarkReg12 = is_active ? art_quick_read_barrier_mark_introspection : nullptr; + if (kUseReadBarrier && kUseBakerReadBarrier) { + // For the alignment check, strip the Thumb mode bit. + DCHECK_ALIGNED(reinterpret_cast<intptr_t>(art_quick_read_barrier_mark_introspection) - 1u, + 256u); + // Check the field narrow entrypoint offset from the introspection entrypoint. + intptr_t narrow_diff = + reinterpret_cast<intptr_t>(art_quick_read_barrier_mark_introspection_narrow) - + reinterpret_cast<intptr_t>(art_quick_read_barrier_mark_introspection); + DCHECK_EQ(BAKER_MARK_INTROSPECTION_FIELD_LDR_NARROW_ENTRYPOINT_OFFSET, narrow_diff); + // Check array switch cases offsets from the introspection entrypoint. + intptr_t array_diff = + reinterpret_cast<intptr_t>(art_quick_read_barrier_mark_introspection_arrays) - + reinterpret_cast<intptr_t>(art_quick_read_barrier_mark_introspection); + DCHECK_EQ(BAKER_MARK_INTROSPECTION_ARRAY_SWITCH_OFFSET, array_diff); + // Check the GC root entrypoint offsets from the introspection entrypoint. + intptr_t gc_roots_wide_diff = + reinterpret_cast<intptr_t>(art_quick_read_barrier_mark_introspection_gc_roots_wide) - + reinterpret_cast<intptr_t>(art_quick_read_barrier_mark_introspection); + DCHECK_EQ(BAKER_MARK_INTROSPECTION_GC_ROOT_LDR_WIDE_ENTRYPOINT_OFFSET, gc_roots_wide_diff); + intptr_t gc_roots_narrow_diff = + reinterpret_cast<intptr_t>(art_quick_read_barrier_mark_introspection_gc_roots_narrow) - + reinterpret_cast<intptr_t>(art_quick_read_barrier_mark_introspection); + DCHECK_EQ(BAKER_MARK_INTROSPECTION_GC_ROOT_LDR_NARROW_ENTRYPOINT_OFFSET, gc_roots_narrow_diff); + // The register 12, i.e. IP, is reserved, so there is no art_quick_read_barrier_mark_reg12. + // We're using the entry to hold a pointer to the introspection entrypoint instead. + qpoints->pReadBarrierMarkReg12 = + is_active ? art_quick_read_barrier_mark_introspection : nullptr; + } } void InitEntryPoints(JniEntryPoints* jpoints, QuickEntryPoints* qpoints) { diff --git a/runtime/arch/arm/fault_handler_arm.cc b/runtime/arch/arm/fault_handler_arm.cc index 315bf957cc..bb33a273b8 100644 --- a/runtime/arch/arm/fault_handler_arm.cc +++ b/runtime/arch/arm/fault_handler_arm.cc @@ -20,10 +20,10 @@ #include "art_method.h" #include "base/enums.h" +#include "base/globals.h" #include "base/hex_dump.h" #include "base/logging.h" // For VLOG. #include "base/macros.h" -#include "globals.h" #include "thread-current-inl.h" // diff --git a/runtime/arch/arm/quick_entrypoints_arm.S b/runtime/arch/arm/quick_entrypoints_arm.S index 526960b79d..a930cc494e 100644 --- a/runtime/arch/arm/quick_entrypoints_arm.S +++ b/runtime/arch/arm/quick_entrypoints_arm.S @@ -2610,6 +2610,7 @@ art_quick_read_barrier_mark_introspection_gc_roots\label_suffix: * art_quick_read_barrier_mark_introspection_arrays: // @0x100 * Exactly 128 bytes for array load switch cases (16x2 instructions). */ +#if defined(USE_READ_BARRIER) && defined(USE_BAKER_READ_BARRIER) .balign 512 ENTRY art_quick_read_barrier_mark_introspection // At this point, IP contains the reference, rMR is clobbered by the thunk @@ -2676,6 +2677,11 @@ art_quick_read_barrier_mark_introspection_narrow: art_quick_read_barrier_mark_introspection_arrays: BRBMI_FOR_REGISTERS BRBMI_ARRAY_LOAD, BRBMI_BKPT_FILL_8B END art_quick_read_barrier_mark_introspection +#else // defined(USE_READ_BARRIER) && defined(USE_BAKER_READ_BARRIER) +ENTRY art_quick_read_barrier_mark_introspection + bkpt // Unreachable. +END art_quick_read_barrier_mark_introspection +#endif // defined(USE_READ_BARRIER) && defined(USE_BAKER_READ_BARRIER) .extern artInvokePolymorphic ENTRY art_quick_invoke_polymorphic diff --git a/runtime/arch/arm64/fault_handler_arm64.cc b/runtime/arch/arm64/fault_handler_arm64.cc index d282c8cfc0..e8b4627f86 100644 --- a/runtime/arch/arm64/fault_handler_arm64.cc +++ b/runtime/arch/arm64/fault_handler_arm64.cc @@ -20,10 +20,10 @@ #include "art_method.h" #include "base/enums.h" +#include "base/globals.h" #include "base/hex_dump.h" #include "base/logging.h" // For VLOG. #include "base/macros.h" -#include "globals.h" #include "registers_arm64.h" #include "thread-current-inl.h" diff --git a/runtime/arch/arm64/quick_method_frame_info_arm64.h b/runtime/arch/arm64/quick_method_frame_info_arm64.h index 3e6f6c6e3b..2d2b500ae9 100644 --- a/runtime/arch/arm64/quick_method_frame_info_arm64.h +++ b/runtime/arch/arm64/quick_method_frame_info_arm64.h @@ -21,7 +21,7 @@ #include "base/bit_utils.h" #include "base/callee_save_type.h" #include "base/enums.h" -#include "globals.h" +#include "base/globals.h" #include "quick/quick_method_frame_info.h" #include "registers_arm64.h" diff --git a/runtime/arch/instruction_set.cc b/runtime/arch/instruction_set.cc index ecccdcf7eb..b848eb27fc 100644 --- a/runtime/arch/instruction_set.cc +++ b/runtime/arch/instruction_set.cc @@ -20,7 +20,7 @@ #include "../elf.h" #include "android-base/logging.h" #include "base/bit_utils.h" -#include "globals.h" +#include "base/globals.h" namespace art { diff --git a/runtime/arch/mips/fault_handler_mips.cc b/runtime/arch/mips/fault_handler_mips.cc index f82dc08cb2..d5a9b1589e 100644 --- a/runtime/arch/mips/fault_handler_mips.cc +++ b/runtime/arch/mips/fault_handler_mips.cc @@ -19,10 +19,10 @@ #include "art_method.h" #include "base/callee_save_type.h" +#include "base/globals.h" #include "base/hex_dump.h" #include "base/logging.h" // For VLOG. #include "base/macros.h" -#include "globals.h" #include "quick_method_frame_info_mips.h" #include "registers_mips.h" #include "thread-current-inl.h" diff --git a/runtime/arch/mips/registers_mips.h b/runtime/arch/mips/registers_mips.h index c7f9a3e74e..34f2f9684d 100644 --- a/runtime/arch/mips/registers_mips.h +++ b/runtime/arch/mips/registers_mips.h @@ -21,8 +21,8 @@ #include <android-base/logging.h> +#include "base/globals.h" #include "base/macros.h" -#include "globals.h" namespace art { namespace mips { diff --git a/runtime/arch/mips64/fault_handler_mips64.cc b/runtime/arch/mips64/fault_handler_mips64.cc index ba6fff05ad..695da4794b 100644 --- a/runtime/arch/mips64/fault_handler_mips64.cc +++ b/runtime/arch/mips64/fault_handler_mips64.cc @@ -20,10 +20,10 @@ #include "art_method.h" #include "base/callee_save_type.h" +#include "base/globals.h" #include "base/hex_dump.h" #include "base/logging.h" // For VLOG. #include "base/macros.h" -#include "globals.h" #include "quick_method_frame_info_mips64.h" #include "registers_mips64.h" #include "thread-current-inl.h" diff --git a/runtime/arch/mips64/registers_mips64.h b/runtime/arch/mips64/registers_mips64.h index d3a24b6202..a3fa2ac426 100644 --- a/runtime/arch/mips64/registers_mips64.h +++ b/runtime/arch/mips64/registers_mips64.h @@ -21,8 +21,8 @@ #include <android-base/logging.h> +#include "base/globals.h" #include "base/macros.h" -#include "globals.h" namespace art { namespace mips64 { diff --git a/runtime/arch/x86/fault_handler_x86.cc b/runtime/arch/x86/fault_handler_x86.cc index e6a91247cb..8b243342f9 100644 --- a/runtime/arch/x86/fault_handler_x86.cc +++ b/runtime/arch/x86/fault_handler_x86.cc @@ -20,11 +20,11 @@ #include "art_method.h" #include "base/enums.h" +#include "base/globals.h" #include "base/hex_dump.h" #include "base/logging.h" // For VLOG. #include "base/macros.h" #include "base/safe_copy.h" -#include "globals.h" #include "thread-current-inl.h" #if defined(__APPLE__) diff --git a/runtime/arch/x86/registers_x86.h b/runtime/arch/x86/registers_x86.h index ded3520c76..5a5d226319 100644 --- a/runtime/arch/x86/registers_x86.h +++ b/runtime/arch/x86/registers_x86.h @@ -21,8 +21,8 @@ #include <android-base/logging.h> +#include "base/globals.h" #include "base/macros.h" -#include "globals.h" namespace art { namespace x86 { diff --git a/runtime/arch/x86_64/registers_x86_64.h b/runtime/arch/x86_64/registers_x86_64.h index 4f2243170e..66aea705d2 100644 --- a/runtime/arch/x86_64/registers_x86_64.h +++ b/runtime/arch/x86_64/registers_x86_64.h @@ -21,8 +21,8 @@ #include <android-base/logging.h> +#include "base/globals.h" #include "base/macros.h" -#include "globals.h" namespace art { namespace x86_64 { diff --git a/runtime/arch/x86_64/thread_x86_64.cc b/runtime/arch/x86_64/thread_x86_64.cc index 19d25f6990..5c0446fb4c 100644 --- a/runtime/arch/x86_64/thread_x86_64.cc +++ b/runtime/arch/x86_64/thread_x86_64.cc @@ -25,6 +25,10 @@ #include <asm/prctl.h> #include <sys/prctl.h> #include <sys/syscall.h> +#elif defined(__Fuchsia__) +#include <zircon/process.h> +#include <zircon/syscalls.h> +#include <zircon/syscalls/object.h> #endif namespace art { @@ -40,6 +44,13 @@ void Thread::InitCpu() { #if defined(__linux__) arch_prctl(ARCH_SET_GS, this); +#elif defined(__Fuchsia__) + Thread* thread_ptr = this; + zx_status_t status = zx_object_set_property(zx_thread_self(), + ZX_PROP_REGISTER_GS, + &thread_ptr, + sizeof(thread_ptr)); + CHECK_EQ(status, ZX_OK) << "failed to set GS register"; #else UNIMPLEMENTED(FATAL) << "Need to set GS"; #endif diff --git a/runtime/base/file_utils.cc b/runtime/base/file_utils.cc index 7b0796cf37..7921985b15 100644 --- a/runtime/base/file_utils.cc +++ b/runtime/base/file_utils.cc @@ -43,11 +43,11 @@ #include "android-base/strings.h" #include "base/bit_utils.h" -#include "base/stl_util.h" +#include "base/globals.h" #include "base/os.h" +#include "base/stl_util.h" #include "base/unix_file/fd_file.h" #include "dex/dex_file_loader.h" -#include "globals.h" #if defined(__APPLE__) #include <crt_externs.h> diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc index 3f33f7976e..57c0d9dab2 100644 --- a/runtime/class_linker.cc +++ b/runtime/class_linker.cc @@ -83,7 +83,6 @@ #include "jit/debugger_interface.h" #include "jit/jit.h" #include "jit/jit_code_cache.h" -#include "jit/profile_compilation_info.h" #include "jni_internal.h" #include "linear_alloc.h" #include "mirror/call_site.h" @@ -116,6 +115,7 @@ #include "oat_file_assistant.h" #include "oat_file_manager.h" #include "object_lock.h" +#include "profile/profile_compilation_info.h" #include "runtime.h" #include "runtime_callbacks.h" #include "scoped_thread_state_change-inl.h" diff --git a/runtime/common_runtime_test.h b/runtime/common_runtime_test.h index 83a1f9a58a..186b1cd509 100644 --- a/runtime/common_runtime_test.h +++ b/runtime/common_runtime_test.h @@ -25,12 +25,12 @@ #include <android-base/logging.h> #include "arch/instruction_set.h" +#include "base/globals.h" #include "base/mutex.h" #include "base/os.h" #include "base/unix_file/fd_file.h" #include "dex/art_dex_file_loader.h" #include "dex/compact_dex_level.h" -#include "globals.h" // TODO: Add inl file and avoid including inl. #include "obj_ptr-inl.h" #include "scoped_thread_state_change-inl.h" diff --git a/runtime/dexopt_test.cc b/runtime/dexopt_test.cc index 8f0f9c61dc..f8388f315d 100644 --- a/runtime/dexopt_test.cc +++ b/runtime/dexopt_test.cc @@ -105,7 +105,8 @@ void DexoptTest::GenerateOatForTest(const std::string& dex_location, } // Verify the odex file was generated as expected. - std::unique_ptr<OatFile> odex_file(OatFile::Open(oat_location.c_str(), + std::unique_ptr<OatFile> odex_file(OatFile::Open(/* zip_fd */ -1, + oat_location.c_str(), oat_location.c_str(), nullptr, nullptr, diff --git a/runtime/entrypoints/entrypoint_utils-inl.h b/runtime/entrypoints/entrypoint_utils-inl.h index 270bce2129..137eb4fe1e 100644 --- a/runtime/entrypoints/entrypoint_utils-inl.h +++ b/runtime/entrypoints/entrypoint_utils-inl.h @@ -70,45 +70,41 @@ inline ArtMethod* GetResolvedMethod(ArtMethod* outer_method, } // Find which method did the call in the inlining hierarchy. - ArtMethod* caller = outer_method; - if (inlining_depth != 0) { - caller = GetResolvedMethod(outer_method, - method_info, - inline_info, - encoding, - inlining_depth - 1); - } - - // Lookup the declaring class of the inlined method. - ObjPtr<mirror::DexCache> dex_cache = caller->GetDexCache(); - ArtMethod* inlined_method = dex_cache->GetResolvedMethod(method_index, kRuntimePointerSize); - if (inlined_method != nullptr) { - DCHECK(!inlined_method->IsRuntimeMethod()); - return inlined_method; - } - // TODO: Use ClassLoader::LookupResolvedMethod() instead. - const DexFile* dex_file = dex_cache->GetDexFile(); - const DexFile::MethodId& method_id = dex_file->GetMethodId(method_index); - const char* descriptor = dex_file->StringByTypeIdx(method_id.class_idx_); ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); - Thread* self = Thread::Current(); - mirror::ClassLoader* class_loader = caller->GetDeclaringClass()->GetClassLoader(); - mirror::Class* klass = class_linker->LookupClass(self, descriptor, class_loader); - if (klass == nullptr) { - LOG(FATAL) << "Could not find an inlined method from an .oat file: the class " << descriptor - << " was not found in the class loader of " << caller->PrettyMethod() << ". " - << "This must be due to playing wrongly with class loaders"; - } - - inlined_method = class_linker->FindResolvedMethod(klass, dex_cache, class_loader, method_index); - if (inlined_method == nullptr) { - LOG(FATAL) << "Could not find an inlined method from an .oat file: the class " << descriptor - << " does not have " << dex_file->GetMethodName(method_id) - << dex_file->GetMethodSignature(method_id) << " declared. " - << "This must be due to duplicate classes or playing wrongly with class loaders"; + ArtMethod* method = outer_method; + for (uint32_t depth = 0, end = inlining_depth + 1u; depth != end; ++depth) { + DCHECK(!inline_info.EncodesArtMethodAtDepth(encoding, depth)); + DCHECK_NE(inline_info.GetDexPcAtDepth(encoding, depth), static_cast<uint32_t>(-1)); + method_index = inline_info.GetMethodIndexAtDepth(encoding, method_info, depth); + ArtMethod* inlined_method = class_linker->LookupResolvedMethod(method_index, + method->GetDexCache(), + method->GetClassLoader()); + if (UNLIKELY(inlined_method == nullptr)) { + LOG(FATAL) << "Could not find an inlined method from an .oat file: " + << method->GetDexFile()->PrettyMethod(method_index) << " . " + << "This must be due to duplicate classes or playing wrongly with class loaders"; + UNREACHABLE(); + } + DCHECK(!inlined_method->IsRuntimeMethod()); + if (UNLIKELY(inlined_method->GetDexFile() != method->GetDexFile())) { + // TODO: We could permit inlining within a multi-dex oat file and the boot image, + // even going back from boot image methods to the same oat file. However, this is + // not currently implemented in the compiler. Therefore crossing dex file boundary + // indicates that the inlined definition is not the same as the one used at runtime. + LOG(FATAL) << "Inlined method resolution crossed dex file boundary: from " + << method->PrettyMethod() + << " in " << method->GetDexFile()->GetLocation() << "/" + << static_cast<const void*>(method->GetDexFile()) + << " to " << inlined_method->PrettyMethod() + << " in " << inlined_method->GetDexFile()->GetLocation() << "/" + << static_cast<const void*>(inlined_method->GetDexFile()) << ". " + << "This must be due to duplicate classes or playing wrongly with class loaders"; + UNREACHABLE(); + } + method = inlined_method; } - return inlined_method; + return method; } ALWAYS_INLINE inline mirror::Class* CheckObjectAlloc(mirror::Class* klass, diff --git a/runtime/gc/accounting/bitmap.h b/runtime/gc/accounting/bitmap.h index d039d88770..2d83a8ad2e 100644 --- a/runtime/gc/accounting/bitmap.h +++ b/runtime/gc/accounting/bitmap.h @@ -23,8 +23,8 @@ #include <set> #include <vector> +#include "base/globals.h" #include "base/mutex.h" -#include "globals.h" namespace art { diff --git a/runtime/gc/accounting/card_table.h b/runtime/gc/accounting/card_table.h index 766c976c98..f3548f7ce5 100644 --- a/runtime/gc/accounting/card_table.h +++ b/runtime/gc/accounting/card_table.h @@ -19,8 +19,8 @@ #include <memory> +#include "base/globals.h" #include "base/mutex.h" -#include "globals.h" namespace art { diff --git a/runtime/gc/accounting/mod_union_table.h b/runtime/gc/accounting/mod_union_table.h index 766e0f5d33..7a3c06a281 100644 --- a/runtime/gc/accounting/mod_union_table.h +++ b/runtime/gc/accounting/mod_union_table.h @@ -18,11 +18,11 @@ #define ART_RUNTIME_GC_ACCOUNTING_MOD_UNION_TABLE_H_ #include "base/allocator.h" +#include "base/globals.h" #include "base/safe_map.h" #include "base/tracking_safe_map.h" #include "bitmap.h" #include "card_table.h" -#include "globals.h" #include "mirror/object_reference.h" #include <set> diff --git a/runtime/gc/accounting/read_barrier_table.h b/runtime/gc/accounting/read_barrier_table.h index 57e4db9b2b..4b5a8c61c1 100644 --- a/runtime/gc/accounting/read_barrier_table.h +++ b/runtime/gc/accounting/read_barrier_table.h @@ -20,10 +20,10 @@ #include <sys/mman.h> // For the PROT_* and MAP_* constants. #include "base/bit_utils.h" +#include "base/globals.h" #include "base/mem_map.h" #include "base/mutex.h" #include "gc/space/space.h" -#include "globals.h" namespace art { namespace gc { diff --git a/runtime/gc/accounting/space_bitmap.h b/runtime/gc/accounting/space_bitmap.h index 437aecc2b1..1237f6e8b5 100644 --- a/runtime/gc/accounting/space_bitmap.h +++ b/runtime/gc/accounting/space_bitmap.h @@ -23,8 +23,8 @@ #include <set> #include <vector> +#include "base/globals.h" #include "base/mutex.h" -#include "globals.h" namespace art { diff --git a/runtime/gc/accounting/space_bitmap_test.cc b/runtime/gc/accounting/space_bitmap_test.cc index 1ca3fd6d12..22529b83c2 100644 --- a/runtime/gc/accounting/space_bitmap_test.cc +++ b/runtime/gc/accounting/space_bitmap_test.cc @@ -19,9 +19,9 @@ #include <stdint.h> #include <memory> +#include "base/globals.h" #include "base/mutex.h" #include "common_runtime_test.h" -#include "globals.h" #include "space_bitmap-inl.h" namespace art { diff --git a/runtime/gc/allocator/rosalloc.h b/runtime/gc/allocator/rosalloc.h index 6e5cf0ede8..150fe956ae 100644 --- a/runtime/gc/allocator/rosalloc.h +++ b/runtime/gc/allocator/rosalloc.h @@ -30,8 +30,8 @@ #include "base/allocator.h" #include "base/bit_utils.h" +#include "base/globals.h" #include "base/mutex.h" -#include "globals.h" #include "thread.h" namespace art { diff --git a/runtime/gc/collector/concurrent_copying-inl.h b/runtime/gc/collector/concurrent_copying-inl.h index 6e345fb2f2..b331e975fd 100644 --- a/runtime/gc/collector/concurrent_copying-inl.h +++ b/runtime/gc/collector/concurrent_copying-inl.h @@ -146,8 +146,8 @@ inline mirror::Object* ConcurrentCopying::Mark(mirror::Object* from_ref, return MarkUnevacFromSpaceRegion(from_ref, region_space_bitmap_); default: // The reference is in an unused region. - region_space_->DumpNonFreeRegions(LOG_STREAM(FATAL_WITHOUT_ABORT)); LOG(FATAL_WITHOUT_ABORT) << DumpHeapReference(holder, offset, from_ref); + region_space_->DumpNonFreeRegions(LOG_STREAM(FATAL_WITHOUT_ABORT)); heap_->GetVerification()->LogHeapCorruption(holder, offset, from_ref, /* fatal */ true); UNREACHABLE(); } diff --git a/runtime/gc/gc_cause.cc b/runtime/gc/gc_cause.cc index 508d76535e..ee7ac7dae0 100644 --- a/runtime/gc/gc_cause.cc +++ b/runtime/gc/gc_cause.cc @@ -18,8 +18,8 @@ #include <android-base/logging.h> +#include "base/globals.h" #include "base/macros.h" -#include "globals.h" #include <ostream> diff --git a/runtime/gc/heap.h b/runtime/gc/heap.h index 99ebab9357..609d2ab30e 100644 --- a/runtime/gc/heap.h +++ b/runtime/gc/heap.h @@ -27,6 +27,7 @@ #include "allocator_type.h" #include "arch/instruction_set.h" #include "base/atomic.h" +#include "base/globals.h" #include "base/macros.h" #include "base/mutex.h" #include "base/runtime_debug.h" @@ -37,7 +38,6 @@ #include "gc/collector_type.h" #include "gc/gc_cause.h" #include "gc/space/large_object_space.h" -#include "globals.h" #include "handle.h" #include "obj_ptr.h" #include "offsets.h" diff --git a/runtime/gc/reference_processor.h b/runtime/gc/reference_processor.h index 1d984eb768..c6c78367b0 100644 --- a/runtime/gc/reference_processor.h +++ b/runtime/gc/reference_processor.h @@ -17,8 +17,8 @@ #ifndef ART_RUNTIME_GC_REFERENCE_PROCESSOR_H_ #define ART_RUNTIME_GC_REFERENCE_PROCESSOR_H_ +#include "base/globals.h" #include "base/mutex.h" -#include "globals.h" #include "jni.h" #include "reference_queue.h" diff --git a/runtime/gc/reference_queue.h b/runtime/gc/reference_queue.h index af7788130b..09ab51a045 100644 --- a/runtime/gc/reference_queue.h +++ b/runtime/gc/reference_queue.h @@ -22,9 +22,9 @@ #include <vector> #include "base/atomic.h" +#include "base/globals.h" #include "base/mutex.h" #include "base/timing_logger.h" -#include "globals.h" #include "jni.h" #include "obj_ptr.h" #include "offsets.h" diff --git a/runtime/gc/space/image_space.cc b/runtime/gc/space/image_space.cc index e2154b8e4d..dbe09e8c5b 100644 --- a/runtime/gc/space/image_space.cc +++ b/runtime/gc/space/image_space.cc @@ -1418,7 +1418,8 @@ class ImageSpaceLoader { CHECK(image_header.GetOatDataBegin() != nullptr); - std::unique_ptr<OatFile> oat_file(OatFile::Open(oat_filename, + std::unique_ptr<OatFile> oat_file(OatFile::Open(/* zip_fd */ -1, + oat_filename, oat_filename, image_header.GetOatDataBegin(), image_header.GetOatFileBegin(), diff --git a/runtime/gc/space/image_space_test.cc b/runtime/gc/space/image_space_test.cc index fcc47d45fc..f202a43be9 100644 --- a/runtime/gc/space/image_space_test.cc +++ b/runtime/gc/space/image_space_test.cc @@ -43,7 +43,8 @@ TEST_F(DexoptTest, ValidateOatFile) { args.push_back("--oat-file=" + oat_location); ASSERT_TRUE(OatFileAssistant::Dex2Oat(args, &error_msg)) << error_msg; - std::unique_ptr<OatFile> oat(OatFile::Open(oat_location.c_str(), + std::unique_ptr<OatFile> oat(OatFile::Open(/* zip_fd */ -1, + oat_location.c_str(), oat_location.c_str(), nullptr, nullptr, diff --git a/runtime/gc/space/space.h b/runtime/gc/space/space.h index d888935ff2..4f43d9f5c5 100644 --- a/runtime/gc/space/space.h +++ b/runtime/gc/space/space.h @@ -21,12 +21,12 @@ #include <string> #include "base/atomic.h" +#include "base/globals.h" #include "base/macros.h" #include "base/mem_map.h" #include "base/mutex.h" #include "gc/accounting/space_bitmap.h" #include "gc/collector/object_byte_pair.h" -#include "globals.h" namespace art { namespace mirror { diff --git a/runtime/gc/space/space_test.h b/runtime/gc/space/space_test.h index 1fe3fb2e86..d5861ed5d8 100644 --- a/runtime/gc/space/space_test.h +++ b/runtime/gc/space/space_test.h @@ -20,8 +20,8 @@ #include <stdint.h> #include <memory> +#include "base/globals.h" #include "common_runtime_test.h" -#include "globals.h" #include "mirror/array-inl.h" #include "mirror/class-inl.h" #include "mirror/class_loader.h" diff --git a/runtime/gc/task_processor.h b/runtime/gc/task_processor.h index f6b5607037..6db3c37689 100644 --- a/runtime/gc/task_processor.h +++ b/runtime/gc/task_processor.h @@ -20,8 +20,8 @@ #include <memory> #include <set> +#include "base/globals.h" #include "base/mutex.h" -#include "globals.h" #include "thread_pool.h" namespace art { diff --git a/runtime/globals.h b/runtime/globals.h deleted file mode 100644 index bdc2177c7c..0000000000 --- a/runtime/globals.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ART_RUNTIME_GLOBALS_H_ -#define ART_RUNTIME_GLOBALS_H_ - -// TODO: remove this file in favor of libartbase/base/globals.h -#include "base/globals.h" - -#endif // ART_RUNTIME_GLOBALS_H_ diff --git a/runtime/hprof/hprof.cc b/runtime/hprof/hprof.cc index aa716f12ac..3b6487449b 100644 --- a/runtime/hprof/hprof.cc +++ b/runtime/hprof/hprof.cc @@ -42,6 +42,7 @@ #include "art_field-inl.h" #include "art_method-inl.h" #include "base/array_ref.h" +#include "base/globals.h" #include "base/macros.h" #include "base/mutex.h" #include "base/os.h" @@ -59,7 +60,6 @@ #include "gc/scoped_gc_critical_section.h" #include "gc/space/space.h" #include "gc_root.h" -#include "globals.h" #include "jdwp/jdwp.h" #include "jdwp/jdwp_priv.h" #include "mirror/class-inl.h" diff --git a/runtime/image.h b/runtime/image.h index fe544cc44b..8acd5bc4c4 100644 --- a/runtime/image.h +++ b/runtime/image.h @@ -20,7 +20,7 @@ #include <string.h> #include "base/enums.h" -#include "globals.h" +#include "base/globals.h" #include "mirror/object.h" namespace art { diff --git a/runtime/jit/jit.cc b/runtime/jit/jit.cc index 813430f0bb..d20f760c17 100644 --- a/runtime/jit/jit.cc +++ b/runtime/jit/jit.cc @@ -31,7 +31,7 @@ #include "jit_code_cache.h" #include "oat_file_manager.h" #include "oat_quick_method_header.h" -#include "profile_compilation_info.h" +#include "profile/profile_compilation_info.h" #include "profile_saver.h" #include "runtime.h" #include "runtime_options.h" diff --git a/runtime/jit/jit_code_cache.cc b/runtime/jit/jit_code_cache.cc index 6dcc87179b..1c8c26cf5d 100644 --- a/runtime/jit/jit_code_cache.cc +++ b/runtime/jit/jit_code_cache.cc @@ -41,7 +41,7 @@ #include "oat_file-inl.h" #include "oat_quick_method_header.h" #include "object_callbacks.h" -#include "profile_compilation_info.h" +#include "profile/profile_compilation_info.h" #include "scoped_thread_state_change-inl.h" #include "stack.h" #include "thread-current-inl.h" diff --git a/runtime/jit/profile_saver.cc b/runtime/jit/profile_saver.cc index 53f48644f2..618fde8f00 100644 --- a/runtime/jit/profile_saver.cc +++ b/runtime/jit/profile_saver.cc @@ -37,8 +37,9 @@ #include "gc/collector_type.h" #include "gc/gc_cause.h" #include "gc/scoped_gc_critical_section.h" -#include "jit/profile_compilation_info.h" +#include "jit/profiling_info.h" #include "oat_file_manager.h" +#include "profile/profile_compilation_info.h" #include "scoped_thread_state_change-inl.h" namespace art { @@ -46,6 +47,10 @@ namespace art { ProfileSaver* ProfileSaver::instance_ = nullptr; pthread_t ProfileSaver::profiler_pthread_ = 0U; +static_assert(ProfileCompilationInfo::kIndividualInlineCacheSize == + InlineCache::kIndividualCacheSize, + "InlineCache and ProfileCompilationInfo do not agree on kIndividualCacheSize"); + // At what priority to schedule the saver threads. 9 is the lowest foreground priority on device. static constexpr int kProfileSaverPthreadPriority = 9; diff --git a/runtime/jit/profile_saver.h b/runtime/jit/profile_saver.h index afbb3c122d..02c8cd1474 100644 --- a/runtime/jit/profile_saver.h +++ b/runtime/jit/profile_saver.h @@ -21,7 +21,7 @@ #include "base/safe_map.h" #include "dex/method_reference.h" #include "jit_code_cache.h" -#include "profile_compilation_info.h" +#include "profile/profile_compilation_info.h" #include "profile_saver_options.h" namespace art { diff --git a/runtime/mirror/dex_cache.cc b/runtime/mirror/dex_cache.cc index eb4db00ccd..661f954ef5 100644 --- a/runtime/mirror/dex_cache.cc +++ b/runtime/mirror/dex_cache.cc @@ -17,10 +17,10 @@ #include "dex_cache-inl.h" #include "art_method-inl.h" +#include "base/globals.h" #include "class_linker.h" #include "gc/accounting/card_table-inl.h" #include "gc/heap.h" -#include "globals.h" #include "linear_alloc.h" #include "oat_file.h" #include "object-inl.h" diff --git a/runtime/mirror/object.h b/runtime/mirror/object.h index d00c90bcc0..82045c7b66 100644 --- a/runtime/mirror/object.h +++ b/runtime/mirror/object.h @@ -20,7 +20,7 @@ #include "base/atomic.h" #include "base/casts.h" #include "base/enums.h" -#include "globals.h" +#include "base/globals.h" #include "obj_ptr.h" #include "object_reference.h" #include "offsets.h" diff --git a/runtime/mirror/object_reference.h b/runtime/mirror/object_reference.h index 356fef0d26..77154e2cda 100644 --- a/runtime/mirror/object_reference.h +++ b/runtime/mirror/object_reference.h @@ -18,8 +18,8 @@ #define ART_RUNTIME_MIRROR_OBJECT_REFERENCE_H_ #include "base/atomic.h" +#include "base/globals.h" #include "base/mutex.h" // For Locks::mutator_lock_. -#include "globals.h" #include "heap_poisoning.h" #include "obj_ptr.h" diff --git a/runtime/oat_file.cc b/runtime/oat_file.cc index c7a558cc94..371678d4d9 100644 --- a/runtime/oat_file.cc +++ b/runtime/oat_file.cc @@ -97,7 +97,8 @@ class OatFileBase : public OatFile { virtual ~OatFileBase() {} template <typename kOatFileBaseSubType> - static OatFileBase* OpenOatFile(const std::string& vdex_filename, + static OatFileBase* OpenOatFile(int zip_fd, + const std::string& vdex_filename, const std::string& elf_filename, const std::string& location, uint8_t* requested_base, @@ -109,7 +110,8 @@ class OatFileBase : public OatFile { std::string* error_msg); template <typename kOatFileBaseSubType> - static OatFileBase* OpenOatFile(int vdex_fd, + static OatFileBase* OpenOatFile(int zip_fd, + int vdex_fd, int oat_fd, const std::string& vdex_filename, const std::string& oat_filename, @@ -160,7 +162,7 @@ class OatFileBase : public OatFile { virtual void PreSetup(const std::string& elf_filename) = 0; - bool Setup(const char* abs_dex_location, std::string* error_msg); + bool Setup(int zip_fd, const char* abs_dex_location, std::string* error_msg); // Setters exposed for ElfOatFile. @@ -181,7 +183,8 @@ class OatFileBase : public OatFile { }; template <typename kOatFileBaseSubType> -OatFileBase* OatFileBase::OpenOatFile(const std::string& vdex_filename, +OatFileBase* OatFileBase::OpenOatFile(int zip_fd, + const std::string& vdex_filename, const std::string& elf_filename, const std::string& location, uint8_t* requested_base, @@ -214,7 +217,7 @@ OatFileBase* OatFileBase::OpenOatFile(const std::string& vdex_filename, ret->PreSetup(elf_filename); - if (!ret->Setup(abs_dex_location, error_msg)) { + if (!ret->Setup(zip_fd, abs_dex_location, error_msg)) { return nullptr; } @@ -222,7 +225,8 @@ OatFileBase* OatFileBase::OpenOatFile(const std::string& vdex_filename, } template <typename kOatFileBaseSubType> -OatFileBase* OatFileBase::OpenOatFile(int vdex_fd, +OatFileBase* OatFileBase::OpenOatFile(int zip_fd, + int vdex_fd, int oat_fd, const std::string& vdex_location, const std::string& oat_location, @@ -254,7 +258,7 @@ OatFileBase* OatFileBase::OpenOatFile(int vdex_fd, ret->PreSetup(oat_location); - if (!ret->Setup(abs_dex_location, error_msg)) { + if (!ret->Setup(zip_fd, abs_dex_location, error_msg)) { return nullptr; } @@ -485,7 +489,7 @@ static void DCheckIndexToBssMapping(OatFile* oat_file, } } -bool OatFileBase::Setup(const char* abs_dex_location, std::string* error_msg) { +bool OatFileBase::Setup(int zip_fd, const char* abs_dex_location, std::string* error_msg) { if (!GetOatHeader().IsValid()) { std::string cause = GetOatHeader().GetValidationErrorMessage(); *error_msg = StringPrintf("Invalid oat header for '%s': %s", @@ -641,12 +645,23 @@ bool OatFileBase::Setup(const char* abs_dex_location, std::string* error_msg) { uncompressed_dex_files_.reset(new std::vector<std::unique_ptr<const DexFile>>()); // No dex files, load it from location. const ArtDexFileLoader dex_file_loader; - if (!dex_file_loader.Open(dex_file_location.c_str(), - dex_file_location, - /* verify */ false, - /* verify_checksum */ false, - error_msg, - uncompressed_dex_files_.get())) { + bool loaded = false; + if (zip_fd != -1) { + loaded = dex_file_loader.OpenZip(zip_fd, + dex_file_location, + /* verify */ false, + /* verify_checksum */ false, + error_msg, + uncompressed_dex_files_.get()); + } else { + loaded = dex_file_loader.Open(dex_file_location.c_str(), + dex_file_location, + /* verify */ false, + /* verify_checksum */ false, + error_msg, + uncompressed_dex_files_.get()); + } + if (!loaded) { if (Runtime::Current() == nullptr) { // If there's no runtime, we're running oatdump, so return // a half constructed oat file that oatdump knows how to deal with. @@ -1144,7 +1159,8 @@ class ElfOatFile FINAL : public OatFileBase { public: ElfOatFile(const std::string& filename, bool executable) : OatFileBase(filename, executable) {} - static ElfOatFile* OpenElfFile(File* file, + static ElfOatFile* OpenElfFile(int zip_fd, + File* file, const std::string& location, uint8_t* requested_base, uint8_t* oat_file_begin, // Override base if not null @@ -1154,7 +1170,8 @@ class ElfOatFile FINAL : public OatFileBase { const char* abs_dex_location, std::string* error_msg); - bool InitializeFromElfFile(ElfFile* elf_file, + bool InitializeFromElfFile(int zip_fd, + ElfFile* elf_file, VdexFile* vdex_file, const char* abs_dex_location, std::string* error_msg); @@ -1204,7 +1221,8 @@ class ElfOatFile FINAL : public OatFileBase { DISALLOW_COPY_AND_ASSIGN(ElfOatFile); }; -ElfOatFile* ElfOatFile::OpenElfFile(File* file, +ElfOatFile* ElfOatFile::OpenElfFile(int zip_fd, + File* file, const std::string& location, uint8_t* requested_base, uint8_t* oat_file_begin, // Override base if not null @@ -1231,14 +1249,15 @@ ElfOatFile* ElfOatFile::OpenElfFile(File* file, return nullptr; } - if (!oat_file->Setup(abs_dex_location, error_msg)) { + if (!oat_file->Setup(zip_fd, abs_dex_location, error_msg)) { return nullptr; } return oat_file.release(); } -bool ElfOatFile::InitializeFromElfFile(ElfFile* elf_file, +bool ElfOatFile::InitializeFromElfFile(int zip_fd, + ElfFile* elf_file, VdexFile* vdex_file, const char* abs_dex_location, std::string* error_msg) { @@ -1255,7 +1274,7 @@ bool ElfOatFile::InitializeFromElfFile(ElfFile* elf_file, SetBegin(elf_file->Begin() + offset); SetEnd(elf_file->Begin() + size + offset); // Ignore the optional .bss section when opening non-executable. - return Setup(abs_dex_location, error_msg); + return Setup(zip_fd, abs_dex_location, error_msg); } bool ElfOatFile::Load(const std::string& elf_filename, @@ -1356,18 +1375,20 @@ static void CheckLocation(const std::string& location) { CHECK(!location.empty()); } -OatFile* OatFile::OpenWithElfFile(ElfFile* elf_file, +OatFile* OatFile::OpenWithElfFile(int zip_fd, + ElfFile* elf_file, VdexFile* vdex_file, const std::string& location, const char* abs_dex_location, std::string* error_msg) { std::unique_ptr<ElfOatFile> oat_file(new ElfOatFile(location, false /* executable */)); - return oat_file->InitializeFromElfFile(elf_file, vdex_file, abs_dex_location, error_msg) + return oat_file->InitializeFromElfFile(zip_fd, elf_file, vdex_file, abs_dex_location, error_msg) ? oat_file.release() : nullptr; } -OatFile* OatFile::Open(const std::string& oat_filename, +OatFile* OatFile::Open(int zip_fd, + const std::string& oat_filename, const std::string& oat_location, uint8_t* requested_base, uint8_t* oat_file_begin, @@ -1392,7 +1413,8 @@ OatFile* OatFile::Open(const std::string& oat_filename, // Try dlopen first, as it is required for native debuggability. This will fail fast if dlopen is // disabled. - OatFile* with_dlopen = OatFileBase::OpenOatFile<DlOpenOatFile>(vdex_filename, + OatFile* with_dlopen = OatFileBase::OpenOatFile<DlOpenOatFile>(zip_fd, + vdex_filename, oat_filename, oat_location, requested_base, @@ -1421,7 +1443,8 @@ OatFile* OatFile::Open(const std::string& oat_filename, // // Another independent reason is the absolute placement of boot.oat. dlopen on the host usually // does honor the virtual address encoded in the ELF file only for ET_EXEC files, not ET_DYN. - OatFile* with_internal = OatFileBase::OpenOatFile<ElfOatFile>(vdex_filename, + OatFile* with_internal = OatFileBase::OpenOatFile<ElfOatFile>(zip_fd, + vdex_filename, oat_filename, oat_location, requested_base, @@ -1434,7 +1457,8 @@ OatFile* OatFile::Open(const std::string& oat_filename, return with_internal; } -OatFile* OatFile::Open(int vdex_fd, +OatFile* OatFile::Open(int zip_fd, + int vdex_fd, int oat_fd, const std::string& oat_location, uint8_t* requested_base, @@ -1447,7 +1471,8 @@ OatFile* OatFile::Open(int vdex_fd, std::string vdex_location = GetVdexFilename(oat_location); - OatFile* with_internal = OatFileBase::OpenOatFile<ElfOatFile>(vdex_fd, + OatFile* with_internal = OatFileBase::OpenOatFile<ElfOatFile>(zip_fd, + vdex_fd, oat_fd, vdex_location, oat_location, @@ -1461,12 +1486,14 @@ OatFile* OatFile::Open(int vdex_fd, return with_internal; } -OatFile* OatFile::OpenWritable(File* file, +OatFile* OatFile::OpenWritable(int zip_fd, + File* file, const std::string& location, const char* abs_dex_location, std::string* error_msg) { CheckLocation(location); - return ElfOatFile::OpenElfFile(file, + return ElfOatFile::OpenElfFile(zip_fd, + file, location, nullptr, nullptr, @@ -1477,12 +1504,14 @@ OatFile* OatFile::OpenWritable(File* file, error_msg); } -OatFile* OatFile::OpenReadable(File* file, +OatFile* OatFile::OpenReadable(int zip_fd, + File* file, const std::string& location, const char* abs_dex_location, std::string* error_msg) { CheckLocation(location); - return ElfOatFile::OpenElfFile(file, + return ElfOatFile::OpenElfFile(zip_fd, + file, location, nullptr, nullptr, diff --git a/runtime/oat_file.h b/runtime/oat_file.h index 6494b4c58e..8e18cee729 100644 --- a/runtime/oat_file.h +++ b/runtime/oat_file.h @@ -74,7 +74,8 @@ class OatFile { // Opens an oat file contained within the given elf file. This is always opened as // non-executable at the moment. - static OatFile* OpenWithElfFile(ElfFile* elf_file, + static OatFile* OpenWithElfFile(int zip_fd, + ElfFile* elf_file, VdexFile* vdex_file, const std::string& location, const char* abs_dex_location, @@ -83,7 +84,8 @@ class OatFile { // optionally be used to request where the file should be loaded. // See the ResolveRelativeEncodedDexLocation for a description of how the // abs_dex_location argument is used. - static OatFile* Open(const std::string& filename, + static OatFile* Open(int zip_fd, + const std::string& filename, const std::string& location, uint8_t* requested_base, uint8_t* oat_file_begin, @@ -93,8 +95,10 @@ class OatFile { std::string* error_msg); // Similar to OatFile::Open(const std::string...), but accepts input vdex and - // odex files as file descriptors. - static OatFile* Open(int vdex_fd, + // odex files as file descriptors. We also take zip_fd in case the vdex does not + // contain the dex code, and we need to read it from the zip file. + static OatFile* Open(int zip_fd, + int vdex_fd, int oat_fd, const std::string& oat_location, uint8_t* requested_base, @@ -109,11 +113,15 @@ class OatFile { // where relocations may be required. Currently used from // ImageWriter which wants to open a writable version from an existing // file descriptor for patching. - static OatFile* OpenWritable(File* file, const std::string& location, + static OatFile* OpenWritable(int zip_fd, + File* file, + const std::string& location, const char* abs_dex_location, std::string* error_msg); // Open an oat file from an already opened File. Maps it PROT_READ, MAP_PRIVATE. - static OatFile* OpenReadable(File* file, const std::string& location, + static OatFile* OpenReadable(int zip_fd, + File* file, + const std::string& location, const char* abs_dex_location, std::string* error_msg); diff --git a/runtime/oat_file_assistant.cc b/runtime/oat_file_assistant.cc index 718f9176e9..9c8b6512a7 100644 --- a/runtime/oat_file_assistant.cc +++ b/runtime/oat_file_assistant.cc @@ -118,7 +118,7 @@ OatFileAssistant::OatFileAssistant(const char* dex_location, std::string error_msg; std::string odex_file_name; if (DexLocationToOdexFilename(dex_location_, isa_, &odex_file_name, &error_msg)) { - odex_.Reset(odex_file_name, UseFdToReadFiles(), vdex_fd, oat_fd); + odex_.Reset(odex_file_name, UseFdToReadFiles(), zip_fd, vdex_fd, oat_fd); } else { LOG(WARNING) << "Failed to determine odex file name: " << error_msg; } @@ -1148,7 +1148,8 @@ const OatFile* OatFileAssistant::OatFileInfo::GetFile() { std::string error_msg; if (use_fd_) { if (oat_fd_ >= 0 && vdex_fd_ >= 0) { - file_.reset(OatFile::Open(vdex_fd_, + file_.reset(OatFile::Open(zip_fd_, + vdex_fd_, oat_fd_, filename_.c_str(), nullptr, @@ -1159,7 +1160,8 @@ const OatFile* OatFileAssistant::OatFileInfo::GetFile() { &error_msg)); } } else { - file_.reset(OatFile::Open(filename_.c_str(), + file_.reset(OatFile::Open(/* zip_fd */ -1, + filename_.c_str(), filename_.c_str(), nullptr, nullptr, @@ -1235,11 +1237,15 @@ void OatFileAssistant::OatFileInfo::Reset() { status_attempted_ = false; } -void OatFileAssistant::OatFileInfo::Reset(const std::string& filename, bool use_fd, int vdex_fd, +void OatFileAssistant::OatFileInfo::Reset(const std::string& filename, + bool use_fd, + int zip_fd, + int vdex_fd, int oat_fd) { filename_provided_ = true; filename_ = filename; use_fd_ = use_fd; + zip_fd_ = zip_fd; vdex_fd_ = vdex_fd; oat_fd_ = oat_fd; Reset(); diff --git a/runtime/oat_file_assistant.h b/runtime/oat_file_assistant.h index 8d6ec0014a..a6d0961835 100644 --- a/runtime/oat_file_assistant.h +++ b/runtime/oat_file_assistant.h @@ -378,7 +378,11 @@ class OatFileAssistant { // Clear any cached information and switch to getting info about the oat // file with the given filename. - void Reset(const std::string& filename, bool use_fd, int vdex_fd = -1, int oat_fd = -1); + void Reset(const std::string& filename, + bool use_fd, + int zip_fd = -1, + int vdex_fd = -1, + int oat_fd = -1); // Release the loaded oat file for runtime use. // Returns null if the oat file hasn't been loaded or is out of date. @@ -415,6 +419,7 @@ class OatFileAssistant { bool filename_provided_ = false; std::string filename_; + int zip_fd_ = -1; int oat_fd_ = -1; int vdex_fd_ = -1; bool use_fd_ = false; diff --git a/runtime/oat_file_test.cc b/runtime/oat_file_test.cc index 89812f370f..12dfe20d56 100644 --- a/runtime/oat_file_test.cc +++ b/runtime/oat_file_test.cc @@ -74,7 +74,8 @@ TEST_F(OatFileTest, LoadOat) { std::string error_msg; ASSERT_TRUE(OatFileAssistant::DexLocationToOatFilename( dex_location, kRuntimeISA, &oat_location, &error_msg)) << error_msg; - std::unique_ptr<OatFile> odex_file(OatFile::Open(oat_location.c_str(), + std::unique_ptr<OatFile> odex_file(OatFile::Open(/* zip_fd */ -1, + oat_location.c_str(), oat_location.c_str(), nullptr, nullptr, @@ -101,7 +102,8 @@ TEST_F(OatFileTest, ChangingMultiDexUncompressed) { // Ensure we can load that file. Just a precondition. { - std::unique_ptr<OatFile> odex_file(OatFile::Open(oat_location.c_str(), + std::unique_ptr<OatFile> odex_file(OatFile::Open(/* zip_fd */ -1, + oat_location.c_str(), oat_location.c_str(), nullptr, nullptr, @@ -117,7 +119,8 @@ TEST_F(OatFileTest, ChangingMultiDexUncompressed) { Copy(GetTestDexFileName("MainUncompressed"), dex_location); // And try to load again. - std::unique_ptr<OatFile> odex_file(OatFile::Open(oat_location.c_str(), + std::unique_ptr<OatFile> odex_file(OatFile::Open(/* zip_fd */ -1, + oat_location.c_str(), oat_location.c_str(), nullptr, nullptr, diff --git a/runtime/obj_ptr.h b/runtime/obj_ptr.h index 14fdba31d9..e421d878ff 100644 --- a/runtime/obj_ptr.h +++ b/runtime/obj_ptr.h @@ -20,9 +20,9 @@ #include <ostream> #include <type_traits> +#include "base/globals.h" #include "base/macros.h" #include "base/mutex.h" // For Locks::mutator_lock_. -#include "globals.h" namespace art { diff --git a/runtime/offsets.h b/runtime/offsets.h index aaf5c0c120..4df9b27f61 100644 --- a/runtime/offsets.h +++ b/runtime/offsets.h @@ -20,7 +20,7 @@ #include <ostream> #include "base/enums.h" -#include "globals.h" +#include "base/globals.h" namespace art { diff --git a/runtime/parsed_options.h b/runtime/parsed_options.h index 0f8555a829..8c77d39f7b 100644 --- a/runtime/parsed_options.h +++ b/runtime/parsed_options.h @@ -23,9 +23,9 @@ #include <jni.h> #include "arch/instruction_set.h" +#include "base/globals.h" #include "gc/collector_type.h" #include "gc/space/large_object_space.h" -#include "globals.h" // #include "jit/profile_saver_options.h" #include "runtime_options.h" diff --git a/runtime/runtime.cc b/runtime/runtime.cc index 8f5295cec6..d12a976be8 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -1002,7 +1002,8 @@ static bool OpenDexFilesFromImage(const std::string& image_location, return false; } std::unique_ptr<const OatFile> oat_file( - OatFile::OpenWithElfFile(elf_file.release(), + OatFile::OpenWithElfFile(/* zip_fd */ -1, + elf_file.release(), vdex_file.release(), oat_location, nullptr, diff --git a/runtime/thread.h b/runtime/thread.h index 22b77eea64..3ec050a5eb 100644 --- a/runtime/thread.h +++ b/runtime/thread.h @@ -30,11 +30,11 @@ #include "arch/instruction_set.h" #include "base/atomic.h" #include "base/enums.h" +#include "base/globals.h" #include "base/macros.h" #include "base/mutex.h" #include "entrypoints/jni/jni_entrypoints.h" #include "entrypoints/quick/quick_entrypoints.h" -#include "globals.h" #include "handle_scope.h" #include "instrumentation.h" #include "jvalue.h" diff --git a/runtime/trace.h b/runtime/trace.h index b242d1596c..1fae250d77 100644 --- a/runtime/trace.h +++ b/runtime/trace.h @@ -27,10 +27,10 @@ #include <vector> #include "base/atomic.h" +#include "base/globals.h" #include "base/macros.h" #include "base/os.h" #include "base/safe_map.h" -#include "globals.h" #include "instrumentation.h" namespace unix_file { diff --git a/runtime/utils/dex_cache_arrays_layout-inl.h b/runtime/utils/dex_cache_arrays_layout-inl.h index 68a5760f7e..c0ea6be5a3 100644 --- a/runtime/utils/dex_cache_arrays_layout-inl.h +++ b/runtime/utils/dex_cache_arrays_layout-inl.h @@ -22,9 +22,9 @@ #include <android-base/logging.h> #include "base/bit_utils.h" +#include "base/globals.h" #include "dex/primitive.h" #include "gc_root.h" -#include "globals.h" #include "mirror/dex_cache.h" namespace art { diff --git a/runtime/verify_object.cc b/runtime/verify_object.cc index a031a07a94..70ca13f913 100644 --- a/runtime/verify_object.cc +++ b/runtime/verify_object.cc @@ -17,8 +17,8 @@ #include "verify_object-inl.h" #include "base/bit_utils.h" +#include "base/globals.h" #include "gc/heap.h" -#include "globals.h" #include "mirror/object-inl.h" #include "obj_ptr-inl.h" #include "runtime.h" diff --git a/simulator/code_simulator_container.cc b/simulator/code_simulator_container.cc index 9f52b320f2..3206bc7844 100644 --- a/simulator/code_simulator_container.cc +++ b/simulator/code_simulator_container.cc @@ -18,9 +18,9 @@ #include "code_simulator_container.h" +#include "base/globals.h" #include "base/logging.h" // For VLOG. #include "code_simulator.h" -#include "globals.h" namespace art { diff --git a/test/1935-get-set-current-frame-jit/src/Main.java b/test/1935-get-set-current-frame-jit/src/Main.java index 70e94c439f..97f0973823 100644 --- a/test/1935-get-set-current-frame-jit/src/Main.java +++ b/test/1935-get-set-current-frame-jit/src/Main.java @@ -58,6 +58,10 @@ public class Main { } public void run() { int TARGET = 42; + if (hasJit() && expectOsr && !Main.isInterpreted()) { + System.out.println("Unexpectedly in jit code prior to restarting the JIT!"); + } + startJit(); // We will suspend the thread during this loop. while (continueBusyLoop) { inBusyLoop = true; @@ -91,7 +95,9 @@ public class Main { public static void runGet() throws Exception { Method target = IntRunner.class.getDeclaredMethod("run"); - // Get Int + // Stop jit temporarily. It will be restarted by the test itself. + stopJit(); + // Get Int. IntRunner int_runner = new IntRunner(true); Thread target_get = new Thread(int_runner, "GetLocalInt - Target"); target_get.start(); @@ -121,7 +127,9 @@ public class Main { public static void runSet() throws Exception { Method target = IntRunner.class.getDeclaredMethod("run"); - // Set Int + // Stop jit temporarily. It will be restarted by the test itself. + stopJit(); + // Set Int. Even if we start out in JIT code somehow we should be pushed out of it. IntRunner int_runner = new IntRunner(false); Thread target_set = new Thread(int_runner, "SetLocalInt - Target"); target_set.start(); @@ -173,5 +181,7 @@ public class Main { public static native boolean isInterpreted(); public static native boolean isInOsrCode(String methodName); + public static native boolean stopJit(); + public static native boolean startJit(); public static native boolean hasJit(); } diff --git a/test/1940-ddms-ext/expected.txt b/test/1940-ddms-ext/expected.txt index 1a457a01a5..5af111676b 100644 --- a/test/1940-ddms-ext/expected.txt +++ b/test/1940-ddms-ext/expected.txt @@ -16,6 +16,10 @@ JVMTI returned chunk: Chunk(Type: 0xFADE7357, Len: 0, data: []) Sending data [1] to chunk handler 305419896 MyDdmHandler: Chunk received: Chunk(Type: 0x12345678, Len: 1, data: [1]) Got error: JVMTI_ERROR_INTERNAL +threadNotify started! +Target thread started! +Target thread finished! +threadNotify Disabled! Saw expected thread events. Expected chunk type published: 1213221190 Expected chunk type published: 1297109829 diff --git a/test/1940-ddms-ext/src-art/art/Test1940.java b/test/1940-ddms-ext/src-art/art/Test1940.java index 226fe350bd..2957f632ba 100644 --- a/test/1940-ddms-ext/src-art/art/Test1940.java +++ b/test/1940-ddms-ext/src-art/art/Test1940.java @@ -178,10 +178,14 @@ public class Test1940 { } }; DdmVmInternal.threadNotify(true); + System.out.println("threadNotify started!"); final Thread thr = new Thread(() -> { return; }, "THREAD"); thr.start(); + System.out.println("Target thread started!"); thr.join(); + System.out.println("Target thread finished!"); DdmVmInternal.threadNotify(false); + System.out.println("threadNotify Disabled!"); // Make sure we saw at least one of Thread-create, Thread name, & thread death. if (!types_seen[0] || !types_seen[1] || !types_seen[2]) { System.out.println("Didn't see expected chunks for thread creation! got: " + diff --git a/test/305-other-fault-handler/fault_handler.cc b/test/305-other-fault-handler/fault_handler.cc index a0831ca8c2..211d142a2b 100644 --- a/test/305-other-fault-handler/fault_handler.cc +++ b/test/305-other-fault-handler/fault_handler.cc @@ -23,9 +23,9 @@ #include <stdint.h> #include <sys/mman.h> +#include "base/globals.h" #include "base/mem_map.h" #include "fault_handler.h" -#include "globals.h" namespace art { diff --git a/test/442-checker-constant-folding/src/Main.java b/test/442-checker-constant-folding/src/Main.java index 95c19eaabc..fcc3c1a852 100644 --- a/test/442-checker-constant-folding/src/Main.java +++ b/test/442-checker-constant-folding/src/Main.java @@ -991,15 +991,23 @@ public class Main { /// CHECK-START: int Main.StaticConditionNulls() constant_folding$after_inlining (before) /// CHECK-DAG: <<Null:l\d+>> NullConstant /// CHECK-DAG: <<Cond:z\d+>> NotEqual [<<Null>>,<<Null>>] - /// CHECK-DAG: Select [{{i\d+}},{{i\d+}},<<Cond>>] + /// CHECK-DAG: If [<<Cond>>] /// CHECK-START: int Main.StaticConditionNulls() constant_folding$after_inlining (after) /// CHECK-DAG: <<Const0:i\d+>> IntConstant 0 - /// CHECK-DAG: Select [{{i\d+}},{{i\d+}},<<Const0>>] + /// CHECK-DAG: If [<<Const0>>] /// CHECK-START: int Main.StaticConditionNulls() constant_folding$after_inlining (after) /// CHECK-NOT: NotEqual + /// CHECK-START: int Main.StaticConditionNulls() dead_code_elimination$after_inlining (before) + /// CHECK-DAG: <<Phi:i\d+>> Phi + /// CHECK-DAG: Return [<<Phi>>] + // + /// CHECK-START: int Main.StaticConditionNulls() dead_code_elimination$after_inlining (after) + /// CHECK-DAG: <<Const5:i\d+>> IntConstant 5 + /// CHECK-DAG: Return [<<Const5>>] + private static Object getNull() { return null; } diff --git a/test/458-checker-instruct-simplification/src/Main.java b/test/458-checker-instruct-simplification/src/Main.java index 444b4557ce..b24cfcb775 100644 --- a/test/458-checker-instruct-simplification/src/Main.java +++ b/test/458-checker-instruct-simplification/src/Main.java @@ -882,7 +882,7 @@ public class Main { /// CHECK-NOT: Neg /// CHECK-NOT: Add - /// CHECK-START: int Main.$noinline$NegNeg2(int) constant_folding$after_inlining (after) + /// CHECK-START: int Main.$noinline$NegNeg2(int) constant_folding$after_gvn (after) /// CHECK: <<Const0:i\d+>> IntConstant 0 /// CHECK-NOT: Neg /// CHECK-NOT: Add @@ -1128,17 +1128,19 @@ public class Main { return res; } - /// CHECK-START: boolean Main.$noinline$EqualBoolVsIntConst(boolean) instruction_simplifier$after_inlining (before) + /// CHECK-START: boolean Main.$noinline$EqualBoolVsIntConst(boolean) dead_code_elimination$after_inlining (before) /// CHECK-DAG: <<Arg:z\d+>> ParameterValue /// CHECK-DAG: <<Const0:i\d+>> IntConstant 0 /// CHECK-DAG: <<Const1:i\d+>> IntConstant 1 /// CHECK-DAG: <<Const2:i\d+>> IntConstant 2 - /// CHECK-DAG: <<NotArg:i\d+>> Select [<<Const1>>,<<Const0>>,<<Arg>>] - /// CHECK-DAG: <<Cond:z\d+>> Equal [<<NotArg>>,<<Const2>>] - /// CHECK-DAG: <<NotCond:i\d+>> Select [<<Const1>>,<<Const0>>,<<Cond>>] - /// CHECK-DAG: Return [<<NotCond>>] - - /// CHECK-START: boolean Main.$noinline$EqualBoolVsIntConst(boolean) instruction_simplifier$after_inlining (after) + /// CHECK-DAG: If [<<Arg>>] + /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Const0>>,<<Const1>>] + /// CHECK-DAG: <<Cond:z\d+>> Equal [<<Phi1>>,<<Const2>>] + /// CHECK-DAG: If [<<Cond>>] + /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Const1>>,<<Const0>>] + /// CHECK-DAG: Return [<<Phi2>>] + + /// CHECK-START: boolean Main.$noinline$EqualBoolVsIntConst(boolean) dead_code_elimination$after_inlining (after) /// CHECK-DAG: <<True:i\d+>> IntConstant 1 /// CHECK-DAG: Return [<<True>>] @@ -1157,12 +1159,14 @@ public class Main { /// CHECK-DAG: <<Const0:i\d+>> IntConstant 0 /// CHECK-DAG: <<Const1:i\d+>> IntConstant 1 /// CHECK-DAG: <<Const2:i\d+>> IntConstant 2 - /// CHECK-DAG: <<NotArg:i\d+>> Select [<<Const1>>,<<Const0>>,<<Arg>>] - /// CHECK-DAG: <<Cond:z\d+>> NotEqual [<<NotArg>>,<<Const2>>] - /// CHECK-DAG: <<NotCond:i\d+>> Select [<<Const1>>,<<Const0>>,<<Cond>>] - /// CHECK-DAG: Return [<<NotCond>>] - - /// CHECK-START: boolean Main.$noinline$NotEqualBoolVsIntConst(boolean) instruction_simplifier$after_inlining (after) + /// CHECK-DAG: If [<<Arg>>] + /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Const0>>,<<Const1>>] + /// CHECK-DAG: <<Cond:z\d+>> NotEqual [<<Phi1>>,<<Const2>>] + /// CHECK-DAG: If [<<Cond>>] + /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Const1>>,<<Const0>>] + /// CHECK-DAG: Return [<<Phi2>>] + + /// CHECK-START: boolean Main.$noinline$NotEqualBoolVsIntConst(boolean) dead_code_elimination$after_inlining (after) /// CHECK-DAG: <<False:i\d+>> IntConstant 0 /// CHECK-DAG: Return [<<False>>] @@ -1198,28 +1202,14 @@ public class Main { /// CHECK-START: boolean Main.$noinline$NotNotBool(boolean) instruction_simplifier$after_inlining (before) /// CHECK-DAG: <<Arg:z\d+>> ParameterValue - /// CHECK-NOT: BooleanNot [<<Arg>>] - /// CHECK-NOT: Phi - - /// CHECK-START: boolean Main.$noinline$NotNotBool(boolean) instruction_simplifier$after_inlining (before) - /// CHECK-DAG: <<Arg:z\d+>> ParameterValue /// CHECK-DAG: <<Const0:i\d+>> IntConstant 0 /// CHECK-DAG: <<Const1:i\d+>> IntConstant 1 - /// CHECK-DAG: <<Sel:i\d+>> Select [<<Const1>>,<<Const0>>,<<Arg>>] - /// CHECK-DAG: <<Sel2:i\d+>> Select [<<Const1>>,<<Const0>>,<<Sel>>] - /// CHECK-DAG: Return [<<Sel2>>] - - /// CHECK-START: boolean Main.$noinline$NotNotBool(boolean) instruction_simplifier$after_inlining (after) - /// CHECK-DAG: <<Arg:z\d+>> ParameterValue - /// CHECK: BooleanNot [<<Arg>>] - /// CHECK-NEXT: Goto - - /// CHECK-START: boolean Main.$noinline$NotNotBool(boolean) instruction_simplifier$after_inlining (after) - /// CHECK-NOT: Select + /// CHECK-DAG: If [<<Arg>>] + /// CHECK-DAG: <<Phi:i\d+>> Phi [<<Const1>>,<<Const0>>] + /// CHECK-DAG: Return [<<Phi>>] - /// CHECK-START: boolean Main.$noinline$NotNotBool(boolean) dead_code_elimination$final (after) + /// CHECK-START: boolean Main.$noinline$NotNotBool(boolean) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Arg:z\d+>> ParameterValue - /// CHECK-NOT: BooleanNot [<<Arg>>] /// CHECK-DAG: Return [<<Arg>>] public static boolean NegateValue(boolean arg) { @@ -1348,10 +1338,11 @@ public class Main { /// CHECK-DAG: <<Const54:i\d+>> IntConstant 54 /// CHECK-DAG: <<Field:z\d+>> StaticFieldGet /// CHECK-DAG: <<NE:z\d+>> NotEqual [<<Field>>,<<Const1>>] - /// CHECK-DAG: <<Select:i\d+>> Select [<<Const13>>,<<Const54>>,<<NE>>] - /// CHECK-DAG: Return [<<Select>>] + /// CHECK-DAG: If [<<NE>>] + /// CHECK-DAG: <<Phi:i\d+>> Phi [<<Const13>>,<<Const54>>] + /// CHECK-DAG: Return [<<Phi>>] - /// CHECK-START: int Main.$noinline$booleanFieldNotEqualOne() instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.$noinline$booleanFieldNotEqualOne() select_generator (after) /// CHECK-DAG: <<Field:z\d+>> StaticFieldGet /// CHECK-DAG: <<Const13:i\d+>> IntConstant 13 /// CHECK-DAG: <<Const54:i\d+>> IntConstant 54 @@ -1367,11 +1358,12 @@ public class Main { /// CHECK-DAG: <<Const13:i\d+>> IntConstant 13 /// CHECK-DAG: <<Const54:i\d+>> IntConstant 54 /// CHECK-DAG: <<Field:z\d+>> StaticFieldGet - /// CHECK-DAG: <<NE:z\d+>> Equal [<<Field>>,<<Const0>>] - /// CHECK-DAG: <<Select:i\d+>> Select [<<Const13>>,<<Const54>>,<<NE>>] - /// CHECK-DAG: Return [<<Select>>] + /// CHECK-DAG: <<EQ:z\d+>> Equal [<<Field>>,<<Const0>>] + /// CHECK-DAG: If [<<EQ>>] + /// CHECK-DAG: <<Phi:i\d+>> Phi [<<Const13>>,<<Const54>>] + /// CHECK-DAG: Return [<<Phi>>] - /// CHECK-START: int Main.$noinline$booleanFieldEqualZero() instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.$noinline$booleanFieldEqualZero() select_generator (after) /// CHECK-DAG: <<Field:z\d+>> StaticFieldGet /// CHECK-DAG: <<Const13:i\d+>> IntConstant 13 /// CHECK-DAG: <<Const54:i\d+>> IntConstant 54 @@ -1390,18 +1382,20 @@ public class Main { /// CHECK-DAG: <<Const42:i\d+>> IntConstant 42 /// CHECK-DAG: <<Const54:i\d+>> IntConstant 54 /// CHECK-DAG: <<LE:z\d+>> LessThanOrEqual [<<Arg>>,<<Const42>>] - /// CHECK-DAG: <<GT:i\d+>> Select [<<Const1>>,<<Const0>>,<<LE>>] - /// CHECK-DAG: <<NE:z\d+>> NotEqual [<<GT>>,<<Const1>>] - /// CHECK-DAG: <<Result:i\d+>> Select [<<Const13>>,<<Const54>>,<<NE>>] - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.$noinline$intConditionNotEqualOne(int) instruction_simplifier$after_inlining (after) + /// CHECK-DAG: If [<<LE>>] + /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Const1>>,<<Const0>>] + /// CHECK-DAG: <<NE:z\d+>> NotEqual [<<Phi1>>,<<Const1>>] + /// CHECK-DAG: If [<<NE>>] + /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Const13>>,<<Const54>>] + /// CHECK-DAG: Return [<<Phi2>>] + + /// CHECK-START: int Main.$noinline$intConditionNotEqualOne(int) select_generator (after) /// CHECK-DAG: <<Arg:i\d+>> ParameterValue /// CHECK-DAG: <<Const13:i\d+>> IntConstant 13 /// CHECK-DAG: <<Const42:i\d+>> IntConstant 42 /// CHECK-DAG: <<Const54:i\d+>> IntConstant 54 - /// CHECK-DAG: <<Result:i\d+>> Select [<<Const13>>,<<Const54>>,<<LE:z\d+>>] - /// CHECK-DAG: <<LE>> LessThanOrEqual [<<Arg>>,<<Const42>>] + /// CHECK-DAG: <<LE:z\d+>> LessThanOrEqual [<<Arg>>,<<Const42>>] + /// CHECK-DAG: <<Result:i\d+>> Select [<<Const13>>,<<Const54>>,<<LE>>] /// CHECK-DAG: Return [<<Result>>] // Note that we match `LE` from Select because there are two identical // LessThanOrEqual instructions. @@ -1418,18 +1412,20 @@ public class Main { /// CHECK-DAG: <<Const42:i\d+>> IntConstant 42 /// CHECK-DAG: <<Const54:i\d+>> IntConstant 54 /// CHECK-DAG: <<LE:z\d+>> LessThanOrEqual [<<Arg>>,<<Const42>>] - /// CHECK-DAG: <<GT:i\d+>> Select [<<Const1>>,<<Const0>>,<<LE>>] - /// CHECK-DAG: <<NE:z\d+>> Equal [<<GT>>,<<Const0>>] - /// CHECK-DAG: <<Result:i\d+>> Select [<<Const13>>,<<Const54>>,<<NE>>] - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.$noinline$intConditionEqualZero(int) instruction_simplifier$after_inlining (after) + /// CHECK-DAG: If [<<LE>>] + /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Const1>>,<<Const0>>] + /// CHECK-DAG: <<EQ:z\d+>> Equal [<<Phi1>>,<<Const0>>] + /// CHECK-DAG: If [<<EQ>>] + /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Const13>>,<<Const54>>] + /// CHECK-DAG: Return [<<Phi2>>] + + /// CHECK-START: int Main.$noinline$intConditionEqualZero(int) select_generator (after) /// CHECK-DAG: <<Arg:i\d+>> ParameterValue /// CHECK-DAG: <<Const13:i\d+>> IntConstant 13 /// CHECK-DAG: <<Const42:i\d+>> IntConstant 42 /// CHECK-DAG: <<Const54:i\d+>> IntConstant 54 - /// CHECK-DAG: <<Result:i\d+>> Select [<<Const13>>,<<Const54>>,<<LE:z\d+>>] - /// CHECK-DAG: <<LE>> LessThanOrEqual [<<Arg>>,<<Const42>>] + /// CHECK-DAG: <<LE:z\d+>> LessThanOrEqual [<<Arg>>,<<Const42>>] + /// CHECK-DAG: <<Result:i\d+>> Select [<<Const13>>,<<Const54>>,<<LE>>] /// CHECK-DAG: Return [<<Result>>] // Note that we match `LE` from Select because there are two identical // LessThanOrEqual instructions. @@ -2571,12 +2567,13 @@ public class Main { /// CHECK-DAG: <<Const0:i\d+>> IntConstant 0 /// CHECK-DAG: <<Const1:i\d+>> IntConstant 1 /// CHECK-DAG: <<Const255:i\d+>> IntConstant 255 - /// CHECK-DAG: <<Select:i\d+>> Select [<<Const0>>,<<Const1>>,<<Arg>>] - /// CHECK-DAG: <<And:i\d+>> And [<<Select>>,<<Const255>>] + /// CHECK-DAG: If [<<Arg>>] + /// CHECK-DAG: <<Phi:i\d+>> Phi [<<Const1>>,<<Const0>>] + /// CHECK-DAG: <<And:i\d+>> And [<<Const255>>,<<Phi>>] /// CHECK-DAG: <<Conv:b\d+>> TypeConversion [<<And>>] /// CHECK-DAG: Return [<<Conv>>] - /// CHECK-START: int Main.$noinline$bug68142795Boolean(boolean) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.$noinline$bug68142795Boolean(boolean) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Arg:z\d+>> ParameterValue /// CHECK-DAG: Return [<<Arg>>] public static int $noinline$bug68142795Boolean(boolean b) { diff --git a/test/485-checker-dce-loop-update/smali/TestCase.smali b/test/485-checker-dce-loop-update/smali/TestCase.smali index cda6f73861..5290bad3ed 100644 --- a/test/485-checker-dce-loop-update/smali/TestCase.smali +++ b/test/485-checker-dce-loop-update/smali/TestCase.smali @@ -140,11 +140,11 @@ ## CHECK-DAG: <<PhiX:i\d+>> Phi [<<ArgX>>,<<Add5:i\d+>>,<<Add7:i\d+>>] loop:<<HeaderY:B\d+>> ## CHECK-DAG: If [<<ArgY>>] loop:<<HeaderY>> ## CHECK-DAG: <<Mul9:i\d+>> Mul [<<PhiX>>,<<Cst11>>] loop:<<HeaderY>> -## CHECK-DAG: <<SelX:i\d+>> Select [<<PhiX>>,<<Mul9>>,<<ArgZ>>] loop:<<HeaderY>> +## CHECK-DAG: <<PhiY:i\d+>> Phi [<<PhiX>>,<<Mul9>>] loop:<<HeaderY>> ## CHECK-DAG: If [<<Cst1>>] loop:<<HeaderY>> -## CHECK-DAG: <<Add5>> Add [<<SelX>>,<<Cst5>>] loop:<<HeaderY>> +## CHECK-DAG: <<Add5>> Add [<<PhiY>>,<<Cst5>>] loop:<<HeaderY>> ## CHECK-DAG: <<Add7>> Add [<<PhiX>>,<<Cst7>>] loop:<<HeaderY>> -## CHECK-DAG: Return [<<SelX>>] loop:none +## CHECK-DAG: Return [<<PhiY>>] loop:none ## CHECK-START: int TestCase.testExitPredecessors(int, boolean, boolean) dead_code_elimination$after_inlining (after) ## CHECK-DAG: <<ArgX:i\d+>> ParameterValue @@ -156,6 +156,22 @@ ## CHECK-DAG: If [<<ArgY>>] loop:<<HeaderY>> ## CHECK-DAG: <<Add7>> Add [<<PhiX>>,<<Cst7>>] loop:<<HeaderY>> ## CHECK-DAG: <<Mul9:i\d+>> Mul [<<PhiX>>,<<Cst11>>] loop:none +## CHECK-DAG: <<Phi:i\d+>> Phi [<<PhiX>>,<<Mul9>>] loop:none +## CHECK-DAG: Return [<<Phi>>] loop:none + +## CHECK-START: int TestCase.testExitPredecessors(int, boolean, boolean) dead_code_elimination$after_inlining (after) +## CHECK-NOT: IntConstant 5 + +## CHECK-START: int TestCase.testExitPredecessors(int, boolean, boolean) select_generator (after) +## CHECK-DAG: <<ArgX:i\d+>> ParameterValue +## CHECK-DAG: <<ArgY:z\d+>> ParameterValue +## CHECK-DAG: <<ArgZ:z\d+>> ParameterValue +## CHECK-DAG: <<Cst7:i\d+>> IntConstant 7 +## CHECK-DAG: <<Cst11:i\d+>> IntConstant 11 +## CHECK-DAG: <<PhiX:i\d+>> Phi [<<ArgX>>,<<Add7:i\d+>>] loop:<<HeaderY:B\d+>> +## CHECK-DAG: If [<<ArgY>>] loop:<<HeaderY>> +## CHECK-DAG: <<Add7>> Add [<<PhiX>>,<<Cst7>>] loop:<<HeaderY>> +## CHECK-DAG: <<Mul9:i\d+>> Mul [<<PhiX>>,<<Cst11>>] loop:none ## CHECK-DAG: <<SelX:i\d+>> Select [<<PhiX>>,<<Mul9>>,<<ArgZ>>] loop:none ## CHECK-DAG: Return [<<SelX>>] loop:none diff --git a/test/543-checker-dce-trycatch/smali/TestCase.smali b/test/543-checker-dce-trycatch/smali/TestCase.smali index f50e01e51b..7ad9ba8e64 100644 --- a/test/543-checker-dce-trycatch/smali/TestCase.smali +++ b/test/543-checker-dce-trycatch/smali/TestCase.smali @@ -215,10 +215,10 @@ ## CHECK-DAG: <<Const0x10:i\d+>> IntConstant 16 ## CHECK-DAG: <<Const0x11:i\d+>> IntConstant 17 ## CHECK-DAG: <<Add:i\d+>> Add [<<Arg0>>,<<Arg1>>] -## CHECK-DAG: <<Select:i\d+>> Select [<<Const0xf>>,<<Add>>,{{z\d+}}] +## CHECK-DAG: <<Phi:i\d+>> Phi [<<Add>>,<<Const0xf>>] reg:3 is_catch_phi:false ## CHECK-DAG: Phi [<<Const0xa>>,<<Const0xb>>,<<Const0xd>>] reg:1 is_catch_phi:true ## CHECK-DAG: Phi [<<Add>>,<<Const0xc>>,<<Const0xe>>] reg:2 is_catch_phi:true -## CHECK-DAG: Phi [<<Select>>,<<Const0x10>>,<<Const0x11>>] reg:3 is_catch_phi:true +## CHECK-DAG: Phi [<<Phi>>,<<Const0x10>>,<<Const0x11>>] reg:3 is_catch_phi:true ## CHECK-START: int TestCase.testCatchPhiInputs_DefinedInTryBlock(int, int, int, int) dead_code_elimination$after_inlining (after) ## CHECK-DAG: <<Const0xb:i\d+>> IntConstant 11 diff --git a/test/551-checker-shifter-operand/src/Main.java b/test/551-checker-shifter-operand/src/Main.java index fb76904677..b3e4a60e9a 100644 --- a/test/551-checker-shifter-operand/src/Main.java +++ b/test/551-checker-shifter-operand/src/Main.java @@ -728,9 +728,41 @@ public class Main { /// CHECK: UShr /// CHECK-NOT: UShr // - // Note: running extra simplification before GVN would expose the common subexpressions between - // shifts with larger distance `b << 62`, `b << 63` etc. and the equivalent smaller distances. - // TODO: b/78171933 + // Note: running extra simplification after inlining and before GVN exposes the common + // subexpressions between shifts with larger distance `b << 62`, `b << 63` etc. + // and the equivalent smaller distances. + // + /// CHECK-START: void Main.$opt$validateShiftInt(int, int) GVN (after) + /// CHECK: Shl + /// CHECK: Shl + /// CHECK: Shl + /// CHECK: Shl + /// CHECK: Shl + /// CHECK: Shl + /// CHECK: Shl + /// CHECK: Shl + /// CHECK: Shl + /// CHECK-NOT: Shl + /// CHECK: Shr + /// CHECK: Shr + /// CHECK: Shr + /// CHECK: Shr + /// CHECK: Shr + /// CHECK: Shr + /// CHECK: Shr + /// CHECK: Shr + /// CHECK: Shr + /// CHECK-NOT: Shl + /// CHECK: UShr + /// CHECK: UShr + /// CHECK: UShr + /// CHECK: UShr + /// CHECK: UShr + /// CHECK: UShr + /// CHECK: UShr + /// CHECK: UShr + /// CHECK: UShr + /// CHECK-NOT: UShr // /// CHECK-START-ARM: void Main.$opt$validateShiftInt(int, int) instruction_simplifier_arm (after) /// CHECK: DataProcWithShifterOp @@ -760,12 +792,6 @@ public class Main { /// CHECK: DataProcWithShifterOp /// CHECK: DataProcWithShifterOp /// CHECK: DataProcWithShifterOp - /// CHECK: DataProcWithShifterOp - /// CHECK: DataProcWithShifterOp - /// CHECK: DataProcWithShifterOp - /// CHECK: DataProcWithShifterOp - /// CHECK: DataProcWithShifterOp - /// CHECK: DataProcWithShifterOp /// CHECK-NOT: DataProcWithShifterOp /// CHECK-START-ARM: void Main.$opt$validateShiftInt(int, int) instruction_simplifier_arm (after) @@ -801,12 +827,6 @@ public class Main { /// CHECK: DataProcWithShifterOp /// CHECK: DataProcWithShifterOp /// CHECK: DataProcWithShifterOp - /// CHECK: DataProcWithShifterOp - /// CHECK: DataProcWithShifterOp - /// CHECK: DataProcWithShifterOp - /// CHECK: DataProcWithShifterOp - /// CHECK: DataProcWithShifterOp - /// CHECK: DataProcWithShifterOp /// CHECK-NOT: DataProcWithShifterOp /// CHECK-START-ARM64: void Main.$opt$validateShiftInt(int, int) instruction_simplifier_arm64 (after) diff --git a/test/565-checker-doublenegbitwise/src/Main.java b/test/565-checker-doublenegbitwise/src/Main.java index 80358cd2ba..e36a2bab40 100644 --- a/test/565-checker-doublenegbitwise/src/Main.java +++ b/test/565-checker-doublenegbitwise/src/Main.java @@ -94,7 +94,7 @@ public class Main { * same pass. */ - /// CHECK-START: boolean Main.$opt$noinline$booleanAndToOr(boolean, boolean) instruction_simplifier$after_inlining (before) + /// CHECK-START: boolean Main.$opt$noinline$booleanAndToOr(boolean, boolean) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<P1:z\d+>> ParameterValue /// CHECK-DAG: <<P2:z\d+>> ParameterValue /// CHECK-DAG: <<Const0:i\d+>> IntConstant 0 @@ -104,7 +104,7 @@ public class Main { /// CHECK-DAG: <<And:i\d+>> And [<<Select1>>,<<Select2>>] /// CHECK-DAG: Return [<<And>>] - /// CHECK-START: boolean Main.$opt$noinline$booleanAndToOr(boolean, boolean) instruction_simplifier$after_inlining (after) + /// CHECK-START: boolean Main.$opt$noinline$booleanAndToOr(boolean, boolean) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Cond1:z\d+>> ParameterValue /// CHECK-DAG: <<Cond2:z\d+>> ParameterValue /// CHECK-DAG: <<Or:i\d+>> Or [<<Cond1>>,<<Cond2>>] @@ -165,7 +165,7 @@ public class Main { * same pass. */ - /// CHECK-START: boolean Main.$opt$noinline$booleanOrToAnd(boolean, boolean) instruction_simplifier$after_inlining (before) + /// CHECK-START: boolean Main.$opt$noinline$booleanOrToAnd(boolean, boolean) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<P1:z\d+>> ParameterValue /// CHECK-DAG: <<P2:z\d+>> ParameterValue /// CHECK-DAG: <<Const0:i\d+>> IntConstant 0 @@ -175,7 +175,7 @@ public class Main { /// CHECK-DAG: <<Or:i\d+>> Or [<<Select1>>,<<Select2>>] /// CHECK-DAG: Return [<<Or>>] - /// CHECK-START: boolean Main.$opt$noinline$booleanOrToAnd(boolean, boolean) instruction_simplifier$after_inlining (after) + /// CHECK-START: boolean Main.$opt$noinline$booleanOrToAnd(boolean, boolean) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Cond1:z\d+>> ParameterValue /// CHECK-DAG: <<Cond2:z\d+>> ParameterValue /// CHECK-DAG: <<And:i\d+>> And [<<Cond1>>,<<Cond2>>] @@ -275,7 +275,7 @@ public class Main { * same pass. */ - /// CHECK-START: boolean Main.$opt$noinline$booleanNotXorToXor(boolean, boolean) instruction_simplifier$after_inlining (before) + /// CHECK-START: boolean Main.$opt$noinline$booleanNotXorToXor(boolean, boolean) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<P1:z\d+>> ParameterValue /// CHECK-DAG: <<P2:z\d+>> ParameterValue /// CHECK-DAG: <<Const0:i\d+>> IntConstant 0 @@ -285,7 +285,7 @@ public class Main { /// CHECK-DAG: <<Xor:i\d+>> Xor [<<Select1>>,<<Select2>>] /// CHECK-DAG: Return [<<Xor>>] - /// CHECK-START: boolean Main.$opt$noinline$booleanNotXorToXor(boolean, boolean) instruction_simplifier$after_inlining (after) + /// CHECK-START: boolean Main.$opt$noinline$booleanNotXorToXor(boolean, boolean) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Cond1:z\d+>> ParameterValue /// CHECK-DAG: <<Cond2:z\d+>> ParameterValue /// CHECK-DAG: <<Xor:i\d+>> Xor [<<Cond1>>,<<Cond2>>] diff --git a/test/593-checker-boolean-2-integral-conv/smali/SmaliTests.smali b/test/593-checker-boolean-2-integral-conv/smali/SmaliTests.smali index 494ab95434..f74e88f580 100644 --- a/test/593-checker-boolean-2-integral-conv/smali/SmaliTests.smali +++ b/test/593-checker-boolean-2-integral-conv/smali/SmaliTests.smali @@ -233,9 +233,7 @@ ## CHECK-DAG: <<One:i\d+>> IntConstant 1 ## CHECK-DAG: <<Sget:z\d+>> StaticFieldGet ## CHECK-DAG: <<Sel:i\d+>> Select [<<Zero>>,<<One>>,<<Sget>>] -## CHECK-DAG: <<IToJ:j\d+>> TypeConversion [<<Sel>>] -## CHECK-DAG: <<JToI:i\d+>> TypeConversion [<<IToJ>>] -## CHECK-DAG: Return [<<JToI>>] +## CHECK-DAG: Return [<<Sel>>] ## CHECK-START: int SmaliTests.longToIntOfBoolean() instruction_simplifier$after_bce (after) ## CHECK-DAG: <<Method:[ij]\d+>> CurrentMethod diff --git a/test/595-profile-saving/profile-saving.cc b/test/595-profile-saving/profile-saving.cc index bb9ab84fb5..b22d61e38d 100644 --- a/test/595-profile-saving/profile-saving.cc +++ b/test/595-profile-saving/profile-saving.cc @@ -18,7 +18,6 @@ #include "art_method-inl.h" #include "dex/method_reference.h" -#include "jit/profile_compilation_info.h" #include "jit/profile_saver.h" #include "jni.h" #include "mirror/class-inl.h" @@ -26,6 +25,7 @@ #include "nativehelper/ScopedUtfChars.h" #include "oat_file_assistant.h" #include "oat_file_manager.h" +#include "profile/profile_compilation_info.h" #include "scoped_thread_state_change-inl.h" #include "thread.h" diff --git a/test/631-checker-get-class/src/Main.java b/test/631-checker-get-class/src/Main.java index 61c0adf624..b318168713 100644 --- a/test/631-checker-get-class/src/Main.java +++ b/test/631-checker-get-class/src/Main.java @@ -34,11 +34,14 @@ public class Main { } /// CHECK-START: boolean Main.classEquality1() instruction_simplifier$after_inlining (before) + /// CHECK-DAG: <<Const0:i\d+>> IntConstant 0 + /// CHECK-DAG: <<Const1:i\d+>> IntConstant 1 /// CHECK-DAG: <<Eq:z\d+>> {{Equal|NotEqual}} - /// CHECK-DAG: <<Select:i\d+>> Select [{{i\d+}},{{i\d+}},<<Eq>>] - /// CHECK-DAG: Return [<<Select>>] + /// CHECK-DAG: If [<<Eq>>] + /// CHECK-DAG: <<Phi:i\d+>> Phi [<<Const1>>,<<Const0>>] + /// CHECK-DAG: Return [<<Phi>>] - /// CHECK-START: boolean Main.classEquality1() instruction_simplifier$after_inlining (after) + /// CHECK-START: boolean Main.classEquality1() dead_code_elimination$after_inlining (after) /// CHECK-DAG: <<Constant:i\d+>> IntConstant 1 /// CHECK-DAG: Return [<<Constant>>] public static boolean classEquality1() { @@ -46,11 +49,14 @@ public class Main { } /// CHECK-START: boolean Main.classEquality2() instruction_simplifier$after_inlining (before) + /// CHECK-DAG: <<Const0:i\d+>> IntConstant 0 + /// CHECK-DAG: <<Const1:i\d+>> IntConstant 1 /// CHECK-DAG: <<Eq:z\d+>> {{Equal|NotEqual}} - /// CHECK-DAG: <<Select:i\d+>> Select [{{i\d+}},{{i\d+}},<<Eq>>] - /// CHECK-DAG: Return [<<Select>>] + /// CHECK-DAG: If [<<Eq>>] + /// CHECK-DAG: <<Phi:i\d+>> Phi [<<Const1>>,<<Const0>>] + /// CHECK-DAG: Return [<<Phi>>] - /// CHECK-START: boolean Main.classEquality2() instruction_simplifier$after_inlining (after) + /// CHECK-START: boolean Main.classEquality2() dead_code_elimination$after_inlining (after) /// CHECK-DAG: <<Constant:i\d+>> IntConstant 0 /// CHECK-DAG: Return [<<Constant>>] public static boolean classEquality2() { @@ -59,11 +65,14 @@ public class Main { } /// CHECK-START: boolean Main.classEquality3() instruction_simplifier$after_inlining (before) + /// CHECK-DAG: <<Const0:i\d+>> IntConstant 0 + /// CHECK-DAG: <<Const1:i\d+>> IntConstant 1 /// CHECK-DAG: <<Eq:z\d+>> {{Equal|NotEqual}} - /// CHECK-DAG: <<Select:i\d+>> Select [{{i\d+}},{{i\d+}},<<Eq>>] - /// CHECK-DAG: Return [<<Select>>] + /// CHECK-DAG: If [<<Eq>>] + /// CHECK-DAG: <<Phi:i\d+>> Phi [<<Const1>>,<<Const0>>] + /// CHECK-DAG: Return [<<Phi>>] - /// CHECK-START: boolean Main.classEquality3() instruction_simplifier$after_inlining (after) + /// CHECK-START: boolean Main.classEquality3() dead_code_elimination$after_inlining (after) /// CHECK-DAG: <<Constant:i\d+>> IntConstant 0 /// CHECK-DAG: Return [<<Constant>>] public static boolean classEquality3() { @@ -71,11 +80,14 @@ public class Main { } /// CHECK-START: boolean Main.classEquality4() instruction_simplifier$after_inlining (before) + /// CHECK-DAG: <<Const0:i\d+>> IntConstant 0 + /// CHECK-DAG: <<Const1:i\d+>> IntConstant 1 /// CHECK-DAG: <<Eq:z\d+>> {{Equal|NotEqual}} - /// CHECK-DAG: <<Select:i\d+>> Select [{{i\d+}},{{i\d+}},<<Eq>>] - /// CHECK-DAG: Return [<<Select>>] + /// CHECK-DAG: If [<<Eq>>] + /// CHECK-DAG: <<Phi:i\d+>> Phi [<<Const1>>,<<Const0>>] + /// CHECK-DAG: Return [<<Phi>>] - /// CHECK-START: boolean Main.classEquality4() instruction_simplifier$after_inlining (after) + /// CHECK-START: boolean Main.classEquality4() dead_code_elimination$after_inlining (after) /// CHECK-DAG: <<Constant:i\d+>> IntConstant 1 /// CHECK-DAG: Return [<<Constant>>] public static boolean classEquality4() { diff --git a/test/660-checker-sad-byte/src/Main.java b/test/660-checker-sad-byte/src/Main.java index cd7fbcbdb9..bcd62c4852 100644 --- a/test/660-checker-sad-byte/src/Main.java +++ b/test/660-checker-sad-byte/src/Main.java @@ -19,22 +19,22 @@ */ public class Main { - /// CHECK-START: int Main.sad1(byte, byte) instruction_simplifier$after_inlining (before) + /// CHECK-START: int Main.sad1(byte, byte) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Select:i\d+>> Select /// CHECK-DAG: Return [<<Select>>] // - /// CHECK-START: int Main.sad1(byte, byte) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.sad1(byte, byte) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Intrin:i\d+>> Abs /// CHECK-DAG: Return [<<Intrin>>] static int sad1(byte x, byte y) { return x >= y ? x - y : y - x; } - /// CHECK-START: int Main.sad2(byte, byte) instruction_simplifier$after_inlining (before) + /// CHECK-START: int Main.sad2(byte, byte) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Select:i\d+>> Select /// CHECK-DAG: Return [<<Select>>] // - /// CHECK-START: int Main.sad2(byte, byte) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.sad2(byte, byte) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Intrin:i\d+>> Abs /// CHECK-DAG: Return [<<Intrin>>] static int sad2(byte x, byte y) { @@ -43,11 +43,11 @@ public class Main { return diff; } - /// CHECK-START: int Main.sad3(byte, byte) instruction_simplifier$after_inlining (before) + /// CHECK-START: int Main.sad3(byte, byte) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Select:i\d+>> Select /// CHECK-DAG: Return [<<Select>>] // - /// CHECK-START: int Main.sad3(byte, byte) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.sad3(byte, byte) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Intrin:i\d+>> Abs /// CHECK-DAG: Return [<<Intrin>>] static int sad3(byte x, byte y) { @@ -55,11 +55,11 @@ public class Main { return diff >= 0 ? diff : -diff; } - /// CHECK-START: int Main.sad3Alt(byte, byte) instruction_simplifier$after_inlining (before) + /// CHECK-START: int Main.sad3Alt(byte, byte) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Select:i\d+>> Select /// CHECK-DAG: Return [<<Select>>] // - /// CHECK-START: int Main.sad3Alt(byte, byte) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.sad3Alt(byte, byte) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Intrin:i\d+>> Abs /// CHECK-DAG: Return [<<Intrin>>] static int sad3Alt(byte x, byte y) { @@ -67,11 +67,11 @@ public class Main { return 0 <= diff ? diff : -diff; } - /// CHECK-START: long Main.sadL1(byte, byte) instruction_simplifier$after_inlining (before) + /// CHECK-START: long Main.sadL1(byte, byte) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Select:j\d+>> Select /// CHECK-DAG: Return [<<Select>>] // - /// CHECK-START: long Main.sadL1(byte, byte) instruction_simplifier$after_inlining (after) + /// CHECK-START: long Main.sadL1(byte, byte) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Intrin:j\d+>> Abs /// CHECK-DAG: Return [<<Intrin>>] static long sadL1(byte x, byte y) { @@ -80,11 +80,11 @@ public class Main { return xl >= yl ? xl - yl : yl - xl; } - /// CHECK-START: long Main.sadL2(byte, byte) instruction_simplifier$after_inlining (before) + /// CHECK-START: long Main.sadL2(byte, byte) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Select:j\d+>> Select /// CHECK-DAG: Return [<<Select>>] // - /// CHECK-START: long Main.sadL2(byte, byte) instruction_simplifier$after_inlining (after) + /// CHECK-START: long Main.sadL2(byte, byte) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Intrin:j\d+>> Abs /// CHECK-DAG: Return [<<Intrin>>] static long sadL2(byte x, byte y) { @@ -93,11 +93,11 @@ public class Main { return diff; } - /// CHECK-START: long Main.sadL3(byte, byte) instruction_simplifier$after_inlining (before) + /// CHECK-START: long Main.sadL3(byte, byte) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Select:j\d+>> Select /// CHECK-DAG: Return [<<Select>>] // - /// CHECK-START: long Main.sadL3(byte, byte) instruction_simplifier$after_inlining (after) + /// CHECK-START: long Main.sadL3(byte, byte) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Intrin:j\d+>> Abs /// CHECK-DAG: Return [<<Intrin>>] static long sadL3(byte x, byte y) { @@ -105,11 +105,11 @@ public class Main { return diff >= 0L ? diff : -diff; } - /// CHECK-START: long Main.sadL3Alt(byte, byte) instruction_simplifier$after_inlining (before) + /// CHECK-START: long Main.sadL3Alt(byte, byte) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Select:j\d+>> Select /// CHECK-DAG: Return [<<Select>>] // - /// CHECK-START: long Main.sadL3Alt(byte, byte) instruction_simplifier$after_inlining (after) + /// CHECK-START: long Main.sadL3Alt(byte, byte) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Intrin:j\d+>> Abs /// CHECK-DAG: Return [<<Intrin>>] static long sadL3Alt(byte x, byte y) { diff --git a/test/660-checker-sad-char/src/Main.java b/test/660-checker-sad-char/src/Main.java index ecf748ae07..998ec33119 100644 --- a/test/660-checker-sad-char/src/Main.java +++ b/test/660-checker-sad-char/src/Main.java @@ -19,22 +19,22 @@ */ public class Main { - /// CHECK-START: int Main.sad1(char, char) instruction_simplifier$after_inlining (before) + /// CHECK-START: int Main.sad1(char, char) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Select:i\d+>> Select /// CHECK-DAG: Return [<<Select>>] // - /// CHECK-START: int Main.sad1(char, char) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.sad1(char, char) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Intrin:i\d+>> Abs /// CHECK-DAG: Return [<<Intrin>>] static int sad1(char x, char y) { return x >= y ? x - y : y - x; } - /// CHECK-START: int Main.sad2(char, char) instruction_simplifier$after_inlining (before) + /// CHECK-START: int Main.sad2(char, char) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Select:i\d+>> Select /// CHECK-DAG: Return [<<Select>>] // - /// CHECK-START: int Main.sad2(char, char) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.sad2(char, char) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Intrin:i\d+>> Abs /// CHECK-DAG: Return [<<Intrin>>] static int sad2(char x, char y) { @@ -43,11 +43,11 @@ public class Main { return diff; } - /// CHECK-START: int Main.sad3(char, char) instruction_simplifier$after_inlining (before) + /// CHECK-START: int Main.sad3(char, char) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Select:i\d+>> Select /// CHECK-DAG: Return [<<Select>>] // - /// CHECK-START: int Main.sad3(char, char) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.sad3(char, char) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Intrin:i\d+>> Abs /// CHECK-DAG: Return [<<Intrin>>] static int sad3(char x, char y) { @@ -55,11 +55,11 @@ public class Main { return diff >= 0 ? diff : -diff; } - /// CHECK-START: int Main.sad3Alt(char, char) instruction_simplifier$after_inlining (before) + /// CHECK-START: int Main.sad3Alt(char, char) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Select:i\d+>> Select /// CHECK-DAG: Return [<<Select>>] // - /// CHECK-START: int Main.sad3Alt(char, char) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.sad3Alt(char, char) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Intrin:i\d+>> Abs /// CHECK-DAG: Return [<<Intrin>>] static int sad3Alt(char x, char y) { @@ -67,11 +67,11 @@ public class Main { return 0 <= diff ? diff : -diff; } - /// CHECK-START: long Main.sadL1(char, char) instruction_simplifier$after_inlining (before) + /// CHECK-START: long Main.sadL1(char, char) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Select:j\d+>> Select /// CHECK-DAG: Return [<<Select>>] // - /// CHECK-START: long Main.sadL1(char, char) instruction_simplifier$after_inlining (after) + /// CHECK-START: long Main.sadL1(char, char) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Intrin:j\d+>> Abs /// CHECK-DAG: Return [<<Intrin>>] static long sadL1(char x, char y) { @@ -80,11 +80,11 @@ public class Main { return xl >= yl ? xl - yl : yl - xl; } - /// CHECK-START: long Main.sadL2(char, char) instruction_simplifier$after_inlining (before) + /// CHECK-START: long Main.sadL2(char, char) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Select:j\d+>> Select /// CHECK-DAG: Return [<<Select>>] // - /// CHECK-START: long Main.sadL2(char, char) instruction_simplifier$after_inlining (after) + /// CHECK-START: long Main.sadL2(char, char) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Intrin:j\d+>> Abs /// CHECK-DAG: Return [<<Intrin>>] static long sadL2(char x, char y) { @@ -93,11 +93,11 @@ public class Main { return diff; } - /// CHECK-START: long Main.sadL3(char, char) instruction_simplifier$after_inlining (before) + /// CHECK-START: long Main.sadL3(char, char) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Select:j\d+>> Select /// CHECK-DAG: Return [<<Select>>] // - /// CHECK-START: long Main.sadL3(char, char) instruction_simplifier$after_inlining (after) + /// CHECK-START: long Main.sadL3(char, char) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Intrin:j\d+>> Abs /// CHECK-DAG: Return [<<Intrin>>] static long sadL3(char x, char y) { @@ -105,11 +105,11 @@ public class Main { return diff >= 0L ? diff : -diff; } - /// CHECK-START: long Main.sadL3Alt(char, char) instruction_simplifier$after_inlining (before) + /// CHECK-START: long Main.sadL3Alt(char, char) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Select:j\d+>> Select /// CHECK-DAG: Return [<<Select>>] // - /// CHECK-START: long Main.sadL3Alt(char, char) instruction_simplifier$after_inlining (after) + /// CHECK-START: long Main.sadL3Alt(char, char) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Intrin:j\d+>> Abs /// CHECK-DAG: Return [<<Intrin>>] static long sadL3Alt(char x, char y) { diff --git a/test/660-checker-sad-int/src/Main.java b/test/660-checker-sad-int/src/Main.java index 280dd66a51..09878a5052 100644 --- a/test/660-checker-sad-int/src/Main.java +++ b/test/660-checker-sad-int/src/Main.java @@ -19,15 +19,15 @@ */ public class Main { - /// CHECK-START: int Main.sad1(int, int) instruction_simplifier$after_inlining (before) + /// CHECK-START: int Main.sad1(int, int) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Select:i\d+>> Select /// CHECK-DAG: Return [<<Select>>] // - /// CHECK-START: int Main.sad1(int, int) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.sad1(int, int) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Select:i\d+>> Select /// CHECK-DAG: Return [<<Select>>] // - /// CHECK-START: int Main.sad1(int, int) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.sad1(int, int) instruction_simplifier$after_gvn (after) /// CHECK-NOT: Abs // // NOTE: for direct 32-bit operands, this is not an ABS. @@ -35,11 +35,11 @@ public class Main { return x >= y ? x - y : y - x; } - /// CHECK-START: int Main.sad2(int, int) instruction_simplifier$after_inlining (before) + /// CHECK-START: int Main.sad2(int, int) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Select:i\d+>> Select /// CHECK-DAG: Return [<<Select>>] // - /// CHECK-START: int Main.sad2(int, int) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.sad2(int, int) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Intrin:i\d+>> Abs /// CHECK-DAG: Return [<<Intrin>>] static int sad2(int x, int y) { @@ -48,11 +48,11 @@ public class Main { return diff; } - /// CHECK-START: int Main.sad3(int, int) instruction_simplifier$after_inlining (before) + /// CHECK-START: int Main.sad3(int, int) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Select:i\d+>> Select /// CHECK-DAG: Return [<<Select>>] // - /// CHECK-START: int Main.sad3(int, int) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.sad3(int, int) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Intrin:i\d+>> Abs /// CHECK-DAG: Return [<<Intrin>>] static int sad3(int x, int y) { @@ -60,11 +60,11 @@ public class Main { return diff >= 0 ? diff : -diff; } - /// CHECK-START: int Main.sad3Alt(int, int) instruction_simplifier$after_inlining (before) + /// CHECK-START: int Main.sad3Alt(int, int) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Select:i\d+>> Select /// CHECK-DAG: Return [<<Select>>] // - /// CHECK-START: int Main.sad3Alt(int, int) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.sad3Alt(int, int) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Intrin:i\d+>> Abs /// CHECK-DAG: Return [<<Intrin>>] static int sad3Alt(int x, int y) { @@ -72,11 +72,11 @@ public class Main { return 0 <= diff ? diff : -diff; } - /// CHECK-START: long Main.sadL1(int, int) instruction_simplifier$after_inlining (before) + /// CHECK-START: long Main.sadL1(int, int) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Select:j\d+>> Select /// CHECK-DAG: Return [<<Select>>] // - /// CHECK-START: long Main.sadL1(int, int) instruction_simplifier$after_inlining (after) + /// CHECK-START: long Main.sadL1(int, int) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Intrin:j\d+>> Abs /// CHECK-DAG: Return [<<Intrin>>] static long sadL1(int x, int y) { @@ -85,11 +85,11 @@ public class Main { return xl >= yl ? xl - yl : yl - xl; } - /// CHECK-START: long Main.sadL2(int, int) instruction_simplifier$after_inlining (before) + /// CHECK-START: long Main.sadL2(int, int) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Select:j\d+>> Select /// CHECK-DAG: Return [<<Select>>] // - /// CHECK-START: long Main.sadL2(int, int) instruction_simplifier$after_inlining (after) + /// CHECK-START: long Main.sadL2(int, int) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Intrin:j\d+>> Abs /// CHECK-DAG: Return [<<Intrin>>] static long sadL2(int x, int y) { @@ -98,11 +98,11 @@ public class Main { return diff; } - /// CHECK-START: long Main.sadL3(int, int) instruction_simplifier$after_inlining (before) + /// CHECK-START: long Main.sadL3(int, int) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Select:j\d+>> Select /// CHECK-DAG: Return [<<Select>>] // - /// CHECK-START: long Main.sadL3(int, int) instruction_simplifier$after_inlining (after) + /// CHECK-START: long Main.sadL3(int, int) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Intrin:j\d+>> Abs /// CHECK-DAG: Return [<<Intrin>>] static long sadL3(int x, int y) { @@ -110,11 +110,11 @@ public class Main { return diff >= 0L ? diff : -diff; } - /// CHECK-START: long Main.sadL3Alt(int, int) instruction_simplifier$after_inlining (before) + /// CHECK-START: long Main.sadL3Alt(int, int) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Select:j\d+>> Select /// CHECK-DAG: Return [<<Select>>] // - /// CHECK-START: long Main.sadL3Alt(int, int) instruction_simplifier$after_inlining (after) + /// CHECK-START: long Main.sadL3Alt(int, int) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Intrin:j\d+>> Abs /// CHECK-DAG: Return [<<Intrin>>] static long sadL3Alt(int x, int y) { diff --git a/test/660-checker-sad-long/src/Main.java b/test/660-checker-sad-long/src/Main.java index ca0f4b71dd..b9eeb5ff81 100644 --- a/test/660-checker-sad-long/src/Main.java +++ b/test/660-checker-sad-long/src/Main.java @@ -19,15 +19,15 @@ */ public class Main { - /// CHECK-START: long Main.sad1(long, long) instruction_simplifier$after_inlining (before) + /// CHECK-START: long Main.sad1(long, long) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Select:j\d+>> Select /// CHECK-DAG: Return [<<Select>>] // - /// CHECK-START: long Main.sad1(long, long) instruction_simplifier$after_inlining (after) + /// CHECK-START: long Main.sad1(long, long) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Select:j\d+>> Select /// CHECK-DAG: Return [<<Select>>] // - /// CHECK-START: long Main.sad1(long, long) instruction_simplifier$after_inlining (after) + /// CHECK-START: long Main.sad1(long, long) instruction_simplifier$after_gvn (after) /// CHECK-NOT: Abs // // NOTE: for direct 64-bit operands, this is not an ABS. @@ -35,11 +35,11 @@ public class Main { return x >= y ? x - y : y - x; } - /// CHECK-START: long Main.sad2(long, long) instruction_simplifier$after_inlining (before) + /// CHECK-START: long Main.sad2(long, long) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Select:j\d+>> Select /// CHECK-DAG: Return [<<Select>>] // - /// CHECK-START: long Main.sad2(long, long) instruction_simplifier$after_inlining (after) + /// CHECK-START: long Main.sad2(long, long) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Intrin:j\d+>> Abs /// CHECK-DAG: Return [<<Intrin>>] static long sad2(long x, long y) { @@ -48,11 +48,11 @@ public class Main { return diff; } - /// CHECK-START: long Main.sad3(long, long) instruction_simplifier$after_inlining (before) + /// CHECK-START: long Main.sad3(long, long) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Select:j\d+>> Select /// CHECK-DAG: Return [<<Select>>] // - /// CHECK-START: long Main.sad3(long, long) instruction_simplifier$after_inlining (after) + /// CHECK-START: long Main.sad3(long, long) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Intrin:j\d+>> Abs /// CHECK-DAG: Return [<<Intrin>>] static long sad3(long x, long y) { @@ -60,11 +60,11 @@ public class Main { return diff >= 0 ? diff : -diff; } - /// CHECK-START: long Main.sad3Alt(long, long) instruction_simplifier$after_inlining (before) + /// CHECK-START: long Main.sad3Alt(long, long) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Select:j\d+>> Select /// CHECK-DAG: Return [<<Select>>] // - /// CHECK-START: long Main.sad3Alt(long, long) instruction_simplifier$after_inlining (after) + /// CHECK-START: long Main.sad3Alt(long, long) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Intrin:j\d+>> Abs /// CHECK-DAG: Return [<<Intrin>>] static long sad3Alt(long x, long y) { diff --git a/test/660-checker-sad-short/src/Main.java b/test/660-checker-sad-short/src/Main.java index b712a146f4..0a1a4dc92e 100644 --- a/test/660-checker-sad-short/src/Main.java +++ b/test/660-checker-sad-short/src/Main.java @@ -19,22 +19,22 @@ */ public class Main { - /// CHECK-START: int Main.sad1(short, short) instruction_simplifier$after_inlining (before) + /// CHECK-START: int Main.sad1(short, short) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Select:i\d+>> Select /// CHECK-DAG: Return [<<Select>>] // - /// CHECK-START: int Main.sad1(short, short) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.sad1(short, short) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Intrin:i\d+>> Abs /// CHECK-DAG: Return [<<Intrin>>] static int sad1(short x, short y) { return x >= y ? x - y : y - x; } - /// CHECK-START: int Main.sad2(short, short) instruction_simplifier$after_inlining (before) + /// CHECK-START: int Main.sad2(short, short) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Select:i\d+>> Select /// CHECK-DAG: Return [<<Select>>] // - /// CHECK-START: int Main.sad2(short, short) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.sad2(short, short) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Intrin:i\d+>> Abs /// CHECK-DAG: Return [<<Intrin>>] static int sad2(short x, short y) { @@ -43,11 +43,11 @@ public class Main { return diff; } - /// CHECK-START: int Main.sad3(short, short) instruction_simplifier$after_inlining (before) + /// CHECK-START: int Main.sad3(short, short) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Select:i\d+>> Select /// CHECK-DAG: Return [<<Select>>] // - /// CHECK-START: int Main.sad3(short, short) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.sad3(short, short) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Intrin:i\d+>> Abs /// CHECK-DAG: Return [<<Intrin>>] static int sad3(short x, short y) { @@ -55,11 +55,11 @@ public class Main { return diff >= 0 ? diff : -diff; } - /// CHECK-START: int Main.sad3Alt(short, short) instruction_simplifier$after_inlining (before) + /// CHECK-START: int Main.sad3Alt(short, short) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Select:i\d+>> Select /// CHECK-DAG: Return [<<Select>>] // - /// CHECK-START: int Main.sad3Alt(short, short) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.sad3Alt(short, short) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Intrin:i\d+>> Abs /// CHECK-DAG: Return [<<Intrin>>] static int sad3Alt(short x, short y) { @@ -67,11 +67,11 @@ public class Main { return 0 <= diff ? diff : -diff; } - /// CHECK-START: long Main.sadL1(short, short) instruction_simplifier$after_inlining (before) + /// CHECK-START: long Main.sadL1(short, short) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Select:j\d+>> Select /// CHECK-DAG: Return [<<Select>>] // - /// CHECK-START: long Main.sadL1(short, short) instruction_simplifier$after_inlining (after) + /// CHECK-START: long Main.sadL1(short, short) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Intrin:j\d+>> Abs /// CHECK-DAG: Return [<<Intrin>>] static long sadL1(short x, short y) { @@ -80,11 +80,11 @@ public class Main { return xl >= yl ? xl - yl : yl - xl; } - /// CHECK-START: long Main.sadL2(short, short) instruction_simplifier$after_inlining (before) + /// CHECK-START: long Main.sadL2(short, short) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Select:j\d+>> Select /// CHECK-DAG: Return [<<Select>>] // - /// CHECK-START: long Main.sadL2(short, short) instruction_simplifier$after_inlining (after) + /// CHECK-START: long Main.sadL2(short, short) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Intrin:j\d+>> Abs /// CHECK-DAG: Return [<<Intrin>>] static long sadL2(short x, short y) { @@ -93,11 +93,11 @@ public class Main { return diff; } - /// CHECK-START: long Main.sadL3(short, short) instruction_simplifier$after_inlining (before) + /// CHECK-START: long Main.sadL3(short, short) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Select:j\d+>> Select /// CHECK-DAG: Return [<<Select>>] // - /// CHECK-START: long Main.sadL3(short, short) instruction_simplifier$after_inlining (after) + /// CHECK-START: long Main.sadL3(short, short) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Intrin:j\d+>> Abs /// CHECK-DAG: Return [<<Intrin>>] static long sadL3(short x, short y) { @@ -105,11 +105,11 @@ public class Main { return diff >= 0L ? diff : -diff; } - /// CHECK-START: long Main.sadL3Alt(short, short) instruction_simplifier$after_inlining (before) + /// CHECK-START: long Main.sadL3Alt(short, short) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Select:j\d+>> Select /// CHECK-DAG: Return [<<Select>>] // - /// CHECK-START: long Main.sadL3Alt(short, short) instruction_simplifier$after_inlining (after) + /// CHECK-START: long Main.sadL3Alt(short, short) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Intrin:j\d+>> Abs /// CHECK-DAG: Return [<<Intrin>>] static long sadL3Alt(short x, short y) { diff --git a/test/679-checker-minmax/src/Main.java b/test/679-checker-minmax/src/Main.java index 48de1da291..abf8c279da 100644 --- a/test/679-checker-minmax/src/Main.java +++ b/test/679-checker-minmax/src/Main.java @@ -99,211 +99,211 @@ public class Main { // Different types. // - /// CHECK-START: int Main.min1(int, int) instruction_simplifier$after_inlining (before) + /// CHECK-START: int Main.min1(int, int) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Cnd:z\d+>> GreaterThanOrEqual [<<Op1:i\d+>>,<<Op2:i\d+>>] /// CHECK-DAG: <<Sel:i\d+>> Select [<<Op1>>,<<Op2>>,<<Cnd>>] /// CHECK-DAG: Return [<<Sel>>] // - /// CHECK-START: int Main.min1(int, int) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.min1(int, int) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Min:i\d+>> Min /// CHECK-DAG: Return [<<Min>>] // - /// CHECK-START: int Main.min1(int, int) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.min1(int, int) instruction_simplifier$after_gvn (after) /// CHECK-NOT: Select public static int min1(int a, int b) { return a < b ? a : b; } - /// CHECK-START: int Main.min2(int, int) instruction_simplifier$after_inlining (before) + /// CHECK-START: int Main.min2(int, int) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Cnd:z\d+>> GreaterThan [<<Op1:i\d+>>,<<Op2:i\d+>>] /// CHECK-DAG: <<Sel:i\d+>> Select [<<Op1>>,<<Op2>>,<<Cnd>>] /// CHECK-DAG: Return [<<Sel>>] // - /// CHECK-START: int Main.min2(int, int) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.min2(int, int) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Min:i\d+>> Min /// CHECK-DAG: Return [<<Min>>] // - /// CHECK-START: int Main.min2(int, int) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.min2(int, int) instruction_simplifier$after_gvn (after) /// CHECK-NOT: Select public static int min2(int a, int b) { return a <= b ? a : b; } - /// CHECK-START: int Main.min3(int, int) instruction_simplifier$after_inlining (before) + /// CHECK-START: int Main.min3(int, int) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Cnd:z\d+>> LessThanOrEqual [<<Op1:i\d+>>,<<Op2:i\d+>>] /// CHECK-DAG: <<Sel:i\d+>> Select [<<Op2>>,<<Op1>>,<<Cnd>>] /// CHECK-DAG: Return [<<Sel>>] // - /// CHECK-START: int Main.min3(int, int) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.min3(int, int) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Min:i\d+>> Min /// CHECK-DAG: Return [<<Min>>] // - /// CHECK-START: int Main.min3(int, int) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.min3(int, int) instruction_simplifier$after_gvn (after) /// CHECK-NOT: Select public static int min3(int a, int b) { return a > b ? b : a; } - /// CHECK-START: int Main.min4(int, int) instruction_simplifier$after_inlining (before) + /// CHECK-START: int Main.min4(int, int) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Cnd:z\d+>> LessThan [<<Op1:i\d+>>,<<Op2:i\d+>>] /// CHECK-DAG: <<Sel:i\d+>> Select [<<Op2>>,<<Op1>>,<<Cnd>>] /// CHECK-DAG: Return [<<Sel>>] // - /// CHECK-START: int Main.min4(int, int) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.min4(int, int) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Min:i\d+>> Min /// CHECK-DAG: Return [<<Min>>] // - /// CHECK-START: int Main.min4(int, int) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.min4(int, int) instruction_simplifier$after_gvn (after) /// CHECK-NOT: Select public static int min4(int a, int b) { return a >= b ? b : a; } - /// CHECK-START: int Main.min5(short, short) instruction_simplifier$after_inlining (before) + /// CHECK-START: int Main.min5(short, short) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Cnd:z\d+>> LessThan [<<Op1:s\d+>>,<<Op2:s\d+>>] /// CHECK-DAG: <<Sel:i\d+>> Select [<<Op2>>,<<Op1>>,<<Cnd>>] /// CHECK-DAG: Return [<<Sel>>] // - /// CHECK-START: int Main.min5(short, short) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.min5(short, short) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Min:i\d+>> Min /// CHECK-DAG: Return [<<Min>>] // - /// CHECK-START: int Main.min5(short, short) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.min5(short, short) instruction_simplifier$after_gvn (after) /// CHECK-NOT: Select public static int min5(short a, short b) { return a >= b ? b : a; } - /// CHECK-START: int Main.min6(byte, byte) instruction_simplifier$after_inlining (before) + /// CHECK-START: int Main.min6(byte, byte) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Cnd:z\d+>> LessThan [<<Op1:b\d+>>,<<Op2:b\d+>>] /// CHECK-DAG: <<Sel:i\d+>> Select [<<Op2>>,<<Op1>>,<<Cnd>>] /// CHECK-DAG: Return [<<Sel>>] // - /// CHECK-START: int Main.min6(byte, byte) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.min6(byte, byte) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Min:i\d+>> Min /// CHECK-DAG: Return [<<Min>>] // - /// CHECK-START: int Main.min6(byte, byte) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.min6(byte, byte) instruction_simplifier$after_gvn (after) /// CHECK-NOT: Select public static int min6(byte a, byte b) { return a >= b ? b : a; } - /// CHECK-START: long Main.min7(long, long) instruction_simplifier$after_inlining (before) + /// CHECK-START: long Main.min7(long, long) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Cnd:z\d+>> LessThan [<<Op1:j\d+>>,<<Op2:j\d+>>] /// CHECK-DAG: <<Sel:j\d+>> Select [<<Op2>>,<<Op1>>,<<Cnd>>] /// CHECK-DAG: Return [<<Sel>>] // - /// CHECK-START: long Main.min7(long, long) instruction_simplifier$after_inlining (after) + /// CHECK-START: long Main.min7(long, long) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Min:j\d+>> Min /// CHECK-DAG: Return [<<Min>>] // - /// CHECK-START: long Main.min7(long, long) instruction_simplifier$after_inlining (after) + /// CHECK-START: long Main.min7(long, long) instruction_simplifier$after_gvn (after) /// CHECK-NOT: Select public static long min7(long a, long b) { return a >= b ? b : a; } - /// CHECK-START: int Main.max1(int, int) instruction_simplifier$after_inlining (before) + /// CHECK-START: int Main.max1(int, int) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Cnd:z\d+>> GreaterThanOrEqual [<<Op1:i\d+>>,<<Op2:i\d+>>] /// CHECK-DAG: <<Sel:i\d+>> Select [<<Op2>>,<<Op1>>,<<Cnd>>] /// CHECK-DAG: Return [<<Sel>>] // - /// CHECK-START: int Main.max1(int, int) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.max1(int, int) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Max:i\d+>> Max /// CHECK-DAG: Return [<<Max>>] // - /// CHECK-START: int Main.max1(int, int) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.max1(int, int) instruction_simplifier$after_gvn (after) /// CHECK-NOT: Select public static int max1(int a, int b) { return a < b ? b : a; } - /// CHECK-START: int Main.max2(int, int) instruction_simplifier$after_inlining (before) + /// CHECK-START: int Main.max2(int, int) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Cnd:z\d+>> GreaterThan [<<Op1:i\d+>>,<<Op2:i\d+>>] /// CHECK-DAG: <<Sel:i\d+>> Select [<<Op2>>,<<Op1>>,<<Cnd>>] /// CHECK-DAG: Return [<<Sel>>] // - /// CHECK-START: int Main.max2(int, int) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.max2(int, int) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Max:i\d+>> Max /// CHECK-DAG: Return [<<Max>>] // - /// CHECK-START: int Main.max2(int, int) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.max2(int, int) instruction_simplifier$after_gvn (after) /// CHECK-NOT: Select public static int max2(int a, int b) { return a <= b ? b : a; } - /// CHECK-START: int Main.max3(int, int) instruction_simplifier$after_inlining (before) + /// CHECK-START: int Main.max3(int, int) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Cnd:z\d+>> LessThanOrEqual [<<Op1:i\d+>>,<<Op2:i\d+>>] /// CHECK-DAG: <<Sel:i\d+>> Select [<<Op1>>,<<Op2>>,<<Cnd>>] /// CHECK-DAG: Return [<<Sel>>] // - /// CHECK-START: int Main.max3(int, int) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.max3(int, int) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Max:i\d+>> Max /// CHECK-DAG: Return [<<Max>>] // - /// CHECK-START: int Main.max3(int, int) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.max3(int, int) instruction_simplifier$after_gvn (after) /// CHECK-NOT: Select public static int max3(int a, int b) { return a > b ? a : b; } - /// CHECK-START: int Main.max4(int, int) instruction_simplifier$after_inlining (before) + /// CHECK-START: int Main.max4(int, int) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Cnd:z\d+>> LessThan [<<Op1:i\d+>>,<<Op2:i\d+>>] /// CHECK-DAG: <<Sel:i\d+>> Select [<<Op1>>,<<Op2>>,<<Cnd>>] /// CHECK-DAG: Return [<<Sel>>] // - /// CHECK-START: int Main.max4(int, int) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.max4(int, int) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Max:i\d+>> Max /// CHECK-DAG: Return [<<Max>>] // - /// CHECK-START: int Main.max4(int, int) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.max4(int, int) instruction_simplifier$after_gvn (after) /// CHECK-NOT: Select public static int max4(int a, int b) { return a >= b ? a : b; } - /// CHECK-START: int Main.max5(short, short) instruction_simplifier$after_inlining (before) + /// CHECK-START: int Main.max5(short, short) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Cnd:z\d+>> LessThan [<<Op1:s\d+>>,<<Op2:s\d+>>] /// CHECK-DAG: <<Sel:i\d+>> Select [<<Op1>>,<<Op2>>,<<Cnd>>] /// CHECK-DAG: Return [<<Sel>>] // - /// CHECK-START: int Main.max5(short, short) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.max5(short, short) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Max:i\d+>> Max /// CHECK-DAG: Return [<<Max>>] // - /// CHECK-START: int Main.max5(short, short) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.max5(short, short) instruction_simplifier$after_gvn (after) /// CHECK-NOT: Select public static int max5(short a, short b) { return a >= b ? a : b; } - /// CHECK-START: int Main.max6(byte, byte) instruction_simplifier$after_inlining (before) + /// CHECK-START: int Main.max6(byte, byte) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Cnd:z\d+>> LessThan [<<Op1:b\d+>>,<<Op2:b\d+>>] /// CHECK-DAG: <<Sel:i\d+>> Select [<<Op1>>,<<Op2>>,<<Cnd>>] /// CHECK-DAG: Return [<<Sel>>] // - /// CHECK-START: int Main.max6(byte, byte) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.max6(byte, byte) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Max:i\d+>> Max /// CHECK-DAG: Return [<<Max>>] // - /// CHECK-START: int Main.max6(byte, byte) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.max6(byte, byte) instruction_simplifier$after_gvn (after) /// CHECK-NOT: Select public static int max6(byte a, byte b) { return a >= b ? a : b; } - /// CHECK-START: long Main.max7(long, long) instruction_simplifier$after_inlining (before) + /// CHECK-START: long Main.max7(long, long) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Cnd:z\d+>> LessThan [<<Op1:j\d+>>,<<Op2:j\d+>>] /// CHECK-DAG: <<Sel:j\d+>> Select [<<Op1>>,<<Op2>>,<<Cnd>>] /// CHECK-DAG: Return [<<Sel>>] // - /// CHECK-START: long Main.max7(long, long) instruction_simplifier$after_inlining (after) + /// CHECK-START: long Main.max7(long, long) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Max:j\d+>> Max /// CHECK-DAG: Return [<<Max>>] // - /// CHECK-START: long Main.max7(long, long) instruction_simplifier$after_inlining (after) + /// CHECK-START: long Main.max7(long, long) instruction_simplifier$after_gvn (after) /// CHECK-NOT: Select public static long max7(long a, long b) { return a >= b ? a : b; @@ -313,18 +313,18 @@ public class Main { // Complications. // - /// CHECK-START: int Main.min0(int[], int[]) instruction_simplifier$after_inlining (before) + /// CHECK-START: int Main.min0(int[], int[]) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Ar1:i\d+>> ArrayGet [{{l\d+}},{{i\d+}}] /// CHECK-DAG: <<Ar2:i\d+>> ArrayGet [{{l\d+}},{{i\d+}}] /// CHECK-DAG: <<Cnd:z\d+>> GreaterThan [<<Ar1>>,<<Ar2>>] /// CHECK-DAG: <<Sel:i\d+>> Select [<<Ar1>>,<<Ar2>>,<<Cnd>>] /// CHECK-DAG: Return [<<Sel>>] // - /// CHECK-START: int Main.min0(int[], int[]) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.min0(int[], int[]) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Min:i\d+>> Min /// CHECK-DAG: Return [<<Min>>] // - /// CHECK-START: int Main.min0(int[], int[]) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.min0(int[], int[]) instruction_simplifier$after_gvn (after) /// CHECK-NOT: Select public static int min0(int[] a, int[] b) { // Repeat of array references needs finding the common subexpressions @@ -332,18 +332,18 @@ public class Main { return a[0] <= b[0] ? a[0] : b[0]; } - /// CHECK-START: int Main.max0(int[], int[]) instruction_simplifier$after_inlining (before) + /// CHECK-START: int Main.max0(int[], int[]) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Ar1:i\d+>> ArrayGet [{{l\d+}},{{i\d+}}] /// CHECK-DAG: <<Ar2:i\d+>> ArrayGet [{{l\d+}},{{i\d+}}] /// CHECK-DAG: <<Cnd:z\d+>> LessThan [<<Ar1>>,<<Ar2>>] /// CHECK-DAG: <<Sel:i\d+>> Select [<<Ar1>>,<<Ar2>>,<<Cnd>>] /// CHECK-DAG: Return [<<Sel>>] // - /// CHECK-START: int Main.max0(int[], int[]) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.max0(int[], int[]) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Max:i\d+>> Max /// CHECK-DAG: Return [<<Max>>] // - /// CHECK-START: int Main.max0(int[], int[]) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.max0(int[], int[]) instruction_simplifier$after_gvn (after) /// CHECK-NOT: Select public static int max0(int[] a, int[] b) { // Repeat of array references needs finding the common subexpressions @@ -351,7 +351,7 @@ public class Main { return a[0] >= b[0] ? a[0] : b[0]; } - /// CHECK-START: int Main.minmax1(int) instruction_simplifier$after_inlining (before) + /// CHECK-START: int Main.minmax1(int) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Par:i\d+>> ParameterValue /// CHECK-DAG: <<P100:i\d+>> IntConstant 100 /// CHECK-DAG: <<M100:i\d+>> IntConstant -100 @@ -361,7 +361,7 @@ public class Main { /// CHECK-DAG: <<Sel2:i\d+>> Select [<<M100>>,<<Sel1>>,<<Cnd2>>] /// CHECK-DAG: Return [<<Sel2>>] // - /// CHECK-START: int Main.minmax1(int) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.minmax1(int) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Par:i\d+>> ParameterValue /// CHECK-DAG: <<P100:i\d+>> IntConstant 100 /// CHECK-DAG: <<M100:i\d+>> IntConstant -100 @@ -369,7 +369,7 @@ public class Main { /// CHECK-DAG: <<Max:i\d+>> Max [<<Min>>,<<M100>>] /// CHECK-DAG: Return [<<Max>>] // - /// CHECK-START: int Main.minmax1(int) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.minmax1(int) instruction_simplifier$after_gvn (after) /// CHECK-NOT: Select public static int minmax1(int x) { // Simple if-if gives clean select sequence. @@ -382,7 +382,7 @@ public class Main { return x; } - /// CHECK-START: int Main.minmax2(int) instruction_simplifier$after_inlining (before) + /// CHECK-START: int Main.minmax2(int) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Par:i\d+>> ParameterValue /// CHECK-DAG: <<P100:i\d+>> IntConstant 100 /// CHECK-DAG: <<M100:i\d+>> IntConstant -100 @@ -392,7 +392,7 @@ public class Main { /// CHECK-DAG: <<Sel2:i\d+>> Select [<<P100>>,<<Sel1>>,<<Cnd1>>] /// CHECK-DAG: Return [<<Sel2>>] // - /// CHECK-START: int Main.minmax2(int) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.minmax2(int) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Par:i\d+>> ParameterValue /// CHECK-DAG: <<P100:i\d+>> IntConstant 100 /// CHECK-DAG: <<M100:i\d+>> IntConstant -100 @@ -400,7 +400,7 @@ public class Main { /// CHECK-DAG: <<Min:i\d+>> Min [<<Max>>,<<P100>>] /// CHECK-DAG: Return [<<Min>>] // - /// CHECK-START: int Main.minmax2(int) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.minmax2(int) instruction_simplifier$after_gvn (after) /// CHECK-NOT: Select public static int minmax2(int x) { // Simple if-else requires inspecting bounds of resulting selects. @@ -412,7 +412,7 @@ public class Main { return x; } - /// CHECK-START: int Main.minmax3(int) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.minmax3(int) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Par:i\d+>> ParameterValue /// CHECK-DAG: <<P100:i\d+>> IntConstant 100 /// CHECK-DAG: <<M100:i\d+>> IntConstant -100 @@ -420,13 +420,13 @@ public class Main { /// CHECK-DAG: <<Min:i\d+>> Min [<<Max>>,<<P100>>] /// CHECK-DAG: Return [<<Min>>] // - /// CHECK-START: int Main.minmax3(int) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.minmax3(int) instruction_simplifier$after_gvn (after) /// CHECK-NOT: Select public static int minmax3(int x) { return (x > 100) ? 100 : ((x < -100) ? -100 : x); } - /// CHECK-START: int Main.minmax4(int) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.minmax4(int) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Par:i\d+>> ParameterValue /// CHECK-DAG: <<P100:i\d+>> IntConstant 100 /// CHECK-DAG: <<M100:i\d+>> IntConstant -100 @@ -434,7 +434,7 @@ public class Main { /// CHECK-DAG: <<Max:i\d+>> Max [<<Min>>,<<M100>>] /// CHECK-DAG: Return [<<Max>>] // - /// CHECK-START: int Main.minmax4(int) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.minmax4(int) instruction_simplifier$after_gvn (after) /// CHECK-NOT: Select public static int minmax4(int x) { return (x < -100) ? -100 : ((x > 100) ? 100 : x); @@ -454,7 +454,7 @@ public class Main { /// CHECK-DAG: <<Add5:i\d+>> Add [<<Sel2>>,<<Add4>>] /// CHECK-DAG: Return [<<Add5>>] // - /// CHECK-START: int Main.minmaxCSEScalar(int, int) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.minmaxCSEScalar(int, int) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Par1:i\d+>> ParameterValue /// CHECK-DAG: <<Par2:i\d+>> ParameterValue /// CHECK-DAG: <<Max:i\d+>> Max [<<Par1>>,<<Par2>>] @@ -490,7 +490,7 @@ public class Main { /// CHECK-DAG: <<Add5:i\d+>> Add [<<Sel2>>,<<Add4>>] /// CHECK-DAG: Return [<<Add5>>] // - /// CHECK-START: int Main.minmaxCSEArray(int[], int[]) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.minmaxCSEArray(int[], int[]) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Arr1:i\d+>> ArrayGet /// CHECK-DAG: <<Arr2:i\d+>> ArrayGet /// CHECK-DAG: <<Max:i\d+>> Max [<<Arr1>>,<<Arr2>>] @@ -512,7 +512,7 @@ public class Main { return t1 + t2 + t3 + t4 + t5 + t6; } - /// CHECK-START: int Main.minmaxCSEScalarAndCond(int, int) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.minmaxCSEScalarAndCond(int, int) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Par1:i\d+>> ParameterValue /// CHECK-DAG: <<Par2:i\d+>> ParameterValue /// CHECK-DAG: <<Max:i\d+>> Max [<<Par1>>,<<Par2>>] diff --git a/test/681-checker-abs/src/Main.java b/test/681-checker-abs/src/Main.java index 2b95a8d56e..00390c3145 100644 --- a/test/681-checker-abs/src/Main.java +++ b/test/681-checker-abs/src/Main.java @@ -59,7 +59,7 @@ public class Main { // Types. // - /// CHECK-START: int Main.abs1(int) instruction_simplifier$after_inlining (before) + /// CHECK-START: int Main.abs1(int) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Par:i\d+>> ParameterValue /// CHECK-DAG: <<Zer:i\d+>> IntConstant 0 /// CHECK-DAG: <<Cnd:z\d+>> GreaterThanOrEqual [<<Par>>,<<Zer>>] @@ -67,18 +67,18 @@ public class Main { /// CHECK-DAG: <<Sel:i\d+>> Select [<<Neg>>,<<Par>>,<<Cnd>>] /// CHECK-DAG: Return [<<Sel>>] // - /// CHECK-START: int Main.abs1(int) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.abs1(int) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Par:i\d+>> ParameterValue /// CHECK-DAG: <<Abs:i\d+>> Abs [<<Par>>] /// CHECK-DAG: Return [<<Abs>>] // - /// CHECK-START: int Main.abs1(int) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.abs1(int) instruction_simplifier$after_gvn (after) /// CHECK-NOT: Select public static int abs1(int a) { return a < 0 ? -a : a; } - /// CHECK-START: int Main.abs2(int) instruction_simplifier$after_inlining (before) + /// CHECK-START: int Main.abs2(int) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Par:i\d+>> ParameterValue /// CHECK-DAG: <<Zer:i\d+>> IntConstant 0 /// CHECK-DAG: <<Cnd:z\d+>> GreaterThan [<<Par>>,<<Zer>>] @@ -86,18 +86,18 @@ public class Main { /// CHECK-DAG: <<Sel:i\d+>> Select [<<Neg>>,<<Par>>,<<Cnd>>] /// CHECK-DAG: Return [<<Sel>>] // - /// CHECK-START: int Main.abs2(int) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.abs2(int) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Par:i\d+>> ParameterValue /// CHECK-DAG: <<Abs:i\d+>> Abs [<<Par>>] /// CHECK-DAG: Return [<<Abs>>] // - /// CHECK-START: int Main.abs2(int) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.abs2(int) instruction_simplifier$after_gvn (after) /// CHECK-NOT: Select public static int abs2(int a) { return a <= 0 ? -a : a; } - /// CHECK-START: int Main.abs3(int) instruction_simplifier$after_inlining (before) + /// CHECK-START: int Main.abs3(int) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Par:i\d+>> ParameterValue /// CHECK-DAG: <<Zer:i\d+>> IntConstant 0 /// CHECK-DAG: <<Cnd:z\d+>> LessThanOrEqual [<<Par>>,<<Zer>>] @@ -105,18 +105,18 @@ public class Main { /// CHECK-DAG: <<Sel:i\d+>> Select [<<Par>>,<<Neg>>,<<Cnd>>] /// CHECK-DAG: Return [<<Sel>>] // - /// CHECK-START: int Main.abs3(int) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.abs3(int) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Par:i\d+>> ParameterValue /// CHECK-DAG: <<Abs:i\d+>> Abs [<<Par>>] /// CHECK-DAG: Return [<<Abs>>] // - /// CHECK-START: int Main.abs3(int) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.abs3(int) instruction_simplifier$after_gvn (after) /// CHECK-NOT: Select public static int abs3(int a) { return a > 0 ? a : -a; } - /// CHECK-START: int Main.abs4(int) instruction_simplifier$after_inlining (before) + /// CHECK-START: int Main.abs4(int) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Par:i\d+>> ParameterValue /// CHECK-DAG: <<Zer:i\d+>> IntConstant 0 /// CHECK-DAG: <<Cnd:z\d+>> LessThan [<<Par>>,<<Zer>>] @@ -124,18 +124,18 @@ public class Main { /// CHECK-DAG: <<Sel:i\d+>> Select [<<Par>>,<<Neg>>,<<Cnd>>] /// CHECK-DAG: Return [<<Sel>>] // - /// CHECK-START: int Main.abs4(int) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.abs4(int) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Par:i\d+>> ParameterValue /// CHECK-DAG: <<Abs:i\d+>> Abs [<<Par>>] /// CHECK-DAG: Return [<<Abs>>] // - /// CHECK-START: int Main.abs4(int) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.abs4(int) instruction_simplifier$after_gvn (after) /// CHECK-NOT: Select public static int abs4(int a) { return a >= 0 ? a : -a; } - /// CHECK-START: int Main.abs5(short) instruction_simplifier$after_inlining (before) + /// CHECK-START: int Main.abs5(short) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Par:s\d+>> ParameterValue /// CHECK-DAG: <<Zer:i\d+>> IntConstant 0 /// CHECK-DAG: <<Cnd:z\d+>> LessThan [<<Par>>,<<Zer>>] @@ -143,18 +143,18 @@ public class Main { /// CHECK-DAG: <<Sel:i\d+>> Select [<<Par>>,<<Neg>>,<<Cnd>>] /// CHECK-DAG: Return [<<Sel>>] // - /// CHECK-START: int Main.abs5(short) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.abs5(short) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Par:s\d+>> ParameterValue /// CHECK-DAG: <<Abs:i\d+>> Abs [<<Par>>] /// CHECK-DAG: Return [<<Abs>>] // - /// CHECK-START: int Main.abs5(short) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.abs5(short) instruction_simplifier$after_gvn (after) /// CHECK-NOT: Select public static int abs5(short a) { return a >= 0 ? a : -a; } - /// CHECK-START: int Main.abs6(byte) instruction_simplifier$after_inlining (before) + /// CHECK-START: int Main.abs6(byte) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Par:b\d+>> ParameterValue /// CHECK-DAG: <<Zer:i\d+>> IntConstant 0 /// CHECK-DAG: <<Cnd:z\d+>> LessThan [<<Par>>,<<Zer>>] @@ -162,18 +162,18 @@ public class Main { /// CHECK-DAG: <<Sel:i\d+>> Select [<<Par>>,<<Neg>>,<<Cnd>>] /// CHECK-DAG: Return [<<Sel>>] // - /// CHECK-START: int Main.abs6(byte) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.abs6(byte) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Par:b\d+>> ParameterValue /// CHECK-DAG: <<Abs:i\d+>> Abs [<<Par>>] /// CHECK-DAG: Return [<<Abs>>] // - /// CHECK-START: int Main.abs6(byte) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.abs6(byte) instruction_simplifier$after_gvn (after) /// CHECK-NOT: Select public static int abs6(byte a) { return a >= 0 ? a : -a; } - /// CHECK-START: long Main.abs7(long) instruction_simplifier$after_inlining (before) + /// CHECK-START: long Main.abs7(long) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Par:j\d+>> ParameterValue /// CHECK-DAG: <<Zer:j\d+>> LongConstant 0 /// CHECK-DAG: <<Cnd:z\d+>> LessThan [<<Par>>,<<Zer>>] @@ -181,12 +181,12 @@ public class Main { /// CHECK-DAG: <<Sel:j\d+>> Select [<<Par>>,<<Neg>>,<<Cnd>>] /// CHECK-DAG: Return [<<Sel>>] // - /// CHECK-START: long Main.abs7(long) instruction_simplifier$after_inlining (after) + /// CHECK-START: long Main.abs7(long) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Par:j\d+>> ParameterValue /// CHECK-DAG: <<Abs:j\d+>> Abs [<<Par>>] /// CHECK-DAG: Return [<<Abs>>] // - /// CHECK-START: long Main.abs7(long) instruction_simplifier$after_inlining (after) + /// CHECK-START: long Main.abs7(long) instruction_simplifier$after_gvn (after) /// CHECK-NOT: Select public static long abs7(long a) { return a >= 0 ? a : -a; @@ -196,7 +196,7 @@ public class Main { // Complications. // - /// CHECK-START: int Main.abs0(int[]) instruction_simplifier$after_inlining (before) + /// CHECK-START: int Main.abs0(int[]) instruction_simplifier$after_gvn (before) /// CHECK-DAG: <<Zer:i\d+>> IntConstant 0 /// CHECK-DAG: <<Arr:i\d+>> ArrayGet [{{l\d+}},{{i\d+}}] /// CHECK-DAG: <<Cnd:z\d+>> LessThan [<<Arr>>,<<Zer>>] @@ -204,12 +204,12 @@ public class Main { /// CHECK-DAG: <<Sel:i\d+>> Select [<<Arr>>,<<Neg>>,<<Cnd>>] /// CHECK-DAG: Return [<<Sel>>] // - /// CHECK-START: int Main.abs0(int[]) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.abs0(int[]) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Arr:i\d+>> ArrayGet [{{l\d+}},{{i\d+}}] /// CHECK-DAG: <<Abs:i\d+>> Abs [<<Arr>>] /// CHECK-DAG: Return [<<Abs>>] // - /// CHECK-START: int Main.abs0(int[]) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.abs0(int[]) instruction_simplifier$after_gvn (after) /// CHECK-NOT: Select public static int abs0(int[] a) { return a[0] >= 0 ? a[0] : -a[0]; @@ -267,11 +267,11 @@ public class Main { /// CHECK-DAG: <<Abs:i\d+>> Abs [<<Par>>] /// CHECK-DAG: Return [<<Abs>>] // - /// CHECK-START: int Main.zabs3(char) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.zabs3(char) instruction_simplifier$after_gvn (after) /// CHECK-DAG: <<Par:c\d+>> ParameterValue /// CHECK-DAG: Return [<<Par>>] // - /// CHECK-START: int Main.zabs3(char) instruction_simplifier$after_inlining (after) + /// CHECK-START: int Main.zabs3(char) instruction_simplifier$after_gvn (after) /// CHECK-NOT: InvokeStaticOrDirect /// CHECK-NOT: Abs public static int zabs3(char a) { diff --git a/test/Android.bp b/test/Android.bp index b9312c8f15..16d14cdf30 100644 --- a/test/Android.bp +++ b/test/Android.bp @@ -63,6 +63,7 @@ art_cc_defaults { "libvixld-arm64", "libart-gtest", "libdexfiled", + "libprofiled", "libbase", "libicuuc", @@ -115,6 +116,7 @@ art_cc_defaults { "libartd", "libartd-compiler", "libdexfiled", + "libprofiled", ], static_libs: [ "libgtest", @@ -152,6 +154,7 @@ art_cc_library { "libartd", "libartd-compiler", "libdexfiled", + "libprofiled", "libbase", "libbacktrace", ], @@ -182,6 +185,7 @@ art_cc_test_library { shared_libs: [ "libart", "libdexfile", + "libprofile", ], } @@ -195,6 +199,7 @@ art_cc_test_library { shared_libs: [ "libartd", "libdexfiled", + "libprofiled", ], } @@ -315,6 +320,7 @@ art_cc_test_library { shared_libs: [ "libart", "libdexfile", + "libprofile", ], } @@ -327,6 +333,7 @@ art_cc_test_library { shared_libs: [ "libartd", "libdexfiled", + "libprofiled", ], } @@ -458,6 +465,7 @@ art_cc_test_library { shared_libs: [ "libart", "libdexfile", + "libprofile", ], } @@ -470,6 +478,7 @@ art_cc_test_library { shared_libs: [ "libartd", "libdexfiled", + "libprofiled", ], } diff --git a/test/common/runtime_state.cc b/test/common/runtime_state.cc index 2203bdca01..a55cc79ef9 100644 --- a/test/common/runtime_state.cc +++ b/test/common/runtime_state.cc @@ -25,12 +25,12 @@ #include "instrumentation.h" #include "jit/jit.h" #include "jit/jit_code_cache.h" -#include "jit/profile_compilation_info.h" #include "jit/profiling_info.h" #include "mirror/class-inl.h" #include "nativehelper/ScopedUtfChars.h" #include "oat_file.h" #include "oat_quick_method_header.h" +#include "profile/profile_compilation_info.h" #include "runtime.h" #include "scoped_thread_state_change-inl.h" #include "thread-current-inl.h" diff --git a/test/etc/run-test-jar b/test/etc/run-test-jar index c5277548eb..be1296b990 100755 --- a/test/etc/run-test-jar +++ b/test/etc/run-test-jar @@ -871,9 +871,9 @@ if [ "$HOST" = "n" ]; then # System libraries needed by libarttestd.so PUBLIC_LIBS=libc++.so:libbacktrace.so:libbase.so:libnativehelper.so if [ "$TEST_IS_NDEBUG" = "y" ]; then - PUBLIC_LIBS=$PUBLIC_LIBS:libart.so:libdexfile.so + PUBLIC_LIBS=$PUBLIC_LIBS:libart.so:libdexfile.so:libprofile.so else - PUBLIC_LIBS=$PUBLIC_LIBS:libartd.so:libdexfiled.so + PUBLIC_LIBS=$PUBLIC_LIBS:libartd.so:libdexfiled.so:libprofiled.so fi # Create a script with the command. The command can get longer than the longest diff --git a/tools/cpp-define-generator/constant_globals.def b/tools/cpp-define-generator/constant_globals.def index 539633e0b3..d0d6350f80 100644 --- a/tools/cpp-define-generator/constant_globals.def +++ b/tools/cpp-define-generator/constant_globals.def @@ -18,8 +18,8 @@ #if defined(DEFINE_INCLUDE_DEPENDENCIES) #include <atomic> // std::memory_order_relaxed +#include "base/globals.h" // art::kObjectAlignment #include "dex/modifiers.h" -#include "globals.h" // art::kObjectAlignment #endif DEFINE_EXPR(STD_MEMORY_ORDER_RELAXED, int32_t, std::memory_order_relaxed) diff --git a/tools/public.libraries.buildbot.txt b/tools/public.libraries.buildbot.txt index de636a813a..6c8114558e 100644 --- a/tools/public.libraries.buildbot.txt +++ b/tools/public.libraries.buildbot.txt @@ -8,3 +8,5 @@ libc++.so libdl.so libm.so libnativehelper.so +libprofile.so +libprofiled.so diff --git a/tools/veridex/Android.mk b/tools/veridex/Android.mk index 4183054193..51d924a3c1 100644 --- a/tools/veridex/Android.mk +++ b/tools/veridex/Android.mk @@ -18,13 +18,13 @@ LOCAL_PATH := $(call my-dir) system_stub_dex := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/core_dex_intermediates/classes.dex $(system_stub_dex): PRIVATE_MIN_SDK_VERSION := 1000 -$(system_stub_dex): $(TOPDIR)prebuilts/sdk/system_current/android.jar | $(ZIP2ZIP) $(DX) +$(system_stub_dex): $(call resolve-prebuilt-sdk-jar-path,system_current) | $(ZIP2ZIP) $(DX) $(transform-classes-d8.jar-to-dex) oahl_stub_dex := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/oahl_dex_intermediates/classes.dex $(oahl_stub_dex): PRIVATE_MIN_SDK_VERSION := 1000 -$(oahl_stub_dex): $(TOPDIR)prebuilts/sdk/org.apache.http.legacy/org.apache.http.legacy.jar | $(ZIP2ZIP) $(DX) +$(oahl_stub_dex): $(call get-prebuilt-sdk-dir,current)/org.apache.http.legacy.jar | $(ZIP2ZIP) $(DX) $(transform-classes-d8.jar-to-dex) .PHONY: appcompat |