System.arraycopy

Christian Thalinger christian.thalinger at oracle.com
Thu Jun 5 21:51:25 UTC 2014


On Jun 5, 2014, at 2:43 PM, Tom Rodriguez <tom.rodriguez at oracle.com> wrote:

> 
> On Jun 5, 2014, at 2:39 PM, Deneau, Tom <tom.deneau at amd.com> wrote:
> 
>> Christian --
>> 
>> For now just going for functionally correct, will address performance issues in the future.  But yes there are vector instructions that could help even in a single workitem.
>> 
>> Is there already a pure java implementation of System.arrayCopy we could substitute?
> 
> UnsafeArrayCopyNode is pretty much that.

Oh yeah, I forgot about that.  It’s using UnsafeLoadNode/UnsafeStoreNode and GPUs should be able to substitute these, right?

>  The flag CallArrayCopy controls whether it prefers the hotspot stubs for array copy or not but it should be able to fall back to UnsafeArrayCopyNode.
> 
> tom
> 
>> 
>> I guess we would want to use the logic to do different substitutions based on the type of the array (like in ArrayCopySnippets)?  
>> 
>> any other advice for implementing this?
>> 
>> -- Tom
>> 
>> 
>> 
>>> -----Original Message-----
>>> From: Christian Thalinger [mailto:christian.thalinger at oracle.com]
>>> Sent: Thursday, June 05, 2014 3:45 PM
>>> To: Deneau, Tom
>>> Cc: graal-dev at openjdk.java.net
>>> Subject: Re: System.arraycopy
>>> 
>>> Well, I guess the easiest but maybe not most performant way would be to
>>> have a substitution and implement it in plain Java.
>>> 
>>> On the other hand you could rely on vectorization and the power of GPUs
>>> to produce good, parallel code :-)
>>> 
>>> On Jun 5, 2014, at 1:29 PM, Deneau, Tom <tom.deneau at amd.com> wrote:
>>> 
>>>> Since we cannot handle "foreign calls" in the hsail backend, what is
>>> the preferred way to implement System.arraycopy?  Right now, we are
>>> deferring to the host and so getting an ArrayCopyCallNode which gets
>>> lowered to a graph containing a ForeignCallNode.
>>>> 
>>>> I confess to being a little confused with the ArrayCopyNode and
>>> Snippets, UnsafeArrayCopyNode and Snippets, ArrayCopyCallNode, etc.
>>>> 
>>>> -- Tom
>>>> 
>> 
> 



More information about the graal-dev mailing list