HHVM Runtime support for inout parameters
Summary:
Implements the runtime support required for inout parameters and compatibility wrappers. These new functions are implemented using name mangling (made possible because we require callsites to be annotated to indicate which parameters are inout). In addition the specification calls for the creation of interoperability wrappers for all inout and reference functions. A mangled inout function is created for each function taking at least one ref which would not result in an illegal inout function (e.g. no async functions). Similarly all inout functions have an associated ref wrapper which takes parameters by reference.
All inout functions must always have wrappers, however, for reference functions inout wrappers are only created when the runtime option Eval.CreateInOutWrapperFunctions is true. While inout functions must be invariant across method overrides the same is not true for by ref functions. A runtime option Eval.ReffinessInvariance has been added to force by ref functions to share this invariance. Wrappers for ref methods will only be created when this option is set to avoid creating illegal inout methods which do not preserve inout invariance.
The displayName, and fullDisplayName methods were used to unmangled names, and a new helper was added for raising undefined method and function errors which also performs any required unmangling.
Finally, to deal with dynamic function calls the FPushObjMethod, FPushFunc, FPushClsMethod, and FPushClsMethodF bytecodes were extended to take an immediate vector of parameters which were marked pass by inout, so that the name called may be mangled at runtime.
Reviewed By: swtaarrs
Differential Revision:
D6002807
fbshipit-source-id:
4aaa707e3d48c8954ea4c160f457b88a7bc5e3c4