Add static method support to FCallBuiltin
commitd9171fc3e9f7a340147a914a25d9f24d08213d17
authorShaunak Kishore <kshaunak@fb.com>
Thu, 16 May 2019 16:06:46 +0000 (16 09:06 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Thu, 16 May 2019 16:11:25 +0000 (16 09:11 -0700)
tree4f7458df77f36fc654035e76ae8ea1e896331938
parente094af6bea736c01cbd404499953754d2cb2563e
Add static method support to FCallBuiltin

Summary:
This diff modifies hhbbc to emit FCallBuiltin for static functions if the class and function name are both statically known and both match the native function's name. The literal string for FCallBuiltin is a new one, formed as cls::fn (so, for example, "HH\Shapes::idx"). On the HHVM side, I index all native functions in a unit using keys computed the same way in IRUnit.

The purpose of this diff is to support adding a "fast path" for some static native functions, like we do for things like "get_class", "is_array", and others (see "optimizedFCallBuiltin" in irgen-builtin.cpp). Specifically, we want to add a fast path for Shapes::idx.

Reviewed By: mxw

Differential Revision: D15314597

fbshipit-source-id: d2b1da4ecda4cdf340fe6a171ca50dc428992b65
hphp/doc/bytecode.specification
hphp/hhbbc/interp-builtin.cpp
hphp/hhbbc/interp.cpp
hphp/runtime/vm/bytecode.cpp
hphp/runtime/vm/jit/irgen-builtin.cpp
hphp/runtime/vm/unit.cpp