diff options
Diffstat (limited to 'compiler/optimizing')
23 files changed, 58 insertions, 37 deletions
diff --git a/compiler/optimizing/bounds_check_elimination.cc b/compiler/optimizing/bounds_check_elimination.cc index bcee5638fc..ae9974d7e9 100644 --- a/compiler/optimizing/bounds_check_elimination.cc +++ b/compiler/optimizing/bounds_check_elimination.cc @@ -14,9 +14,9 @@ * limitations under the License. */ +#include "base/arena_containers.h" #include "bounds_check_elimination.h" #include "nodes.h" -#include "utils/arena_containers.h" namespace art { diff --git a/compiler/optimizing/bounds_check_elimination_test.cc b/compiler/optimizing/bounds_check_elimination_test.cc index 662834a91c..17cb8f35de 100644 --- a/compiler/optimizing/bounds_check_elimination_test.cc +++ b/compiler/optimizing/bounds_check_elimination_test.cc @@ -14,6 +14,7 @@ * limitations under the License. */ +#include "base/arena_allocator.h" #include "bounds_check_elimination.h" #include "builder.h" #include "gvn.h" @@ -21,7 +22,6 @@ #include "nodes.h" #include "optimizing_unit_test.h" #include "side_effects_analysis.h" -#include "utils/arena_allocator.h" #include "gtest/gtest.h" diff --git a/compiler/optimizing/builder.h b/compiler/optimizing/builder.h index c5101363ee..3e4a6169d9 100644 --- a/compiler/optimizing/builder.h +++ b/compiler/optimizing/builder.h @@ -17,13 +17,13 @@ #ifndef ART_COMPILER_OPTIMIZING_BUILDER_H_ #define ART_COMPILER_OPTIMIZING_BUILDER_H_ +#include "base/arena_object.h" #include "dex_file.h" #include "dex_file-inl.h" #include "driver/compiler_driver.h" #include "driver/dex_compilation_unit.h" #include "optimizing_compiler_stats.h" #include "primitive.h" -#include "utils/arena_object.h" #include "utils/growable_array.h" #include "nodes.h" diff --git a/compiler/optimizing/code_generator.cc b/compiler/optimizing/code_generator.cc index 5b395c8eeb..2a57fdc929 100644 --- a/compiler/optimizing/code_generator.cc +++ b/compiler/optimizing/code_generator.cc @@ -620,7 +620,7 @@ void CodeGenerator::RecordPcInfo(HInstruction* instruction, uint32_t dex_pc) { Location location = locations->GetEnvironmentAt(i); switch (location.GetKind()) { case Location::kConstant: { - DCHECK(current == location.GetConstant()); + DCHECK_EQ(current, location.GetConstant()); if (current->IsLongConstant()) { int64_t value = current->AsLongConstant()->GetValue(); stack_map_stream_.AddDexRegisterEntry(DexRegisterMap::kConstant, Low32Bits(value)); diff --git a/compiler/optimizing/code_generator_arm64.cc b/compiler/optimizing/code_generator_arm64.cc index 6da1e6177c..0d7864fa35 100644 --- a/compiler/optimizing/code_generator_arm64.cc +++ b/compiler/optimizing/code_generator_arm64.cc @@ -1397,7 +1397,13 @@ void LocationsBuilderARM64::VisitCompare(HCompare* compare) { case Primitive::kPrimFloat: case Primitive::kPrimDouble: { locations->SetInAt(0, Location::RequiresFpuRegister()); - locations->SetInAt(1, Location::RequiresFpuRegister()); + HInstruction* right = compare->InputAt(1); + if ((right->IsFloatConstant() && (right->AsFloatConstant()->GetValue() == 0.0f)) || + (right->IsDoubleConstant() && (right->AsDoubleConstant()->GetValue() == 0.0))) { + locations->SetInAt(1, Location::ConstantLocation(right->AsConstant())); + } else { + locations->SetInAt(1, Location::RequiresFpuRegister()); + } locations->SetOut(Location::RequiresRegister()); break; } @@ -1427,9 +1433,17 @@ void InstructionCodeGeneratorARM64::VisitCompare(HCompare* compare) { case Primitive::kPrimDouble: { Register result = OutputRegister(compare); FPRegister left = InputFPRegisterAt(compare, 0); - FPRegister right = InputFPRegisterAt(compare, 1); - - __ Fcmp(left, right); + if (compare->GetLocations()->InAt(1).IsConstant()) { + if (kIsDebugBuild) { + HInstruction* right = compare->GetLocations()->InAt(1).GetConstant(); + DCHECK((right->IsFloatConstant() && (right->AsFloatConstant()->GetValue() == 0.0f)) || + (right->IsDoubleConstant() && (right->AsDoubleConstant()->GetValue() == 0.0))); + } + // 0.0 is the only immediate that can be encoded directly in a FCMP instruction. + __ Fcmp(left, 0.0); + } else { + __ Fcmp(left, InputFPRegisterAt(compare, 1)); + } if (compare->IsGtBias()) { __ Cset(result, ne); } else { diff --git a/compiler/optimizing/dominator_test.cc b/compiler/optimizing/dominator_test.cc index b246c6f98d..7623e421fd 100644 --- a/compiler/optimizing/dominator_test.cc +++ b/compiler/optimizing/dominator_test.cc @@ -14,11 +14,11 @@ * limitations under the License. */ +#include "base/arena_allocator.h" #include "builder.h" #include "dex_instruction.h" #include "nodes.h" #include "optimizing_unit_test.h" -#include "utils/arena_allocator.h" #include "gtest/gtest.h" diff --git a/compiler/optimizing/find_loops_test.cc b/compiler/optimizing/find_loops_test.cc index e05d9b3b0f..2bfecc696a 100644 --- a/compiler/optimizing/find_loops_test.cc +++ b/compiler/optimizing/find_loops_test.cc @@ -14,13 +14,13 @@ * limitations under the License. */ +#include "base/arena_allocator.h" #include "builder.h" #include "dex_file.h" #include "dex_instruction.h" #include "nodes.h" #include "optimizing_unit_test.h" #include "ssa_liveness_analysis.h" -#include "utils/arena_allocator.h" #include "pretty_printer.h" #include "gtest/gtest.h" diff --git a/compiler/optimizing/graph_test.cc b/compiler/optimizing/graph_test.cc index c59f8366fa..4742e4d073 100644 --- a/compiler/optimizing/graph_test.cc +++ b/compiler/optimizing/graph_test.cc @@ -14,12 +14,12 @@ * limitations under the License. */ +#include "base/arena_allocator.h" #include "base/stringprintf.h" #include "builder.h" #include "nodes.h" #include "optimizing_unit_test.h" #include "pretty_printer.h" -#include "utils/arena_allocator.h" #include "gtest/gtest.h" diff --git a/compiler/optimizing/gvn_test.cc b/compiler/optimizing/gvn_test.cc index 4a48fee2fb..a81d49aa0c 100644 --- a/compiler/optimizing/gvn_test.cc +++ b/compiler/optimizing/gvn_test.cc @@ -14,12 +14,12 @@ * limitations under the License. */ +#include "base/arena_allocator.h" #include "builder.h" #include "gvn.h" #include "nodes.h" #include "optimizing_unit_test.h" #include "side_effects_analysis.h" -#include "utils/arena_allocator.h" #include "gtest/gtest.h" diff --git a/compiler/optimizing/linearize_test.cc b/compiler/optimizing/linearize_test.cc index eb27965c79..f22b7a7e82 100644 --- a/compiler/optimizing/linearize_test.cc +++ b/compiler/optimizing/linearize_test.cc @@ -16,6 +16,7 @@ #include <fstream> +#include "base/arena_allocator.h" #include "base/stringprintf.h" #include "builder.h" #include "code_generator.h" @@ -29,7 +30,6 @@ #include "pretty_printer.h" #include "ssa_builder.h" #include "ssa_liveness_analysis.h" -#include "utils/arena_allocator.h" #include "gtest/gtest.h" diff --git a/compiler/optimizing/live_interval_test.cc b/compiler/optimizing/live_interval_test.cc index ac8759c805..28000c18f8 100644 --- a/compiler/optimizing/live_interval_test.cc +++ b/compiler/optimizing/live_interval_test.cc @@ -14,9 +14,9 @@ * limitations under the License. */ +#include "base/arena_allocator.h" #include "optimizing_unit_test.h" #include "ssa_liveness_analysis.h" -#include "utils/arena_allocator.h" #include "gtest/gtest.h" diff --git a/compiler/optimizing/live_ranges_test.cc b/compiler/optimizing/live_ranges_test.cc index 0558b85b47..17914e8206 100644 --- a/compiler/optimizing/live_ranges_test.cc +++ b/compiler/optimizing/live_ranges_test.cc @@ -14,6 +14,7 @@ * limitations under the License. */ +#include "base/arena_allocator.h" #include "builder.h" #include "code_generator.h" #include "code_generator_x86.h" @@ -24,7 +25,6 @@ #include "optimizing_unit_test.h" #include "prepare_for_register_allocation.h" #include "ssa_liveness_analysis.h" -#include "utils/arena_allocator.h" #include "gtest/gtest.h" diff --git a/compiler/optimizing/liveness_test.cc b/compiler/optimizing/liveness_test.cc index c9be570c73..907eff162f 100644 --- a/compiler/optimizing/liveness_test.cc +++ b/compiler/optimizing/liveness_test.cc @@ -14,6 +14,7 @@ * limitations under the License. */ +#include "base/arena_allocator.h" #include "builder.h" #include "code_generator.h" #include "code_generator_x86.h" @@ -24,7 +25,6 @@ #include "optimizing_unit_test.h" #include "prepare_for_register_allocation.h" #include "ssa_liveness_analysis.h" -#include "utils/arena_allocator.h" #include "gtest/gtest.h" diff --git a/compiler/optimizing/locations.h b/compiler/optimizing/locations.h index ebca1cc4d0..198cc15cce 100644 --- a/compiler/optimizing/locations.h +++ b/compiler/optimizing/locations.h @@ -17,10 +17,10 @@ #ifndef ART_COMPILER_OPTIMIZING_LOCATIONS_H_ #define ART_COMPILER_OPTIMIZING_LOCATIONS_H_ +#include "base/arena_object.h" #include "base/bit_field.h" #include "base/bit_vector.h" #include "base/value_object.h" -#include "utils/arena_object.h" #include "utils/growable_array.h" namespace art { diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index 4baea6635d..352403d72c 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -17,6 +17,7 @@ #ifndef ART_COMPILER_OPTIMIZING_NODES_H_ #define ART_COMPILER_OPTIMIZING_NODES_H_ +#include "base/arena_object.h" #include "entrypoints/quick/quick_entrypoints_enum.h" #include "handle.h" #include "handle_scope.h" @@ -25,7 +26,6 @@ #include "mirror/class.h" #include "offsets.h" #include "primitive.h" -#include "utils/arena_object.h" #include "utils/arena_bit_vector.h" #include "utils/growable_array.h" diff --git a/compiler/optimizing/nodes_test.cc b/compiler/optimizing/nodes_test.cc index 5dbdc74924..4cf22d3b2e 100644 --- a/compiler/optimizing/nodes_test.cc +++ b/compiler/optimizing/nodes_test.cc @@ -14,8 +14,8 @@ * limitations under the License. */ +#include "base/arena_allocator.h" #include "nodes.h" -#include "utils/arena_allocator.h" #include "gtest/gtest.h" diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc index 385a553b69..2fef8c7b3a 100644 --- a/compiler/optimizing/optimizing_compiler.cc +++ b/compiler/optimizing/optimizing_compiler.cc @@ -19,6 +19,7 @@ #include <fstream> #include <stdint.h> +#include "base/arena_allocator.h" #include "base/dumpable.h" #include "base/timing_logger.h" #include "bounds_check_elimination.h" @@ -47,7 +48,6 @@ #include "ssa_phi_elimination.h" #include "ssa_liveness_analysis.h" #include "reference_type_propagation.h" -#include "utils/arena_allocator.h" namespace art { diff --git a/compiler/optimizing/parallel_move_test.cc b/compiler/optimizing/parallel_move_test.cc index bb7541d99a..44a3da2817 100644 --- a/compiler/optimizing/parallel_move_test.cc +++ b/compiler/optimizing/parallel_move_test.cc @@ -14,9 +14,9 @@ * limitations under the License. */ +#include "base/arena_allocator.h" #include "nodes.h" #include "parallel_move_resolver.h" -#include "utils/arena_allocator.h" #include "gtest/gtest.h" diff --git a/compiler/optimizing/pretty_printer_test.cc b/compiler/optimizing/pretty_printer_test.cc index 9cf8235d85..293fde978e 100644 --- a/compiler/optimizing/pretty_printer_test.cc +++ b/compiler/optimizing/pretty_printer_test.cc @@ -14,6 +14,7 @@ * limitations under the License. */ +#include "base/arena_allocator.h" #include "base/stringprintf.h" #include "builder.h" #include "dex_file.h" @@ -21,7 +22,6 @@ #include "nodes.h" #include "optimizing_unit_test.h" #include "pretty_printer.h" -#include "utils/arena_allocator.h" #include "gtest/gtest.h" diff --git a/compiler/optimizing/register_allocator_test.cc b/compiler/optimizing/register_allocator_test.cc index 0cc00c0fde..e5d06a9f8b 100644 --- a/compiler/optimizing/register_allocator_test.cc +++ b/compiler/optimizing/register_allocator_test.cc @@ -14,6 +14,7 @@ * limitations under the License. */ +#include "base/arena_allocator.h" #include "builder.h" #include "code_generator.h" #include "code_generator_x86.h" @@ -25,7 +26,6 @@ #include "register_allocator.h" #include "ssa_liveness_analysis.h" #include "ssa_phi_elimination.h" -#include "utils/arena_allocator.h" #include "gtest/gtest.h" diff --git a/compiler/optimizing/ssa_test.cc b/compiler/optimizing/ssa_test.cc index 7e90b37fe6..7fc1ec6dd1 100644 --- a/compiler/optimizing/ssa_test.cc +++ b/compiler/optimizing/ssa_test.cc @@ -14,6 +14,7 @@ * limitations under the License. */ +#include "base/arena_allocator.h" #include "base/stringprintf.h" #include "builder.h" #include "dex_file.h" @@ -22,7 +23,6 @@ #include "optimizing_unit_test.h" #include "pretty_printer.h" #include "ssa_builder.h" -#include "utils/arena_allocator.h" #include "gtest/gtest.h" diff --git a/compiler/optimizing/stack_map_stream.h b/compiler/optimizing/stack_map_stream.h index 3974e53e6f..5283d5dcca 100644 --- a/compiler/optimizing/stack_map_stream.h +++ b/compiler/optimizing/stack_map_stream.h @@ -166,18 +166,23 @@ class StackMapStream : public ValueObject { stack_map.SetStackMask(*entry.sp_mask); } - // Set the register map. - MemoryRegion register_region = dex_register_maps_region.Subregion( - next_dex_register_map_offset, - DexRegisterMap::kFixedSize + entry.num_dex_registers * DexRegisterMap::SingleEntrySize()); - next_dex_register_map_offset += register_region.size(); - DexRegisterMap dex_register_map(register_region); - stack_map.SetDexRegisterMapOffset(register_region.start() - memory_start); - - for (size_t j = 0; j < entry.num_dex_registers; ++j) { - DexRegisterEntry register_entry = - dex_register_maps_.Get(j + entry.dex_register_maps_start_index); - dex_register_map.SetRegisterInfo(j, register_entry.kind, register_entry.value); + if (entry.num_dex_registers != 0) { + // Set the register map. + MemoryRegion register_region = dex_register_maps_region.Subregion( + next_dex_register_map_offset, + DexRegisterMap::kFixedSize + + entry.num_dex_registers * DexRegisterMap::SingleEntrySize()); + next_dex_register_map_offset += register_region.size(); + DexRegisterMap dex_register_map(register_region); + stack_map.SetDexRegisterMapOffset(register_region.start() - memory_start); + + for (size_t j = 0; j < entry.num_dex_registers; ++j) { + DexRegisterEntry register_entry = + dex_register_maps_.Get(j + entry.dex_register_maps_start_index); + dex_register_map.SetRegisterInfo(j, register_entry.kind, register_entry.value); + } + } else { + stack_map.SetDexRegisterMapOffset(StackMap::kNoDexRegisterMap); } // Set the inlining info. @@ -196,7 +201,7 @@ class StackMapStream : public ValueObject { inline_info.SetMethodReferenceIndexAtDepth(j, inline_entry.method_index); } } else { - stack_map.SetInlineDescriptorOffset(InlineInfo::kNoInlineInfo); + stack_map.SetInlineDescriptorOffset(StackMap::kNoInlineInfo); } } } diff --git a/compiler/optimizing/stack_map_test.cc b/compiler/optimizing/stack_map_test.cc index 5ee6ae049c..744fb45fff 100644 --- a/compiler/optimizing/stack_map_test.cc +++ b/compiler/optimizing/stack_map_test.cc @@ -61,6 +61,7 @@ TEST(StackMapTest, Test1) { MemoryRegion stack_mask = stack_map.GetStackMask(); ASSERT_TRUE(SameBits(stack_mask, sp_mask)); + ASSERT_TRUE(stack_map.HasDexRegisterMap()); DexRegisterMap dex_registers = code_info.GetDexRegisterMapOf(stack_map, 2); ASSERT_EQ(DexRegisterMap::kInStack, dex_registers.GetLocationKind(0)); ASSERT_EQ(DexRegisterMap::kConstant, dex_registers.GetLocationKind(1)); @@ -107,6 +108,7 @@ TEST(StackMapTest, Test2) { MemoryRegion stack_mask = stack_map.GetStackMask(); ASSERT_TRUE(SameBits(stack_mask, sp_mask1)); + ASSERT_TRUE(stack_map.HasDexRegisterMap()); DexRegisterMap dex_registers = code_info.GetDexRegisterMapOf(stack_map, 2); ASSERT_EQ(DexRegisterMap::kInStack, dex_registers.GetLocationKind(0)); ASSERT_EQ(DexRegisterMap::kConstant, dex_registers.GetLocationKind(1)); |