Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce version cloning #1208

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
sanity check
  • Loading branch information
skrynski committed May 6, 2022
commit 33df2e756fed7056f664f539a876de7194369c92
2 changes: 1 addition & 1 deletion rir/src/compiler/opt/eager_calls.cpp
Original file line number Diff line number Diff line change
@@ -315,7 +315,7 @@ bool EagerCalls::apply(Compiler& cmp, ClosureVersion* cls, Code* code,
if (version != call->lastSeen) {
version->staticCallRefCount++;
}

version->isClone = true;
call->lastSeen = nullptr;
if (version->isClone || version->staticCallRefCount > 1) {

24 changes: 12 additions & 12 deletions rir/src/compiler/pir/instruction.cpp
Original file line number Diff line number Diff line change
@@ -1275,18 +1275,18 @@ StaticCall::StaticCall(Value* callerEnv, Closure* cls, Context givenContext,
assert(tryDispatch());
}

Instruction* StaticCall::clone() const {
auto r = InstructionImplementation::clone();

auto sc = StaticCall::Cast(r);
sc->lastSeen = nullptr;
auto target = sc->tryDispatch();
if (target) {
sc->lastSeen = target;
target->staticCallRefCount++;
}
return sc;
}
// Instruction* StaticCall::clone() const {
// auto r = InstructionImplementation::clone();

// auto sc = StaticCall::Cast(r);
// sc->lastSeen = nullptr;
// auto target = sc->tryDispatch();
// if (target) {
// sc->lastSeen = target;
// target->staticCallRefCount++;
// }
// return sc;
// }

PirType StaticCall::inferType(const GetType& getType) const {
auto t = PirType::bottom();
2 changes: 1 addition & 1 deletion rir/src/compiler/pir/instruction.h
Original file line number Diff line number Diff line change
@@ -2281,7 +2281,7 @@ class VLIE(StaticCall, Effects::Any()), public CallInstruction {

size_t nCallArgs() const override { return nargs() - 3; }

Instruction* clone() const override;
// Instruction* clone() const override;

void eachNamedCallArg(const NamedArgumentValueIterator& it) const override {
for (size_t i = 0; i < nCallArgs(); ++i)