Make predicted inner ref types independent of BoxedCell ssatmp types
commitecd969b3eb55c5c6cf4100fdd8972e031ceb5c15
authorJordan DeLong <jdelong@fb.com>
Fri, 31 Oct 2014 03:32:58 +0000 (30 20:32 -0700)
committerhhvm-bot <hhvm-bot@fb.com>
Fri, 7 Nov 2014 04:30:22 +0000 (6 20:30 -0800)
tree8bdae21594c1dea99a7064a65de472cbb23b3619
parent3b1ce71b3ba8e315cf3f8df048fb9210e2022650
Make predicted inner ref types independent of BoxedCell ssatmp types

Summary: This does part of the job of getting inner types to be factual
(PtrToFoo types isn't in this diff).  This diff adds PredictLocInner and
PredictStkInner opcodes that let frame-state track a good predicted type for
the inside of boxed values, and makes users look at those types to decide what
kind of LdRef to emit.  It also refactors minstr-translator to deal with
potentially boxed base types through this (and call simpleCollectionOp less
often---it was genning a bunch of loads just to find out types).

This diff is landable but there's more to do in follow up diffs.  I'm putting
it up as is to make sure people are ok with some not measurable, but "strictly
worse" changes in what the JIT does here:

   - checkTypeStack now always spills the stack if the type is boxed.
     Otherwise we have nowhere to track a prediction unless we add a
     PredictType opcode---after we break up spill stack this won't matter
     (because it will just change a frame state value also); and I perflabbed
     it independently and it's in the noise, so I'd rather just wait on that.

   - This removes the ability to relax guards on inner types of boxes.  I
     implemented something that does that again in another version of this
     diff: basically it treated LdRef opcodes as isGuardOps, and gives them an
     outer constraint that served the same purpose as the old inner constraint.
     But this was quite a regression (something important somewhere must not
     have been constraining the value on one of them, but I couldn't find it).
     Since this diff is in the noise without that, I'd like to just move
     forward if no one has strong objections.  (There's a fair bit of code
     relating to inner constraints that can go away with either approach here,
     but I'll do that in a follow up diff.)

Reviewed By: @swtaarrs

Differential Revision: D1656055

Signature: t1:1656055:1415215686:07c100474f89263eee9fc36d00d0674efb5406de
22 files changed:
hphp/doc/ir.specification
hphp/runtime/vm/jit/cfg.cpp
hphp/runtime/vm/jit/code-gen-arm.cpp
hphp/runtime/vm/jit/code-gen-x64.cpp
hphp/runtime/vm/jit/extra-data.h
hphp/runtime/vm/jit/frame-state.cpp
hphp/runtime/vm/jit/frame-state.h
hphp/runtime/vm/jit/guard-relaxation.cpp
hphp/runtime/vm/jit/hhbc-translator-iter.cpp
hphp/runtime/vm/jit/hhbc-translator.cpp
hphp/runtime/vm/jit/hhbc-translator.h
hphp/runtime/vm/jit/ir-builder.cpp
hphp/runtime/vm/jit/ir-builder.h
hphp/runtime/vm/jit/ir-instruction.cpp
hphp/runtime/vm/jit/memory-effects.cpp
hphp/runtime/vm/jit/minstr-translator.cpp
hphp/runtime/vm/jit/refcount-opts.cpp
hphp/runtime/vm/jit/reg-alloc.cpp
hphp/runtime/vm/jit/region-tracelet.cpp
hphp/runtime/vm/jit/simplify.cpp
hphp/runtime/vm/jit/simplify.h
hphp/runtime/vm/jit/type.cpp