Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 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 | #include "common_compiler_test.h" |
| 18 | |
Andreas Gampe | b68ed2c | 2018-06-20 10:39:31 -0700 | [diff] [blame] | 19 | #include <type_traits> |
| 20 | |
Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 21 | #include "arch/instruction_set_features.h" |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 22 | #include "art_field-inl.h" |
Andreas Gampe | c6ea7d0 | 2017-02-01 16:46:28 -0800 | [diff] [blame] | 23 | #include "art_method-inl.h" |
Andreas Gampe | 8228cdf | 2017-05-30 15:03:54 -0700 | [diff] [blame] | 24 | #include "base/callee_save_type.h" |
Vladimir Marko | 2afaff7 | 2018-11-30 17:01:50 +0000 | [diff] [blame] | 25 | #include "base/casts.h" |
Andreas Gampe | 542451c | 2016-07-26 09:02:02 -0700 | [diff] [blame] | 26 | #include "base/enums.h" |
David Sehr | c431b9d | 2018-03-02 12:01:51 -0800 | [diff] [blame] | 27 | #include "base/utils.h" |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 28 | #include "class_linker.h" |
Vladimir Marko | d8dbc8d | 2017-09-20 13:37:47 +0100 | [diff] [blame] | 29 | #include "compiled_method-inl.h" |
David Sehr | b2ec9f5 | 2018-02-21 13:20:31 -0800 | [diff] [blame] | 30 | #include "dex/descriptors_names.h" |
Mathieu Chartier | 5bdab12 | 2015-01-26 18:30:19 -0800 | [diff] [blame] | 31 | #include "dex/verification_results.h" |
Vladimir Marko | 815d5e5 | 2019-03-04 10:18:31 +0000 | [diff] [blame] | 32 | #include "driver/compiled_method_storage.h" |
Vladimir Marko | 20f8559 | 2015-03-19 10:07:02 +0000 | [diff] [blame] | 33 | #include "driver/compiler_options.h" |
Vladimir Marko | dc4bcce | 2018-06-21 16:15:42 +0100 | [diff] [blame] | 34 | #include "jni/java_vm_ext.h" |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 35 | #include "interpreter/interpreter.h" |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 36 | #include "mirror/class-inl.h" |
Andreas Gampe | 8cf9cb3 | 2017-07-19 09:28:38 -0700 | [diff] [blame] | 37 | #include "mirror/class_loader.h" |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 38 | #include "mirror/dex_cache.h" |
| 39 | #include "mirror/object-inl.h" |
Nicolas Geoffray | 524e7ea | 2015-10-16 17:13:34 +0100 | [diff] [blame] | 40 | #include "oat_quick_method_header.h" |
Mathieu Chartier | 0795f23 | 2016-09-27 18:43:30 -0700 | [diff] [blame] | 41 | #include "scoped_thread_state_change-inl.h" |
Andreas Gampe | b486a98 | 2017-06-01 13:45:54 -0700 | [diff] [blame] | 42 | #include "thread-current-inl.h" |
Vladimir Marko | 213ee2d | 2018-06-22 11:56:34 +0100 | [diff] [blame] | 43 | #include "utils/atomic_dex_ref_map-inl.h" |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 44 | |
| 45 | namespace art { |
| 46 | |
Vladimir Marko | f91fc12 | 2020-05-13 09:21:00 +0100 | [diff] [blame] | 47 | std::unique_ptr<CompilerOptions> CommonCompilerTest::CreateCompilerOptions( |
| 48 | InstructionSet instruction_set, const std::string& variant) { |
| 49 | std::unique_ptr<CompilerOptions> compiler_options = std::make_unique<CompilerOptions>(); |
| 50 | compiler_options->instruction_set_ = instruction_set; |
| 51 | std::string error_msg; |
| 52 | compiler_options->instruction_set_features_ = |
| 53 | InstructionSetFeatures::FromVariant(instruction_set, variant, &error_msg); |
| 54 | CHECK(compiler_options->instruction_set_features_ != nullptr) << error_msg; |
| 55 | return compiler_options; |
| 56 | } |
| 57 | |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 58 | CommonCompilerTest::CommonCompilerTest() {} |
| 59 | CommonCompilerTest::~CommonCompilerTest() {} |
| 60 | |
Vladimir Marko | 815d5e5 | 2019-03-04 10:18:31 +0000 | [diff] [blame] | 61 | void CommonCompilerTest::MakeExecutable(ArtMethod* method, const CompiledMethod* compiled_method) { |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 62 | CHECK(method != nullptr); |
Calin Juravle | e0ac115 | 2017-02-13 19:03:47 -0800 | [diff] [blame] | 63 | // If the code size is 0 it means the method was skipped due to profile guided compilation. |
| 64 | if (compiled_method != nullptr && compiled_method->GetQuickCode().size() != 0u) { |
Vladimir Marko | 35831e8 | 2015-09-11 11:59:18 +0100 | [diff] [blame] | 65 | ArrayRef<const uint8_t> code = compiled_method->GetQuickCode(); |
Mathieu Chartier | cbcedbf | 2017-03-12 22:24:50 -0700 | [diff] [blame] | 66 | const uint32_t code_size = code.size(); |
Vladimir Marko | 35831e8 | 2015-09-11 11:59:18 +0100 | [diff] [blame] | 67 | ArrayRef<const uint8_t> vmap_table = compiled_method->GetVmapTable(); |
Mathieu Chartier | cbcedbf | 2017-03-12 22:24:50 -0700 | [diff] [blame] | 68 | const uint32_t vmap_table_offset = vmap_table.empty() ? 0u |
Vladimir Marko | 35831e8 | 2015-09-11 11:59:18 +0100 | [diff] [blame] | 69 | : sizeof(OatQuickMethodHeader) + vmap_table.size(); |
Nicolas Geoffray | 5708376 | 2019-03-05 09:24:45 +0000 | [diff] [blame] | 70 | OatQuickMethodHeader method_header(vmap_table_offset, code_size); |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 71 | |
Elliott Hughes | 956af0f | 2014-12-11 14:34:28 -0800 | [diff] [blame] | 72 | header_code_and_maps_chunks_.push_back(std::vector<uint8_t>()); |
| 73 | std::vector<uint8_t>* chunk = &header_code_and_maps_chunks_.back(); |
Vladimir Marko | 562ff44 | 2015-10-27 18:51:20 +0000 | [diff] [blame] | 74 | const size_t max_padding = GetInstructionSetAlignment(compiled_method->GetInstructionSet()); |
David Srbecky | 8cd5454 | 2018-07-15 23:58:44 +0100 | [diff] [blame] | 75 | const size_t size = vmap_table.size() + sizeof(method_header) + code_size; |
Vladimir Marko | 562ff44 | 2015-10-27 18:51:20 +0000 | [diff] [blame] | 76 | chunk->reserve(size + max_padding); |
Elliott Hughes | 956af0f | 2014-12-11 14:34:28 -0800 | [diff] [blame] | 77 | chunk->resize(sizeof(method_header)); |
Andreas Gampe | b68ed2c | 2018-06-20 10:39:31 -0700 | [diff] [blame] | 78 | static_assert(std::is_trivially_copyable<OatQuickMethodHeader>::value, "Cannot use memcpy"); |
Elliott Hughes | 956af0f | 2014-12-11 14:34:28 -0800 | [diff] [blame] | 79 | memcpy(&(*chunk)[0], &method_header, sizeof(method_header)); |
Vladimir Marko | 35831e8 | 2015-09-11 11:59:18 +0100 | [diff] [blame] | 80 | chunk->insert(chunk->begin(), vmap_table.begin(), vmap_table.end()); |
Vladimir Marko | 35831e8 | 2015-09-11 11:59:18 +0100 | [diff] [blame] | 81 | chunk->insert(chunk->end(), code.begin(), code.end()); |
Vladimir Marko | 562ff44 | 2015-10-27 18:51:20 +0000 | [diff] [blame] | 82 | CHECK_EQ(chunk->size(), size); |
| 83 | const void* unaligned_code_ptr = chunk->data() + (size - code_size); |
| 84 | size_t offset = dchecked_integral_cast<size_t>(reinterpret_cast<uintptr_t>(unaligned_code_ptr)); |
| 85 | size_t padding = compiled_method->AlignCode(offset) - offset; |
| 86 | // Make sure no resizing takes place. |
| 87 | CHECK_GE(chunk->capacity(), chunk->size() + padding); |
| 88 | chunk->insert(chunk->begin(), padding, 0); |
| 89 | const void* code_ptr = reinterpret_cast<const uint8_t*>(unaligned_code_ptr) + padding; |
| 90 | CHECK_EQ(code_ptr, static_cast<const void*>(chunk->data() + (chunk->size() - code_size))); |
Vladimir Marko | 35831e8 | 2015-09-11 11:59:18 +0100 | [diff] [blame] | 91 | MakeExecutable(code_ptr, code.size()); |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 92 | const void* method_code = CompiledMethod::CodePointer(code_ptr, |
| 93 | compiled_method->GetInstructionSet()); |
David Sehr | 709b070 | 2016-10-13 09:12:37 -0700 | [diff] [blame] | 94 | LOG(INFO) << "MakeExecutable " << method->PrettyMethod() << " code=" << method_code; |
Vladimir Marko | fbfc394 | 2017-07-27 16:51:35 +0100 | [diff] [blame] | 95 | method->SetEntryPointFromQuickCompiledCode(method_code); |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 96 | } else { |
| 97 | // No code? You must mean to go into the interpreter. |
| 98 | // Or the generic JNI... |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 99 | class_linker_->SetEntryPointsToInterpreter(method); |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 100 | } |
| 101 | } |
| 102 | |
| 103 | void CommonCompilerTest::MakeExecutable(const void* code_start, size_t code_length) { |
| 104 | CHECK(code_start != nullptr); |
| 105 | CHECK_NE(code_length, 0U); |
| 106 | uintptr_t data = reinterpret_cast<uintptr_t>(code_start); |
| 107 | uintptr_t base = RoundDown(data, kPageSize); |
| 108 | uintptr_t limit = RoundUp(data + code_length, kPageSize); |
| 109 | uintptr_t len = limit - base; |
David Srbecky | 2acd1ec | 2020-05-16 01:38:49 +0100 | [diff] [blame] | 110 | // Remove hwasan tag. This is done in kernel in newer versions. This supports older kernels. |
| 111 | void* base_ptr = HWASanUntag(reinterpret_cast<void*>(base)); |
| 112 | int result = mprotect(base_ptr, len, PROT_READ | PROT_WRITE | PROT_EXEC); |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 113 | CHECK_EQ(result, 0); |
| 114 | |
Orion Hodson | aeb0223 | 2019-06-25 14:18:18 +0100 | [diff] [blame] | 115 | CHECK(FlushCpuCaches(reinterpret_cast<void*>(base), reinterpret_cast<void*>(base + len))); |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 116 | } |
| 117 | |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 118 | void CommonCompilerTest::SetUp() { |
| 119 | CommonRuntimeTest::SetUp(); |
| 120 | { |
| 121 | ScopedObjectAccess soa(Thread::Current()); |
| 122 | |
Vladimir Marko | a043111 | 2018-06-25 09:32:54 +0100 | [diff] [blame] | 123 | runtime_->SetInstructionSet(instruction_set_); |
Andreas Gampe | 8228cdf | 2017-05-30 15:03:54 -0700 | [diff] [blame] | 124 | for (uint32_t i = 0; i < static_cast<uint32_t>(CalleeSaveType::kLastCalleeSaveType); ++i) { |
| 125 | CalleeSaveType type = CalleeSaveType(i); |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 126 | if (!runtime_->HasCalleeSaveMethod(type)) { |
Ian Rogers | 6a3c1fc | 2014-10-31 00:33:20 -0700 | [diff] [blame] | 127 | runtime_->SetCalleeSaveMethod(runtime_->CreateCalleeSaveMethod(), type); |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 128 | } |
| 129 | } |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 130 | } |
Mathieu Chartier | ceb07b3 | 2015-12-10 09:33:21 -0800 | [diff] [blame] | 131 | } |
| 132 | |
Vladimir Marko | a043111 | 2018-06-25 09:32:54 +0100 | [diff] [blame] | 133 | void CommonCompilerTest::ApplyInstructionSet() { |
| 134 | // Copy local instruction_set_ and instruction_set_features_ to *compiler_options_; |
| 135 | CHECK(instruction_set_features_ != nullptr); |
| 136 | if (instruction_set_ == InstructionSet::kThumb2) { |
| 137 | CHECK_EQ(InstructionSet::kArm, instruction_set_features_->GetInstructionSet()); |
| 138 | } else { |
| 139 | CHECK_EQ(instruction_set_, instruction_set_features_->GetInstructionSet()); |
| 140 | } |
| 141 | compiler_options_->instruction_set_ = instruction_set_; |
| 142 | compiler_options_->instruction_set_features_ = |
| 143 | InstructionSetFeatures::FromBitmap(instruction_set_, instruction_set_features_->AsBitmap()); |
| 144 | CHECK(compiler_options_->instruction_set_features_->Equals(instruction_set_features_.get())); |
| 145 | } |
| 146 | |
| 147 | void CommonCompilerTest::OverrideInstructionSetFeatures(InstructionSet instruction_set, |
| 148 | const std::string& variant) { |
| 149 | instruction_set_ = instruction_set; |
| 150 | std::string error_msg; |
| 151 | instruction_set_features_ = |
| 152 | InstructionSetFeatures::FromVariant(instruction_set, variant, &error_msg); |
| 153 | CHECK(instruction_set_features_ != nullptr) << error_msg; |
| 154 | |
| 155 | if (compiler_options_ != nullptr) { |
| 156 | ApplyInstructionSet(); |
| 157 | } |
| 158 | } |
| 159 | |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 160 | void CommonCompilerTest::SetUpRuntimeOptions(RuntimeOptions* options) { |
| 161 | CommonRuntimeTest::SetUpRuntimeOptions(options); |
| 162 | |
| 163 | compiler_options_.reset(new CompilerOptions); |
| 164 | verification_results_.reset(new VerificationResults(compiler_options_.get())); |
Vladimir Marko | 815d5e5 | 2019-03-04 10:18:31 +0000 | [diff] [blame] | 165 | |
| 166 | ApplyInstructionSet(); |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 167 | } |
| 168 | |
Roland Levillain | bbcc01a | 2015-06-30 14:16:48 +0100 | [diff] [blame] | 169 | Compiler::Kind CommonCompilerTest::GetCompilerKind() const { |
| 170 | return compiler_kind_; |
| 171 | } |
| 172 | |
| 173 | void CommonCompilerTest::SetCompilerKind(Compiler::Kind compiler_kind) { |
| 174 | compiler_kind_ = compiler_kind; |
| 175 | } |
| 176 | |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 177 | void CommonCompilerTest::TearDown() { |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 178 | verification_results_.reset(); |
| 179 | compiler_options_.reset(); |
| 180 | |
| 181 | CommonRuntimeTest::TearDown(); |
| 182 | } |
| 183 | |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 184 | void CommonCompilerTest::CompileMethod(ArtMethod* method) { |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 185 | CHECK(method != nullptr); |
Vladimir Marko | dc4bcce | 2018-06-21 16:15:42 +0100 | [diff] [blame] | 186 | TimingLogger timings("CommonCompilerTest::CompileMethod", false, false); |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 187 | TimingLogger::ScopedTiming t(__FUNCTION__, &timings); |
Vladimir Marko | 815d5e5 | 2019-03-04 10:18:31 +0000 | [diff] [blame] | 188 | CompiledMethodStorage storage(/*swap_fd=*/ -1); |
Vladimir Marko | 4b2d1c5 | 2019-03-06 11:21:11 +0000 | [diff] [blame] | 189 | CompiledMethod* compiled_method = nullptr; |
Vladimir Marko | dc4bcce | 2018-06-21 16:15:42 +0100 | [diff] [blame] | 190 | { |
Vladimir Marko | dc4bcce | 2018-06-21 16:15:42 +0100 | [diff] [blame] | 191 | DCHECK(!Runtime::Current()->IsStarted()); |
Vladimir Marko | 815d5e5 | 2019-03-04 10:18:31 +0000 | [diff] [blame] | 192 | Thread* self = Thread::Current(); |
Vladimir Marko | dc4bcce | 2018-06-21 16:15:42 +0100 | [diff] [blame] | 193 | StackHandleScope<2> hs(self); |
Vladimir Marko | 815d5e5 | 2019-03-04 10:18:31 +0000 | [diff] [blame] | 194 | std::unique_ptr<Compiler> compiler( |
| 195 | Compiler::Create(*compiler_options_, &storage, compiler_kind_)); |
| 196 | const DexFile& dex_file = *method->GetDexFile(); |
| 197 | Handle<mirror::DexCache> dex_cache = hs.NewHandle(class_linker_->FindDexCache(self, dex_file)); |
| 198 | Handle<mirror::ClassLoader> class_loader = hs.NewHandle(method->GetClassLoader()); |
Vladimir Marko | 2afaff7 | 2018-11-30 17:01:50 +0000 | [diff] [blame] | 199 | compiler_options_->verification_results_ = verification_results_.get(); |
Vladimir Marko | 815d5e5 | 2019-03-04 10:18:31 +0000 | [diff] [blame] | 200 | if (method->IsNative()) { |
| 201 | compiled_method = compiler->JniCompile(method->GetAccessFlags(), |
| 202 | method->GetDexMethodIndex(), |
| 203 | dex_file, |
| 204 | dex_cache); |
| 205 | } else { |
| 206 | verification_results_->AddDexFile(&dex_file); |
| 207 | verification_results_->CreateVerifiedMethodFor( |
| 208 | MethodReference(&dex_file, method->GetDexMethodIndex())); |
| 209 | compiled_method = compiler->Compile(method->GetCodeItem(), |
| 210 | method->GetAccessFlags(), |
| 211 | method->GetInvokeType(), |
| 212 | method->GetClassDefIndex(), |
| 213 | method->GetDexMethodIndex(), |
| 214 | class_loader, |
| 215 | dex_file, |
| 216 | dex_cache); |
| 217 | } |
Vladimir Marko | 2afaff7 | 2018-11-30 17:01:50 +0000 | [diff] [blame] | 218 | compiler_options_->verification_results_ = nullptr; |
Vladimir Marko | dc4bcce | 2018-06-21 16:15:42 +0100 | [diff] [blame] | 219 | } |
Vladimir Marko | 4b2d1c5 | 2019-03-06 11:21:11 +0000 | [diff] [blame] | 220 | CHECK(method != nullptr); |
| 221 | { |
| 222 | TimingLogger::ScopedTiming t2("MakeExecutable", &timings); |
| 223 | MakeExecutable(method, compiled_method); |
| 224 | } |
| 225 | CompiledMethod::ReleaseSwapAllocatedCompiledMethod(&storage, compiled_method); |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 226 | } |
| 227 | |
Andreas Gampe | 5a4b8a2 | 2014-09-11 08:30:08 -0700 | [diff] [blame] | 228 | void CommonCompilerTest::CompileDirectMethod(Handle<mirror::ClassLoader> class_loader, |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 229 | const char* class_name, const char* method_name, |
| 230 | const char* signature) { |
| 231 | std::string class_descriptor(DotToDescriptor(class_name)); |
| 232 | Thread* self = Thread::Current(); |
Vladimir Marko | e9987b0 | 2018-05-22 16:26:43 +0100 | [diff] [blame] | 233 | ObjPtr<mirror::Class> klass = |
| 234 | class_linker_->FindClass(self, class_descriptor.c_str(), class_loader); |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 235 | CHECK(klass != nullptr) << "Class not found " << class_name; |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 236 | auto pointer_size = class_linker_->GetImagePointerSize(); |
Vladimir Marko | ba11882 | 2017-06-12 15:41:56 +0100 | [diff] [blame] | 237 | ArtMethod* method = klass->FindClassMethod(method_name, signature, pointer_size); |
| 238 | CHECK(method != nullptr && method->IsDirect()) << "Direct method not found: " |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 239 | << class_name << "." << method_name << signature; |
| 240 | CompileMethod(method); |
| 241 | } |
| 242 | |
Andreas Gampe | 5a4b8a2 | 2014-09-11 08:30:08 -0700 | [diff] [blame] | 243 | void CommonCompilerTest::CompileVirtualMethod(Handle<mirror::ClassLoader> class_loader, |
Mathieu Chartier | bf99f77 | 2014-08-23 16:37:27 -0700 | [diff] [blame] | 244 | const char* class_name, const char* method_name, |
| 245 | const char* signature) { |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 246 | std::string class_descriptor(DotToDescriptor(class_name)); |
| 247 | Thread* self = Thread::Current(); |
Vladimir Marko | e9987b0 | 2018-05-22 16:26:43 +0100 | [diff] [blame] | 248 | ObjPtr<mirror::Class> klass = |
| 249 | class_linker_->FindClass(self, class_descriptor.c_str(), class_loader); |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 250 | CHECK(klass != nullptr) << "Class not found " << class_name; |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 251 | auto pointer_size = class_linker_->GetImagePointerSize(); |
Vladimir Marko | ba11882 | 2017-06-12 15:41:56 +0100 | [diff] [blame] | 252 | ArtMethod* method = klass->FindClassMethod(method_name, signature, pointer_size); |
| 253 | CHECK(method != nullptr && !method->IsDirect()) << "Virtual method not found: " |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 254 | << class_name << "." << method_name << signature; |
| 255 | CompileMethod(method); |
| 256 | } |
| 257 | |
Vladimir Marko | a043111 | 2018-06-25 09:32:54 +0100 | [diff] [blame] | 258 | void CommonCompilerTest::ClearBootImageOption() { |
Vladimir Marko | 9c4b970 | 2018-11-14 15:09:02 +0000 | [diff] [blame] | 259 | compiler_options_->image_type_ = CompilerOptions::ImageType::kNone; |
Vladimir Marko | a043111 | 2018-06-25 09:32:54 +0100 | [diff] [blame] | 260 | } |
| 261 | |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 262 | } // namespace art |