diff options
author | 2023-06-28 14:22:48 +0100 | |
---|---|---|
committer | 2023-07-06 10:38:01 +0000 | |
commit | 5b65e02b1cdce48da11a972ab6d75a7fb5c859bd (patch) | |
tree | eb8bbf8bc23f669114760675ca131057f7e7188b | |
parent | aaf05154a31fe0b326795436ec8077d5d3469fef (diff) |
Remove code related to quicken
It was obsolete (and in some cases dead code).
Update our code to use `verify` instead of `quicken`
for compiler filters.
Bug: 289199192
Change-Id: I39048d50b4d8a3f48e0e88e752a2fd7ad73559a7
-rw-r--r-- | compiler/optimizing/block_builder.cc | 16 | ||||
-rw-r--r-- | compiler/optimizing/block_builder.h | 5 | ||||
-rw-r--r-- | dex2oat/dex/quick_compiler_callbacks.cc | 2 | ||||
-rw-r--r-- | dex2oat/linker/oat_writer.cc | 16 | ||||
-rw-r--r-- | dex2oat/linker/oat_writer.h | 9 | ||||
-rw-r--r-- | libartbase/base/compiler_filter.cc | 2 | ||||
-rw-r--r-- | runtime/art_method.cc | 1 | ||||
-rw-r--r-- | runtime/dex/dex_file_annotations.cc | 1 | ||||
-rw-r--r-- | runtime/native/dalvik_system_ZygoteHooks.cc | 4 | ||||
-rw-r--r-- | runtime/oat_file_assistant.h | 6 | ||||
-rw-r--r-- | runtime/quicken_info.h | 85 | ||||
-rw-r--r-- | runtime/runtime.cc | 2 | ||||
-rw-r--r-- | runtime/vdex_file.cc | 1 | ||||
-rw-r--r-- | runtime/vdex_file.h | 1 | ||||
-rw-r--r-- | test/595-profile-saving/run.py | 6 | ||||
-rw-r--r-- | tools/dexfuzz/src/dexfuzz/executors/Executor.java | 2 | ||||
-rwxr-xr-x | tools/run-jdwp-tests.sh | 6 | ||||
-rwxr-xr-x | tools/run-libcore-tests.py | 2 |
18 files changed, 17 insertions, 150 deletions
diff --git a/compiler/optimizing/block_builder.cc b/compiler/optimizing/block_builder.cc index 703584c537..9da2bfb8ef 100644 --- a/compiler/optimizing/block_builder.cc +++ b/compiler/optimizing/block_builder.cc @@ -20,7 +20,6 @@ #include "dex/bytecode_utils.h" #include "dex/code_item_accessors-inl.h" #include "dex/dex_file_exception_helpers.h" -#include "quicken_info.h" namespace art HIDDEN { @@ -40,9 +39,7 @@ HBasicBlockBuilder::HBasicBlockBuilder(HGraph* graph, local_allocator->Adapter(kArenaAllocGraphBuilder)), throwing_blocks_(kDefaultNumberOfThrowingBlocks, local_allocator->Adapter(kArenaAllocGraphBuilder)), - number_of_branches_(0u), - quicken_index_for_dex_pc_(std::less<uint32_t>(), - local_allocator->Adapter(kArenaAllocGraphBuilder)) {} + number_of_branches_(0u) {} HBasicBlock* HBasicBlockBuilder::MaybeCreateBlockAt(uint32_t dex_pc) { return MaybeCreateBlockAt(dex_pc, dex_pc); @@ -147,7 +144,6 @@ void HBasicBlockBuilder::ConnectBasicBlocks() { HBasicBlock* block = graph_->GetEntryBlock(); graph_->AddBlock(block); - size_t quicken_index = 0; bool is_throwing_block = false; // Calculate the qucikening index here instead of CreateBranchTargets since it's easier to // calculate in dex_pc order. @@ -158,8 +154,6 @@ void HBasicBlockBuilder::ConnectBasicBlocks() { // Check if this dex_pc address starts a new basic block. HBasicBlock* next_block = GetBlockAt(dex_pc); if (next_block != nullptr) { - // We only need quicken index entries for basic block boundaries. - quicken_index_for_dex_pc_.Put(dex_pc, quicken_index); if (block != nullptr) { // Last instruction did not end its basic block but a new one starts here. // It must have been a block falling through into the next one. @@ -169,10 +163,6 @@ void HBasicBlockBuilder::ConnectBasicBlocks() { is_throwing_block = false; graph_->AddBlock(block); } - // Make sure to increment this before the continues. - if (QuickenInfoTable::NeedsIndexForInstruction(&instruction)) { - ++quicken_index; - } if (block == nullptr) { // Ignore dead code. @@ -483,8 +473,4 @@ void HBasicBlockBuilder::BuildIntrinsic() { body->AddSuccessor(exit_block); } -size_t HBasicBlockBuilder::GetQuickenIndex(uint32_t dex_pc) const { - return quicken_index_for_dex_pc_.Get(dex_pc); -} - } // namespace art diff --git a/compiler/optimizing/block_builder.h b/compiler/optimizing/block_builder.h index 8668ef8221..1aa9375e5a 100644 --- a/compiler/optimizing/block_builder.h +++ b/compiler/optimizing/block_builder.h @@ -45,8 +45,6 @@ class HBasicBlockBuilder : public ValueObject { size_t GetNumberOfBranches() const { return number_of_branches_; } HBasicBlock* GetBlockAt(uint32_t dex_pc) const { return branch_targets_[dex_pc]; } - size_t GetQuickenIndex(uint32_t dex_pc) const; - private: // Creates a basic block starting at given `dex_pc`. HBasicBlock* MaybeCreateBlockAt(uint32_t dex_pc); @@ -83,9 +81,6 @@ class HBasicBlockBuilder : public ValueObject { ScopedArenaVector<HBasicBlock*> throwing_blocks_; size_t number_of_branches_; - // A table to quickly find the quicken index for the first instruction of a basic block. - ScopedArenaSafeMap<uint32_t, uint32_t> quicken_index_for_dex_pc_; - static constexpr size_t kDefaultNumberOfThrowingBlocks = 2u; DISALLOW_COPY_AND_ASSIGN(HBasicBlockBuilder); diff --git a/dex2oat/dex/quick_compiler_callbacks.cc b/dex2oat/dex/quick_compiler_callbacks.cc index 7611374561..c3b1c9b530 100644 --- a/dex2oat/dex/quick_compiler_callbacks.cc +++ b/dex2oat/dex/quick_compiler_callbacks.cc @@ -47,8 +47,6 @@ ClassStatus QuickCompilerCallbacks::GetPreviousClassState(ClassReference ref) { return ClassStatus::kNotReady; } DCHECK(compiler_driver_ != nullptr); - // In the case of the quicken filter: avoiding verification of quickened instructions, which the - // verifier doesn't currently support. // In the case of the verify filter, avoiding verifiying twice. return compiler_driver_->GetClassStatus(ref); } diff --git a/dex2oat/linker/oat_writer.cc b/dex2oat/linker/oat_writer.cc index b290c34049..41e9cdb841 100644 --- a/dex2oat/linker/oat_writer.cc +++ b/dex2oat/linker/oat_writer.cc @@ -69,7 +69,6 @@ #include "oat.h" #include "oat_quick_method_header.h" #include "profile/profile_compilation_info.h" -#include "quicken_info.h" #include "scoped_thread_state_change-inl.h" #include "stack_map.h" #include "stream/buffered_output_stream.h" @@ -338,7 +337,6 @@ OatWriter::OatWriter(const CompilerOptions& compiler_options, vdex_dex_files_offset_(0u), vdex_dex_shared_data_offset_(0u), vdex_verifier_deps_offset_(0u), - vdex_quickening_info_offset_(0u), vdex_lookup_tables_offset_(0u), oat_checksum_(adler32(0L, Z_NULL, 0)), code_size_(0u), @@ -361,15 +359,12 @@ OatWriter::OatWriter(const CompilerOptions& compiler_options, size_vdex_header_(0), size_vdex_checksums_(0), size_dex_file_alignment_(0), - size_quickening_table_offset_(0), size_executable_offset_alignment_(0), size_oat_header_(0), size_oat_header_key_value_store_(0), size_dex_file_(0), size_verifier_deps_(0), size_verifier_deps_alignment_(0), - size_quickening_info_(0), - size_quickening_info_alignment_(0), size_vdex_lookup_table_alignment_(0), size_vdex_lookup_table_(0), size_interpreter_to_interpreter_bridge_(0), @@ -1276,7 +1271,7 @@ class OatWriter::LayoutReserveOffsetCodeMethodVisitor : public OrderedMethodVisi offset_ += code_size; } - // Exclude quickened dex methods (code_size == 0) since they have no native code. + // Exclude dex methods without native code. if (generate_debug_info_ && code_size != 0) { DCHECK(has_debug_info); const uint8_t* code_info = compiled_method->GetVmapTable().data(); @@ -2508,12 +2503,6 @@ bool OatWriter::WriteRodata(OutputStream* out) { return true; } -void OatWriter::WriteQuickeningInfo([[maybe_unused]] /*out*/ std::vector<uint8_t>*) { - // Nothing to write. Leave `vdex_size_` untouched and unaligned. - vdex_quickening_info_offset_ = vdex_size_; - size_quickening_info_alignment_ = 0; -} - void OatWriter::WriteVerifierDeps(verifier::VerifierDeps* verifier_deps, /*out*/std::vector<uint8_t>* buffer) { if (verifier_deps == nullptr) { @@ -2621,7 +2610,6 @@ bool OatWriter::CheckOatSize(OutputStream* out, size_t file_offset, size_t relat DO_STAT(size_vdex_header_); DO_STAT(size_vdex_checksums_); DO_STAT(size_dex_file_alignment_); - DO_STAT(size_quickening_table_offset_); DO_STAT(size_executable_offset_alignment_); DO_STAT(size_oat_header_); DO_STAT(size_oat_header_key_value_store_); @@ -2630,8 +2618,6 @@ bool OatWriter::CheckOatSize(OutputStream* out, size_t file_offset, size_t relat DO_STAT(size_verifier_deps_alignment_); DO_STAT(size_vdex_lookup_table_); DO_STAT(size_vdex_lookup_table_alignment_); - DO_STAT(size_quickening_info_); - DO_STAT(size_quickening_info_alignment_); DO_STAT(size_interpreter_to_interpreter_bridge_); DO_STAT(size_interpreter_to_compiled_code_bridge_); DO_STAT(size_jni_dlsym_lookup_trampoline_); diff --git a/dex2oat/linker/oat_writer.h b/dex2oat/linker/oat_writer.h index 79ec47e37f..a10572af8b 100644 --- a/dex2oat/linker/oat_writer.h +++ b/dex2oat/linker/oat_writer.h @@ -93,7 +93,7 @@ enum class CopyOption { // ... // MethodBssMapping // -// VmapTable one variable sized VmapTable blob (CodeInfo or QuickeningInfo). +// VmapTable one variable sized VmapTable blob (CodeInfo). // VmapTable VmapTables are deduplicated. // ... // VmapTable @@ -286,7 +286,6 @@ class OatWriter { bool OpenDexFiles(File* file, /*inout*/ std::vector<MemMap>* opened_dex_files_map, /*out*/ std::vector<std::unique_ptr<const DexFile>>* opened_dex_files); - void WriteQuickeningInfo(/*out*/std::vector<uint8_t>* buffer); void WriteTypeLookupTables(/*out*/std::vector<uint8_t>* buffer); void WriteVerifierDeps(verifier::VerifierDeps* verifier_deps, /*out*/std::vector<uint8_t>* buffer); @@ -397,9 +396,6 @@ class OatWriter { // Offset of section holding VerifierDeps inside Vdex. size_t vdex_verifier_deps_offset_; - // Offset of section holding quickening info inside Vdex. - size_t vdex_quickening_info_offset_; - // Offset of type lookup tables inside Vdex. size_t vdex_lookup_tables_offset_; @@ -500,15 +496,12 @@ class OatWriter { uint32_t size_vdex_header_; uint32_t size_vdex_checksums_; uint32_t size_dex_file_alignment_; - uint32_t size_quickening_table_offset_; uint32_t size_executable_offset_alignment_; uint32_t size_oat_header_; uint32_t size_oat_header_key_value_store_; uint32_t size_dex_file_; uint32_t size_verifier_deps_; uint32_t size_verifier_deps_alignment_; - uint32_t size_quickening_info_; - uint32_t size_quickening_info_alignment_; uint32_t size_vdex_lookup_table_alignment_; uint32_t size_vdex_lookup_table_; uint32_t size_interpreter_to_interpreter_bridge_; diff --git a/libartbase/base/compiler_filter.cc b/libartbase/base/compiler_filter.cc index b4f924d39f..5f86256e15 100644 --- a/libartbase/base/compiler_filter.cc +++ b/libartbase/base/compiler_filter.cc @@ -163,7 +163,7 @@ bool CompilerFilter::ParseCompilerFilter(const char* option, Filter* filter) { *filter = kAssumeVerified; } else if (strcmp(option, "interpret-only") == 0) { LOG(WARNING) << "'interpret-only' is an obsolete compiler filter name that will be " - << "removed in future releases, please use 'quicken' instead."; + << "removed in future releases, please use 'verify' instead."; *filter = kVerify; } else if (strcmp(option, "verify-profile") == 0) { LOG(WARNING) << "'verify-profile' is an obsolete compiler filter name that will be " diff --git a/runtime/art_method.cc b/runtime/art_method.cc index b500d9b592..c7be2dc0ca 100644 --- a/runtime/art_method.cc +++ b/runtime/art_method.cc @@ -49,7 +49,6 @@ #include "mirror/object_array-inl.h" #include "mirror/string.h" #include "oat_file-inl.h" -#include "quicken_info.h" #include "runtime_callbacks.h" #include "scoped_thread_state_change-inl.h" #include "vdex_file.h" diff --git a/runtime/dex/dex_file_annotations.cc b/runtime/dex/dex_file_annotations.cc index 7c1dd1e8a9..827ced9545 100644 --- a/runtime/dex/dex_file_annotations.cc +++ b/runtime/dex/dex_file_annotations.cc @@ -37,7 +37,6 @@ #include "mirror/object_array-inl.h" #include "oat_file.h" #include "obj_ptr-inl.h" -#include "quicken_info.h" #include "reflection.h" #include "thread.h" #include "well_known_classes.h" diff --git a/runtime/native/dalvik_system_ZygoteHooks.cc b/runtime/native/dalvik_system_ZygoteHooks.cc index a052b62f10..49e5188458 100644 --- a/runtime/native/dalvik_system_ZygoteHooks.cc +++ b/runtime/native/dalvik_system_ZygoteHooks.cc @@ -187,8 +187,8 @@ static uint32_t EnableDebugFeatures(uint32_t runtime_flags) { const bool safe_mode = (runtime_flags & DEBUG_ENABLE_SAFEMODE) != 0; if (safe_mode) { - // Only quicken oat files. - runtime->AddCompilerOption("--compiler-filter=quicken"); + // Only verify oat files. + runtime->AddCompilerOption("--compiler-filter=verify"); runtime->SetSafeMode(true); runtime_flags &= ~DEBUG_ENABLE_SAFEMODE; } diff --git a/runtime/oat_file_assistant.h b/runtime/oat_file_assistant.h index 922dbf3e04..402e9aef1a 100644 --- a/runtime/oat_file_assistant.h +++ b/runtime/oat_file_assistant.h @@ -204,10 +204,8 @@ class OatFileAssistant { // compiler filter is at least as good as an oat file generated with the // given compiler filter otherwise, if its set to true, it checks whether // the oat file generated with the target filter will be downgraded as - // compared to the current state. For example, if the current compiler filter is - // quicken, and target filter is verify, it will recommend to dexopt, while - // if the target filter is speed profile, it will recommend to keep it in its - // current state. + // compared to the current state. For example, if the current compiler filter is verify and the + // target filter is speed profile it will recommend to keep it in its current state. // profile_changed should be true to indicate the profile has recently changed // for this dex location. // If the purpose of the dexopt is to downgrade the compiler filter, diff --git a/runtime/quicken_info.h b/runtime/quicken_info.h deleted file mode 100644 index 83dc5f1df8..0000000000 --- a/runtime/quicken_info.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (C) 2017 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_RUNTIME_QUICKEN_INFO_H_ -#define ART_RUNTIME_QUICKEN_INFO_H_ - -#include "base/array_ref.h" -#include "base/leb128.h" -#include "dex/compact_offset_table.h" -#include "dex/dex_instruction.h" - -namespace art { - -// QuickenInfoTable is a table of 16 bit dex indices. There is one slot for every instruction that -// is possibly dequickenable. -class QuickenInfoTable { - public: - class Builder { - public: - Builder(std::vector<uint8_t>* out_data, size_t num_elements) : out_data_(out_data) { - EncodeUnsignedLeb128(out_data_, num_elements); - } - - void AddIndex(uint16_t index) { - out_data_->push_back(static_cast<uint8_t>(index)); - out_data_->push_back(static_cast<uint8_t>(index >> 8)); - } - - private: - std::vector<uint8_t>* const out_data_; - }; - - explicit QuickenInfoTable(ArrayRef<const uint8_t> data) - : data_(data.data()), - num_elements_(!data.empty() ? DecodeUnsignedLeb128(&data_) : 0u) {} - - bool IsNull() const { - return data_ == nullptr; - } - - uint16_t GetData(size_t index) const { - return data_[index * 2] | (static_cast<uint16_t>(data_[index * 2 + 1]) << 8); - } - - // Returns true if the dex instruction has an index in the table. (maybe dequickenable). - static bool NeedsIndexForInstruction(const Instruction* inst) { - return inst->IsQuickened(); - } - - static size_t NumberOfIndices(size_t bytes) { - return bytes / sizeof(uint16_t); - } - - static size_t SizeInBytes(ArrayRef<const uint8_t> data) { - QuickenInfoTable table(data); - return table.data_ + table.NumIndices() * 2 - data.data(); - } - - uint32_t NumIndices() const { - return num_elements_; - } - - private: - const uint8_t* data_; - const uint32_t num_elements_; - - DISALLOW_COPY_AND_ASSIGN(QuickenInfoTable); -}; - -} // namespace art - -#endif // ART_RUNTIME_QUICKEN_INFO_H_ diff --git a/runtime/runtime.cc b/runtime/runtime.cc index f3bd4dd37e..62f6a1327d 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -3014,7 +3014,7 @@ std::string Runtime::GetFaultMessage() { void Runtime::AddCurrentRuntimeFeaturesAsDex2OatArguments(std::vector<std::string>* argv) const { if (GetInstrumentation()->InterpretOnly()) { - argv->push_back("--compiler-filter=quicken"); + argv->push_back("--compiler-filter=verify"); } // Make the dex2oat instruction set match that of the launching runtime. If we have multiple diff --git a/runtime/vdex_file.cc b/runtime/vdex_file.cc index 5a5d3bc68d..ef4fb5e694 100644 --- a/runtime/vdex_file.cc +++ b/runtime/vdex_file.cc @@ -40,7 +40,6 @@ #include "gc/heap.h" #include "gc/space/image_space.h" #include "mirror/class-inl.h" -#include "quicken_info.h" #include "handle_scope-inl.h" #include "runtime.h" #include "verifier/verifier_deps.h" diff --git a/runtime/vdex_file.h b/runtime/vdex_file.h index fe65c07bac..2a5655f62c 100644 --- a/runtime/vdex_file.h +++ b/runtime/vdex_file.h @@ -27,7 +27,6 @@ #include "class_status.h" #include "dex/compact_offset_table.h" #include "dex/dex_file.h" -#include "quicken_info.h" #include "handle.h" namespace art { diff --git a/test/595-profile-saving/run.py b/test/595-profile-saving/run.py index 96de2810be..599f76a6fc 100644 --- a/test/595-profile-saving/run.py +++ b/test/595-profile-saving/run.py @@ -17,16 +17,16 @@ def run(ctx, args): # Use - # --compiler-filter=quicken to make sure that the test is not compiled AOT + # --compiler-filter=verify to make sure that the test is not compiled AOT # and to make sure the test is not compiled when loaded (by PathClassLoader) # -Xjitsaveprofilinginfo to enable profile saving # -Xusejit:false to disable jit and only test profiles. # -Xjitinitialsize:32M to prevent profiling info creation failure. ctx.default_run( args, - Xcompiler_option=["--compiler-filter=quicken"], + Xcompiler_option=["--compiler-filter=verify"], runtime_option=[ - "-Xcompiler-option --compiler-filter=quicken", + "-Xcompiler-option --compiler-filter=verify", "-Xjitinitialsize:32M", "-Xjitsaveprofilinginfo", "-Xusejit:false", diff --git a/tools/dexfuzz/src/dexfuzz/executors/Executor.java b/tools/dexfuzz/src/dexfuzz/executors/Executor.java index 0367a83059..1706d5b91c 100644 --- a/tools/dexfuzz/src/dexfuzz/executors/Executor.java +++ b/tools/dexfuzz/src/dexfuzz/executors/Executor.java @@ -115,7 +115,7 @@ public abstract class Executor { commandBuilder.append("--oat-file=output.oat "); commandBuilder.append("--android-root=").append(device.getAndroidHostOut()).append(" "); commandBuilder.append("--dex-file=").append(programName).append(" "); - commandBuilder.append("--compiler-filter=quicken --runtime-arg -Xnorelocate "); + commandBuilder.append("--compiler-filter=verify --runtime-arg -Xnorelocate "); ExecutionResult verificationResult = device.executeCommand(commandBuilder.toString(), true, outputConsumer, errorConsumer); diff --git a/tools/run-jdwp-tests.sh b/tools/run-jdwp-tests.sh index fec969c870..699a2e569d 100755 --- a/tools/run-jdwp-tests.sh +++ b/tools/run-jdwp-tests.sh @@ -386,9 +386,9 @@ fi if [[ $mode != "ri" ]]; then # Because we're running debuggable, we discard any AOT code. - # Therefore we run de2oat with 'quicken' to avoid spending time compiling. - vm_args="$vm_args --vm-arg -Xcompiler-option --vm-arg --compiler-filter=quicken" - debuggee_args="$debuggee_args -Xcompiler-option --compiler-filter=quicken" + # Therefore we run dex2oat with 'verify' to avoid spending time compiling. + vm_args="$vm_args --vm-arg -Xcompiler-option --vm-arg --compiler-filter=verify" + debuggee_args="$debuggee_args -Xcompiler-option --compiler-filter=verify" if $instant_jit; then debuggee_args="$debuggee_args -Xjitthreshold:0" diff --git a/tools/run-libcore-tests.py b/tools/run-libcore-tests.py index c6958f1b6c..e5ece24d8a 100755 --- a/tools/run-libcore-tests.py +++ b/tools/run-libcore-tests.py @@ -446,7 +446,7 @@ def get_vogar_command(test_name): cmd.append("--timeout {}".format(get_timeout_secs())) cmd.append("--toolchain d8 --language CUR") if args.jit: - cmd.append("--vm-arg -Xcompiler-option --vm-arg --compiler-filter=quicken") + cmd.append("--vm-arg -Xcompiler-option --vm-arg --compiler-filter=verify") cmd.append("--vm-arg -Xusejit:{}".format(str(args.jit).lower())) if args.verbose: |