From a4ff25fe6672bcdaca2db6bad33c10a533492b25 Mon Sep 17 00:00:00 2001 From: Alexander Markov Date: Fri, 15 Nov 2024 17:33:11 +0000 Subject: [PATCH] [vm] Cleanup conversion of deopt info to catch entry moves Follow-up to https://dart-review.googlesource.com/c/sdk/+/395344. TEST=ci Change-Id: Ic1b23a83f053ee57c3c2432b562dc7db4546aee7 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/395581 Commit-Queue: Alexander Aprelev Reviewed-by: Alexander Aprelev Auto-Submit: Alexander Markov --- runtime/vm/deopt_instructions.cc | 59 -------------------------------- runtime/vm/deopt_instructions.h | 11 ------ 2 files changed, 70 deletions(-) diff --git a/runtime/vm/deopt_instructions.cc b/runtime/vm/deopt_instructions.cc index 89065bf3c5c..43453e4dbc1 100644 --- a/runtime/vm/deopt_instructions.cc +++ b/runtime/vm/deopt_instructions.cc @@ -314,32 +314,6 @@ void DeoptContext::FillDestFrame() { } } -const CatchEntryMoves* DeoptContext::ToCatchEntryMoves(intptr_t num_vars) { - const Code& code = Code::Handle(code_); - const TypedData& deopt_info = TypedData::Handle(deopt_info_); - GrowableArray deopt_instructions; - const Array& deopt_table = Array::Handle(code.deopt_info_array()); - ASSERT(!deopt_table.IsNull()); - DeoptInfo::Unpack(deopt_table, deopt_info, &deopt_instructions); - - CatchEntryMoves* moves = CatchEntryMoves::Allocate(num_vars); - - Function& function = Function::Handle(zone(), code.function()); - intptr_t params = - function.MakesCopyOfParameters() ? 0 : function.num_fixed_parameters(); - for (intptr_t i = 0; i < num_vars; i++) { - const intptr_t len = deopt_instructions.length(); - intptr_t slot = i < params ? i - : i + kParamEndSlotFromFp - - runtime_frame_layout.first_local_from_fp; - DeoptInstr* instr = deopt_instructions[len - 1 - slot]; - intptr_t dest_index = i - params; - moves->At(i) = instr->ToCatchEntryMove(this, dest_index); - } - - return moves; -} - static void FillDeferredSlots(DeoptContext* deopt_context, DeferredSlot** slot_list) { DeferredSlot* slot = *slot_list; @@ -477,11 +451,6 @@ class DeoptConstantInstr : public DeoptInstr { *reinterpret_cast(dest_addr) = obj.ptr(); } - CatchEntryMove ToCatchEntryMove(DeoptContext* deopt_context, - intptr_t dest_slot) { - return CatchEntryMove::FromConstant(object_table_index_, dest_slot); - } - private: const intptr_t object_table_index_; @@ -509,13 +478,6 @@ class DeoptWordInstr : public DeoptInstr { *dest_addr = source_.Value(deopt_context); } - CatchEntryMove ToCatchEntryMove(DeoptContext* deopt_context, - intptr_t dest_slot) { - return CatchEntryMove::FromSlot(CatchEntryMove::SourceKind::kTaggedSlot, - source_.StackSlot(deopt_context), - dest_slot); - } - private: const CpuRegisterSource source_; @@ -569,15 +531,6 @@ class DeoptMintPairInstr : public DeoptIntegerInstrBase { hi_.Value(deopt_context)); } - CatchEntryMove ToCatchEntryMove(DeoptContext* deopt_context, - intptr_t dest_slot) { - return CatchEntryMove::FromSlot( - CatchEntryMove::SourceKind::kInt64PairSlot, - CatchEntryMove::EncodePairSource(lo_.StackSlot(deopt_context), - hi_.StackSlot(deopt_context)), - dest_slot); - } - private: static constexpr intptr_t kFieldWidth = kBitsPerWord / 2; using LoRegister = BitField; @@ -608,12 +561,6 @@ class DeoptIntInstr : public DeoptIntegerInstrBase { return static_cast(source_.Value(deopt_context)); } - CatchEntryMove ToCatchEntryMove(DeoptContext* deopt_context, - intptr_t dest_slot) { - return CatchEntryMove::FromSlot(slot_kind, source_.StackSlot(deopt_context), - dest_slot); - } - private: const CpuRegisterSource source_; @@ -654,12 +601,6 @@ class DeoptFpuInstr : public DeoptInstr { reinterpret_cast(dest_addr)); } - CatchEntryMove ToCatchEntryMove(DeoptContext* deopt_context, - intptr_t dest_slot) { - return CatchEntryMove::FromSlot(slot_kind, source_.StackSlot(deopt_context), - dest_slot); - } - private: const FpuRegisterSource source_; diff --git a/runtime/vm/deopt_instructions.h b/runtime/vm/deopt_instructions.h index 5365a44ab63..ecbc1b4be2e 100644 --- a/runtime/vm/deopt_instructions.h +++ b/runtime/vm/deopt_instructions.h @@ -147,11 +147,6 @@ class DeoptContext : public MallocAllocated { // objects. void FillDestFrame(); - // Convert deoptimization instructions to a list of moves that need - // to be executed when entering catch entry block from this deoptimization - // point. - const CatchEntryMoves* ToCatchEntryMoves(intptr_t num_vars); - // Materializes all deferred objects. Returns the total number of // artificial arguments used during deoptimization. intptr_t MaterializeDeferredObjects(); @@ -317,12 +312,6 @@ class DeoptInstr : public ZoneAllocated { virtual void Execute(DeoptContext* deopt_context, intptr_t* dest_addr) = 0; - virtual CatchEntryMove ToCatchEntryMove(DeoptContext* deopt_context, - intptr_t dest_slot) { - UNREACHABLE(); - return CatchEntryMove(); - } - virtual DeoptInstr::Kind kind() const = 0; bool Equals(const DeoptInstr& other) const {