Superword - Aligning arrays

John Rose John.Rose at Sun.COM
Tue Feb 3 15:47:37 PST 2009

On Feb 3, 2009, at 11:19 AM, James Walsh wrote:

> I must not be looking in the right files for the array reallocation  
> code.  Can you dumb it down and give me a file name and line number?

Look in space.hpp at Space::allocate and par_allocate.  Those virtuals  
are both defined and called in very many places.  At a minimum, each  
implementation would have to insert the alignment correction before  
affected objects.

You know, it would probably simplify matters (deep down in the GC) to  
strongly align *all* objects bigger than a certain threshold, not just  
arrays.  Then your alignment logic would simply compare the requested  
size against the threshold, rather than ask potentially expensive  
questions about exactly which kind of object were being allocated.  Or  
(thinking out loud) the alignment request could be passed in as an  
additional boolean argument to [par_]allocate.

> I'm guessing that option 1 is a no go since it will explode memory  
> usage with dead space and only doing SIMD on longs/doubles isn't  
> going to work for me so I guess I'm going to give option 3 a try.   
> Is the C2 arraycopy intrinsic you refer to  
> LibraryCallKit::inline_arraycopy()?

Yes.  Look for this comment in generate_block_arraycopy:
   // One more chance:  Pick off an initial 32-bit word.

There's similar logic in ClearArrayNode::clear_memory, too.

You're making progress, I think, but it's not an easy problem.  Good  

-- John

More information about the hotspot-dev mailing list