diff options
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/optimizing/code_generator_arm.h | 2 | ||||
| -rw-r--r-- | compiler/optimizing/code_generator_arm64.h | 2 | ||||
| -rw-r--r-- | compiler/utils/string_reference.h | 65 | ||||
| -rw-r--r-- | compiler/utils/string_reference_test.cc | 2 | ||||
| -rw-r--r-- | compiler/utils/type_reference.h | 2 |
5 files changed, 4 insertions, 69 deletions
diff --git a/compiler/optimizing/code_generator_arm.h b/compiler/optimizing/code_generator_arm.h index 477c4f18c1..cc38f3e6a6 100644 --- a/compiler/optimizing/code_generator_arm.h +++ b/compiler/optimizing/code_generator_arm.h @@ -21,9 +21,9 @@ #include "dex/compiler_enums.h" #include "driver/compiler_options.h" #include "nodes.h" +#include "string_reference.h" #include "parallel_move_resolver.h" #include "utils/arm/assembler_thumb2.h" -#include "utils/string_reference.h" #include "utils/type_reference.h" namespace art { diff --git a/compiler/optimizing/code_generator_arm64.h b/compiler/optimizing/code_generator_arm64.h index d4bf695602..c2f055a1cf 100644 --- a/compiler/optimizing/code_generator_arm64.h +++ b/compiler/optimizing/code_generator_arm64.h @@ -24,8 +24,8 @@ #include "driver/compiler_options.h" #include "nodes.h" #include "parallel_move_resolver.h" +#include "string_reference.h" #include "utils/arm64/assembler_arm64.h" -#include "utils/string_reference.h" #include "utils/type_reference.h" #include "vixl/a64/disasm-a64.h" #include "vixl/a64/macro-assembler-a64.h" diff --git a/compiler/utils/string_reference.h b/compiler/utils/string_reference.h deleted file mode 100644 index e4c34ca605..0000000000 --- a/compiler/utils/string_reference.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2016 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ART_COMPILER_UTILS_STRING_REFERENCE_H_ -#define ART_COMPILER_UTILS_STRING_REFERENCE_H_ - -#include <stdint.h> - -#include "base/logging.h" -#include "dex_file-inl.h" -#include "utf-inl.h" - -namespace art { - -// A string is located by its DexFile and the string_ids_ table index into that DexFile. -struct StringReference { - StringReference(const DexFile* file, uint32_t index) : dex_file(file), string_index(index) { } - - const char* GetStringData() const { - return dex_file->GetStringData(dex_file->GetStringId(string_index)); - } - - const DexFile* dex_file; - uint32_t string_index; -}; - -// Compare the actual referenced string values. Used for string reference deduplication. -struct StringReferenceValueComparator { - bool operator()(StringReference sr1, StringReference sr2) const { - // Note that we want to deduplicate identical strings even if they are referenced - // by different dex files, so we need some (any) total ordering of strings, rather - // than references. However, the references should usually be from the same dex file, - // so we choose the dex file string ordering so that we can simply compare indexes - // and avoid the costly string comparison in the most common case. - if (sr1.dex_file == sr2.dex_file) { - // Use the string order enforced by the dex file verifier. - DCHECK_EQ( - sr1.string_index < sr2.string_index, - CompareModifiedUtf8ToModifiedUtf8AsUtf16CodePointValues(sr1.GetStringData(), - sr2.GetStringData()) < 0); - return sr1.string_index < sr2.string_index; - } else { - // Cannot compare indexes, so do the string comparison. - return CompareModifiedUtf8ToModifiedUtf8AsUtf16CodePointValues(sr1.GetStringData(), - sr2.GetStringData()) < 0; - } - } -}; - -} // namespace art - -#endif // ART_COMPILER_UTILS_STRING_REFERENCE_H_ diff --git a/compiler/utils/string_reference_test.cc b/compiler/utils/string_reference_test.cc index df5080e93e..0fd9e5ba53 100644 --- a/compiler/utils/string_reference_test.cc +++ b/compiler/utils/string_reference_test.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "utils/string_reference.h" +#include "string_reference.h" #include <memory> diff --git a/compiler/utils/type_reference.h b/compiler/utils/type_reference.h index bd0739fc98..d0c1656836 100644 --- a/compiler/utils/type_reference.h +++ b/compiler/utils/type_reference.h @@ -20,7 +20,7 @@ #include <stdint.h> #include "base/logging.h" -#include "utils/string_reference.h" +#include "string_reference.h" namespace art { |