Optimizing: Clean up after const-string sharpening.
Do not look up the String for JIT, just check if it's in the
dex cache. Strings on hot paths should already be resolved
and we don't want to unnecessarily increase JIT compile time
to have a chance of improving a cold path.
Also, change the enum LinkerPatchType to be an inner enum
class of LinkerPatch and clean up casts between pointers and
uint64_t.
Change-Id: Ia6e0513af1a84ce94a3b30edac0c592157d374ec
diff --git a/compiler/linker/relative_patcher_test.h b/compiler/linker/relative_patcher_test.h
index c9fb543..bf61ea0 100644
--- a/compiler/linker/relative_patcher_test.h
+++ b/compiler/linker/relative_patcher_test.h
@@ -142,26 +142,26 @@
patched_code_.assign(code.begin(), code.end());
code = ArrayRef<const uint8_t>(patched_code_);
for (const LinkerPatch& patch : compiled_method->GetPatches()) {
- if (patch.Type() == kLinkerPatchCallRelative) {
+ if (patch.GetType() == LinkerPatch::Type::kCallRelative) {
auto result = method_offset_map_.FindMethodOffset(patch.TargetMethod());
uint32_t target_offset =
result.first ? result.second : kTrampolineOffset + compiled_method->CodeDelta();
patcher_->PatchCall(&patched_code_, patch.LiteralOffset(),
offset + patch.LiteralOffset(), target_offset);
- } else if (patch.Type() == kLinkerPatchDexCacheArray) {
+ } else if (patch.GetType() == LinkerPatch::Type::kDexCacheArray) {
uint32_t target_offset = dex_cache_arrays_begin_ + patch.TargetDexCacheElementOffset();
patcher_->PatchPcRelativeReference(&patched_code_,
patch,
offset + patch.LiteralOffset(),
target_offset);
- } else if (patch.Type() == kLinkerPatchStringRelative) {
+ } else if (patch.GetType() == LinkerPatch::Type::kStringRelative) {
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. " << patch.Type();
+ LOG(FATAL) << "Bad patch type. " << patch.GetType();
UNREACHABLE();
}
}