1 /* 2 * Copyright (C) 2019 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef ART_DEX2OAT_COMMON_COMPILER_DRIVER_TEST_H_ 18 #define ART_DEX2OAT_COMMON_COMPILER_DRIVER_TEST_H_ 19 20 #include <vector> 21 22 #include <jni.h> 23 24 #include "common_compiler_test.h" 25 #include "base/hash_set.h" 26 #include "base/mem_map.h" 27 28 namespace art { 29 30 class CompilerDriver; 31 class DexFile; 32 class ProfileCompilationInfo; 33 class TimingLogger; 34 class VerificationResults; 35 36 class CommonCompilerDriverTest : public CommonCompilerTest { 37 public: 38 CommonCompilerDriverTest(); 39 ~CommonCompilerDriverTest(); 40 41 void CompileAll(jobject class_loader, 42 const std::vector<const DexFile*>& dex_files, 43 TimingLogger* timings) REQUIRES(!Locks::mutator_lock_); 44 45 void SetDexFilesForOatFile(const std::vector<const DexFile*>& dex_files); 46 47 void ReserveImageSpace(); 48 49 void UnreserveImageSpace(); 50 51 void CreateCompilerDriver(); 52 53 protected: 54 void SetUpRuntimeOptions(RuntimeOptions* options) override; 55 56 void SetUp() override; 57 void TearDown() override; 58 59 // Get the set of image classes given to the compiler-driver in SetUp. 60 virtual std::unique_ptr<HashSet<std::string>> GetImageClasses(); 61 62 virtual ProfileCompilationInfo* GetProfileCompilationInfo(); 63 64 size_t number_of_threads_ = 2u; 65 66 std::unique_ptr<VerificationResults> verification_results_; 67 std::unique_ptr<CompilerDriver> compiler_driver_; 68 69 private: 70 MemMap image_reservation_; 71 void* inaccessible_page_; 72 }; 73 74 } // namespace art 75 76 #endif // ART_DEX2OAT_COMMON_COMPILER_DRIVER_TEST_H_ 77