Introduce .try {} .catch {} hhas directives
commit05ca1e124e8820635aca4b300c622a898c158445
authorJan Oravec <jan@fb.com>
Wed, 17 May 2017 19:33:10 +0000 (17 12:33 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Wed, 17 May 2017 19:40:59 +0000 (17 12:40 -0700)
treedab65b51b13c26fe6c4580ac0e419e2c7f12096e
parent938d2f10b05434213732cde3b4d8dfb5b91616aa
Introduce .try {} .catch {} hhas directives

Summary:
The .try_catch {} hhas directive does not encode the length of catch blocks,
preventing catch blocks from being emitted inside open FPI blocks, which are
needed for migration of faults to catches.

Let's introduce .try {} .catch {} directive, so that we can eventually mark the
catch blocks as top-level inside the FPI table.

.try {} blocks are required to not fall-thru, .catch {} blocks implicitly
encode the Catch opcode as their first statement.

The support is added to all places that read hhas (as.cpp and hhas_parser) and
some places that emits hhas (hhcodegen and all manually written hhas files).

The disas.cpp still emits the original .try_catch {} for two reasons:
- hhbbc may rearrange blocks such that m_past != m_handler
- EH table does not yet contain information about length of catch blocks

Reviewed By: paulbiss

Differential Revision: D5049855

fbshipit-source-id: 268b190c4c5228f7387a732cfe7db527fbfb7c37
20 files changed:
hphp/hack/src/hhbc/emit_statement.ml
hphp/hack/src/hhbc/hhas_lexer.mll
hphp/hack/src/hhbc/hhas_parser.mly
hphp/hack/src/hhbc/hhbc_ast.ml
hphp/hack/src/hhbc/hhbc_hhas.ml
hphp/hack/src/hhbc/instruction_sequence.ml
hphp/hack/src/hhbc/label_rewriter.ml
hphp/hack/src/hhbc/semdiff/rhl.ml
hphp/runtime/ext/collections/ext_collections-map.php
hphp/runtime/ext/collections/ext_collections-map.tmpl
hphp/runtime/vm/as.cpp
hphp/system/php/array_filter.hhas
hphp/system/php/array_map.hhas
hphp/system/php/array_reduce.hhas
hphp/test/quick/asm_cont.hhas
hphp/test/quick/asm_dvinit_fault.hhas
hphp/test/quick/asm_fault.hhas
hphp/test/quick/asm_fault_endings.hhas
hphp/test/quick/hopt-translator_unwind.hhas
hphp/test/quick/translator_unwind.hhas