diff options
author | Vladimir Marko <vmarko@google.com> | 2017-10-03 14:49:14 +0100 |
---|---|---|
committer | Vladimir Marko <vmarko@google.com> | 2017-10-06 17:53:50 +0100 |
commit | ca6fff898afcb62491458ae8bcd428bfb3043da1 (patch) | |
tree | 195a6b16d3a4b34acc2faf91ce56f448efb15e07 /compiler/optimizing/codegen_test_utils.h | |
parent | aa7273e56fbafc2692c8d20a31b50d2f4bdd2aa1 (diff) |
ART: Use ScopedArenaAllocator for pass-local data.
Passes using local ArenaAllocator were hiding their memory
usage from the allocation counting, making it difficult to
track down where memory was used. Using ScopedArenaAllocator
reveals the memory usage.
This changes the HGraph constructor which requires a lot of
changes in tests. Refactor these tests to limit the amount
of work needed the next time we change that constructor.
Test: m test-art-host-gtest
Test: testrunner.py --host
Test: Build with kArenaAllocatorCountAllocations = true.
Bug: 64312607
Change-Id: I34939e4086b500d6e827ff3ef2211d1a421ac91a
Diffstat (limited to 'compiler/optimizing/codegen_test_utils.h')
-rw-r--r-- | compiler/optimizing/codegen_test_utils.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/compiler/optimizing/codegen_test_utils.h b/compiler/optimizing/codegen_test_utils.h index aa4f5da3f0..5f4593ff0e 100644 --- a/compiler/optimizing/codegen_test_utils.h +++ b/compiler/optimizing/codegen_test_utils.h @@ -298,7 +298,7 @@ static void RunCodeNoCheck(CodeGenerator* codegen, SsaLivenessAnalysis liveness(graph, codegen); PrepareForRegisterAllocation(graph).Run(); liveness.Analyze(); - RegisterAllocator::Create(graph->GetArena(), codegen, liveness)->AllocateRegisters(); + RegisterAllocator::Create(graph->GetAllocator(), codegen, liveness)->AllocateRegisters(); hook_before_codegen(graph); InternalCodeAllocator allocator; codegen->Compile(&allocator); @@ -331,7 +331,7 @@ static void RunCode(CodegenTargetConfig target_config, CodeGenerator* create_codegen_arm_vixl32(HGraph* graph, const CompilerOptions& compiler_options) { std::unique_ptr<const ArmInstructionSetFeatures> features_arm( ArmInstructionSetFeatures::FromCppDefines()); - return new (graph->GetArena()) + return new (graph->GetAllocator()) TestCodeGeneratorARMVIXL(graph, *features_arm.get(), compiler_options); } #endif @@ -340,7 +340,7 @@ CodeGenerator* create_codegen_arm_vixl32(HGraph* graph, const CompilerOptions& c CodeGenerator* create_codegen_arm64(HGraph* graph, const CompilerOptions& compiler_options) { std::unique_ptr<const Arm64InstructionSetFeatures> features_arm64( Arm64InstructionSetFeatures::FromCppDefines()); - return new (graph->GetArena()) + return new (graph->GetAllocator()) TestCodeGeneratorARM64(graph, *features_arm64.get(), compiler_options); } #endif @@ -349,7 +349,8 @@ CodeGenerator* create_codegen_arm64(HGraph* graph, const CompilerOptions& compil CodeGenerator* create_codegen_x86(HGraph* graph, const CompilerOptions& compiler_options) { std::unique_ptr<const X86InstructionSetFeatures> features_x86( X86InstructionSetFeatures::FromCppDefines()); - return new (graph->GetArena()) TestCodeGeneratorX86(graph, *features_x86.get(), compiler_options); + return new (graph->GetAllocator()) TestCodeGeneratorX86( + graph, *features_x86.get(), compiler_options); } #endif @@ -357,7 +358,7 @@ CodeGenerator* create_codegen_x86(HGraph* graph, const CompilerOptions& compiler CodeGenerator* create_codegen_x86_64(HGraph* graph, const CompilerOptions& compiler_options) { std::unique_ptr<const X86_64InstructionSetFeatures> features_x86_64( X86_64InstructionSetFeatures::FromCppDefines()); - return new (graph->GetArena()) + return new (graph->GetAllocator()) x86_64::CodeGeneratorX86_64(graph, *features_x86_64.get(), compiler_options); } #endif @@ -366,7 +367,7 @@ CodeGenerator* create_codegen_x86_64(HGraph* graph, const CompilerOptions& compi CodeGenerator* create_codegen_mips(HGraph* graph, const CompilerOptions& compiler_options) { std::unique_ptr<const MipsInstructionSetFeatures> features_mips( MipsInstructionSetFeatures::FromCppDefines()); - return new (graph->GetArena()) + return new (graph->GetAllocator()) mips::CodeGeneratorMIPS(graph, *features_mips.get(), compiler_options); } #endif @@ -375,7 +376,7 @@ CodeGenerator* create_codegen_mips(HGraph* graph, const CompilerOptions& compile CodeGenerator* create_codegen_mips64(HGraph* graph, const CompilerOptions& compiler_options) { std::unique_ptr<const Mips64InstructionSetFeatures> features_mips64( Mips64InstructionSetFeatures::FromCppDefines()); - return new (graph->GetArena()) + return new (graph->GetAllocator()) mips64::CodeGeneratorMIPS64(graph, *features_mips64.get(), compiler_options); } #endif |