From b9485ace615a1ef2476884ee790357dd28c32d4e Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Mon, 17 Jun 2024 14:28:40 +0000 Subject: 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 --- compiler/common_compiler_test.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'compiler/common_compiler_test.cc') 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 CommonCompilerTestImpl::JniCompileCode(ArtMethod* method) { + CHECK(method->IsNative()); + Thread* self = Thread::Current(); + StackHandleScope<1> hs(self); + const DexFile& dex_file = *method->GetDexFile(); + Handle dex_cache = + hs.NewHandle(GetClassLinker()->FindDexCache(self, dex_file)); + OneCompiledMethodStorage storage; + std::unique_ptr compiler(Compiler::Create(*compiler_options_, &storage)); + compiler->JniCompile(method->GetAccessFlags(), + method->GetDexMethodIndex(), + dex_file, + dex_cache); + ArrayRef code = storage.GetCode(); + return std::vector(code.begin(), code.end()); +} + void CommonCompilerTestImpl::ClearBootImageOption() { compiler_options_->image_type_ = CompilerOptions::ImageType::kNone; } -- cgit v1.2.3-59-g8ed1b