Implement impulse cache with spacial reduction.

This also adds the support for predictive contacts.
Note that the cache is lost when an island is put to sleep.
Handling cache recovery when an island wakes up is really hard and might be too time consuming.