EVALUATION
Array-backed collections are the source of many of the performance-sensitive
uses of arraycopy. Since insertions/removals at the end of the array
will tend to be O(1) while insertions/removals at a random index will tend
to be O(N), much code will tend to operate at the end of an array,
which will result in a call to arraycopy with a length of zero.
A particular example is AbstractList.add(E), which is *specified*
to call add(size(), e)
public boolean add(E e) {
add(size(), e);
return true;
}
which is likely to result in a zero-length call to arraycopy in some subclass.
|
EVALUATION
The regression starts after the next putback:
20061023120554.jrose.dolphin-cleanups with fixes for 6470497.
John Rose wrote:
I removed the inline zero-length test from the arraycopy intrinsic
because it was complicating the code for some other cases, and the
out-of-line paths handle the zero-length case fine.
I mistakenly thought zero-length arraycopy requests were rare, because
of Java-level guard code like Tom points out.
Also after that putback we generates a lot more spills on stack.
|