Constify

I did some work on moving constant data out of the read-write segment. Each of the commits in here should be pretty self-contained and straightforward.

As a side effect I made the linear type indexing stuff a little better at constant folding; some indices can be computed at compile time instead of requiring a table lookup at run time.