summaryrefslogtreecommitdiffstats
path: root/compiler
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2015-03-09 22:15:18 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-03-09 22:15:19 +0000
commit54a8cc689dc23f346c9aac0d5fc6f47e61df8cad (patch)
tree821954efb4addc26406dd6dc54a969e8e75c1f07 /compiler
parentb3226684f0ee69094f896cb99a9d1f12585eac42 (diff)
parent9b34b244ecddd8a35c922ed87bc3df0ca4db0282 (diff)
downloadandroid_art-54a8cc689dc23f346c9aac0d5fc6f47e61df8cad.tar.gz
android_art-54a8cc689dc23f346c9aac0d5fc6f47e61df8cad.tar.bz2
android_art-54a8cc689dc23f346c9aac0d5fc6f47e61df8cad.zip
Merge "Trim arenas for JIT"
Diffstat (limited to 'compiler')
-rw-r--r--compiler/dex/quick/quick_compiler.cc5
-rw-r--r--compiler/driver/compiler_driver.cc5
-rw-r--r--compiler/driver/compiler_driver.h9
-rw-r--r--compiler/jit/jit_compiler.cc6
4 files changed, 10 insertions, 15 deletions
diff --git a/compiler/dex/quick/quick_compiler.cc b/compiler/dex/quick/quick_compiler.cc
index 13a6d9d815..02d74a0691 100644
--- a/compiler/dex/quick/quick_compiler.cc
+++ b/compiler/dex/quick/quick_compiler.cc
@@ -628,12 +628,13 @@ CompiledMethod* QuickCompiler::Compile(const DexFile::CodeItem* code_item,
DCHECK(driver->GetCompilerOptions().IsCompilationEnabled());
- ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
+ Runtime* const runtime = Runtime::Current();
+ ClassLinker* const class_linker = runtime->GetClassLinker();
InstructionSet instruction_set = driver->GetInstructionSet();
if (instruction_set == kArm) {
instruction_set = kThumb2;
}
- CompilationUnit cu(driver->GetArenaPool(), instruction_set, driver, class_linker);
+ CompilationUnit cu(runtime->GetArenaPool(), instruction_set, driver, class_linker);
CHECK((cu.instruction_set == kThumb2) ||
(cu.instruction_set == kArm64) ||
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index d1291fa719..78dd6cc29e 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -2412,8 +2412,9 @@ bool CompilerDriver::SkipCompilation(const std::string& method_name) {
std::string CompilerDriver::GetMemoryUsageString(bool extended) const {
std::ostringstream oss;
- const ArenaPool* arena_pool = GetArenaPool();
- gc::Heap* heap = Runtime::Current()->GetHeap();
+ Runtime* const runtime = Runtime::Current();
+ const ArenaPool* arena_pool = runtime->GetArenaPool();
+ gc::Heap* const heap = runtime->GetHeap();
oss << "arena alloc=" << PrettySize(arena_pool->GetBytesAllocated());
oss << " java alloc=" << PrettySize(heap->GetBytesAllocated());
#ifdef HAVE_MALLOC_H
diff --git a/compiler/driver/compiler_driver.h b/compiler/driver/compiler_driver.h
index f94966733f..28a82457cc 100644
--- a/compiler/driver/compiler_driver.h
+++ b/compiler/driver/compiler_driver.h
@@ -362,12 +362,6 @@ class CompilerDriver {
support_boot_image_fixup_ = support_boot_image_fixup;
}
- ArenaPool* GetArenaPool() {
- return &arena_pool_;
- }
- const ArenaPool* GetArenaPool() const {
- return &arena_pool_;
- }
SwapAllocator<void>& GetSwapSpaceAllocator() {
return *swap_space_allocator_.get();
}
@@ -606,9 +600,6 @@ class CompilerDriver {
void* compiler_context_;
- // Arena pool used by the compiler.
- ArenaPool arena_pool_;
-
bool support_boot_image_fixup_;
// DeDuplication data structures, these own the corresponding byte arrays.
diff --git a/compiler/jit/jit_compiler.cc b/compiler/jit/jit_compiler.cc
index 04efa21f4e..a63e14a980 100644
--- a/compiler/jit/jit_compiler.cc
+++ b/compiler/jit/jit_compiler.cc
@@ -103,7 +103,7 @@ JitCompiler::~JitCompiler() {
}
bool JitCompiler::CompileMethod(Thread* self, mirror::ArtMethod* method) {
- uint64_t start_time = NanoTime();
+ const uint64_t start_time = NanoTime();
StackHandleScope<2> hs(self);
self->AssertNoPendingException();
Runtime* runtime = Runtime::Current();
@@ -130,6 +130,8 @@ bool JitCompiler::CompileMethod(Thread* self, mirror::ArtMethod* method) {
}
}
CompiledMethod* compiled_method(compiler_driver_->CompileMethod(self, h_method.Get()));
+ // Trim maps to reduce memory usage, TODO: measure how much this increases compile time.
+ runtime->GetArenaPool()->TrimMaps();
if (compiled_method == nullptr) {
return false;
}
@@ -137,7 +139,7 @@ bool JitCompiler::CompileMethod(Thread* self, mirror::ArtMethod* method) {
// Don't add the method if we are supposed to be deoptimized.
bool result = false;
if (!runtime->GetInstrumentation()->AreAllMethodsDeoptimized()) {
- const void* code = Runtime::Current()->GetClassLinker()->GetOatMethodQuickCodeFor(
+ const void* code = runtime->GetClassLinker()->GetOatMethodQuickCodeFor(
h_method.Get());
if (code != nullptr) {
// Already have some compiled code, just use this instead of linking.