Support SetM in new minstrs
commitaff732a3e827b782c4c25721ae49a6fd7c7473f7
authorBrett Simmers <bsimmers@fb.com>
Wed, 21 Oct 2015 05:03:41 +0000 (20 22:03 -0700)
committerhhvm-bot <hhvm-bot@fb.com>
Wed, 21 Oct 2015 05:30:35 +0000 (20 22:30 -0700)
tree65600a89d4c1524dd6e6bfa295d02a7cf6616b68
parent1c422d13fa02d6306930e2bbf7e7b577cfe9b906
Support SetM in new minstrs

Summary: This adds new final operation minstrs to handle SetM.

A few things worth calling out:
- The unwinder now DecRefs tvRef/tvRef2 if a minstr throws. This takes the
  place of the custom catch traces used by the old minstr instructions.
- FrameState supports member set operations that modify local/stack bases
  through pointers that don't come directly from LdLocAddr/LdStkAddr. This
  almost never happens in practice but now that we can break tracelets in the
  middle of a member operation, it's necessary for correctness. The current
  support is extremely conservative; if that turns out to be a problem it can
  be refined later.
- Added gen-time load-elim for the member base register, to preserve some of
  the optimizations done in irgen-minstr. Track the type when we have to give
  up on the specific value. We can stop relying on this if and when we move a
  lot of the logic in irgen-minstr to its own pass.
- Fixed a bug in relaxToGuardable() that was causing us to guard on StaticArr
  in a pseudomain. Also added an assert in codegen that will catch this if it
  happens again, rather than just emitting an incorrect guard.
- Fixed a couple places in member-operations.h where we were returning &tvRef
  with tvRef set to Uninit, violating the invariant that the result is &tvRef
  iff tvRef isn't Uninit.

Reviewed By: alexmalyshev

Differential Revision: D2507681

fb-gh-sync-id: 25ee0c2e3e9d0711f64457afe9eb435ca896899e
34 files changed:
hphp/compiler/analysis/emitter.cpp
hphp/compiler/analysis/emitter.h
hphp/doc/bytecode.specification
hphp/doc/ir.specification
hphp/hhbbc/bc.h
hphp/hhbbc/emit.cpp
hphp/hhbbc/interp-minstr.cpp
hphp/hhbbc/interp-state.h
hphp/hhbbc/optimize.cpp
hphp/runtime/base/tv-helpers.h
hphp/runtime/test/alias-class.cpp
hphp/runtime/vm/as.cpp
hphp/runtime/vm/bytecode.cpp
hphp/runtime/vm/hhbc.cpp
hphp/runtime/vm/hhbc.h
hphp/runtime/vm/jit/code-gen-x64.cpp
hphp/runtime/vm/jit/frame-state.cpp
hphp/runtime/vm/jit/frame-state.h
hphp/runtime/vm/jit/ir-builder.cpp
hphp/runtime/vm/jit/ir-builder.h
hphp/runtime/vm/jit/irgen-internal.h
hphp/runtime/vm/jit/irgen-interpone.cpp
hphp/runtime/vm/jit/irgen-minstr.cpp
hphp/runtime/vm/jit/minstr-effects.cpp
hphp/runtime/vm/jit/region-hot-cfg.cpp
hphp/runtime/vm/jit/store-elim.cpp
hphp/runtime/vm/jit/translator.cpp
hphp/runtime/vm/member-operations.h
hphp/runtime/vm/unwind.cpp
hphp/runtime/vm/verifier/check-func.cpp
hphp/test/quick/SetM.php
hphp/test/quick/SetM.php.expectf
hphp/test/slow/array_access/local_type.php [new file with mode: 0644]
hphp/test/slow/array_access/local_type.php.expect [new file with mode: 0644]