Move code around in OptimizingCompiler::Compile to reduce stack space.
Also fix an (intentional) memory leak, by allocating the CodeGenerator
on the heap instead of the arena: they construct an Assembler object
that requires destruction.
BUG:18787334
Change-Id: I8cf0667cb70ce5b14d4ac334bd4487a562635f1b
diff --git a/compiler/optimizing/code_generator.cc b/compiler/optimizing/code_generator.cc
index 4d8154e..a5d82a8 100644
--- a/compiler/optimizing/code_generator.cc
+++ b/compiler/optimizing/code_generator.cc
@@ -325,26 +325,25 @@
return current->GetBlockId() + 1 == next->GetBlockId();
}
-CodeGenerator* CodeGenerator::Create(ArenaAllocator* allocator,
- HGraph* graph,
+CodeGenerator* CodeGenerator::Create(HGraph* graph,
InstructionSet instruction_set,
const InstructionSetFeatures& isa_features) {
switch (instruction_set) {
case kArm:
case kThumb2: {
- return new (allocator) arm::CodeGeneratorARM(graph,
+ return new arm::CodeGeneratorARM(graph,
isa_features.AsArmInstructionSetFeatures());
}
case kArm64: {
- return new (allocator) arm64::CodeGeneratorARM64(graph);
+ return new arm64::CodeGeneratorARM64(graph);
}
case kMips:
return nullptr;
case kX86: {
- return new (allocator) x86::CodeGeneratorX86(graph);
+ return new x86::CodeGeneratorX86(graph);
}
case kX86_64: {
- return new (allocator) x86_64::CodeGeneratorX86_64(graph);
+ return new x86_64::CodeGeneratorX86_64(graph);
}
default:
return nullptr;