Fix tc-print's handling of bytecode regions
commitd7ef71b14bf2772b72c2ea8ee33957e4076a5cee
authorbsimmers <bsimmers@fb.com>
Mon, 2 Jun 2014 22:39:33 +0000 (2 15:39 -0700)
committerJoelMarcey <joelm@fb.com>
Wed, 4 Jun 2014 02:34:21 +0000 (3 19:34 -0700)
tree60988db030d16477047ac2a0628011f6f4c99b29
parent2a345ff3cdf06ddfc12f10580d8f87dfa6cd921d
Fix tc-print's handling of bytecode regions

Summary: tc-print has always treated a translation as a single, continuous
range of bytecode instructions. This was almost never true: we've been tracing
through forward Jmps since before tc-print was born. Inlining and PGO have just
made the problem worse. I hacked in rough inlining support a while ago but this
diff fixes it more.

The TC dump now has a list of bytecode blocks contained in the translation
rather than just a starting and stopping offset. Blocks contain a unit md5 (may
differ due to inlining) and a range of bytecode offsets. This is used to print
the correct bytecodes at the beginning of the translation's disassembly. I also
changed the bytecode that we print inline with the assembly to only print
bytecodes that have code directly assigned to them. The previous logic of
attempting to fill in the gaps didn't work when we had more than one block in a
translation, and as a result it often printed some bytecodes that weren't
actually in the translation.

Two more small improvements: guards are now printed in tc-print, and we
shouldn't falsely attribute time spent in the guards to the first bytecode
instruction of the translation anymore.

Reviewed By: @ottoni

Differential Revision: D1362151
17 files changed:
hphp/doc/ir.specification
hphp/runtime/vm/func.cpp
hphp/runtime/vm/func.h
hphp/runtime/vm/jit/code-gen-arm.cpp
hphp/runtime/vm/jit/code-gen-x64.cpp
hphp/runtime/vm/jit/code-gen.cpp
hphp/runtime/vm/jit/code-gen.h
hphp/runtime/vm/jit/hhbc-translator.cpp
hphp/runtime/vm/jit/hhbc-translator.h
hphp/runtime/vm/jit/ir.h
hphp/runtime/vm/jit/mc-generator.cpp
hphp/runtime/vm/jit/region-selection.cpp
hphp/runtime/vm/jit/trans-rec.cpp [new file with mode: 0644]
hphp/runtime/vm/jit/trans-rec.h [new file with mode: 0644]
hphp/runtime/vm/jit/translator.cpp
hphp/runtime/vm/jit/translator.h
hphp/runtime/vm/unit.cpp