United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-4809552 Optimize Arrays.fill(...)
JDK-4809552 : Optimize Arrays.fill(...)

Details
Type:
Enhancement
Submit Date:
2003-01-28
Status:
Closed
Updated Date:
2011-04-23
Project Name:
JDK
Resolved Date:
2011-04-23
Component:
hotspot
OS:
windows_2000
Sub-Component:
compiler
CPU:
x86
Priority:
P4
Resolution:
Fixed
Affected Versions:
1.4.1
Fixed Versions:
hs19 (b07)

Related Reports
Backport:
Backport:
Backport:
Backport:
Backport:
Backport:
Relates:
Relates:
Relates:

Sub Tasks

Description
Name: rmT116609			Date: 01/28/2003


DESCRIPTION OF THE PROBLEM :
System.arraycopy() performs brilliantly on Intel/AMD CPUs as it maps right on down to a single REP MOVS instruction. Perhaps an order of magnitude faster than the same thing in a normal loop.

I'd like a System.arrayfill() method that could be built on a REP STOS operation.

(Today I'm initializing buffers for a b-tree. Need to blank-fill the text buffer - a pretty common thing to do. Index efficiency is critical to DB operations, so speed matters here.)

(Review ID: 180473) 
======================================================================

                                    

Comments
EVALUATION

http://hg.openjdk.java.net/hsx/hsx19/baseline/rev/d64a8c7aa9d5
                                     
2010-10-08
EVALUATION

The java.util.Arrays.fill(...) family of static methods
already provide the functionality desired.
Making those methods fast seems like a job for hotspot.
I think this CR belongs in java/hotspot/ somewhere;
the core library maintainers can't turn those method bodies into
one machine instruction.

This seems similar to

6431242: Optimize Integer.reverseBytes()
6431243: Optimize Integer.rotateLeft()

so I am changing the synopsis to

"Optimize Arrays.fill(...)"
                                     
2006-09-05
EVALUATION

I've changed the categories to java/hotspot/compiler2.
                                     
2006-09-05
EVALUATION

http://hg.openjdk.java.net/jdk7/hotspot-comp/hotspot/rev/d6f45b55c972
                                     
2010-08-28
EVALUATION

http://hg.openjdk.java.net/jdk7/hotspot-gc/hotspot/rev/d6f45b55c972
                                     
2010-09-04
EVALUATION

4809552: Optimize Arrays.fill(...)
Reviewed-by: kvn

This adds new logic to recognize fill idioms and convert them into a
call to an optimized fill routine.  Loop predication creates easily
matched loops that are simply replaced with calls to the new assembly
stubs.  Currently only 1,2 and 4 byte primitive types are supported.
Objects and longs/double will be supported in a later putback.  Tested
with runthese, nsk and ctw plus jbb2005.
                                     
2010-09-09



Hardware and Software, Engineered to Work Together