Lower some CufIter operations to more specific instructions
commit17cade079878e87a62459174174734babb0f65dd
authorRick Lavoie <rlavoie@fb.com>
Thu, 18 May 2017 21:29:11 +0000 (18 14:29 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Thu, 18 May 2017 21:47:19 +0000 (18 14:47 -0700)
treefee9b58ba3e2f2456cdea5cfe4073ca6dc2a79b0
parentcd41d3d0b1b5feaeef98aa5cbfd58afa16394b2f
Lower some CufIter operations to more specific instructions

Summary:
Introduce pure-load and pure-store IR instructions which read and write to the
fields of cuf-iter slots. These instructions have the proper memory effects so
that load/store-elim can remove loads and stores to these fields. The
CufIterSpillFrame instruction is now no longer needed. It can be replaced by
loads of the respective fields which can then be passed into the normal
SpillFrame instruction.

As a result, the SpillFrame instruction needs to be enhanced. Since the "invoke
name" now may not be statically known (because its coming from a
LdCufIterInvName instruction), instead pass it as a parameter instead of in
extra-data. Modify the lowering of SpillFrame to not generate extra code in the
(common) case where we know that the invoke name is null.

Unfortunately we cannot get rid of the DecodeCufIter instruction. For object
callables, its easy to lower the decoding into the equivalent set of store
instructions to the cuf-iterator slot. However, its not done right now for other
types, so we need to continue to emit DecodeCufIter for those.

Finally, the CIterFree instruction can be removed. It can instead by implemented
by loads of the fields, dec-reffing them, and then killing the slot so that
store-elim knows the values in the slot are no longer important. This is done by
a new KillCufIter instruction.

Reviewed By: markw65

Differential Revision: D5069510

fbshipit-source-id: 2827acc3d1ba7f6ae17b7844a2f2cd54f1eb5dc1
15 files changed:
hphp/doc/ir.specification
hphp/runtime/base/memory-manager.h
hphp/runtime/vm/act-rec.h
hphp/runtime/vm/jit/dce.cpp
hphp/runtime/vm/jit/extra-data.h
hphp/runtime/vm/jit/frame-state.cpp
hphp/runtime/vm/jit/ir-instruction.cpp
hphp/runtime/vm/jit/irgen-call.cpp
hphp/runtime/vm/jit/irgen-internal.h
hphp/runtime/vm/jit/irgen-iter.cpp
hphp/runtime/vm/jit/irlower-act-rec.cpp
hphp/runtime/vm/jit/irlower-iter.cpp
hphp/runtime/vm/jit/load-elim.cpp
hphp/runtime/vm/jit/memory-effects.cpp
hphp/runtime/vm/jit/simplify.cpp