It feels that all of those are trying to do something similar.
We could pull this into the record_type directly or document why there are differences.
In rir/src/runtime/TypeFeedback.cpp for deopt:
// FIXME: very similar code is in the recordTypeFeedbackImpl
// IMHO the one there is more correct. Would it make sense
// to pull this into the TypeFeedback::record_type()?
// and get rid of the overload that takes lambda?
feedback->record_type(origin.idx(), val);
feedback->record_type(origin.idx(), [&](auto& slot) {
if (TYPEOF(val) == PROMSXP) {
if (PRVALUE(val) == R_UnboundValue &&
slot.stateBeforeLastForce < ObservedValues::promise)
slot.stateBeforeLastForce = ObservedValues::promise;
else if (slot.stateBeforeLastForce <
ObservedValues::evaluatedPromise)
slot.stateBeforeLastForce =
ObservedValues::evaluatedPromise;
}
});
In rir/src/interpreter/interp.cpp in recordForceBehavior:
There are a few places in the code that should likely by consolidated:
feedbackOrigin::function
without the corresponding index.Is it the case that the
feedbackOrigin::function
is used for something without the index? It is not clear, should be documented.In
rir/src/compiler/pir/builder.cpp:131
inBuilder::Builder(Continuation* cnt, Value* closureEnv)
:In
rir/src/compiler/pir/builder.cpp:180
inBuilder::Builder(ClosureVersion* version, Value* closureEnv)
:It feels that all of those are trying to do something similar. We could pull this into the
record_type
directly or document why there are differences.In
rir/src/runtime/TypeFeedback.cpp
for deopt:In
rir/src/interpreter/interp.cpp
inrecordForceBehavior
:In
rir/src/compiler/native/builtins.cpp
inrecordTypefeedbackImpl
: