diff options
-rw-r--r-- | compiler/optimizing/builder.cc | 6 | ||||
-rw-r--r-- | compiler/optimizing/builder.h | 4 | ||||
-rw-r--r-- | compiler/optimizing/inliner.cc | 3 | ||||
-rw-r--r-- | compiler/optimizing/instruction_builder.cc | 112 | ||||
-rw-r--r-- | compiler/optimizing/instruction_builder.h | 13 | ||||
-rw-r--r-- | compiler/optimizing/optimizing_compiler.cc | 8 | ||||
-rw-r--r-- | runtime/art_method.cc | 27 | ||||
-rw-r--r-- | runtime/art_method.h | 3 | ||||
-rw-r--r-- | runtime/common_throws.cc | 72 | ||||
-rw-r--r-- | runtime/dex/dex_file_annotations.cc | 40 | ||||
-rw-r--r-- | runtime/instrumentation.cc | 19 | ||||
-rw-r--r-- | runtime/oat_file.cc | 10 | ||||
-rw-r--r-- | runtime/oat_file.h | 3 | ||||
-rw-r--r-- | runtime/verifier/method_verifier.cc | 21 |
14 files changed, 39 insertions, 302 deletions
diff --git a/compiler/optimizing/builder.cc b/compiler/optimizing/builder.cc index decc4a815a..3263e9ca3a 100644 --- a/compiler/optimizing/builder.cc +++ b/compiler/optimizing/builder.cc @@ -41,8 +41,7 @@ HGraphBuilder::HGraphBuilder(HGraph* graph, const DexCompilationUnit* dex_compilation_unit, const DexCompilationUnit* outer_compilation_unit, CodeGenerator* code_generator, - OptimizingCompilerStats* compiler_stats, - ArrayRef<const uint8_t> interpreter_metadata) + OptimizingCompilerStats* compiler_stats) : graph_(graph), dex_file_(&graph->GetDexFile()), code_item_accessor_(accessor), @@ -50,7 +49,6 @@ HGraphBuilder::HGraphBuilder(HGraph* graph, outer_compilation_unit_(outer_compilation_unit), code_generator_(code_generator), compilation_stats_(compiler_stats), - interpreter_metadata_(interpreter_metadata), return_type_(DataType::FromShorty(dex_compilation_unit_->GetShorty()[0])) {} HGraphBuilder::HGraphBuilder(HGraph* graph, @@ -124,7 +122,6 @@ GraphAnalysisResult HGraphBuilder::BuildGraph() { dex_compilation_unit_, outer_compilation_unit_, code_generator_, - interpreter_metadata_, compilation_stats_, &local_allocator); @@ -193,7 +190,6 @@ void HGraphBuilder::BuildIntrinsicGraph(ArtMethod* method) { dex_compilation_unit_, outer_compilation_unit_, code_generator_, - interpreter_metadata_, compilation_stats_, &local_allocator); diff --git a/compiler/optimizing/builder.h b/compiler/optimizing/builder.h index 8b76dd9106..580769e0f9 100644 --- a/compiler/optimizing/builder.h +++ b/compiler/optimizing/builder.h @@ -38,8 +38,7 @@ class HGraphBuilder : public ValueObject { const DexCompilationUnit* dex_compilation_unit, const DexCompilationUnit* outer_compilation_unit, CodeGenerator* code_generator, - OptimizingCompilerStats* compiler_stats, - ArrayRef<const uint8_t> interpreter_metadata); + OptimizingCompilerStats* compiler_stats); // Only for unit testing. HGraphBuilder(HGraph* graph, @@ -69,7 +68,6 @@ class HGraphBuilder : public ValueObject { CodeGenerator* const code_generator_; OptimizingCompilerStats* const compilation_stats_; - const ArrayRef<const uint8_t> interpreter_metadata_; const DataType::Type return_type_; DISALLOW_COPY_AND_ASSIGN(HGraphBuilder); diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc index 7dcca75113..04dcdb6793 100644 --- a/compiler/optimizing/inliner.cc +++ b/compiler/optimizing/inliner.cc @@ -1983,8 +1983,7 @@ bool HInliner::TryBuildAndInlineHelper(HInvoke* invoke_instruction, &dex_compilation_unit, &outer_compilation_unit_, codegen_, - inline_stats_, - resolved_method->GetQuickenedInfo()); + inline_stats_); if (builder.BuildGraph() != kAnalysisSuccess) { LOG_FAIL(stats_, MethodCompilationStat::kNotInlinedCannotBuild) diff --git a/compiler/optimizing/instruction_builder.cc b/compiler/optimizing/instruction_builder.cc index 068d3a964b..146eb1d223 100644 --- a/compiler/optimizing/instruction_builder.cc +++ b/compiler/optimizing/instruction_builder.cc @@ -35,7 +35,6 @@ #include "mirror/dex_cache.h" #include "oat_file.h" #include "optimizing_compiler_stats.h" -#include "quicken_info.h" #include "reflective_handle_scope-inl.h" #include "scoped_thread_state_change-inl.h" #include "sharpening.h" @@ -91,7 +90,6 @@ HInstructionBuilder::HInstructionBuilder(HGraph* graph, const DexCompilationUnit* dex_compilation_unit, const DexCompilationUnit* outer_compilation_unit, CodeGenerator* code_generator, - ArrayRef<const uint8_t> interpreter_metadata, OptimizingCompilerStats* compiler_stats, ScopedArenaAllocator* local_allocator) : allocator_(graph->GetAllocator()), @@ -104,7 +102,6 @@ HInstructionBuilder::HInstructionBuilder(HGraph* graph, code_generator_(code_generator), dex_compilation_unit_(dex_compilation_unit), outer_compilation_unit_(outer_compilation_unit), - quicken_info_(interpreter_metadata), compilation_stats_(compiler_stats), local_allocator_(local_allocator), locals_for_(local_allocator->Adapter(kArenaAllocGraphBuilder)), @@ -396,11 +393,6 @@ bool HInstructionBuilder::Build() { DCHECK(!IsBlockPopulated(current_block_)); - uint32_t quicken_index = 0; - if (CanDecodeQuickenedInfo()) { - quicken_index = block_builder_->GetQuickenIndex(block_dex_pc); - } - for (const DexInstructionPcPair& pair : code_item_accessor_.InstructionsFrom(block_dex_pc)) { if (current_block_ == nullptr) { // The previous instruction ended this block. @@ -425,16 +417,12 @@ bool HInstructionBuilder::Build() { DCHECK(Thread::Current() == nullptr || !Thread::Current()->IsExceptionPending()) << dex_file_->PrettyMethod(dex_compilation_unit_->GetDexMethodIndex()) << " " << pair.Inst().Name() << "@" << dex_pc; - if (!ProcessDexInstruction(pair.Inst(), dex_pc, quicken_index)) { + if (!ProcessDexInstruction(pair.Inst(), dex_pc)) { return false; } DCHECK(Thread::Current() == nullptr || !Thread::Current()->IsExceptionPending()) << dex_file_->PrettyMethod(dex_compilation_unit_->GetDexMethodIndex()) << " " << pair.Inst().Name() << "@" << dex_pc; - - if (QuickenInfoTable::NeedsIndexForInstruction(&pair.Inst())) { - ++quicken_index; - } } if (current_block_ != nullptr) { @@ -852,9 +840,7 @@ static InvokeType GetInvokeTypeFromOpCode(Instruction::Code opcode) { case Instruction::INVOKE_DIRECT_RANGE: return kDirect; case Instruction::INVOKE_VIRTUAL: - case Instruction::INVOKE_VIRTUAL_QUICK: case Instruction::INVOKE_VIRTUAL_RANGE: - case Instruction::INVOKE_VIRTUAL_RANGE_QUICK: return kVirtual; case Instruction::INVOKE_INTERFACE: case Instruction::INVOKE_INTERFACE_RANGE: @@ -1947,21 +1933,10 @@ static DataType::Type GetFieldAccessType(const DexFile& dex_file, uint16_t field bool HInstructionBuilder::BuildInstanceFieldAccess(const Instruction& instruction, uint32_t dex_pc, - bool is_put, - size_t quicken_index) { + bool is_put) { uint32_t source_or_dest_reg = instruction.VRegA_22c(); uint32_t obj_reg = instruction.VRegB_22c(); - uint16_t field_index; - if (instruction.IsQuickened()) { - if (!CanDecodeQuickenedInfo()) { - VLOG(compiler) << "Not compiled: Could not decode quickened instruction " - << instruction.Opcode(); - return false; - } - field_index = LookupQuickenedInfo(quicken_index); - } else { - field_index = instruction.VRegC_22c(); - } + uint16_t field_index = instruction.VRegC_22c(); ScopedObjectAccess soa(Thread::Current()); ArtField* resolved_field = ResolveField(field_index, /* is_static= */ false, is_put); @@ -2615,18 +2590,7 @@ void HInstructionBuilder::BuildTypeCheck(const Instruction& instruction, } } -bool HInstructionBuilder::CanDecodeQuickenedInfo() const { - return !quicken_info_.IsNull(); -} - -uint16_t HInstructionBuilder::LookupQuickenedInfo(uint32_t quicken_index) { - DCHECK(CanDecodeQuickenedInfo()); - return quicken_info_.GetData(quicken_index); -} - -bool HInstructionBuilder::ProcessDexInstruction(const Instruction& instruction, - uint32_t dex_pc, - size_t quicken_index) { +bool HInstructionBuilder::ProcessDexInstruction(const Instruction& instruction, uint32_t dex_pc) { switch (instruction.Opcode()) { case Instruction::CONST_4: { int32_t register_index = instruction.VRegA(); @@ -2777,19 +2741,8 @@ bool HInstructionBuilder::ProcessDexInstruction(const Instruction& instruction, case Instruction::INVOKE_INTERFACE: case Instruction::INVOKE_STATIC: case Instruction::INVOKE_SUPER: - case Instruction::INVOKE_VIRTUAL: - case Instruction::INVOKE_VIRTUAL_QUICK: { - uint16_t method_idx; - if (instruction.Opcode() == Instruction::INVOKE_VIRTUAL_QUICK) { - if (!CanDecodeQuickenedInfo()) { - VLOG(compiler) << "Not compiled: Could not decode quickened instruction " - << instruction.Opcode(); - return false; - } - method_idx = LookupQuickenedInfo(quicken_index); - } else { - method_idx = instruction.VRegB_35c(); - } + case Instruction::INVOKE_VIRTUAL: { + uint16_t method_idx = instruction.VRegB_35c(); uint32_t args[5]; uint32_t number_of_vreg_arguments = instruction.GetVarArgs(args); VarArgsInstructionOperands operands(args, number_of_vreg_arguments); @@ -2803,19 +2756,8 @@ bool HInstructionBuilder::ProcessDexInstruction(const Instruction& instruction, case Instruction::INVOKE_INTERFACE_RANGE: case Instruction::INVOKE_STATIC_RANGE: case Instruction::INVOKE_SUPER_RANGE: - case Instruction::INVOKE_VIRTUAL_RANGE: - case Instruction::INVOKE_VIRTUAL_RANGE_QUICK: { - uint16_t method_idx; - if (instruction.Opcode() == Instruction::INVOKE_VIRTUAL_RANGE_QUICK) { - if (!CanDecodeQuickenedInfo()) { - VLOG(compiler) << "Not compiled: Could not decode quickened instruction " - << instruction.Opcode(); - return false; - } - method_idx = LookupQuickenedInfo(quicken_index); - } else { - method_idx = instruction.VRegB_3rc(); - } + case Instruction::INVOKE_VIRTUAL_RANGE: { + uint16_t method_idx = instruction.VRegB_3rc(); RangeInstructionOperands operands(instruction.VRegC(), instruction.VRegA_3rc()); if (!BuildInvoke(instruction, dex_pc, method_idx, operands)) { return false; @@ -3456,40 +3398,26 @@ bool HInstructionBuilder::ProcessDexInstruction(const Instruction& instruction, break; case Instruction::IGET: - case Instruction::IGET_QUICK: case Instruction::IGET_WIDE: - case Instruction::IGET_WIDE_QUICK: case Instruction::IGET_OBJECT: - case Instruction::IGET_OBJECT_QUICK: case Instruction::IGET_BOOLEAN: - case Instruction::IGET_BOOLEAN_QUICK: case Instruction::IGET_BYTE: - case Instruction::IGET_BYTE_QUICK: case Instruction::IGET_CHAR: - case Instruction::IGET_CHAR_QUICK: - case Instruction::IGET_SHORT: - case Instruction::IGET_SHORT_QUICK: { - if (!BuildInstanceFieldAccess(instruction, dex_pc, /* is_put= */ false, quicken_index)) { + case Instruction::IGET_SHORT: { + if (!BuildInstanceFieldAccess(instruction, dex_pc, /* is_put= */ false)) { return false; } break; } case Instruction::IPUT: - case Instruction::IPUT_QUICK: case Instruction::IPUT_WIDE: - case Instruction::IPUT_WIDE_QUICK: case Instruction::IPUT_OBJECT: - case Instruction::IPUT_OBJECT_QUICK: case Instruction::IPUT_BOOLEAN: - case Instruction::IPUT_BOOLEAN_QUICK: case Instruction::IPUT_BYTE: - case Instruction::IPUT_BYTE_QUICK: case Instruction::IPUT_CHAR: - case Instruction::IPUT_CHAR_QUICK: - case Instruction::IPUT_SHORT: - case Instruction::IPUT_SHORT_QUICK: { - if (!BuildInstanceFieldAccess(instruction, dex_pc, /* is_put= */ true, quicken_index)) { + case Instruction::IPUT_SHORT: { + if (!BuildInstanceFieldAccess(instruction, dex_pc, /* is_put= */ true)) { return false; } break; @@ -3632,6 +3560,22 @@ bool HInstructionBuilder::ProcessDexInstruction(const Instruction& instruction, break; } + case Instruction::IGET_QUICK: + case Instruction::IGET_BOOLEAN_QUICK: + case Instruction::IGET_BYTE_QUICK: + case Instruction::IGET_SHORT_QUICK: + case Instruction::IGET_CHAR_QUICK: + case Instruction::IGET_WIDE_QUICK: + case Instruction::IGET_OBJECT_QUICK: + case Instruction::IPUT_QUICK: + case Instruction::IPUT_BOOLEAN_QUICK: + case Instruction::IPUT_BYTE_QUICK: + case Instruction::IPUT_SHORT_QUICK: + case Instruction::IPUT_CHAR_QUICK: + case Instruction::IPUT_WIDE_QUICK: + case Instruction::IPUT_OBJECT_QUICK: + case Instruction::INVOKE_VIRTUAL_QUICK: + case Instruction::INVOKE_VIRTUAL_RANGE_QUICK: case Instruction::UNUSED_3E: case Instruction::UNUSED_3F: case Instruction::UNUSED_40: diff --git a/compiler/optimizing/instruction_builder.h b/compiler/optimizing/instruction_builder.h index 52d4bfcb1e..817fbaa9e8 100644 --- a/compiler/optimizing/instruction_builder.h +++ b/compiler/optimizing/instruction_builder.h @@ -26,7 +26,6 @@ #include "dex/dex_file_types.h" #include "handle.h" #include "nodes.h" -#include "quicken_info.h" namespace art { @@ -58,7 +57,6 @@ class HInstructionBuilder : public ValueObject { const DexCompilationUnit* dex_compilation_unit, const DexCompilationUnit* outer_compilation_unit, CodeGenerator* code_generator, - ArrayRef<const uint8_t> interpreter_metadata, OptimizingCompilerStats* compiler_stats, ScopedArenaAllocator* local_allocator); @@ -70,12 +68,9 @@ class HInstructionBuilder : public ValueObject { void PropagateLocalsToCatchBlocks(); void SetLoopHeaderPhiInputs(); - bool ProcessDexInstruction(const Instruction& instruction, uint32_t dex_pc, size_t quicken_index); + bool ProcessDexInstruction(const Instruction& instruction, uint32_t dex_pc); ArenaBitVector* FindNativeDebugInfoLocations(); - bool CanDecodeQuickenedInfo() const; - uint16_t LookupQuickenedInfo(uint32_t quicken_index); - HBasicBlock* FindBlockStartingAt(uint32_t dex_pc) const; ScopedArenaVector<HInstruction*>* GetLocalsFor(HBasicBlock* block); @@ -141,8 +136,7 @@ class HInstructionBuilder : public ValueObject { // Builds an instance field access node and returns whether the instruction is supported. bool BuildInstanceFieldAccess(const Instruction& instruction, uint32_t dex_pc, - bool is_put, - size_t quicken_index); + bool is_put); void BuildUnresolvedStaticFieldAccess(const Instruction& instruction, uint32_t dex_pc, @@ -325,9 +319,6 @@ class HInstructionBuilder : public ValueObject { // methods. const DexCompilationUnit* const outer_compilation_unit_; - // Original values kept after instruction quickening. - QuickenInfoTable quicken_info_; - OptimizingCompilerStats* const compilation_stats_; ScopedArenaAllocator* const local_allocator_; diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc index bf99a0e5ac..b6ab9fb1b5 100644 --- a/compiler/optimizing/optimizing_compiler.cc +++ b/compiler/optimizing/optimizing_compiler.cc @@ -784,7 +784,6 @@ CodeGenerator* OptimizingCompiler::TryCompile(ArenaAllocator* allocator, CodeItemDebugInfoAccessor code_item_accessor(dex_file, code_item, method_idx); bool dead_reference_safe; - ArrayRef<const uint8_t> interpreter_metadata; // For AOT compilation, we may not get a method, for example if its class is erroneous, // possibly due to an unavailable superclass. JIT should always have a method. DCHECK(Runtime::Current()->IsAotCompiler() || method != nullptr); @@ -793,7 +792,6 @@ CodeGenerator* OptimizingCompiler::TryCompile(ArenaAllocator* allocator, { ScopedObjectAccess soa(Thread::Current()); containing_class = &method->GetClassDef(); - interpreter_metadata = method->GetQuickenedInfo(); } // MethodContainsRSensitiveAccess is currently slow, but HasDeadReferenceSafeAnnotation() // is currently rarely true. @@ -845,8 +843,7 @@ CodeGenerator* OptimizingCompiler::TryCompile(ArenaAllocator* allocator, &dex_compilation_unit, &dex_compilation_unit, codegen.get(), - compilation_stats_.get(), - interpreter_metadata); + compilation_stats_.get()); GraphAnalysisResult result = builder.BuildGraph(); if (result != kAnalysisSuccess) { switch (result) { @@ -970,8 +967,7 @@ CodeGenerator* OptimizingCompiler::TryCompileIntrinsic( &dex_compilation_unit, &dex_compilation_unit, codegen.get(), - compilation_stats_.get(), - /* interpreter_metadata= */ ArrayRef<const uint8_t>()); + compilation_stats_.get()); builder.BuildIntrinsicGraph(method); } diff --git a/runtime/art_method.cc b/runtime/art_method.cc index bfcb45535d..a2db0f00ad 100644 --- a/runtime/art_method.cc +++ b/runtime/art_method.cc @@ -532,33 +532,6 @@ bool ArtMethod::EqualParameters(Handle<mirror::ObjectArray<mirror::Class>> param return true; } -ArrayRef<const uint8_t> ArtMethod::GetQuickenedInfo() { - const DexFile& dex_file = *GetDexFile(); - const OatDexFile* oat_dex_file = dex_file.GetOatDexFile(); - if (oat_dex_file == nullptr) { - return ArrayRef<const uint8_t>(); - } - return oat_dex_file->GetQuickenedInfoOf(dex_file, GetDexMethodIndex()); -} - -uint16_t ArtMethod::GetIndexFromQuickening(uint32_t dex_pc) { - ArrayRef<const uint8_t> data = GetQuickenedInfo(); - if (data.empty()) { - return DexFile::kDexNoIndex16; - } - QuickenInfoTable table(data); - uint32_t quicken_index = 0; - for (const DexInstructionPcPair& pair : DexInstructions()) { - if (pair.DexPc() == dex_pc) { - return table.GetData(quicken_index); - } - if (QuickenInfoTable::NeedsIndexForInstruction(&pair.Inst())) { - ++quicken_index; - } - } - return DexFile::kDexNoIndex16; -} - const OatQuickMethodHeader* ArtMethod::GetOatQuickMethodHeader(uintptr_t pc) { // Our callers should make sure they don't pass the instrumentation exit pc, // as this method does not look at the side instrumentation stack. diff --git a/runtime/art_method.h b/runtime/art_method.h index 8b85d94c4a..b2c211f7cf 100644 --- a/runtime/art_method.h +++ b/runtime/art_method.h @@ -708,9 +708,6 @@ class ArtMethod final { return MemberOffset(OFFSETOF_MEMBER(ArtMethod, hotness_count_)); } - ArrayRef<const uint8_t> GetQuickenedInfo() REQUIRES_SHARED(Locks::mutator_lock_); - uint16_t GetIndexFromQuickening(uint32_t dex_pc) REQUIRES_SHARED(Locks::mutator_lock_); - // Returns the method header for the compiled code containing 'pc'. Note that runtime // methods will return null for this method, as they are not oat based. const OatQuickMethodHeader* GetOatQuickMethodHeader(uintptr_t pc) diff --git a/runtime/common_throws.cc b/runtime/common_throws.cc index 5a7944c0fe..1f5c58c49e 100644 --- a/runtime/common_throws.cc +++ b/runtime/common_throws.cc @@ -476,9 +476,7 @@ static bool IsValidImplicitCheck(uintptr_t addr, const Instruction& instr) case Instruction::INVOKE_POLYMORPHIC: case Instruction::INVOKE_POLYMORPHIC_RANGE: case Instruction::INVOKE_SUPER: - case Instruction::INVOKE_SUPER_RANGE: - case Instruction::INVOKE_VIRTUAL_QUICK: - case Instruction::INVOKE_VIRTUAL_RANGE_QUICK: { + case Instruction::INVOKE_SUPER_RANGE: { // Without inlining, we could just check that the offset is the class offset. // However, when inlining, the compiler can (validly) merge the null check with a field access // on the same object. Note that the stack map at the NPE will reflect the invoke's location, @@ -510,30 +508,6 @@ static bool IsValidImplicitCheck(uintptr_t addr, const Instruction& instr) return true; } - case Instruction::IGET_OBJECT_QUICK: - if (kEmitCompilerReadBarrier && IsValidReadBarrierImplicitCheck(addr)) { - return true; - } - FALLTHROUGH_INTENDED; - case Instruction::IGET_QUICK: - case Instruction::IGET_BOOLEAN_QUICK: - case Instruction::IGET_BYTE_QUICK: - case Instruction::IGET_CHAR_QUICK: - case Instruction::IGET_SHORT_QUICK: - case Instruction::IGET_WIDE_QUICK: - case Instruction::IPUT_QUICK: - case Instruction::IPUT_BOOLEAN_QUICK: - case Instruction::IPUT_BYTE_QUICK: - case Instruction::IPUT_CHAR_QUICK: - case Instruction::IPUT_SHORT_QUICK: - case Instruction::IPUT_WIDE_QUICK: - case Instruction::IPUT_OBJECT_QUICK: { - // We might be doing an implicit null check with an offset that doesn't correspond - // to the instruction, for example with two field accesses and the first one being - // eliminated or re-ordered. - return true; - } - case Instruction::AGET_OBJECT: if (kEmitCompilerReadBarrier && IsValidReadBarrierImplicitCheck(addr)) { return true; @@ -616,18 +590,6 @@ void ThrowNullPointerExceptionFromDexPC(bool check_address, uintptr_t addr) { case Instruction::INVOKE_POLYMORPHIC_RANGE: ThrowNullPointerExceptionForMethodAccess(instr.VRegB_4rcc(), kVirtual); break; - case Instruction::INVOKE_VIRTUAL_QUICK: - case Instruction::INVOKE_VIRTUAL_RANGE_QUICK: { - uint16_t method_idx = method->GetIndexFromQuickening(throw_dex_pc); - if (method_idx != DexFile::kDexNoIndex16) { - // NPE with precise message. - ThrowNullPointerExceptionForMethodAccess(method_idx, kVirtual); - } else { - // NPE with imprecise message. - ThrowNullPointerException("Attempt to invoke a virtual method on a null object reference"); - } - break; - } case Instruction::IGET: case Instruction::IGET_WIDE: case Instruction::IGET_OBJECT: @@ -641,22 +603,6 @@ void ThrowNullPointerExceptionFromDexPC(bool check_address, uintptr_t addr) { ThrowNullPointerExceptionForFieldAccess(field, /* is_read= */ true); break; } - case Instruction::IGET_QUICK: - case Instruction::IGET_BOOLEAN_QUICK: - case Instruction::IGET_BYTE_QUICK: - case Instruction::IGET_CHAR_QUICK: - case Instruction::IGET_SHORT_QUICK: - case Instruction::IGET_WIDE_QUICK: - case Instruction::IGET_OBJECT_QUICK: { - uint16_t field_idx = method->GetIndexFromQuickening(throw_dex_pc); - ArtField* field = nullptr; - CHECK_NE(field_idx, DexFile::kDexNoIndex16); - field = Runtime::Current()->GetClassLinker()->ResolveField( - field_idx, method, /* is_static= */ false); - Thread::Current()->ClearException(); // Resolution may fail, ignore. - ThrowNullPointerExceptionForFieldAccess(field, /* is_read= */ true); - break; - } case Instruction::IPUT: case Instruction::IPUT_WIDE: case Instruction::IPUT_OBJECT: @@ -670,22 +616,6 @@ void ThrowNullPointerExceptionFromDexPC(bool check_address, uintptr_t addr) { ThrowNullPointerExceptionForFieldAccess(field, /* is_read= */ false); break; } - case Instruction::IPUT_QUICK: - case Instruction::IPUT_BOOLEAN_QUICK: - case Instruction::IPUT_BYTE_QUICK: - case Instruction::IPUT_CHAR_QUICK: - case Instruction::IPUT_SHORT_QUICK: - case Instruction::IPUT_WIDE_QUICK: - case Instruction::IPUT_OBJECT_QUICK: { - uint16_t field_idx = method->GetIndexFromQuickening(throw_dex_pc); - ArtField* field = nullptr; - CHECK_NE(field_idx, DexFile::kDexNoIndex16); - field = Runtime::Current()->GetClassLinker()->ResolveField( - field_idx, method, /* is_static= */ false); - Thread::Current()->ClearException(); // Resolution may fail, ignore. - ThrowNullPointerExceptionForFieldAccess(field, /* is_read= */ false); - break; - } case Instruction::AGET: case Instruction::AGET_WIDE: case Instruction::AGET_OBJECT: diff --git a/runtime/dex/dex_file_annotations.cc b/runtime/dex/dex_file_annotations.cc index c149aeadf4..bae86deda4 100644 --- a/runtime/dex/dex_file_annotations.cc +++ b/runtime/dex/dex_file_annotations.cc @@ -1349,50 +1349,24 @@ bool MethodContainsRSensitiveAccess(const DexFile& dex_file, if (!accessor.HasCodeItem()) { return false; } - ArrayRef<const uint8_t> quicken_data; - const OatDexFile* oat_dex_file = dex_file.GetOatDexFile(); - if (oat_dex_file != nullptr) { - quicken_data = oat_dex_file->GetQuickenedInfoOf(dex_file, method_index); - } - const QuickenInfoTable quicken_info(quicken_data); - uint32_t quicken_index = 0; for (DexInstructionIterator iter = accessor.begin(); iter != accessor.end(); ++iter) { switch (iter->Opcode()) { case Instruction::IGET: - case Instruction::IGET_QUICK: case Instruction::IGET_WIDE: - case Instruction::IGET_WIDE_QUICK: case Instruction::IGET_OBJECT: - case Instruction::IGET_OBJECT_QUICK: case Instruction::IGET_BOOLEAN: - case Instruction::IGET_BOOLEAN_QUICK: case Instruction::IGET_BYTE: - case Instruction::IGET_BYTE_QUICK: case Instruction::IGET_CHAR: - case Instruction::IGET_CHAR_QUICK: case Instruction::IGET_SHORT: - case Instruction::IGET_SHORT_QUICK: case Instruction::IPUT: - case Instruction::IPUT_QUICK: case Instruction::IPUT_WIDE: - case Instruction::IPUT_WIDE_QUICK: case Instruction::IPUT_OBJECT: - case Instruction::IPUT_OBJECT_QUICK: case Instruction::IPUT_BOOLEAN: - case Instruction::IPUT_BOOLEAN_QUICK: case Instruction::IPUT_BYTE: - case Instruction::IPUT_BYTE_QUICK: case Instruction::IPUT_CHAR: - case Instruction::IPUT_CHAR_QUICK: case Instruction::IPUT_SHORT: - case Instruction::IPUT_SHORT_QUICK: { - uint32_t field_index; - if (iter->IsQuickened()) { - field_index = quicken_info.GetData(quicken_index); - } else { - field_index = iter->VRegC_22c(); - } + uint32_t field_index = iter->VRegC_22c(); DCHECK(field_index < dex_file.NumFieldIds()); // We only guarantee to pay attention to the annotation if it's in the same class, // or a containing class, but it's OK to do so in other cases. @@ -1434,15 +1408,6 @@ bool MethodContainsRSensitiveAccess(const DexFile& dex_file, } } break; - case Instruction::INVOKE_VIRTUAL_QUICK: - case Instruction::INVOKE_VIRTUAL_RANGE_QUICK: - { - uint32_t called_method_index = quicken_info.GetData(quicken_index); - if (MethodIsReachabilitySensitive(dex_file, called_method_index)) { - return true; - } - } - break; // We explicitly do not handle indirect ReachabilitySensitive accesses through VarHandles, // etc. Thus we ignore INVOKE_CUSTOM / INVOKE_CUSTOM_RANGE / INVOKE_POLYMORPHIC / // INVOKE_POLYMORPHIC_RANGE. @@ -1454,9 +1419,6 @@ bool MethodContainsRSensitiveAccess(const DexFile& dex_file, // fields, but they can be safely ignored. break; } - if (QuickenInfoTable::NeedsIndexForInstruction(&iter.Inst())) { - ++quicken_index; - } } return false; } diff --git a/runtime/instrumentation.cc b/runtime/instrumentation.cc index 42baf2a5d1..5170a37174 100644 --- a/runtime/instrumentation.cc +++ b/runtime/instrumentation.cc @@ -1434,24 +1434,7 @@ static char GetRuntimeMethodShorty(Thread* thread) REQUIRES_SHARED(Locks::mutato } else { const Instruction& instr = m->DexInstructions().InstructionAt(stack_visitor->GetDexPc()); if (instr.IsInvoke()) { - auto get_method_index_fn = [](ArtMethod* caller, - const Instruction& inst, - uint32_t dex_pc) - REQUIRES_SHARED(Locks::mutator_lock_) { - switch (inst.Opcode()) { - case Instruction::INVOKE_VIRTUAL_RANGE_QUICK: - case Instruction::INVOKE_VIRTUAL_QUICK: { - uint16_t method_idx = caller->GetIndexFromQuickening(dex_pc); - CHECK_NE(method_idx, DexFile::kDexNoIndex16); - return method_idx; - } - default: { - return static_cast<uint16_t>(inst.VRegB()); - } - } - }; - - uint16_t method_index = get_method_index_fn(m, instr, stack_visitor->GetDexPc()); + uint16_t method_index = static_cast<uint16_t>(instr.VRegB()); const DexFile* dex_file = m->GetDexFile(); if (interpreter::IsStringInit(dex_file, method_index)) { // Invoking string init constructor is turned into invoking diff --git a/runtime/oat_file.cc b/runtime/oat_file.cc index 781818fc7e..dc311c8b4f 100644 --- a/runtime/oat_file.cc +++ b/runtime/oat_file.cc @@ -2085,16 +2085,6 @@ OatFile::OatClass OatDexFile::GetOatClass(uint16_t class_def_index) const { reinterpret_cast<const OatMethodOffsets*>(methods_pointer)); } -ArrayRef<const uint8_t> OatDexFile::GetQuickenedInfoOf(const DexFile& dex_file, - uint32_t dex_method_idx) const { - const OatFile* oat_file = GetOatFile(); - if (oat_file == nullptr) { - return ArrayRef<const uint8_t>(); - } else { - return oat_file->GetVdexFile()->GetQuickenedInfoOf(dex_file, dex_method_idx); - } -} - const dex::ClassDef* OatDexFile::FindClassDef(const DexFile& dex_file, const char* descriptor, size_t hash) { diff --git a/runtime/oat_file.h b/runtime/oat_file.h index 7a0dce52d8..bcb4d52821 100644 --- a/runtime/oat_file.h +++ b/runtime/oat_file.h @@ -547,9 +547,6 @@ class OatDexFile final { return dex_file_pointer_; } - ArrayRef<const uint8_t> GetQuickenedInfoOf(const DexFile& dex_file, - uint32_t dex_method_idx) const; - // Looks up a class definition by its class descriptor. Hash must be // ComputeModifiedUtf8Hash(descriptor). static const dex::ClassDef* FindClassDef(const DexFile& dex_file, diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc index 59e9fbafe3..f7d0f28f75 100644 --- a/runtime/verifier/method_verifier.cc +++ b/runtime/verifier/method_verifier.cc @@ -734,32 +734,13 @@ class MethodVerifier final : public ::art::verifier::MethodVerifier { // Returns the method index of an invoke instruction. uint16_t GetMethodIdxOfInvoke(const Instruction* inst) REQUIRES_SHARED(Locks::mutator_lock_) { - switch (inst->Opcode()) { - case Instruction::INVOKE_VIRTUAL_RANGE_QUICK: - case Instruction::INVOKE_VIRTUAL_QUICK: { - DCHECK(Runtime::Current()->IsStarted() || verify_to_dump_) - << dex_file_->PrettyMethod(dex_method_idx_, true) << "@" << work_insn_idx_; - DCHECK(method_being_verified_ != nullptr); - uint16_t method_idx = method_being_verified_->GetIndexFromQuickening(work_insn_idx_); - CHECK_NE(method_idx, DexFile::kDexNoIndex16); - return method_idx; - } - default: { - return inst->VRegB(); - } - } + return inst->VRegB(); } // Returns the field index of a field access instruction. uint16_t GetFieldIdxOfFieldAccess(const Instruction* inst, bool is_static) REQUIRES_SHARED(Locks::mutator_lock_) { if (is_static) { return inst->VRegB_21c(); - } else if (inst->IsQuickened()) { - DCHECK(Runtime::Current()->IsStarted() || verify_to_dump_); - DCHECK(method_being_verified_ != nullptr); - uint16_t field_idx = method_being_verified_->GetIndexFromQuickening(work_insn_idx_); - CHECK_NE(field_idx, DexFile::kDexNoIndex16); - return field_idx; } else { return inst->VRegC_22c(); } |