[vm/compiler] Cleanup yield_index from Return instruction
TEST=ci Change-Id: Ib41689681a171ec93366dc6f5a09aa7d5707c5cd Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268780 Reviewed-by: Martin Kustermann <kustermann@google.com> Commit-Queue: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
committed by
Commit Queue
parent
76945a3b81
commit
3bcb19455f
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user