diff options
| author | 2016-03-30 14:01:24 +0000 | |
|---|---|---|
| committer | 2016-03-30 14:01:24 +0000 | |
| commit | 0b92b73c62ab4cc13ca040d4233fa69d182971cc (patch) | |
| tree | df7d6180b13430de8f255884b12f29f191d1468e /compiler/linker/relative_patcher_test.h | |
| parent | 01098af7a530ca65dcf5a40b3799c5147e49bd64 (diff) | |
| parent | 085055f933d76579c32586488951a4497ffcf10e (diff) | |
Merge "Optimizing: Improve const-string code generation."
am: 085055f
* commit '085055f933d76579c32586488951a4497ffcf10e':
Optimizing: Improve const-string code generation.
Change-Id: Idd5a215e18abba1e2161f1848cb08aefb4719cf0
Diffstat (limited to 'compiler/linker/relative_patcher_test.h')
| -rw-r--r-- | compiler/linker/relative_patcher_test.h | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/compiler/linker/relative_patcher_test.h b/compiler/linker/relative_patcher_test.h index 704135a7b5..c9fb543d2e 100644 --- a/compiler/linker/relative_patcher_test.h +++ b/compiler/linker/relative_patcher_test.h @@ -150,12 +150,19 @@ class RelativePatcherTest : public testing::Test { offset + patch.LiteralOffset(), target_offset); } else if (patch.Type() == kLinkerPatchDexCacheArray) { uint32_t target_offset = dex_cache_arrays_begin_ + patch.TargetDexCacheElementOffset(); - patcher_->PatchDexCacheReference(&patched_code_, - patch, - offset + patch.LiteralOffset(), - target_offset); + patcher_->PatchPcRelativeReference(&patched_code_, + patch, + offset + patch.LiteralOffset(), + target_offset); + } else if (patch.Type() == kLinkerPatchStringRelative) { + uint32_t target_offset = string_index_to_offset_map_.Get(patch.TargetStringIndex()); + patcher_->PatchPcRelativeReference(&patched_code_, + patch, + offset + patch.LiteralOffset(), + target_offset); } else { - LOG(FATAL) << "Bad patch type."; + LOG(FATAL) << "Bad patch type. " << patch.Type(); + UNREACHABLE(); } } } @@ -257,6 +264,7 @@ class RelativePatcherTest : public testing::Test { MethodOffsetMap method_offset_map_; std::unique_ptr<RelativePatcher> patcher_; uint32_t dex_cache_arrays_begin_; + SafeMap<uint32_t, uint32_t> string_index_to_offset_map_; std::vector<MethodReference> compiled_method_refs_; std::vector<std::unique_ptr<CompiledMethod>> compiled_methods_; std::vector<uint8_t> patched_code_; |