summaryrefslogtreecommitdiffstats
path: root/runtime/exception_test.cc
diff options
context:
space:
mode:
authorVladimir Marko <vmarko@google.com>2014-04-09 18:45:35 +0100
committerVladimir Marko <vmarko@google.com>2014-04-25 12:24:46 +0100
commit8a630577ed2d9e9571c3434c505e5de223b23c07 (patch)
tree106367100c639011f0abb72b3b0e227c0764e8e0 /runtime/exception_test.cc
parent96c6ab93336b972a38bd2448bcccf19188b8389b (diff)
downloadart-8a630577ed2d9e9571c3434c505e5de223b23c07.zip
art-8a630577ed2d9e9571c3434c505e5de223b23c07.tar.gz
art-8a630577ed2d9e9571c3434c505e5de223b23c07.tar.bz2
Move mapping table and vmap table offsets to OatMethodHeader.
This change has a libcore/ companion CL "Remove ArtMethod's quick fields mapping table and vmap table." https://android-review.googlesource.com/91254 Bug: 11767815 Change-Id: I46ce2067e1ecd915da3890606498e31ffc332813
Diffstat (limited to 'runtime/exception_test.cc')
-rw-r--r--runtime/exception_test.cc32
1 files changed, 22 insertions, 10 deletions
diff --git a/runtime/exception_test.cc b/runtime/exception_test.cc
index 208eb74..97a8367 100644
--- a/runtime/exception_test.cc
+++ b/runtime/exception_test.cc
@@ -49,10 +49,6 @@ class ExceptionTest : public CommonRuntimeTest {
dex_ = my_klass_->GetDexCache()->GetDexFile();
uint32_t code_size = 12;
- fake_code_.push_back((code_size >> 24) & 0xFF);
- fake_code_.push_back((code_size >> 16) & 0xFF);
- fake_code_.push_back((code_size >> 8) & 0xFF);
- fake_code_.push_back((code_size >> 0) & 0xFF);
for (size_t i = 0 ; i < code_size; i++) {
fake_code_.push_back(0x70 | i);
}
@@ -74,20 +70,35 @@ class ExceptionTest : public CommonRuntimeTest {
fake_gc_map_.push_back(0); // 0 entries.
fake_gc_map_.push_back(0);
+ const std::vector<uint8_t>& fake_vmap_table_data = fake_vmap_table_data_.GetData();
+ const std::vector<uint8_t>& fake_mapping_data = fake_mapping_data_.GetData();
+ uint32_t vmap_table_offset = sizeof(OatMethodHeader) + fake_vmap_table_data.size();
+ uint32_t mapping_table_offset = vmap_table_offset + fake_mapping_data.size();
+ OatMethodHeader method_header(vmap_table_offset, mapping_table_offset, code_size);
+ fake_header_code_and_maps_.resize(sizeof(method_header));
+ memcpy(&fake_header_code_and_maps_[0], &method_header, sizeof(method_header));
+ fake_header_code_and_maps_.insert(fake_header_code_and_maps_.begin(),
+ fake_vmap_table_data.begin(), fake_vmap_table_data.end());
+ fake_header_code_and_maps_.insert(fake_header_code_and_maps_.begin(),
+ fake_mapping_data.begin(), fake_mapping_data.end());
+ fake_header_code_and_maps_.insert(fake_header_code_and_maps_.end(),
+ fake_code_.begin(), fake_code_.end());
+
+ // NOTE: Don't align the code (it will not be executed) but check that the Thumb2
+ // adjustment will be a NOP, see ArtMethod::EntryPointToCodePointer().
+ CHECK_EQ(mapping_table_offset & 1u, 0u);
+ const uint8_t* code_ptr = &fake_header_code_and_maps_[mapping_table_offset];
+
method_f_ = my_klass_->FindVirtualMethod("f", "()I");
ASSERT_TRUE(method_f_ != NULL);
method_f_->SetFrameSizeInBytes(4 * kPointerSize);
- method_f_->SetEntryPointFromQuickCompiledCode(&fake_code_[sizeof(code_size)]);
- method_f_->SetMappingTable(&fake_mapping_data_.GetData()[0]);
- method_f_->SetVmapTable(&fake_vmap_table_data_.GetData()[0]);
+ method_f_->SetEntryPointFromQuickCompiledCode(code_ptr);
method_f_->SetNativeGcMap(&fake_gc_map_[0]);
method_g_ = my_klass_->FindVirtualMethod("g", "(I)V");
ASSERT_TRUE(method_g_ != NULL);
method_g_->SetFrameSizeInBytes(4 * kPointerSize);
- method_g_->SetEntryPointFromQuickCompiledCode(&fake_code_[sizeof(code_size)]);
- method_g_->SetMappingTable(&fake_mapping_data_.GetData()[0]);
- method_g_->SetVmapTable(&fake_vmap_table_data_.GetData()[0]);
+ method_g_->SetEntryPointFromQuickCompiledCode(code_ptr);
method_g_->SetNativeGcMap(&fake_gc_map_[0]);
}
@@ -97,6 +108,7 @@ class ExceptionTest : public CommonRuntimeTest {
Leb128EncodingVector fake_mapping_data_;
Leb128EncodingVector fake_vmap_table_data_;
std::vector<uint8_t> fake_gc_map_;
+ std::vector<uint8_t> fake_header_code_and_maps_;
mirror::ArtMethod* method_f_;
mirror::ArtMethod* method_g_;