blob: b49d18fa1014f0b06804ae428d951437519b495d [file] [log] [blame]
Vladimir Marko815d5e52019-03-04 10:18:31 +00001/*
Vladimir Marko327497e2019-03-04 12:53:20 +00002 * Copyright (C) 2019 The Android Open Source Project
Vladimir Marko815d5e52019-03-04 10:18:31 +00003 *
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
Vladimir Marko327497e2019-03-04 12:53:20 +000017#ifndef ART_DEX2OAT_COMMON_COMPILER_DRIVER_TEST_H_
18#define ART_DEX2OAT_COMMON_COMPILER_DRIVER_TEST_H_
Vladimir Marko815d5e52019-03-04 10:18:31 +000019
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
28namespace art {
29
30class CompilerDriver;
31class DexFile;
32class ProfileCompilationInfo;
33class TimingLogger;
Vladimir Markod46716b2022-09-27 14:47:22 +020034class VerificationResults;
Vladimir Marko815d5e52019-03-04 10:18:31 +000035
36class 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
Vladimir Markod46716b2022-09-27 14:47:22 +020066 std::unique_ptr<VerificationResults> verification_results_;
Vladimir Marko815d5e52019-03-04 10:18:31 +000067 std::unique_ptr<CompilerDriver> compiler_driver_;
68
69 private:
70 MemMap image_reservation_;
71 void* inaccessible_page_;
72};
73
74} // namespace art
75
Vladimir Marko327497e2019-03-04 12:53:20 +000076#endif // ART_DEX2OAT_COMMON_COMPILER_DRIVER_TEST_H_