brownplt/pyret-lang — pull request #235 by blerner (2014-07-25 22:30:08+00:00)
Title: New hybrid strategy for cases, taking the good ideas from no-helper-funs

This branch is a cherry-picked and updated version of the [no-helper-funs2](no-helper-funs2) branch, that takes a hybrid strategy with respect to compiling `cases` and `if` expressions. Basically, it takes the ideas of

1. Having functions for each branch of the `cases` from the old `_match` implementation on `master`
2. Having a dispatch object that includes the label numbers of switch-cases from the `no-helper-funs` implementation
3. Having the error locations checked by the caller of the `cases` expression as in `no-helper-funs`
4. Avoiding allocating closures for every branch (as the `master` version did)
5. Avoiding allocating arrays of fields (as the `no-helper-funs` version did)
6. Uses the inlining approach for `if`s that `no-helper-funs` used.

It works, with at least twice the safe GAS level as `no-helper-funs` did (1000 instead of 500), and regresses no tests. (They are temporarily regressed in the middle of these 11 commits, but are fixed by the end.)

I have not constructed a new bootstrap; somewhat amazingly, I could successfully build the new `phase3` without any intermediate bootstrap states. Note that as a consequence, building `phase1` in this commit will *not* pass all tests, but if you manually move `phase3` in place of `phase1`, all tests pass.

Run this a bit, especially in the browser, and see if it avoids regressing performance the way the `no-helper-funs` branch did. If so, it's worth merging, and (soon) worth killing off the `no-helper-funs` branch (once I salvage the interesting ideas from that branch into `locker` files).