summaryrefslogtreecommitdiff
path: root/compiler/optimizing
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/optimizing')
-rw-r--r--compiler/optimizing/code_generator.h8
-rw-r--r--compiler/optimizing/code_generator_arm.cc30
-rw-r--r--compiler/optimizing/code_generator_arm.h2
-rw-r--r--compiler/optimizing/stack_map_stream.h5
4 files changed, 14 insertions, 31 deletions
diff --git a/compiler/optimizing/code_generator.h b/compiler/optimizing/code_generator.h
index a82b08afe9..e6b1f7c6aa 100644
--- a/compiler/optimizing/code_generator.h
+++ b/compiler/optimizing/code_generator.h
@@ -358,7 +358,6 @@ class CodeGenerator {
number_of_register_pairs_(number_of_register_pairs),
core_callee_save_mask_(core_callee_save_mask),
fpu_callee_save_mask_(fpu_callee_save_mask),
- stack_map_stream_(graph->GetArena()),
is_baseline_(false),
graph_(graph),
compiler_options_(compiler_options),
@@ -366,7 +365,8 @@ class CodeGenerator {
block_order_(nullptr),
current_block_index_(0),
is_leaf_(true),
- requires_current_method_(false) {}
+ requires_current_method_(false),
+ stack_map_stream_(graph->GetArena()) {}
// Register allocation logic.
void AllocateRegistersLocally(HInstruction* instruction) const;
@@ -436,8 +436,6 @@ class CodeGenerator {
const uint32_t core_callee_save_mask_;
const uint32_t fpu_callee_save_mask_;
- StackMapStream stack_map_stream_;
-
// Whether we are using baseline.
bool is_baseline_;
@@ -466,6 +464,8 @@ class CodeGenerator {
// Whether an instruction in the graph accesses the current method.
bool requires_current_method_;
+ StackMapStream stack_map_stream_;
+
friend class OptimizingCFITest;
DISALLOW_COPY_AND_ASSIGN(CodeGenerator);
diff --git a/compiler/optimizing/code_generator_arm.cc b/compiler/optimizing/code_generator_arm.cc
index d14594562e..3d3e35d0fc 100644
--- a/compiler/optimizing/code_generator_arm.cc
+++ b/compiler/optimizing/code_generator_arm.cc
@@ -392,26 +392,12 @@ CodeGeneratorARM::CodeGeneratorARM(HGraph* graph,
location_builder_(graph, this),
instruction_visitor_(graph, this),
move_resolver_(graph->GetArena(), this),
- assembler_(),
+ assembler_(false /* can_relocate_branches */),
isa_features_(isa_features) {
// Save the PC register to mimic Quick.
AddAllocatedRegister(Location::RegisterLocation(PC));
}
-void CodeGeneratorARM::Finalize(CodeAllocator* allocator) {
- // Ensure that we fix up branches and literal loads and emit the literal pool.
- __ FinalizeCode();
-
- // Adjust native pc offsets in stack maps.
- for (size_t i = 0, num = stack_map_stream_.GetNumberOfStackMaps(); i != num; ++i) {
- uint32_t old_position = stack_map_stream_.GetStackMap(i).native_pc_offset;
- uint32_t new_position = __ GetAdjustedPosition(old_position);
- stack_map_stream_.SetStackMapNativePcOffset(i, new_position);
- }
-
- CodeGenerator::Finalize(allocator);
-}
-
Location CodeGeneratorARM::AllocateFreeRegister(Primitive::Type type) const {
switch (type) {
case Primitive::kPrimLong: {
@@ -2845,7 +2831,7 @@ void InstructionCodeGeneratorARM::VisitCompare(HCompare* compare) {
Location left = locations->InAt(0);
Location right = locations->InAt(1);
- Label less, greater, done;
+ NearLabel less, greater, done;
Primitive::Type type = compare->InputAt(0)->GetType();
switch (type) {
case Primitive::kPrimLong: {
@@ -2941,7 +2927,7 @@ void InstructionCodeGeneratorARM::GenerateWideAtomicStore(Register addr,
Register temp1,
Register temp2,
HInstruction* instruction) {
- Label fail;
+ NearLabel fail;
if (offset != 0) {
__ LoadImmediate(temp1, offset);
__ add(IP, addr, ShifterOperand(temp1));
@@ -3621,7 +3607,7 @@ void CodeGeneratorARM::MarkGCCard(Register temp,
Register object,
Register value,
bool can_be_null) {
- Label is_null;
+ NearLabel is_null;
if (can_be_null) {
__ CompareAndBranchIfZero(value, &is_null);
}
@@ -4050,7 +4036,7 @@ void InstructionCodeGeneratorARM::VisitInstanceOf(HInstanceOf* instruction) {
Register cls = locations->InAt(1).AsRegister<Register>();
Register out = locations->Out().AsRegister<Register>();
uint32_t class_offset = mirror::Object::ClassOffset().Int32Value();
- Label done, zero;
+ NearLabel done, zero;
SlowPathCodeARM* slow_path = nullptr;
// Return 0 if `obj` is null.
@@ -4107,15 +4093,19 @@ void InstructionCodeGeneratorARM::VisitCheckCast(HCheckCast* instruction) {
instruction, locations->InAt(1), locations->GetTemp(0), instruction->GetDexPc());
codegen_->AddSlowPath(slow_path);
+ NearLabel done;
// avoid null check if we know obj is not null.
if (instruction->MustDoNullCheck()) {
- __ CompareAndBranchIfZero(obj, slow_path->GetExitLabel());
+ __ CompareAndBranchIfZero(obj, &done);
}
// Compare the class of `obj` with `cls`.
__ LoadFromOffset(kLoadWord, temp, obj, class_offset);
__ cmp(temp, ShifterOperand(cls));
__ b(slow_path->GetEntryLabel(), NE);
__ Bind(slow_path->GetExitLabel());
+ if (instruction->MustDoNullCheck()) {
+ __ Bind(&done);
+ }
}
void LocationsBuilderARM::VisitMonitorOperation(HMonitorOperation* instruction) {
diff --git a/compiler/optimizing/code_generator_arm.h b/compiler/optimizing/code_generator_arm.h
index 1599a23568..824e48cc9f 100644
--- a/compiler/optimizing/code_generator_arm.h
+++ b/compiler/optimizing/code_generator_arm.h
@@ -298,8 +298,6 @@ class CodeGeneratorARM : public CodeGenerator {
block_labels_.SetSize(GetGraph()->GetBlocks().Size());
}
- void Finalize(CodeAllocator* allocator) OVERRIDE;
-
const ArmInstructionSetFeatures& GetInstructionSetFeatures() const {
return isa_features_;
}
diff --git a/compiler/optimizing/stack_map_stream.h b/compiler/optimizing/stack_map_stream.h
index 550ed70e0f..bc3653d7ea 100644
--- a/compiler/optimizing/stack_map_stream.h
+++ b/compiler/optimizing/stack_map_stream.h
@@ -134,11 +134,6 @@ class StackMapStream : public ValueObject {
return stack_maps_.GetRawStorage()[i];
}
- void SetStackMapNativePcOffset(size_t i, uint32_t native_pc_offset) {
- DCHECK_LT(i, stack_maps_.Size());
- stack_maps_.GetRawStorage()[i].native_pc_offset = native_pc_offset;
- }
-
uint32_t ComputeMaxNativePcOffset() const;
// Prepares the stream to fill in a memory region. Must be called before FillIn.