Please sign in to comment.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid extra references in inout wrappers
Summary: This diff makes a few performance tweaks to the inout parameter implementation: - Don't verify return typehints twice when calling through wrapper functions - For wrappers pass all by-value non-ref, non-inout parameters via PushL to avoid observing an extra reference count - For wrappers set ref arguments to Null after pushing their values to the stack to avoid observing an extra reference count via the ref - For each inout parameter at a callsite if (1) the callsite isn't within a try block, and (2) the parameter is only seen once in the course of the call, set it to Null after pushing to the stack to avoid observing an extra reference count. The setting of inout parameters and reffy arguments to null creates an observable behavioral change in the presence of references. Since this behavioral quirk is restricted to inout functions, which themselves aim to eliminate the need for references this is a temporary and hopefully workable solution to some of the performance issues associated with these wrappers. Reviewed By: swtaarrs Differential Revision: D6776155 fbshipit-source-id: 93bf273d46a06d68a1cfa6c699c25234d8222e06
- Loading branch information
Showing with 153 additions and 48 deletions.
- +67 −23 hphp/compiler/analysis/emitter.cpp
- +1 −0 hphp/hack/src/hhbc/Hhas_parser_actions.ml
- +6 −2 hphp/hack/src/hhbc/emit_env.ml
- +21 −3 hphp/hack/src/hhbc/emit_expression.ml
- +20 −18 hphp/hack/src/hhbc/emit_inout_function.ml
- +4 −2 hphp/hack/src/hhbc/emit_statement.ml
- +7 −0 hphp/hack/src/hhbc/hhas_param.ml
- +21 −0 hphp/test/slow/inout/reffy-magic.php
- +6 −0 hphp/test/slow/inout/reffy-magic.php.expect
Oops, something went wrong.