Skip to content

Commit

Permalink
Remove code related to quicken
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Santiago Aboy Solanes authored and Treehugger Robot committed Jul 6, 2023
1 parent aaf0515 commit 5b65e02
Show file tree
Hide file tree
Showing 18 changed files with 17 additions and 150 deletions.
16 changes: 1 addition & 15 deletions compiler/optimizing/block_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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);
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -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
5 changes: 0 additions & 5 deletions compiler/optimizing/block_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions dex2oat/dex/quick_compiler_callbacks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
16 changes: 1 addition & 15 deletions dex2oat/linker/oat_writer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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),
Expand All @@ -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),
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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_);
Expand All @@ -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_);
Expand Down
9 changes: 1 addition & 8 deletions dex2oat/linker/oat_writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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_;

Expand Down Expand Up @@ -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_;
Expand Down
2 changes: 1 addition & 1 deletion libartbase/base/compiler_filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand Down
1 change: 0 additions & 1 deletion runtime/art_method.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion runtime/dex/dex_file_annotations.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions runtime/native/dalvik_system_ZygoteHooks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 2 additions & 4 deletions runtime/oat_file_assistant.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
85 changes: 0 additions & 85 deletions runtime/quicken_info.h

This file was deleted.

2 changes: 1 addition & 1 deletion runtime/runtime.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion runtime/vdex_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion runtime/vdex_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions test/595-profile-saving/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion tools/dexfuzz/src/dexfuzz/executors/Executor.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public boolean verifyOnHost(String programName) {
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);
Expand Down
6 changes: 3 additions & 3 deletions tools/run-jdwp-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading

0 comments on commit 5b65e02

Please sign in to comment.