diff options
author | Vladimir Marko <vmarko@google.com> | 2021-02-03 09:39:46 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-02-03 09:39:46 +0000 |
commit | aaf8fd8dc96c0131c8044667674def81909f5527 (patch) | |
tree | 46a1c77e994a5d238d385d579320eaf3224c6630 /compiler/optimizing/codegen_test_utils.h | |
parent | d6738f57f207f42139ec21024a6829d3175fdf2d (diff) | |
parent | 37fd800e917269df7824052452bcbd65f5528a3e (diff) |
Use mmap for compiled code for gtest. am: 37fd800e91
Original change: https://android-review.googlesource.com/c/platform/art/+/1570480
MUST ONLY BE SUBMITTED BY AUTOMERGER
Change-Id: I6d65eed1b7d0f1848e3a1e2cade257e088c7de49
Diffstat (limited to 'compiler/optimizing/codegen_test_utils.h')
-rw-r--r-- | compiler/optimizing/codegen_test_utils.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/compiler/optimizing/codegen_test_utils.h b/compiler/optimizing/codegen_test_utils.h index 9d15f1f294..397e601cee 100644 --- a/compiler/optimizing/codegen_test_utils.h +++ b/compiler/optimizing/codegen_test_utils.h @@ -248,9 +248,17 @@ static void Run(const InternalCodeAllocator& allocator, Expected expected) { InstructionSet target_isa = codegen.GetInstructionSet(); + struct CodeHolder : CommonCompilerTestImpl { + protected: + ClassLinker* GetClassLinker() override { return nullptr; } + Runtime* GetRuntime() override { return nullptr; } + }; + CodeHolder code_holder; + const void* code_ptr = + code_holder.MakeExecutable(allocator.GetMemory(), ArrayRef<const uint8_t>(), target_isa); + typedef Expected (*fptr)(); - CommonCompilerTest::MakeExecutable(allocator.GetMemory().data(), allocator.GetMemory().size()); - fptr f = reinterpret_cast<fptr>(reinterpret_cast<uintptr_t>(allocator.GetMemory().data())); + fptr f = reinterpret_cast<fptr>(reinterpret_cast<uintptr_t>(code_ptr)); if (target_isa == InstructionSet::kThumb2) { // For thumb we need the bottom bit set. f = reinterpret_cast<fptr>(reinterpret_cast<uintptr_t>(f) + 1); |