From 72041a0dcb5b7c133b79a1d6783a23039f2136bd Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Fri, 14 Jul 2017 18:23:25 -0700 Subject: Use class unloading in dex2oat for verify and extract Unload the main classloader in between each dex file compilation to reduce RAM. This frees the whole java heap and associated linear allocs. This is only used for quickening since filters that do compilation may require loaded classes in the compiler and oat writer. This reduces dex2oat peak PSS for compiling a large app from 196MB to 135MB. Only works for verify and extract since the current approach is incompatible with oat writer patching. b/63911263 Added a verification override that reads the compiled class status to avoid ever verifying classes that were quickened (since this is not supported and causes failures). There is still some duplicated verification for some class with superclasses in other dex files. Support for quicken will be added in a follow up CL. Bug: 63467744 Test: test-art-host Test: test/testrunner/testrunner.py --interpreter --host -j40 Change-Id: Id0e4f84eb5db91d6143f752b498f4832a5b25b6e --- compiler/driver/compiler_driver_test.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'compiler/driver/compiler_driver_test.cc') diff --git a/compiler/driver/compiler_driver_test.cc b/compiler/driver/compiler_driver_test.cc index 10bfd972f0..fee6afb91f 100644 --- a/compiler/driver/compiler_driver_test.cc +++ b/compiler/driver/compiler_driver_test.cc @@ -42,7 +42,9 @@ class CompilerDriverTest : public CommonCompilerTest { void CompileAll(jobject class_loader) REQUIRES(!Locks::mutator_lock_) { TimingLogger timings("CompilerDriverTest::CompileAll", false, false); TimingLogger::ScopedTiming t(__FUNCTION__, &timings); - compiler_driver_->CompileAll(class_loader, GetDexFiles(class_loader), &timings); + dex_files_ = GetDexFiles(class_loader); + compiler_driver_->SetDexFilesForOatFile(dex_files_);; + compiler_driver_->CompileAll(class_loader, dex_files_, &timings); t.NewTiming("MakeAllExecutable"); MakeAllExecutable(class_loader); } @@ -95,6 +97,7 @@ class CompilerDriverTest : public CommonCompilerTest { JNIEnv* env_; jclass class_; jmethodID mid_; + std::vector dex_files_; }; // Disabled due to 10 second runtime on host -- cgit v1.2.3-59-g8ed1b