The major parts of this patch are the changes to allow interning
of primitives that make use of segment building.

Once that lands, the ports for other primitives that use segments
should be straightforward.