diff options
author | 2025-02-04 10:26:33 +0000 | |
---|---|---|
committer | 2025-02-07 07:06:12 -0800 | |
commit | 08f1b58976bae5514a0d6877b4e8f68ff15bcafb (patch) | |
tree | cda31472d1a3367f730fa77a06c876c35a2ce250 | |
parent | 95cebecfa36d6275ae078b649aae3d6ed7622716 (diff) |
Remove cdex support from `ArtMethod`...
... and a few other places in `runtime/`.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Bug: 325430813
Change-Id: Ied837bffed78b1fe4c4d381772b8c1933b76f6c0
-rw-r--r-- | libdexfile/dex/code_item_accessors.h | 5 | ||||
-rw-r--r-- | openjdkjvmti/ti_redefine.cc | 3 | ||||
-rw-r--r-- | runtime/art_method.cc | 9 | ||||
-rw-r--r-- | runtime/art_method.h | 9 | ||||
-rw-r--r-- | runtime/class_linker.cc | 12 | ||||
-rw-r--r-- | runtime/jit/debugger_interface.cc | 6 | ||||
-rw-r--r-- | runtime/nterp_helpers.cc | 3 |
7 files changed, 15 insertions, 32 deletions
diff --git a/libdexfile/dex/code_item_accessors.h b/libdexfile/dex/code_item_accessors.h index 5952b2d7ea..bfdf30b066 100644 --- a/libdexfile/dex/code_item_accessors.h +++ b/libdexfile/dex/code_item_accessors.h @@ -30,7 +30,6 @@ struct CodeItem; struct TryItem; } // namespace dex -class ArtMethod; class DexFile; class DexInstructionIterator; template <typename Iter> @@ -43,8 +42,6 @@ class CodeItemInstructionAccessor { ALWAYS_INLINE CodeItemInstructionAccessor(const DexFile& dex_file, const dex::CodeItem* code_item); - ALWAYS_INLINE explicit CodeItemInstructionAccessor(ArtMethod* method); - ALWAYS_INLINE DexInstructionIterator begin() const; ALWAYS_INLINE DexInstructionIterator end() const; @@ -155,8 +152,6 @@ class CodeItemDebugInfoAccessor : public CodeItemDataAccessor { const dex::CodeItem* code_item, uint32_t dex_method_index); - ALWAYS_INLINE explicit CodeItemDebugInfoAccessor(ArtMethod* method); - uint32_t DebugInfoOffset() const { return debug_info_offset_; } diff --git a/openjdkjvmti/ti_redefine.cc b/openjdkjvmti/ti_redefine.cc index d2e022fd14..db9ad2417b 100644 --- a/openjdkjvmti/ti_redefine.cc +++ b/openjdkjvmti/ti_redefine.cc @@ -2576,8 +2576,7 @@ void Redefiner::ClassRedefinition::UpdateMethods(art::ObjPtr<art::mirror::Class> driver_->runtime_->GetInstrumentation()->InitializeMethodsCode(&method, /*aot_code=*/ nullptr); if (method.HasCodeItem()) { method.SetCodeItem( - dex_file_->GetCodeItem(dex_file_->FindCodeItemOffset(class_def, dex_method_idx)), - dex_file_->IsCompactDexFile()); + dex_file_->GetCodeItem(dex_file_->FindCodeItemOffset(class_def, dex_method_idx))); } // Clear all the intrinsics related flags. method.SetNotIntrinsic(); diff --git a/runtime/art_method.cc b/runtime/art_method.cc index a03df5cc2f..759dd958a6 100644 --- a/runtime/art_method.cc +++ b/runtime/art_method.cc @@ -912,15 +912,6 @@ const char* ArtMethod::GetRuntimeMethodName() { } } -void ArtMethod::SetCodeItem(const dex::CodeItem* code_item, bool is_compact_dex_code_item) { - DCHECK(HasCodeItem()); - // We mark the lowest bit for the interpreter to know whether it's executing a - // method in a compact or standard dex file. - uintptr_t data = - reinterpret_cast<uintptr_t>(code_item) | (is_compact_dex_code_item ? 1 : 0); - SetDataPtrSize(reinterpret_cast<void*>(data), kRuntimePointerSize); -} - // AssertSharedHeld doesn't work in GetAccessFlags, so use a NO_THREAD_SAFETY_ANALYSIS helper. // TODO: Figure out why ASSERT_SHARED_CAPABILITY doesn't work. template <ReadBarrierOption kReadBarrierOption> diff --git a/runtime/art_method.h b/runtime/art_method.h index 186ff7e45e..f826a594ca 100644 --- a/runtime/art_method.h +++ b/runtime/art_method.h @@ -914,10 +914,11 @@ class EXPORT ArtMethod final { !IsProxyMethod(); } - // We need to explicitly indicate whether the code item is obtained from the compact dex file, - // because in JVMTI, we obtain the code item from the standard dex file to update the method. - void SetCodeItem(const dex::CodeItem* code_item, bool is_compact_dex_code_item) - REQUIRES_SHARED(Locks::mutator_lock_); + void SetCodeItem(const dex::CodeItem* code_item) + REQUIRES_SHARED(Locks::mutator_lock_) { + DCHECK(HasCodeItem()); + SetDataPtrSize(code_item, kRuntimePointerSize); + } // Is this a hand crafted method used for something like describing callee saves? bool IsCalleeSaveMethod() REQUIRES_SHARED(Locks::mutator_lock_); diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc index 57eb72dea5..c2c2e2c928 100644 --- a/runtime/class_linker.cc +++ b/runtime/class_linker.cc @@ -2278,6 +2278,10 @@ bool ClassLinker::AddImageSpace(gc::space::ImageSpace* space, }, space->Begin(), image_pointer_size_); } + for (auto dex_cache : dex_caches.Iterate<mirror::DexCache>()) { + CHECK(!dex_cache->GetDexFile()->IsCompactDexFile()); + } + ScopedTrace trace("AppImage:UpdateCodeItemAndNterp"); bool can_use_nterp = interpreter::CanRuntimeUseNterp(); uint16_t hotness_threshold = runtime->GetJITOptions()->GetWarmupThreshold(); @@ -2287,7 +2291,7 @@ bool ClassLinker::AddImageSpace(gc::space::ImageSpace* space, if (method.HasCodeItem()) { const dex::CodeItem* code_item = method.GetDexFile()->GetCodeItem( reinterpret_cast32<uint32_t>(method.GetDataPtrSize(image_pointer_size_))); - method.SetCodeItem(code_item, method.GetDexFile()->IsCompactDexFile()); + method.SetCodeItem(code_item); // The hotness counter may have changed since we compiled the image, so // reset it with the runtime value. method.ResetCounter(hotness_threshold); @@ -4025,7 +4029,7 @@ void ClassLinker::LoadMethod(const DexFile& dex_file, if (Runtime::Current()->IsAotCompiler()) { dst->SetDataPtrSize(reinterpret_cast32<void*>(code_item_offset), image_pointer_size_); } else { - dst->SetCodeItem(dex_file.GetCodeItem(code_item_offset), dex_file.IsCompactDexFile()); + dst->SetCodeItem(dex_file.GetCodeItem(code_item_offset)); } } @@ -4081,6 +4085,7 @@ void ClassLinker::LoadClass(Thread* self, const DexFile& dex_file, const dex::ClassDef& dex_class_def, Handle<mirror::Class> klass) { + CHECK(!dex_file.IsCompactDexFile()); ClassAccessor accessor(dex_file, dex_class_def, /* parse_hiddenapi_class_data= */ klass->IsBootStrapClassLoaded()); @@ -5200,8 +5205,7 @@ void ClassLinker::ResolveMethodExceptionHandlerTypes(ArtMethod* method) { CHECK(method->GetDexFile()->IsInDataSection(handlers_ptr)) << method->PrettyMethod() << "@" << method->GetDexFile()->GetLocation() - << "@" << reinterpret_cast<const void*>(handlers_ptr) - << " is_compact_dex=" << method->GetDexFile()->IsCompactDexFile(); + << "@" << reinterpret_cast<const void*>(handlers_ptr); uint32_t handlers_size = DecodeUnsignedLeb128(&handlers_ptr); for (uint32_t idx = 0; idx < handlers_size; idx++) { diff --git a/runtime/jit/debugger_interface.cc b/runtime/jit/debugger_interface.cc index d367bbf5cd..674e1e1b23 100644 --- a/runtime/jit/debugger_interface.cc +++ b/runtime/jit/debugger_interface.cc @@ -428,11 +428,7 @@ void AddNativeDebugInfoForDex(Thread* self, const DexFile* dexfile) { DCHECK(dexfile != nullptr); // Container dex files (v41) may store data past the size defined in the header. uint32_t size = dexfile->SizeIncludingSharedData(); - if (dexfile->IsCompactDexFile()) { - // Compact dex files may store data past the size defined in the header. - const DexFile::Header& header = dexfile->GetHeader(); - size = std::max(size, header.data_off_ + header.data_size_); - } + CHECK(!dexfile->IsCompactDexFile()); const ArrayRef<const uint8_t> symfile(dexfile->Begin(), size); CreateJITCodeEntryInternal<DexNativeInfo>(symfile); } diff --git a/runtime/nterp_helpers.cc b/runtime/nterp_helpers.cc index 0a306e2f56..90edb54b3f 100644 --- a/runtime/nterp_helpers.cc +++ b/runtime/nterp_helpers.cc @@ -236,9 +236,6 @@ bool CanMethodUseNterp(ArtMethod* method, InstructionSet isa) { method->IsProxyMethod()) { return false; } - if (isa == InstructionSet::kRiscv64 && method->GetDexFile()->IsCompactDexFile()) { - return false; // Riscv64 nterp does not support compact dex yet. - } // There is no need to add the alignment padding size for comparison with aligned limit. size_t frame_size_without_padding = NterpGetFrameSizeWithoutPadding(method, isa); DCHECK_EQ(NterpGetFrameSize(method, isa), RoundUp(frame_size_without_padding, kStackAlignment)); |