Skip to content

Commit

Permalink
Refuse to inline when there are readonly violations
Browse files Browse the repository at this point in the history
Reviewed By: paulbiss

Differential Revision: D30701228

fbshipit-source-id: b186e7ef48349b23db70d0088a8103ae200d742a
  • Loading branch information
oulgen authored and facebook-github-bot committed Sep 2, 2021
1 parent d425808 commit 4b3a784
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions hphp/runtime/vm/jit/inlining-decider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,14 @@ bool checkNumArgs(SrcKey callSK,
}
}

if (fca.enforceMutableReturn() && (callee->attrs() & AttrReadonlyReturn)) {
return refuse("caller requries mutable return but callee is readonly return");
}

if (fca.enforceReadonlyThis() && !(callee->attrs() & AttrReadonlyThis)) {
return refuse("caller expects no modifications to the instance but callee does modify");
}

return true;
}

Expand Down

0 comments on commit 4b3a784

Please sign in to comment.