Merge "Have the opt. compiler set the size of "empty" frames to zero."
diff --git a/compiler/optimizing/code_generator.h b/compiler/optimizing/code_generator.h
index 6c78f10..0310877 100644
--- a/compiler/optimizing/code_generator.h
+++ b/compiler/optimizing/code_generator.h
@@ -238,6 +238,13 @@
void AllocateLocations(HInstruction* instruction);
+ // Tells whether the stack frame of the compiled method is
+ // considered "empty", that is either actually having a size of zero,
+ // or just containing the saved return address register.
+ bool HasEmptyFrame() const {
+ return GetFrameSize() == (CallPushesPC() ? GetWordSize() : 0);
+ }
+
protected:
CodeGenerator(HGraph* graph,
size_t number_of_core_registers,
@@ -312,10 +319,6 @@
return instruction_set == kX86 || instruction_set == kX86_64;
}
- bool HasEmptyFrame() const {
- return GetFrameSize() == (CallPushesPC() ? GetWordSize() : 0);
- }
-
// Arm64 has its own type for a label, so we need to templatize this method
// to share the logic.
template <typename T>
diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc
index c518f33..0ece77d 100644
--- a/compiler/optimizing/optimizing_compiler.cc
+++ b/compiler/optimizing/optimizing_compiler.cc
@@ -376,7 +376,10 @@
compiler_driver,
codegen->GetInstructionSet(),
ArrayRef<const uint8_t>(allocator.GetMemory()),
- codegen->GetFrameSize(),
+ // Follow Quick's behavior and set the frame size to zero if it is
+ // considered "empty" (see the definition of
+ // art::CodeGenerator::HasEmptyFrame).
+ codegen->HasEmptyFrame() ? 0 : codegen->GetFrameSize(),
codegen->GetCoreSpillMask(),
codegen->GetFpuSpillMask(),
ArrayRef<const uint8_t>(stack_map));
@@ -400,17 +403,21 @@
codegen->BuildNativeGCMap(&gc_map, dex_compilation_unit);
compilation_stats_.RecordStat(MethodCompilationStat::kCompiledBaseline);
- return CompiledMethod::SwapAllocCompiledMethod(compiler_driver,
- codegen->GetInstructionSet(),
- ArrayRef<const uint8_t>(allocator.GetMemory()),
- codegen->GetFrameSize(),
- codegen->GetCoreSpillMask(),
- codegen->GetFpuSpillMask(),
- &src_mapping_table,
- AlignVectorSize(mapping_table),
- AlignVectorSize(vmap_table),
- AlignVectorSize(gc_map),
- ArrayRef<const uint8_t>());
+ return CompiledMethod::SwapAllocCompiledMethod(
+ compiler_driver,
+ codegen->GetInstructionSet(),
+ ArrayRef<const uint8_t>(allocator.GetMemory()),
+ // Follow Quick's behavior and set the frame size to zero if it is
+ // considered "empty" (see the definition of
+ // art::CodeGenerator::HasEmptyFrame).
+ codegen->HasEmptyFrame() ? 0 : codegen->GetFrameSize(),
+ codegen->GetCoreSpillMask(),
+ codegen->GetFpuSpillMask(),
+ &src_mapping_table,
+ AlignVectorSize(mapping_table),
+ AlignVectorSize(vmap_table),
+ AlignVectorSize(gc_map),
+ ArrayRef<const uint8_t>());
}
CompiledMethod* OptimizingCompiler::Compile(const DexFile::CodeItem* code_item,