Use mmap for compiled code for gtest.

Avoid executing code in memory allocated with malloc() as
pointers to that memory can be tagged which interferes with
managed stack walk.

Test: m test-art-host-gtest.
Bug: 177816575
Change-Id: Id376091f82d5686adf3ab18d2980a42e78de57ce
diff --git a/compiler/common_compiler_test.h b/compiler/common_compiler_test.h
index 8317d7f..89cc1fa 100644
--- a/compiler/common_compiler_test.h
+++ b/compiler/common_compiler_test.h
@@ -50,11 +50,14 @@
   CommonCompilerTestImpl();
   virtual ~CommonCompilerTestImpl();
 
+  // Create an executable copy of the code with given metadata.
+  const void* MakeExecutable(ArrayRef<const uint8_t> code,
+                             ArrayRef<const uint8_t> vmap_table,
+                             InstructionSet instruction_set);
+
   void MakeExecutable(ArtMethod* method, const CompiledMethod* compiled_method)
       REQUIRES_SHARED(Locks::mutator_lock_);
 
-  static void MakeExecutable(const void* code_start, size_t code_length);
-
  protected:
   void SetUp();
 
@@ -100,8 +103,8 @@
   virtual Runtime* GetRuntime() = 0;
 
  private:
-  // Chunks must not move their storage after being created - use the node-based std::list.
-  std::list<std::vector<uint8_t>> header_code_and_maps_chunks_;
+  class CodeAndMetadata;
+  std::vector<CodeAndMetadata> code_and_metadata_;
 };
 
 template <typename RuntimeBase>