summaryrefslogtreecommitdiff
path: root/compiler/common_compiler_test.cc
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2024-06-17 14:28:40 +0000
committer VladimĂ­r Marko <vmarko@google.com> 2024-06-18 09:09:11 +0000
commitb9485ace615a1ef2476884ee790357dd28c32d4e (patch)
tree59010f8e2765a2f5434011e13fa463c2e37aac9c /compiler/common_compiler_test.cc
parent3004a295d46959b0c4b9fa354175e6c88462a17b (diff)
Move `jni_stub_hash_map_test.cc` to `compiler/`.
The test is using `Compiler`, so it belongs to `compiler/`. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 288983053 Change-Id: Id1d5aef67a694a8b610d390c4e40e74d9d788ca9
Diffstat (limited to 'compiler/common_compiler_test.cc')
-rw-r--r--compiler/common_compiler_test.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/compiler/common_compiler_test.cc b/compiler/common_compiler_test.cc
index d7f6a2274f..392a0d1001 100644
--- a/compiler/common_compiler_test.cc
+++ b/compiler/common_compiler_test.cc
@@ -303,6 +303,23 @@ void CommonCompilerTestImpl::CompileMethod(ArtMethod* method) {
}
}
+std::vector<uint8_t> CommonCompilerTestImpl::JniCompileCode(ArtMethod* method) {
+ CHECK(method->IsNative());
+ Thread* self = Thread::Current();
+ StackHandleScope<1> hs(self);
+ const DexFile& dex_file = *method->GetDexFile();
+ Handle<mirror::DexCache> dex_cache =
+ hs.NewHandle(GetClassLinker()->FindDexCache(self, dex_file));
+ OneCompiledMethodStorage storage;
+ std::unique_ptr<Compiler> compiler(Compiler::Create(*compiler_options_, &storage));
+ compiler->JniCompile(method->GetAccessFlags(),
+ method->GetDexMethodIndex(),
+ dex_file,
+ dex_cache);
+ ArrayRef<const uint8_t> code = storage.GetCode();
+ return std::vector<uint8_t>(code.begin(), code.end());
+}
+
void CommonCompilerTestImpl::ClearBootImageOption() {
compiler_options_->image_type_ = CompilerOptions::ImageType::kNone;
}