Tweak wholecfg region former, and fix a bug in translateRegion
commit275584b3526b3f1057efcc378ccee84f13522afa
authorGuilherme Ottoni <ottoni@fb.com>
Thu, 2 Oct 2014 18:26:03 +0000 (2 11:26 -0700)
committerhhvm-bot <hhvm-bot@fb.com>
Thu, 2 Oct 2014 18:30:24 +0000 (2 11:30 -0700)
treec788f4b6afe2188a2bc1165a6d015125a3ed2240
parent13de476da138fe30f238ac5002954a3c570c1e0d
Tweak wholecfg region former, and fix a bug in translateRegion

Summary: This diff makes 2 tweaks to wholecfg region formation:
  - stop a region when reaching a SrcKey that has already been optimized

  - regionize a function in increasing order of bytecode offsets, so
    that we start from the the function body

These changes exposed a bug in translateRegion when running unit
tests, where a fall-through jump was incorrectly going to the next
region block.  This was due to the use of the nextOffset in the
NormalizedInstruction, which should only be used to enable jump
flipping in hottrace mode.  So add an assert to make sure this field
isn't used with bytecode control flow.

Reviewed By: @bertmaher

Differential Revision: D1590831
hphp/runtime/vm/jit/ir-translator.cpp
hphp/runtime/vm/jit/mc-generator.cpp
hphp/runtime/vm/jit/region-whole-cfg.cpp
hphp/runtime/vm/jit/regionize-func.cpp
hphp/runtime/vm/jit/translator.cpp