diff options
author | 2021-04-27 16:22:48 +0100 | |
---|---|---|
committer | 2021-04-28 10:44:11 +0000 | |
commit | 61c624239ced1203d1c77cbeb5a57f9ad2c5c73d (patch) | |
tree | 63e392ba73e02ddb7fb8fc73ca87bf47d6452332 | |
parent | 1dab575cd635706f03d510763cb4ea1b115a2cee (diff) |
Remove RETURN_VOID_NO_BARRIER byte-code.
Unused and obsolete quickened byte-code.
Bug: 170086509
Test: test.py -b --host --64
Change-Id: I1e917c189da7bf64418412522676dc6b081d5c0b
30 files changed, 31 insertions, 433 deletions
diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc index 719221ee32..312b8ed748 100644 --- a/compiler/optimizing/inliner.cc +++ b/compiler/optimizing/inliner.cc @@ -421,7 +421,6 @@ static bool AlwaysThrows(const CompilerOptions& compiler_options, ArtMethod* met case Instruction::RETURN_VOID: case Instruction::RETURN_WIDE: case Instruction::RETURN_OBJECT: - case Instruction::RETURN_VOID_NO_BARRIER: return false; // found regular control flow back case Instruction::THROW: throw_seen = true; diff --git a/compiler/optimizing/instruction_builder.cc b/compiler/optimizing/instruction_builder.cc index ee6113f780..4364d39263 100644 --- a/compiler/optimizing/instruction_builder.cc +++ b/compiler/optimizing/instruction_builder.cc @@ -1408,7 +1408,6 @@ static bool HasTrivialClinit(ObjPtr<mirror::Class> klass, PointerSize pointer_si // Primitive, null or j.l.String initialization is permitted. break; case Instruction::RETURN_VOID: - case Instruction::RETURN_VOID_NO_BARRIER: break; case Instruction::SPUT: case Instruction::SPUT_WIDE: @@ -2697,7 +2696,6 @@ bool HInstructionBuilder::ProcessDexInstruction(const Instruction& instruction, break; } - case Instruction::RETURN_VOID_NO_BARRIER: case Instruction::RETURN_VOID: { BuildReturn(instruction, DataType::Type::kVoid, dex_pc); break; @@ -3561,6 +3559,7 @@ bool HInstructionBuilder::ProcessDexInstruction(const Instruction& instruction, } case Instruction::UNUSED_3E ... Instruction::UNUSED_43: + case Instruction::UNUSED_73: case Instruction::UNUSED_79: case Instruction::UNUSED_7A: case Instruction::UNUSED_E3 ... Instruction::UNUSED_F9: { diff --git a/dex2oat/Android.bp b/dex2oat/Android.bp index 5bd7f0042d..5bae16f459 100644 --- a/dex2oat/Android.bp +++ b/dex2oat/Android.bp @@ -463,7 +463,6 @@ art_cc_test { "dex2oat_test.cc", "dex2oat_vdex_test.cc", "dex2oat_image_test.cc", - "dex/dex_to_dex_decompiler_test.cc", "driver/compiler_driver_test.cc", "linker/elf_writer_test.cc", "linker/image_test.cc", diff --git a/dex2oat/dex/dex_to_dex_decompiler_test.cc b/dex2oat/dex/dex_to_dex_decompiler_test.cc deleted file mode 100644 index e754d5d609..0000000000 --- a/dex2oat/dex/dex_to_dex_decompiler_test.cc +++ /dev/null @@ -1,112 +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. - */ - -#include "dex_to_dex_decompiler.h" - -#include "base/casts.h" -#include "class_linker.h" -#include "common_compiler_driver_test.h" -#include "compiled_method-inl.h" -#include "compiler_callbacks.h" -#include "dex/class_accessor-inl.h" -#include "dex/dex_file.h" -#include "driver/compiler_driver.h" -#include "driver/compiler_options.h" -#include "handle_scope-inl.h" -#include "mirror/class_loader.h" -#include "quick_compiler_callbacks.h" -#include "runtime.h" -#include "scoped_thread_state_change-inl.h" -#include "thread.h" -#include "verifier/verifier_deps.h" - -namespace art { - -class DexToDexDecompilerTest : public CommonCompilerDriverTest { - public: - void CompileAll(jobject class_loader) REQUIRES(!Locks::mutator_lock_) { - TimingLogger timings("DexToDexDecompilerTest::CompileAll", false, false); - compiler_options_->image_type_ = CompilerOptions::ImageType::kNone; - compiler_options_->SetCompilerFilter(CompilerFilter::kVerify); - // Create the main VerifierDeps, here instead of in the compiler since we want to aggregate - // the results for all the dex files, not just the results for the current dex file. - down_cast<QuickCompilerCallbacks*>(Runtime::Current()->GetCompilerCallbacks())->SetVerifierDeps( - new verifier::VerifierDeps(GetDexFiles(class_loader))); - std::vector<const DexFile*> dex_files = GetDexFiles(class_loader); - CommonCompilerDriverTest::CompileAll(class_loader, dex_files, &timings); - } - - void RunTest(const char* dex_name) { - Thread* self = Thread::Current(); - // First load the original dex file. - jobject original_class_loader; - { - ScopedObjectAccess soa(self); - original_class_loader = LoadDex(dex_name); - } - const DexFile* original_dex_file = GetDexFiles(original_class_loader)[0]; - - // Load the dex file again and make it writable to quicken them. - jobject class_loader; - const DexFile* updated_dex_file = nullptr; - { - ScopedObjectAccess soa(self); - class_loader = LoadDex(dex_name); - updated_dex_file = GetDexFiles(class_loader)[0]; - Runtime::Current()->GetClassLinker()->RegisterDexFile( - *updated_dex_file, soa.Decode<mirror::ClassLoader>(class_loader)); - } - // The dex files should be identical. - int cmp = memcmp(original_dex_file->Begin(), - updated_dex_file->Begin(), - updated_dex_file->Size()); - ASSERT_EQ(0, cmp); - - updated_dex_file->EnableWrite(); - CompileAll(class_loader); - - // Unquicken the dex file. - for (ClassAccessor accessor : updated_dex_file->GetClasses()) { - // Unquicken each method. - for (const ClassAccessor::Method& method : accessor.GetMethods()) { - CompiledMethod* compiled_method = compiler_driver_->GetCompiledMethod( - method.GetReference()); - ArrayRef<const uint8_t> table; - if (compiled_method != nullptr) { - table = compiled_method->GetVmapTable(); - } - optimizer::ArtDecompileDEX(*updated_dex_file, - *accessor.GetCodeItem(method), - table, - /* decompile_return_instruction= */ true); - } - } - - // Make sure after unquickening we go back to the same contents as the original dex file. - cmp = memcmp(original_dex_file->Begin(), updated_dex_file->Begin(), updated_dex_file->Size()); - ASSERT_EQ(0, cmp); - } -}; - -TEST_F(DexToDexDecompilerTest, VerifierDeps) { - RunTest("VerifierDeps"); -} - -TEST_F(DexToDexDecompilerTest, DexToDexDecompiler) { - RunTest("DexToDexDecompiler"); -} - -} // namespace art diff --git a/libdexfile/dex/dex_instruction_list.h b/libdexfile/dex/dex_instruction_list.h index 36723517f6..9a01bfe5d3 100644 --- a/libdexfile/dex/dex_instruction_list.h +++ b/libdexfile/dex/dex_instruction_list.h @@ -134,7 +134,7 @@ V(0x70, INVOKE_DIRECT, "invoke-direct", k35c, kIndexMethodRef, kContinue | kThrow | kInvoke, 0, kVerifyRegBMethod | kVerifyVarArgNonZero) \ V(0x71, INVOKE_STATIC, "invoke-static", k35c, kIndexMethodRef, kContinue | kThrow | kInvoke, 0, kVerifyRegBMethod | kVerifyVarArg) \ V(0x72, INVOKE_INTERFACE, "invoke-interface", k35c, kIndexMethodRef, kContinue | kThrow | kInvoke, 0, kVerifyRegBMethod | kVerifyVarArgNonZero) \ - V(0x73, RETURN_VOID_NO_BARRIER, "return-void-no-barrier", k10x, kIndexNone, kReturn, 0, kVerifyNothing) \ + V(0x73, UNUSED_73, "unused-73", k10x, kIndexUnknown, 0, 0, kVerifyError) \ V(0x74, INVOKE_VIRTUAL_RANGE, "invoke-virtual/range", k3rc, kIndexMethodRef, kContinue | kThrow | kInvoke, 0, kVerifyRegBMethod | kVerifyVarArgRangeNonZero) \ V(0x75, INVOKE_SUPER_RANGE, "invoke-super/range", k3rc, kIndexMethodRef, kContinue | kThrow | kInvoke, 0, kVerifyRegBMethod | kVerifyVarArgRangeNonZero) \ V(0x76, INVOKE_DIRECT_RANGE, "invoke-direct/range", k3rc, kIndexMethodRef, kContinue | kThrow | kInvoke, 0, kVerifyRegBMethod | kVerifyVarArgRangeNonZero) \ diff --git a/libdexfile/dex/dex_instruction_utils.h b/libdexfile/dex/dex_instruction_utils.h index 53beb9ff1f..242bbcd1c6 100644 --- a/libdexfile/dex/dex_instruction_utils.h +++ b/libdexfile/dex/dex_instruction_utils.h @@ -65,7 +65,7 @@ constexpr bool IsInstructionReturn(Instruction::Code opcode) { constexpr bool IsInstructionInvoke(Instruction::Code opcode) { return Instruction::INVOKE_VIRTUAL <= opcode && opcode <= Instruction::INVOKE_INTERFACE_RANGE && - opcode != Instruction::RETURN_VOID_NO_BARRIER; + opcode != Instruction::UNUSED_73; } constexpr bool IsInstructionInvokeStatic(Instruction::Code opcode) { diff --git a/openjdkjvmti/fixed_up_dex_file.cc b/openjdkjvmti/fixed_up_dex_file.cc index 4aa81ff47e..9d1fabfd4f 100644 --- a/openjdkjvmti/fixed_up_dex_file.cc +++ b/openjdkjvmti/fixed_up_dex_file.cc @@ -39,7 +39,6 @@ // Runtime includes. #include "dex_container.h" #include "dex/compact_dex_level.h" -#include "dex_to_dex_decompiler.h" #include "dexlayout.h" #include "oat_file.h" #include "vdex_file.h" diff --git a/runtime/Android.bp b/runtime/Android.bp index f66faf4265..e8ebc20b9f 100644 --- a/runtime/Android.bp +++ b/runtime/Android.bp @@ -93,7 +93,6 @@ libart_cc_defaults { "debugger.cc", "dex/dex_file_annotations.cc", "dex_register_location.cc", - "dex_to_dex_decompiler.cc", "elf_file.cc", "exec_utils.cc", "fault_handler.cc", diff --git a/runtime/dex_to_dex_decompiler.cc b/runtime/dex_to_dex_decompiler.cc deleted file mode 100644 index eac270998f..0000000000 --- a/runtime/dex_to_dex_decompiler.cc +++ /dev/null @@ -1,144 +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. - */ - -#include "dex_to_dex_decompiler.h" - -#include <android-base/logging.h> - -#include "base/macros.h" -#include "base/mutex.h" -#include "dex/bytecode_utils.h" -#include "dex/code_item_accessors-inl.h" -#include "dex/dex_file-inl.h" -#include "dex/dex_instruction-inl.h" -#include "quicken_info.h" - -namespace art { -namespace optimizer { - -class DexDecompiler { - public: - DexDecompiler(const DexFile& dex_file, - const dex::CodeItem& code_item, - const ArrayRef<const uint8_t>& quickened_info, - bool decompile_return_instruction) - : code_item_accessor_(dex_file, &code_item), - quicken_info_(quickened_info), - decompile_return_instruction_(decompile_return_instruction) {} - - bool Decompile(); - - private: - void DecompileInstanceFieldAccess(Instruction* inst, Instruction::Code new_opcode) { - uint16_t index = NextIndex(); - inst->SetOpcode(new_opcode); - inst->SetVRegC_22c(index); - } - - void DecompileInvokeVirtual(Instruction* inst, Instruction::Code new_opcode, bool is_range) { - const uint16_t index = NextIndex(); - inst->SetOpcode(new_opcode); - if (is_range) { - inst->SetVRegB_3rc(index); - } else { - inst->SetVRegB_35c(index); - } - } - - void DecompileNop(Instruction* inst) { - const uint16_t reference_index = NextIndex(); - if (reference_index == DexFile::kDexNoIndex16) { - // This means it was a normal nop and not a check-cast. - return; - } - const uint16_t type_index = NextIndex(); - inst->SetOpcode(Instruction::CHECK_CAST); - inst->SetVRegA_21c(reference_index); - inst->SetVRegB_21c(type_index); - } - - uint16_t NextIndex() { - DCHECK_LT(quicken_index_, quicken_info_.NumIndices()); - const uint16_t ret = quicken_info_.GetData(quicken_index_); - quicken_index_++; - return ret; - } - - const CodeItemInstructionAccessor code_item_accessor_; - const QuickenInfoTable quicken_info_; - const bool decompile_return_instruction_; - - size_t quicken_index_ = 0u; - - DISALLOW_COPY_AND_ASSIGN(DexDecompiler); -}; - -bool DexDecompiler::Decompile() { - // We need to iterate over the code item, and not over the quickening data, - // because the RETURN_VOID quickening is not encoded in the quickening data. Because - // unquickening is a rare need and not performance sensitive, it is not worth the - // added storage to also add the RETURN_VOID quickening in the quickened data. - for (const DexInstructionPcPair& pair : code_item_accessor_) { - Instruction* inst = const_cast<Instruction*>(&pair.Inst()); - - switch (inst->Opcode()) { - case Instruction::RETURN_VOID_NO_BARRIER: - if (decompile_return_instruction_) { - inst->SetOpcode(Instruction::RETURN_VOID); - } - break; - - case Instruction::NOP: - if (quicken_info_.NumIndices() > 0) { - // Only try to decompile NOP if there are more than 0 indices. Not having - // any index happens when we unquicken a code item that only has - // RETURN_VOID_NO_BARRIER as quickened instruction. - DecompileNop(inst); - } - break; - - default: - break; - } - } - - if (quicken_index_ != quicken_info_.NumIndices()) { - if (quicken_index_ == 0) { - LOG(WARNING) << "Failed to use any value in quickening info," - << " potentially due to duplicate methods."; - } else { - LOG(FATAL) << "Failed to use all values in quickening info." - << " Actual: " << std::hex << quicken_index_ - << " Expected: " << quicken_info_.NumIndices(); - } - } - - return true; -} - -bool ArtDecompileDEX(const DexFile& dex_file, - const dex::CodeItem& code_item, - const ArrayRef<const uint8_t>& quickened_info, - bool decompile_return_instruction) { - if (quickened_info.size() == 0 && !decompile_return_instruction) { - return true; - } - DexDecompiler decompiler(dex_file, code_item, quickened_info, decompile_return_instruction); - return decompiler.Decompile(); -} - -} // namespace optimizer -} // namespace art diff --git a/runtime/dex_to_dex_decompiler.h b/runtime/dex_to_dex_decompiler.h deleted file mode 100644 index 4b6b0f707a..0000000000 --- a/runtime/dex_to_dex_decompiler.h +++ /dev/null @@ -1,46 +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_RUNTIME_DEX_TO_DEX_DECOMPILER_H_ -#define ART_RUNTIME_DEX_TO_DEX_DECOMPILER_H_ - -#include "base/array_ref.h" - -namespace art { - -class DexFile; - -namespace dex { -struct CodeItem; -} // namespace dex - -namespace optimizer { - -// "Decompile", that is unquicken, the code item provided, given the -// associated quickening data. -// TODO: code_item isn't really a const element, but changing it -// to non-const has too many repercussions on the code base. We make it -// consistent with DexToDexCompiler, but we should really change it to -// DexFile::CodeItem*. -bool ArtDecompileDEX(const DexFile& dex_file, - const dex::CodeItem& code_item, - const ArrayRef<const uint8_t>& quickened_data, - bool decompile_return_instruction); - -} // namespace optimizer -} // namespace art - -#endif // ART_RUNTIME_DEX_TO_DEX_DECOMPILER_H_ diff --git a/runtime/interpreter/interpreter_switch_impl-inl.h b/runtime/interpreter/interpreter_switch_impl-inl.h index d7a1b1b149..07a04fe4bb 100644 --- a/runtime/interpreter/interpreter_switch_impl-inl.h +++ b/runtime/interpreter/interpreter_switch_impl-inl.h @@ -440,11 +440,6 @@ class InstructionHandler { return true; } - HANDLER_ATTRIBUTES bool RETURN_VOID_NO_BARRIER() { - JValue result; - return HandleReturn(result); - } - HANDLER_ATTRIBUTES bool RETURN_VOID() { QuasiAtomic::ThreadFenceForConstructor(); JValue result; @@ -1628,6 +1623,10 @@ class InstructionHandler { return HandleUnused(); } + HANDLER_ATTRIBUTES bool UNUSED_73() { + return HandleUnused(); + } + HANDLER_ATTRIBUTES bool UNUSED_79() { return HandleUnused(); } diff --git a/runtime/interpreter/mterp/arm/control_flow.S b/runtime/interpreter/mterp/arm/control_flow.S index 2299ef9332..2b4cf206b7 100644 --- a/runtime/interpreter/mterp/arm/control_flow.S +++ b/runtime/interpreter/mterp/arm/control_flow.S @@ -167,15 +167,6 @@ mov r1, #0 b MterpReturn -%def op_return_void_no_barrier(): - ldr lr, [rSELF, #THREAD_FLAGS_OFFSET] - mov r0, rSELF - ands lr, #THREAD_SUSPEND_OR_CHECKPOINT_REQUEST - blne MterpSuspendCheck @ (self) - mov r0, #0 - mov r1, #0 - b MterpReturn - %def op_return_wide(): /* * Return a 64-bit value. diff --git a/runtime/interpreter/mterp/arm64/control_flow.S b/runtime/interpreter/mterp/arm64/control_flow.S index b634c9812c..25313d3807 100644 --- a/runtime/interpreter/mterp/arm64/control_flow.S +++ b/runtime/interpreter/mterp/arm64/control_flow.S @@ -175,18 +175,6 @@ bl MterpSuspendCheck // (self) b .L${opcode}_return -%def op_return_void_no_barrier(): - ldr w7, [xSELF, #THREAD_FLAGS_OFFSET] - mov x0, xSELF - ands w7, w7, #THREAD_SUSPEND_OR_CHECKPOINT_REQUEST - b.ne .L${opcode}_check -.L${opcode}_return: - mov x0, #0 - b MterpReturn -.L${opcode}_check: - bl MterpSuspendCheck // (self) - b .L${opcode}_return - %def op_return_wide(): /* * Return a 64-bit value. diff --git a/runtime/interpreter/mterp/arm64ng/control_flow.S b/runtime/interpreter/mterp/arm64ng/control_flow.S index 0e0b8dd4d0..f2d0559064 100644 --- a/runtime/interpreter/mterp/arm64ng/control_flow.S +++ b/runtime/interpreter/mterp/arm64ng/control_flow.S @@ -141,12 +141,10 @@ /* * Return a 32-bit value. */ -%def op_return(is_object="0", is_void="0", is_wide="0", is_no_barrier="0"): +%def op_return(is_object="0", is_void="0", is_wide="0"): .if $is_void - .if !$is_no_barrier // Thread fence for constructor dmb ishst - .endif .else lsr w2, wINST, #8 // w2<- AA .if $is_wide @@ -172,16 +170,13 @@ .cfi_restore_state %def op_return_object(): -% op_return(is_object="1", is_void="0", is_wide="0", is_no_barrier="0") +% op_return(is_object="1", is_void="0", is_wide="0") %def op_return_void(): -% op_return(is_object="0", is_void="1", is_wide="0", is_no_barrier="0") - -%def op_return_void_no_barrier(): -% op_return(is_object="0", is_void="1", is_wide="0", is_no_barrier="1") +% op_return(is_object="0", is_void="1", is_wide="0") %def op_return_wide(): -% op_return(is_object="0", is_void="0", is_wide="1", is_no_barrier="0") +% op_return(is_object="0", is_void="0", is_wide="1") %def op_throw(): EXPORT_PC diff --git a/runtime/interpreter/mterp/arm64ng/other.S b/runtime/interpreter/mterp/arm64ng/other.S index ace1b0959a..caaec3d7cc 100644 --- a/runtime/interpreter/mterp/arm64ng/other.S +++ b/runtime/interpreter/mterp/arm64ng/other.S @@ -302,6 +302,9 @@ %def op_unused_43(): % unused() +%def op_unused_73(): +% unused() + %def op_unused_79(): % unused() diff --git a/runtime/interpreter/mterp/armng/control_flow.S b/runtime/interpreter/mterp/armng/control_flow.S index 3d564e7639..ab05228c2c 100644 --- a/runtime/interpreter/mterp/armng/control_flow.S +++ b/runtime/interpreter/mterp/armng/control_flow.S @@ -141,12 +141,10 @@ /* * Return a 32-bit value. */ -%def op_return(is_object="0", is_void="0", is_wide="0", is_no_barrier="0"): +%def op_return(is_object="0", is_void="0", is_wide="0"): .if $is_void - .if !$is_no_barrier // Thread fence for constructor dmb ishst - .endif .else mov r2, rINST, lsr #8 @ r2<- AA .if $is_wide @@ -172,16 +170,13 @@ .cfi_restore_state %def op_return_object(): -% op_return(is_object="1", is_void="0", is_wide="0", is_no_barrier="0") +% op_return(is_object="1", is_void="0", is_wide="0") %def op_return_void(): -% op_return(is_object="0", is_void="1", is_wide="0", is_no_barrier="0") - -%def op_return_void_no_barrier(): -% op_return(is_object="0", is_void="1", is_wide="0", is_no_barrier="1") +% op_return(is_object="0", is_void="1", is_wide="0") %def op_return_wide(): -% op_return(is_object="0", is_void="0", is_wide="1", is_no_barrier="0") +% op_return(is_object="0", is_void="0", is_wide="1") %def op_throw(): EXPORT_PC diff --git a/runtime/interpreter/mterp/x86/control_flow.S b/runtime/interpreter/mterp/x86/control_flow.S index 74b4fad34f..08dc8660e0 100644 --- a/runtime/interpreter/mterp/x86/control_flow.S +++ b/runtime/interpreter/mterp/x86/control_flow.S @@ -174,17 +174,6 @@ xorl %ecx, %ecx jmp MterpReturn -%def op_return_void_no_barrier(): - movl rSELF, %eax - testl $$(THREAD_SUSPEND_OR_CHECKPOINT_REQUEST), THREAD_FLAGS_OFFSET(%eax) - jz 1f - movl %eax, OUT_ARG0(%esp) - call SYMBOL(MterpSuspendCheck) -1: - xorl %eax, %eax - xorl %ecx, %ecx - jmp MterpReturn - %def op_return_wide(): /* * Return a 64-bit value. diff --git a/runtime/interpreter/mterp/x86/other.S b/runtime/interpreter/mterp/x86/other.S index ec556b85b8..b0fd1ec3b0 100644 --- a/runtime/interpreter/mterp/x86/other.S +++ b/runtime/interpreter/mterp/x86/other.S @@ -294,6 +294,9 @@ %def op_unused_43(): % unused() +%def op_unused_73(): +% unused() + %def op_unused_79(): % unused() diff --git a/runtime/interpreter/mterp/x86_64/control_flow.S b/runtime/interpreter/mterp/x86_64/control_flow.S index 2f3b5e560f..3b52c62edf 100644 --- a/runtime/interpreter/mterp/x86_64/control_flow.S +++ b/runtime/interpreter/mterp/x86_64/control_flow.S @@ -165,15 +165,6 @@ xorq %rax, %rax jmp MterpReturn -%def op_return_void_no_barrier(): - movq rSELF, OUT_ARG0 - testl $$(THREAD_SUSPEND_OR_CHECKPOINT_REQUEST), THREAD_FLAGS_OFFSET(OUT_ARG0) - jz 1f - call SYMBOL(MterpSuspendCheck) -1: - xorq %rax, %rax - jmp MterpReturn - %def op_return_wide(): /* * Return a 64-bit value. diff --git a/runtime/interpreter/mterp/x86_64/other.S b/runtime/interpreter/mterp/x86_64/other.S index ec76b83cfd..83e14f0fd7 100644 --- a/runtime/interpreter/mterp/x86_64/other.S +++ b/runtime/interpreter/mterp/x86_64/other.S @@ -263,6 +263,9 @@ %def op_unused_43(): % unused() +%def op_unused_73(): +% unused() + %def op_unused_79(): % unused() diff --git a/runtime/interpreter/mterp/x86_64ng/control_flow.S b/runtime/interpreter/mterp/x86_64ng/control_flow.S index 35276d4047..e6116dd16f 100644 --- a/runtime/interpreter/mterp/x86_64ng/control_flow.S +++ b/runtime/interpreter/mterp/x86_64ng/control_flow.S @@ -153,9 +153,6 @@ ret CFI_RESTORE_STATE -%def op_return_void_no_barrier(): -% op_return_void() - %def op_return_wide(): GET_WIDE_VREG %rax, rINSTq # eax <- vAA // In case we're going back to compiled code, put the diff --git a/runtime/interpreter/mterp/x86_64ng/other.S b/runtime/interpreter/mterp/x86_64ng/other.S index bbbf6637b0..078fac59d9 100644 --- a/runtime/interpreter/mterp/x86_64ng/other.S +++ b/runtime/interpreter/mterp/x86_64ng/other.S @@ -239,6 +239,9 @@ %def op_unused_43(): % unused() +%def op_unused_73(): +% unused() + %def op_unused_79(): % unused() diff --git a/runtime/vdex_file.cc b/runtime/vdex_file.cc index 7a4ef9c62d..29efd4016f 100644 --- a/runtime/vdex_file.cc +++ b/runtime/vdex_file.cc @@ -34,7 +34,6 @@ #include "dex/art_dex_file_loader.h" #include "dex/class_accessor-inl.h" #include "dex/dex_file_loader.h" -#include "dex_to_dex_decompiler.h" #include "gc/heap.h" #include "gc/space/image_space.h" #include "mirror/class-inl.h" diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc index 7faf9c2894..12abed2af5 100644 --- a/runtime/verifier/method_verifier.cc +++ b/runtime/verifier/method_verifier.cc @@ -1993,20 +1993,6 @@ bool MethodVerifier<kVerifierDebug>::CodeFlowVerifyMethod() { return true; } -// Returns the index of the first final instance field of the given class, or kDexNoIndex if there -// is no such field. -static uint32_t GetFirstFinalInstanceFieldIndex(const DexFile& dex_file, dex::TypeIndex type_idx) { - const dex::ClassDef* class_def = dex_file.FindClassDef(type_idx); - DCHECK(class_def != nullptr); - ClassAccessor accessor(dex_file, *class_def); - for (const ClassAccessor::Field& field : accessor.GetInstanceFields()) { - if (field.IsFinal()) { - return field.GetIndex(); - } - } - return dex::kDexNoIndex; -} - // Setup a register line for the given return instruction. template <bool kVerifierDebug> static void AdjustReturnLine(MethodVerifier<kVerifierDebug>* verifier, @@ -2016,7 +2002,6 @@ static void AdjustReturnLine(MethodVerifier<kVerifierDebug>* verifier, switch (opcode) { case Instruction::RETURN_VOID: - case Instruction::RETURN_VOID_NO_BARRIER: if (verifier->IsInstanceConstructor()) { // Before we mark all regs as conflicts, check that we don't have an uninitialized this. line->CheckConstructorReturn(verifier); @@ -3417,42 +3402,10 @@ bool MethodVerifier<kVerifierDebug>::CodeFlowVerifyInstruction(uint32_t* start_g false); break; - // Special instructions. - case Instruction::RETURN_VOID_NO_BARRIER: - if (IsConstructor() && !IsStatic()) { - const RegType& declaring_class = GetDeclaringClass(); - if (declaring_class.IsUnresolvedReference()) { - // We must iterate over the fields, even if we cannot use mirror classes to do so. Do it - // manually over the underlying dex file. - uint32_t first_index = GetFirstFinalInstanceFieldIndex(*dex_file_, - dex_file_->GetMethodId(dex_method_idx_).class_idx_); - if (first_index != dex::kDexNoIndex) { - Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "return-void-no-barrier not expected for field " - << first_index; - } - break; - } - ObjPtr<mirror::Class> klass = declaring_class.GetClass(); - for (uint32_t i = 0, num_fields = klass->NumInstanceFields(); i < num_fields; ++i) { - if (klass->GetInstanceField(i)->IsFinal()) { - Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "return-void-no-barrier not expected for " - << klass->GetInstanceField(i)->PrettyField(); - break; - } - } - } - // Handle this like a RETURN_VOID now. Code is duplicated to separate standard from - // quickened opcodes (otherwise this could be a fall-through). - if (!IsConstructor()) { - if (!GetMethodReturnType().IsConflict()) { - Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "return-void not expected"; - } - } - break; - /* These should never appear during verification. */ case Instruction::UNUSED_3E ... Instruction::UNUSED_43: case Instruction::UNUSED_E3 ... Instruction::UNUSED_F9: + case Instruction::UNUSED_73: case Instruction::UNUSED_79: case Instruction::UNUSED_7A: Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "Unexpected opcode " << inst->DumpString(dex_file_); diff --git a/test/628-vdex/src/Main.java b/test/628-vdex/src/Main.java index 7ceab2c952..0a012f1e8f 100644 --- a/test/628-vdex/src/Main.java +++ b/test/628-vdex/src/Main.java @@ -16,7 +16,6 @@ public class Main { Main() { - // Will be quickened with RETURN_VOID_NO_BARRIER. } public static void main(String[] args) { diff --git a/test/674-vdex-uncompress/src/Main.java b/test/674-vdex-uncompress/src/Main.java index 0a25b564fe..ce8b7b5a6d 100644 --- a/test/674-vdex-uncompress/src/Main.java +++ b/test/674-vdex-uncompress/src/Main.java @@ -16,7 +16,6 @@ public class Main { Main() { - // Will be quickened with RETURN_VOID_NO_BARRIER. } public static void main(String[] args) { diff --git a/test/983-source-transform-verify/source_transform_art.cc b/test/983-source-transform-verify/source_transform_art.cc index fbf25b849e..a1916a03bd 100644 --- a/test/983-source-transform-verify/source_transform_art.cc +++ b/test/983-source-transform-verify/source_transform_art.cc @@ -58,8 +58,7 @@ void VerifyClassData(jint class_data_len, const unsigned char* class_data) { for (const DexInstructionPcPair& pair : method.GetInstructions()) { const Instruction& inst = pair.Inst(); int forbidden_flags = (Instruction::kVerifyError | Instruction::kVerifyRuntimeOnly); - if (inst.Opcode() == Instruction::RETURN_VOID_NO_BARRIER || - (inst.GetVerifyExtraFlags() & forbidden_flags) != 0) { + if ((inst.GetVerifyExtraFlags() & forbidden_flags) != 0) { LOG(FATAL) << "Unexpected instruction found in " << dex->PrettyMethod(method.GetIndex()) << " [Dex PC: 0x" << std::hex << pair.DexPc() << std::dec << "] : " << inst.DumpString(dex.get()) << std::endl; diff --git a/test/DexToDexDecompiler/Main.java b/test/DexToDexDecompiler/Main.java index 8f5075ae2a..60f30493d8 100644 --- a/test/DexToDexDecompiler/Main.java +++ b/test/DexToDexDecompiler/Main.java @@ -16,7 +16,6 @@ public class Main { Main() { - // Will be quickened with RETURN_VOID_NO_BARRIER. } public static void main() { diff --git a/tools/dexfuzz/src/dexfuzz/rawdex/Instruction.java b/tools/dexfuzz/src/dexfuzz/rawdex/Instruction.java index 620ea858c0..a9b93d483c 100644 --- a/tools/dexfuzz/src/dexfuzz/rawdex/Instruction.java +++ b/tools/dexfuzz/src/dexfuzz/rawdex/Instruction.java @@ -434,7 +434,7 @@ public class Instruction implements RawDexObject { addOpcodeInfo(Opcode.INVOKE_DIRECT, "invoke-direct", 0x70, new Format35c()); addOpcodeInfo(Opcode.INVOKE_STATIC, "invoke-static", 0x71, new Format35c()); addOpcodeInfo(Opcode.INVOKE_INTERFACE, "invoke-interface", 0x72, new Format35c()); - addOpcodeInfo(Opcode.RETURN_VOID_NO_BARRIER, "return-void-no-barrier", 0x73, new Format10x()); + addOpcodeInfo(Opcode.UNUSED_73, "unused-73", 0x73, new Format10x()); addOpcodeInfo(Opcode.INVOKE_VIRTUAL_RANGE, "invoke-virtual/range", 0x74, new Format3rc()); addOpcodeInfo(Opcode.INVOKE_SUPER_RANGE, "invoke-super/range", 0x75, new Format3rc()); addOpcodeInfo(Opcode.INVOKE_DIRECT_RANGE, "invoke-direct/range", 0x76, new Format3rc()); diff --git a/tools/dexfuzz/src/dexfuzz/rawdex/Opcode.java b/tools/dexfuzz/src/dexfuzz/rawdex/Opcode.java index 5c2f08140c..76e8ef9a90 100644 --- a/tools/dexfuzz/src/dexfuzz/rawdex/Opcode.java +++ b/tools/dexfuzz/src/dexfuzz/rawdex/Opcode.java @@ -132,7 +132,7 @@ public enum Opcode { INVOKE_DIRECT, INVOKE_STATIC, INVOKE_INTERFACE, - RETURN_VOID_NO_BARRIER, + UNUSED_73, INVOKE_VIRTUAL_RANGE, INVOKE_SUPER_RANGE, INVOKE_DIRECT_RANGE, |