dropbox/pyston — pull request #113 by tjhance (2014-07-30 03:34:47+00:00)
Title: Rewriter2

Ports all of `objmodel.cpp` to use rewriter2. This should make it more straightforward to move forward in `objmodel.cpp`. I found rewriter2 a lot easier to use than it looks like `rewriter` was, although calling `setDoneUsing()` and `setDoneGuarding()` in all the right places was a bit painful. (But it's probably less painful to do that when developing incrementally rather than fixing a 3000-line file all at once ^.^) There's definitely room for optimization and I didn't put much effort into smart register allocation, I just put `Location::any()` everywhere for now. One nice thing about rewriter2 is that we can deal with that kind of thing on its own and focus on correctness first.

Some functionality that I had to add to rewriter2:
- Stack locations (for dealing with more than 6 arguments)
- `addGuard`
- `cmp`
- `toBool`
- Ability to allocate ranges in the scratch space, for when you need to allocate new space for the `args` of function calls (i.e., space for arguments after `arg1`, `arg2`, and `arg3`)