pack: expose a cached delta base directly

Instead of going through a special entry in the chain, let's pass it as
an output parameter.
pack: use stack allocation for smaller delta chains

This avoid allocating the array on the heap for relatively small
chains. The expected performance increase is sadly not really
noticeable.
pack: don't forget to cache the base object

The base object is a good cache candidate, so we shouldn't forget to add
it to the cache.