> On 13 Dec 2016, at 19:37, Martin Buchholz <[email protected]> wrote:
> 
> Hotspot appears to have support for the array filling code pattern, but 
> Arrays.fill itself is not intrinsified.

Yes. I suspect in general it should be ok here. FWIW i still would like to make 
it an explicit intrinsic and improve the code generation.


>   There are bounds checks which hotspot may not be able to elide.

Ah, yes, its the range fill that performs explicit checks (also with the IAE vs 
IOOBE, we are inconsistent in the handling of this in other places).

If this is an issue I think we could probably improve this, since the loop 
anyway has to check the bounds, so perhaps could branch on >=, then branch on >.

Paul.

> For almost all software, Arrays.fill is good enough, but core library 
> collections are an exception.  Also, we introduce other little abstractions 
> like shiftTailOverGap and circularClear.  Another possibility is to introduce 
> our own tiny helper method without checks
> 
> nullOutSlice(Object[] a, int from, int to)
> 
> On Tue, Dec 13, 2016 at 5:26 PM, Paul Sandoz <[email protected] 
> <mailto:[email protected]>> wrote:
> 
> One general question: why did you replace Arrays.fill with an explicit loop 
> in many cases?
> 

Reply via email to