Allow vxls to allocate vmsp during traces
commitb97fa3e9d5b9e1f735c96acf40b182b9c7e85df5
authorbsimmers <bsimmers@fb.com>
Wed, 15 Oct 2014 14:19:49 +0000 (15 07:19 -0700)
committerhhvm-bot <hhvm-bot@fb.com>
Tue, 28 Oct 2014 21:00:20 +0000 (28 14:00 -0700)
tree5d28957d5882ea75199c19944511a2779dd79b42
parentc442b7003cc85849a0a9e898d557d50b3c3b9909
Allow vxls to allocate vmsp during traces

Summary: The rest of the summary is a bit of a lie: everything works just fine if we let
vmsp float freely but that's still disabled for performance reasons. See the
comment in reg-alloc.cpp for details.

%rbx is no longer a reserved register, freeing it up for general
use. vmsp still lives in %rbx between tracelets, so it's copied from %rbx to a
Vreg at the beginning of a tracelet and synced back to %rbx when
appropriate. Most of the Vregs will end up assigned to %rbx anyway due to
vxls's copy hinting. All instructions that leave the current trace for another
one (as opposed to leaving by throwing) now have a RegSet of uses, ensuring
that the value in %rbx is never clobbered between when it's written and the end
of the trace.

We now need to create phis for vmsp when it differs between predecessors rather
than just creating a new one with DefSP. I briefly considered just using an lea
off of %rbp in those situations but that wouldn't work for resumables and would
always generate some code, as opposed to only sometimes generating code for the
jmp/phis. I'm expecting this to have little to no effect on the generated code
due to copy hinting in vxls.

Reviewed By: @edwinsmith

Differential Revision: D1622952
29 files changed:
hphp/doc/ir.specification
hphp/runtime/vm/jit/abi-x64.h
hphp/runtime/vm/jit/check.cpp
hphp/runtime/vm/jit/code-gen-helpers-x64.cpp
hphp/runtime/vm/jit/code-gen-helpers-x64.h
hphp/runtime/vm/jit/code-gen-minstr-x64.cpp
hphp/runtime/vm/jit/code-gen-x64.cpp
hphp/runtime/vm/jit/code-gen-x64.h
hphp/runtime/vm/jit/frame-state.cpp
hphp/runtime/vm/jit/frame-state.h
hphp/runtime/vm/jit/func-prologues-x64.cpp
hphp/runtime/vm/jit/hhbc-translator-builtin.cpp
hphp/runtime/vm/jit/hhbc-translator-callret.cpp
hphp/runtime/vm/jit/hhbc-translator-iter.cpp
hphp/runtime/vm/jit/hhbc-translator.cpp
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/ir-opcode.h
hphp/runtime/vm/jit/minstr-translator.cpp
hphp/runtime/vm/jit/reg-alloc.cpp
hphp/runtime/vm/jit/service-requests-x64.cpp
hphp/runtime/vm/jit/simplify.cpp
hphp/runtime/vm/jit/translator.cpp
hphp/runtime/vm/jit/vasm-print.h
hphp/runtime/vm/jit/vasm-x64.cpp
hphp/runtime/vm/jit/vasm-x64.h
hphp/runtime/vm/jit/vasm-xls.cpp
hphp/test/tools/compare-ir.sh