summaryrefslogtreecommitdiffstats
path: root/runtime/dex_file-inl.h
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2013-09-25 20:26:14 -0700
committerIan Rogers <irogers@google.com>2013-09-26 21:08:25 -0700
commitd91d6d6a80748f277fd938a412211e5af28913b1 (patch)
tree5c45f4ae53aab3f530284a97dc328b4e38ce7c94 /runtime/dex_file-inl.h
parent9c11b56296b8cffc94b0b854ce6cff7e014b8d57 (diff)
downloadandroid_art-d91d6d6a80748f277fd938a412211e5af28913b1.tar.gz
android_art-d91d6d6a80748f277fd938a412211e5af28913b1.tar.bz2
android_art-d91d6d6a80748f277fd938a412211e5af28913b1.zip
Introduce Signature type to avoid string comparisons.
Method resolution currently creates strings to then compare with strings formed from methods in other dex files. The temporary strings are purely created for the sake of comparisons. This change creates a new Signature type that represents a method signature but not as a string. This type supports comparisons and so can be used when searching for methods in resolution. With this change malloc is no longer the hottest method during dex2oat (now its memset) and allocations during verification have been reduced. The verifier is commonly what is populating the dex cache for methods and fields not declared in the dex file itself. Change-Id: I5ef0542823fbcae868aaa4a2457e8da7df0e9dae
Diffstat (limited to 'runtime/dex_file-inl.h')
-rw-r--r--runtime/dex_file-inl.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/runtime/dex_file-inl.h b/runtime/dex_file-inl.h
index 2ee9244bf2..c57a1e7582 100644
--- a/runtime/dex_file-inl.h
+++ b/runtime/dex_file-inl.h
@@ -47,6 +47,10 @@ inline StringPiece DexFile::StringDataAsStringPieceByIdx(uint32_t idx) const {
return StringPiece(data, static_cast<int>(length));
}
+inline const Signature DexFile::GetMethodSignature(const MethodId& method_id) const {
+ return Signature(this, GetProtoId(method_id.proto_idx_));
+}
+
inline const DexFile::TryItem* DexFile::GetTryItems(const CodeItem& code_item, uint32_t offset) {
const uint16_t* insns_end_ = &code_item.insns_[code_item.insns_size_in_code_units_];
return reinterpret_cast<const TryItem*>