ART: Ensure OatQuickMethodHeader is trivially copyable
Remove empty constructor.
Test: mmma art
Change-Id: Ie58721299a6675797e9a525f4eb7e6df82abed50
diff --git a/compiler/common_compiler_test.cc b/compiler/common_compiler_test.cc
index a7f16d3..1d4f020 100644
--- a/compiler/common_compiler_test.cc
+++ b/compiler/common_compiler_test.cc
@@ -16,6 +16,8 @@
#include "common_compiler_test.h"
+#include <type_traits>
+
#include "arch/instruction_set_features.h"
#include "art_field-inl.h"
#include "art_method-inl.h"
@@ -79,6 +81,7 @@
const size_t size = method_info.size() + vmap_table.size() + sizeof(method_header) + code_size;
chunk->reserve(size + max_padding);
chunk->resize(sizeof(method_header));
+ static_assert(std::is_trivially_copyable<OatQuickMethodHeader>::value, "Cannot use memcpy");
memcpy(&(*chunk)[0], &method_header, sizeof(method_header));
chunk->insert(chunk->begin(), vmap_table.begin(), vmap_table.end());
chunk->insert(chunk->begin(), method_info.begin(), method_info.end());
diff --git a/compiler/exception_test.cc b/compiler/exception_test.cc
index 15c0787..8235be9 100644
--- a/compiler/exception_test.cc
+++ b/compiler/exception_test.cc
@@ -15,6 +15,7 @@
*/
#include <memory>
+#include <type_traits>
#include "base/arena_allocator.h"
#include "base/callee_save_type.h"
@@ -92,6 +93,7 @@
MemoryRegion stack_maps_region(&fake_header_code_and_maps_[0], stack_maps_size);
stack_maps.FillInCodeInfo(stack_maps_region);
OatQuickMethodHeader method_header(code_offset, 0u, 4 * sizeof(void*), 0u, 0u, code_size);
+ static_assert(std::is_trivially_copyable<OatQuickMethodHeader>::value, "Cannot use memcpy");
memcpy(&fake_header_code_and_maps_[code_offset - header_size], &method_header, header_size);
std::copy(fake_code_.begin(),
fake_code_.end(),
diff --git a/runtime/oat_quick_method_header.cc b/runtime/oat_quick_method_header.cc
index aed6bc5..52714f9 100644
--- a/runtime/oat_quick_method_header.cc
+++ b/runtime/oat_quick_method_header.cc
@@ -35,8 +35,6 @@
frame_info_(frame_size_in_bytes, core_spill_mask, fp_spill_mask),
code_size_(code_size) {}
-OatQuickMethodHeader::~OatQuickMethodHeader() {}
-
uint32_t OatQuickMethodHeader::ToDexPc(ArtMethod* method,
const uintptr_t pc,
bool abort_on_failure) const {
diff --git a/runtime/oat_quick_method_header.h b/runtime/oat_quick_method_header.h
index d6762d6..3d5be36 100644
--- a/runtime/oat_quick_method_header.h
+++ b/runtime/oat_quick_method_header.h
@@ -38,8 +38,6 @@
uint32_t fp_spill_mask,
uint32_t code_size);
- ~OatQuickMethodHeader();
-
static OatQuickMethodHeader* FromCodePointer(const void* code_ptr) {
uintptr_t code = reinterpret_cast<uintptr_t>(code_ptr);
uintptr_t header = code - OFFSETOF_MEMBER(OatQuickMethodHeader, code_);