It does this in a quick and dirty way: copy the values other than TOS into a new array, then copy the values from the array back to the stack. This is slow, but it's not something that I've ever needed in actual use, so I see no reason to devote time to finding a faster solution.
Test Case: