diff options
author | Andreas Gampe <agampe@google.com> | 2014-12-22 21:45:47 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-12-22 21:45:49 +0000 |
commit | 88a7bf2fb1b8be7def92ee13aac9a7882525c98f (patch) | |
tree | 767ca74e7f585364a4e5c4a475be8ccbac364164 /compiler | |
parent | 06814c9a6e40e8a1e211cd40ebf6431ce4a9721d (diff) | |
parent | a2d0afc02234961d148686242c05b8a0c6365f9d (diff) | |
download | android_art-88a7bf2fb1b8be7def92ee13aac9a7882525c98f.tar.gz android_art-88a7bf2fb1b8be7def92ee13aac9a7882525c98f.tar.bz2 android_art-88a7bf2fb1b8be7def92ee13aac9a7882525c98f.zip |
Merge "ART: Fix common_compiler_test assumptions"
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/common_compiler_test.cc | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/compiler/common_compiler_test.cc b/compiler/common_compiler_test.cc index d5c5e601e7..7df71f5b8a 100644 --- a/compiler/common_compiler_test.cc +++ b/compiler/common_compiler_test.cc @@ -54,12 +54,16 @@ void CommonCompilerTest::MakeExecutable(mirror::ArtMethod* method) { const SwapVector<uint8_t>& vmap_table = compiled_method->GetVmapTable(); uint32_t vmap_table_offset = vmap_table.empty() ? 0u : sizeof(OatQuickMethodHeader) + vmap_table.size(); - const SwapVector<uint8_t>& mapping_table = *compiled_method->GetMappingTable(); - uint32_t mapping_table_offset = mapping_table.empty() ? 0u - : sizeof(OatQuickMethodHeader) + vmap_table.size() + mapping_table.size(); - const SwapVector<uint8_t>& gc_map = *compiled_method->GetGcMap(); - uint32_t gc_map_offset = gc_map.empty() ? 0u - : sizeof(OatQuickMethodHeader) + vmap_table.size() + mapping_table.size() + gc_map.size(); + const SwapVector<uint8_t>* mapping_table = compiled_method->GetMappingTable(); + bool mapping_table_used = mapping_table != nullptr && !mapping_table->empty(); + size_t mapping_table_size = mapping_table_used ? mapping_table->size() : 0U; + uint32_t mapping_table_offset = !mapping_table_used ? 0u + : sizeof(OatQuickMethodHeader) + vmap_table.size() + mapping_table_size; + const SwapVector<uint8_t>* gc_map = compiled_method->GetGcMap(); + bool gc_map_used = gc_map != nullptr && !gc_map->empty(); + size_t gc_map_size = gc_map_used ? gc_map->size() : 0U; + uint32_t gc_map_offset = !gc_map_used ? 0u + : sizeof(OatQuickMethodHeader) + vmap_table.size() + mapping_table_size + gc_map_size; OatQuickMethodHeader method_header(mapping_table_offset, vmap_table_offset, gc_map_offset, compiled_method->GetFrameSizeInBytes(), compiled_method->GetCoreSpillMask(), @@ -67,16 +71,20 @@ void CommonCompilerTest::MakeExecutable(mirror::ArtMethod* method) { header_code_and_maps_chunks_.push_back(std::vector<uint8_t>()); std::vector<uint8_t>* chunk = &header_code_and_maps_chunks_.back(); - size_t size = sizeof(method_header) + code_size + vmap_table.size() + mapping_table.size() + - gc_map.size(); + size_t size = sizeof(method_header) + code_size + vmap_table.size() + mapping_table_size + + gc_map_size; size_t code_offset = compiled_method->AlignCode(size - code_size); size_t padding = code_offset - (size - code_size); chunk->reserve(padding + size); chunk->resize(sizeof(method_header)); memcpy(&(*chunk)[0], &method_header, sizeof(method_header)); chunk->insert(chunk->begin(), vmap_table.begin(), vmap_table.end()); - chunk->insert(chunk->begin(), mapping_table.begin(), mapping_table.end()); - chunk->insert(chunk->begin(), gc_map.begin(), gc_map.end()); + if (mapping_table_used) { + chunk->insert(chunk->begin(), mapping_table->begin(), mapping_table->end()); + } + if (gc_map_used) { + chunk->insert(chunk->begin(), gc_map->begin(), gc_map->end()); + } chunk->insert(chunk->begin(), padding, 0); chunk->insert(chunk->end(), code->begin(), code->end()); CHECK_EQ(padding + size, chunk->size()); |