Main point of this patch is to change rb_ary_modify so that it considers ARY_SHARED_NUM
and steel shared array pointer when ARY_SHARED_NUM == 1.
To make it possible, it saves array's capa instead of array's length in ary_make_shared
and fixes rb_ary_sort_bang accordantly.

array.c (ary_ensure_room_for_push): make array really suitable for
queue. [Feature #6638]
when array is shared (which happens after Array#shift), and
ARY_SHARED_NUM == 1 (which is very often when array used as queue),
then make rb_ary_push push directly into shared array.

array.c (ary_ensure_room_for_push): make array really suitable for
queue. [Feature #6638]
when array is shared (which happens after Array#shift), and
ARY_SHARED_NUM == 1 (which is very often when array used as queue),
then make rb_ary_push push directly into shared array.

#push now knows if array is shared, and when ARY_SHARED_NUM(shared) == 1 then tries to push entries directly
into shared array. So that, there is no additional allocations or memmove for most of pushes

#pop behaves almost in old way, but it clears shared array element as #shift do.

#unshift tries to unshift elements to shared array when ARY_SHARED_NUM(shared) == 1, and most of time provides
a room for future unshifts.

In case when array is not shared and it is large enough (currently, more than 116 elements), #unshift makes it
shared and ensures that there is a room for future unshifts.

Another couple of commits to https://github.com/ruby/ruby/pull/133 :
- fixed error in rb_ary_cat_to_shared which leads to memory corruption
- avoid pathological performance cases (when array length is close to capacity)
by increasing capacity earlier and leaving more room for future values