diff options
author | Vladimir Marko <vmarko@google.com> | 2013-11-14 15:34:17 +0000 |
---|---|---|
committer | Vladimir Marko <vmarko@google.com> | 2013-11-18 12:11:02 +0000 |
commit | 5c96e6b4dc354a7439b211b93462fbe8edea5e57 (patch) | |
tree | b89930ae568d5219e4cb1823586a6e536bebdd9b /runtime | |
parent | ca368cb576cf6a436a32c357fca51fbb3082d7a9 (diff) | |
download | art-5c96e6b4dc354a7439b211b93462fbe8edea5e57.zip art-5c96e6b4dc354a7439b211b93462fbe8edea5e57.tar.gz art-5c96e6b4dc354a7439b211b93462fbe8edea5e57.tar.bz2 |
Rewrite intrinsics detection.
Intrinsic methods should be treated as a special case of
inline methods. They should be detected early and used to
guide other optimizations. This CL rewrites the intrinsics
detection so that it can be moved to any compilation phase.
Change-Id: I4424a6a869bd98b9c478953c9e3bcaf1c6de2b33
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/dex_file.cc | 7 | ||||
-rw-r--r-- | runtime/dex_file.h | 6 |
2 files changed, 9 insertions, 4 deletions
diff --git a/runtime/dex_file.cc b/runtime/dex_file.cc index 4f33292..0ddcdf3 100644 --- a/runtime/dex_file.cc +++ b/runtime/dex_file.cc @@ -510,7 +510,8 @@ const DexFile::TypeId* DexFile::FindTypeId(uint32_t string_idx) const { } const DexFile::ProtoId* DexFile::FindProtoId(uint16_t return_type_idx, - const std::vector<uint16_t>& signature_type_idxs) const { + const uint16_t* signature_type_idxs, + uint32_t signature_length) const { int32_t lo = 0; int32_t hi = NumProtoIds() - 1; while (hi >= lo) { @@ -520,7 +521,7 @@ const DexFile::ProtoId* DexFile::FindProtoId(uint16_t return_type_idx, if (compare == 0) { DexFileParameterIterator it(*this, proto); size_t i = 0; - while (it.HasNext() && i < signature_type_idxs.size() && compare == 0) { + while (it.HasNext() && i < signature_length && compare == 0) { compare = signature_type_idxs[i] - it.GetTypeIdx(); it.Next(); i++; @@ -528,7 +529,7 @@ const DexFile::ProtoId* DexFile::FindProtoId(uint16_t return_type_idx, if (compare == 0) { if (it.HasNext()) { compare = -1; - } else if (i < signature_type_idxs.size()) { + } else if (i < signature_length) { compare = 1; } } diff --git a/runtime/dex_file.h b/runtime/dex_file.h index 51ab8d8..84026a4 100644 --- a/runtime/dex_file.h +++ b/runtime/dex_file.h @@ -661,7 +661,11 @@ class DexFile { // Looks up a proto id for a given return type and signature type list const ProtoId* FindProtoId(uint16_t return_type_idx, - const std::vector<uint16_t>& signature_type_idxs_) const; + const uint16_t* signature_type_idxs, uint32_t signature_length) const; + const ProtoId* FindProtoId(uint16_t return_type_idx, + const std::vector<uint16_t>& signature_type_idxs) const { + return FindProtoId(return_type_idx, &signature_type_idxs[0], signature_type_idxs.size()); + } // Given a signature place the type ids into the given vector, returns true on success bool CreateTypeList(const StringPiece& signature, uint16_t* return_type_idx, |