Cleanup context handling of fcallImpl()
commit90329f0a9b5d96c770c9671f5bcbdfac4d9548b1
authorJan Oravec <jan@fb.com>
Tue, 26 Nov 2019 19:17:42 +0000 (26 11:17 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Wed, 27 Nov 2019 11:40:32 +0000 (27 03:40 -0800)
tree58ba874b0bbf0cc810578f58031dd4e5f48a04de
parent04c77938e65857485b0289ceee0a563b38da439e
Cleanup context handling of fcallImpl()

Summary:
Instead of passing a callback to fcallImpl() that initialized the context of
ActRec, pass the context directly to fcallImpl().

This is needed for the next diff that will spill ActRec from doFCall(), which
can't take the lambda as it may be called directly from the TC.

There was one minor complication -- we were previously deferring extraction of
context until after various fcallImpl() checks ran. This meant that we had to
keep structures (array in case of fcallFuncArr) supporting refcount of the
future `$this` alive until the lambda was called. This logic is now performed
before fcallImpl() and fcallImpl() is responsible for freeing `$this` if any of
these checks fail. That means if `$this` came from the stack, it needs to be
overwritten by null so that we don't free it twice.

Reviewed By: oulgen

Differential Revision: D18695010

fbshipit-source-id: 9b5270edd56132190d17cea410f5fd3cb97de030
hphp/runtime/vm/bytecode.cpp