use arrays rather than lists in testing code equivalence
commit1d8c4f2a04e5c012fdbf48e4cf5ed0a39c5a3934
authorNick Benton <pnb@fb.com>
Tue, 6 Jun 2017 12:30:14 +0000 (6 05:30 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Tue, 6 Jun 2017 12:47:42 +0000 (6 05:47 -0700)
tree78cf742ed82a94f3546660fe3231aca3e6b70b3e
parent2c0e0bd36439d685f688ee398e6cb3f19717054c
use arrays rather than lists in testing code equivalence

Summary:
Semdiff used to represent function/method bodies as lists of instructions, using linear-time access to
each instruction and making the whole thing quadratic. This changes that to use arrays instead.

The biggest change is in the pattern-matching for special sequences of instructions. That used to drop the
head of the list up to the point we're looking at and then just using ordinary OCaml matching on lists. Now
there's a tiny combinator library for matching patterns in arrays (and pairs of arrays).

Reviewed By: hubyrod

Differential Revision: D5190479

fbshipit-source-id: 2f569a3086c5629f809ac0f3252427267a12a08f
hphp/hack/src/hhbc/semdiff/hhbc_destruct.ml [new file with mode: 0644]
hphp/hack/src/hhbc/semdiff/rhl.ml