diff --git a/runtime/vm/compiler/backend/block_builder.h b/runtime/vm/compiler/backend/block_builder.h index 45662802886..498962a6248 100644 --- a/runtime/vm/compiler/backend/block_builder.h +++ b/runtime/vm/compiler/backend/block_builder.h @@ -63,7 +63,7 @@ class BlockBuilder : public ValueObject { const auto representation = FlowGraph::ReturnRepresentationOf(function); ReturnInstr* instr = new ReturnInstr( Source(), value, CompilerState::Current().GetNextDeoptId(), - UntaggedPcDescriptors::kInvalidYieldIndex, representation); + representation); AddInstruction(instr); entry_->set_last_instruction(instr); return instr; diff --git a/runtime/vm/compiler/backend/il.h b/runtime/vm/compiler/backend/il.h index fbd27313161..7418e07120b 100644 --- a/runtime/vm/compiler/backend/il.h +++ b/runtime/vm/compiler/backend/il.h @@ -3197,16 +3197,12 @@ inline Definition* Instruction::ArgumentAt(intptr_t index) const { class ReturnInstr : public TemplateInstruction<1, NoThrow> { public: - // The [yield_index], if provided, will cause the instruction to emit extra - // yield_index -> pc offset into the [PcDescriptors]. ReturnInstr(const InstructionSource& source, Value* value, intptr_t deopt_id, - intptr_t yield_index = UntaggedPcDescriptors::kInvalidYieldIndex, Representation representation = kTagged) : TemplateInstruction(source, deopt_id), token_pos_(source.token_pos), - yield_index_(yield_index), representation_(representation) { SetInputAt(0, value); } @@ -3215,7 +3211,6 @@ class ReturnInstr : public TemplateInstruction<1, NoThrow> { virtual TokenPosition token_pos() const { return token_pos_; } Value* value() const { return inputs_[0]; } - intptr_t yield_index() const { return yield_index_; } virtual bool CanBecomeDeoptimizationTarget() const { // Return instruction might turn into a Goto instruction after inlining. @@ -3229,8 +3224,7 @@ class ReturnInstr : public TemplateInstruction<1, NoThrow> { virtual bool AttributesEqual(const Instruction& other) const { auto const other_return = other.AsReturn(); - return token_pos() == other_return->token_pos() && - yield_index() == other_return->yield_index(); + return token_pos() == other_return->token_pos(); } virtual SpeculativeMode SpeculativeModeOfInput(intptr_t index) const { @@ -3247,11 +3241,8 @@ class ReturnInstr : public TemplateInstruction<1, NoThrow> { return representation_; } - PRINT_OPERANDS_TO_SUPPORT - #define FIELD_LIST(F) \ F(const TokenPosition, token_pos_) \ - F(const intptr_t, yield_index_) \ F(const Representation, representation_) DECLARE_INSTRUCTION_SERIALIZABLE_FIELDS(ReturnInstr, diff --git a/runtime/vm/compiler/backend/il_arm.cc b/runtime/vm/compiler/backend/il_arm.cc index 4fe75bfc2e6..c5ec9796d4c 100644 --- a/runtime/vm/compiler/backend/il_arm.cc +++ b/runtime/vm/compiler/backend/il_arm.cc @@ -513,9 +513,6 @@ void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&stack_ok); #endif ASSERT(__ constant_pool_allowed()); - if (yield_index() != UntaggedPcDescriptors::kInvalidYieldIndex) { - compiler->EmitYieldPositionMetadata(source(), yield_index()); - } __ LeaveDartFrameAndReturn(); // Disallows constant pool use. // This ReturnInstr may be emitted out of order by the optimizer. The next // block may be a target expecting a properly set constant pool pointer. diff --git a/runtime/vm/compiler/backend/il_arm64.cc b/runtime/vm/compiler/backend/il_arm64.cc index 91f1d67fec5..618d12b97cc 100644 --- a/runtime/vm/compiler/backend/il_arm64.cc +++ b/runtime/vm/compiler/backend/il_arm64.cc @@ -450,9 +450,6 @@ void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&stack_ok); #endif ASSERT(__ constant_pool_allowed()); - if (yield_index() != UntaggedPcDescriptors::kInvalidYieldIndex) { - compiler->EmitYieldPositionMetadata(source(), yield_index()); - } __ LeaveDartFrame(); // Disallows constant pool use. __ ret(); // This ReturnInstr may be emitted out of order by the optimizer. The next diff --git a/runtime/vm/compiler/backend/il_ia32.cc b/runtime/vm/compiler/backend/il_ia32.cc index 623d36fcd22..9a0a888d5d8 100644 --- a/runtime/vm/compiler/backend/il_ia32.cc +++ b/runtime/vm/compiler/backend/il_ia32.cc @@ -262,9 +262,6 @@ void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ int3(); __ Bind(&done); #endif - if (yield_index() != UntaggedPcDescriptors::kInvalidYieldIndex) { - compiler->EmitYieldPositionMetadata(source(), yield_index()); - } __ LeaveDartFrame(); __ ret(); } diff --git a/runtime/vm/compiler/backend/il_printer.cc b/runtime/vm/compiler/backend/il_printer.cc index 876e2e2cf53..e62264a7f28 100644 --- a/runtime/vm/compiler/backend/il_printer.cc +++ b/runtime/vm/compiler/backend/il_printer.cc @@ -1253,13 +1253,6 @@ void NativeEntryInstr::PrintTo(BaseTextBuffer* f) const { BlockEntryWithInitialDefs::PrintInitialDefinitionsTo(f); } -void ReturnInstr::PrintOperandsTo(BaseTextBuffer* f) const { - Instruction::PrintOperandsTo(f); - if (yield_index() != UntaggedPcDescriptors::kInvalidYieldIndex) { - f->Printf(", yield_index = %" Pd "", yield_index()); - } -} - void FfiCallInstr::PrintOperandsTo(BaseTextBuffer* f) const { f->AddString(" pointer="); InputAt(TargetAddressIndex())->PrintTo(f); diff --git a/runtime/vm/compiler/backend/il_riscv.cc b/runtime/vm/compiler/backend/il_riscv.cc index 60bdf3c3e37..b4d228a593e 100644 --- a/runtime/vm/compiler/backend/il_riscv.cc +++ b/runtime/vm/compiler/backend/il_riscv.cc @@ -525,9 +525,6 @@ void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&stack_ok); #endif ASSERT(__ constant_pool_allowed()); - if (yield_index() != UntaggedPcDescriptors::kInvalidYieldIndex) { - compiler->EmitYieldPositionMetadata(source(), yield_index()); - } __ LeaveDartFrame(fp_sp_dist); // Disallows constant pool use. __ ret(); // This ReturnInstr may be emitted out of order by the optimizer. The next diff --git a/runtime/vm/compiler/backend/il_x64.cc b/runtime/vm/compiler/backend/il_x64.cc index 54198e9adb4..6be79c4e653 100644 --- a/runtime/vm/compiler/backend/il_x64.cc +++ b/runtime/vm/compiler/backend/il_x64.cc @@ -368,9 +368,6 @@ void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&done); #endif ASSERT(__ constant_pool_allowed()); - if (yield_index() != UntaggedPcDescriptors::kInvalidYieldIndex) { - compiler->EmitYieldPositionMetadata(source(), yield_index()); - } __ LeaveDartFrame(); // Disallows constant pool use. __ ret(); // This ReturnInstr may be emitted out of order by the optimizer. The next diff --git a/runtime/vm/compiler/frontend/base_flow_graph_builder.cc b/runtime/vm/compiler/frontend/base_flow_graph_builder.cc index 672d737d01b..4656178d428 100644 --- a/runtime/vm/compiler/frontend/base_flow_graph_builder.cc +++ b/runtime/vm/compiler/frontend/base_flow_graph_builder.cc @@ -202,25 +202,16 @@ Fragment BaseFlowGraphBuilder::BranchIfStrictEqual( return Fragment(branch).closed(); } -Fragment BaseFlowGraphBuilder::Return(TokenPosition position, - intptr_t yield_index) { +Fragment BaseFlowGraphBuilder::Return(TokenPosition position) { Fragment instructions; Value* value = Pop(); ASSERT(stack_ == nullptr); const Function& function = parsed_function_->function(); - Representation representation; - if (function.has_unboxed_integer_return()) { - representation = kUnboxedInt64; - } else if (function.has_unboxed_double_return()) { - representation = kUnboxedDouble; - } else { - ASSERT(!function.has_unboxed_return()); - representation = kTagged; - } - ReturnInstr* return_instr = - new (Z) ReturnInstr(InstructionSource(position), value, GetNextDeoptId(), - yield_index, representation); + const Representation representation = + FlowGraph::ReturnRepresentationOf(function); + ReturnInstr* return_instr = new (Z) ReturnInstr( + InstructionSource(position), value, GetNextDeoptId(), representation); if (exit_collector_ != nullptr) exit_collector_->AddExit(return_instr); instructions <<= return_instr; diff --git a/runtime/vm/compiler/frontend/base_flow_graph_builder.h b/runtime/vm/compiler/frontend/base_flow_graph_builder.h index dd51a481247..4a3ff00ca0e 100644 --- a/runtime/vm/compiler/frontend/base_flow_graph_builder.h +++ b/runtime/vm/compiler/frontend/base_flow_graph_builder.h @@ -302,9 +302,7 @@ class BaseFlowGraphBuilder { bool negate = false); Fragment BranchIfStrictEqual(TargetEntryInstr** then_entry, TargetEntryInstr** otherwise_entry); - Fragment Return( - TokenPosition position, - intptr_t yield_index = UntaggedPcDescriptors::kInvalidYieldIndex); + Fragment Return(TokenPosition position); Fragment CheckStackOverflow(TokenPosition position, intptr_t stack_depth, intptr_t loop_depth); diff --git a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc index 290b9a5da3f..a2377f664a4 100644 --- a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc +++ b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc @@ -1483,10 +1483,9 @@ IndirectGotoInstr* StreamingFlowGraphBuilder::IndirectGoto( return flow_graph_builder_->IndirectGoto(target_count); } -Fragment StreamingFlowGraphBuilder::Return(TokenPosition position, - intptr_t yield_index) { - return flow_graph_builder_->Return(position, /*omit_result_type_check=*/false, - yield_index); +Fragment StreamingFlowGraphBuilder::Return(TokenPosition position) { + return flow_graph_builder_->Return(position, + /*omit_result_type_check=*/false); } Fragment StreamingFlowGraphBuilder::EvaluateAssertion() { diff --git a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h index 92b1c75985e..fb35a4976d8 100644 --- a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h +++ b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h @@ -153,9 +153,7 @@ class StreamingFlowGraphBuilder : public KernelReaderHelper { Fragment DebugStepCheck(TokenPosition position); Fragment LoadLocal(LocalVariable* variable); IndirectGotoInstr* IndirectGoto(intptr_t target_count); - Fragment Return( - TokenPosition position, - intptr_t yield_index = UntaggedPcDescriptors::kInvalidYieldIndex); + Fragment Return(TokenPosition position); Fragment EvaluateAssertion(); Fragment RethrowException(TokenPosition position, int catch_try_index); Fragment ThrowNoSuchMethodError(const Function& target, diff --git a/runtime/vm/compiler/frontend/kernel_to_il.cc b/runtime/vm/compiler/frontend/kernel_to_il.cc index a7edd49a07e..3d043eda3ff 100644 --- a/runtime/vm/compiler/frontend/kernel_to_il.cc +++ b/runtime/vm/compiler/frontend/kernel_to_il.cc @@ -580,8 +580,7 @@ Fragment FlowGraphBuilder::NativeCall(const String& name, } Fragment FlowGraphBuilder::Return(TokenPosition position, - bool omit_result_type_check, - intptr_t yield_index) { + bool omit_result_type_check) { Fragment instructions; const Function& function = parsed_function_->function(); @@ -597,7 +596,7 @@ Fragment FlowGraphBuilder::Return(TokenPosition position, instructions += DebugStepCheck(position); } - instructions += BaseFlowGraphBuilder::Return(position, yield_index); + instructions += BaseFlowGraphBuilder::Return(position); return instructions; } diff --git a/runtime/vm/compiler/frontend/kernel_to_il.h b/runtime/vm/compiler/frontend/kernel_to_il.h index 4a955871a90..7f6e45c80a6 100644 --- a/runtime/vm/compiler/frontend/kernel_to_il.h +++ b/runtime/vm/compiler/frontend/kernel_to_il.h @@ -200,10 +200,7 @@ class FlowGraphBuilder : public BaseFlowGraphBuilder { LocalVariable* instance, LocalVariable* setter_value); Fragment NativeCall(const String& name, const Function& function); - Fragment Return( - TokenPosition position, - bool omit_result_type_check = false, - intptr_t yield_index = UntaggedPcDescriptors::kInvalidYieldIndex); + Fragment Return(TokenPosition position, bool omit_result_type_check = false); void SetResultTypeForStaticCall(StaticCallInstr* call, const Function& target, intptr_t argument_count,