Mercurial > hg > graal-jvmci-8
changeset 7119:84373743fab7
Merge
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Fri, 30 Nov 2012 13:46:37 +0100 |
parents | 1c76a458616e (current diff) e33a0f52e2d9 (diff) |
children | 3b91556bd518 |
files | mx/projects |
diffstat | 2 files changed, 13 insertions(+), 46 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ArrayCopySnippets.java Fri Nov 30 12:08:38 2012 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ArrayCopySnippets.java Fri Nov 30 13:46:37 2012 +0100 @@ -28,6 +28,7 @@ import com.oracle.graal.hotspot.nodes.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.extended.*; +import com.oracle.graal.nodes.java.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; import com.oracle.graal.snippets.*; @@ -43,6 +44,7 @@ @Snippet public static void vectorizedCopy(Object src, int srcPos, Object dest, int destPos, int length, @ConstantParameter("baseKind") Kind baseKind) { + checkInputs(src, srcPos, dest, destPos, length); int header = arrayBaseOffset(baseKind); int elementSize = arrayIndexScale(baseKind); long byteLength = (long) length * elementSize; @@ -70,68 +72,43 @@ } @Snippet - public static void arraycopy(byte[] src, int srcPos, byte[] dest, int destPos, int length) { + public static void checkInputs(Object src, int srcPos, Object dest, int destPos, int length) { if (src == null || dest == null) { throw new NullPointerException(); } - if (srcPos < 0 || destPos < 0 || length < 0 || srcPos + length > src.length || destPos + length > dest.length) { + if (srcPos < 0 || destPos < 0 || length < 0 || srcPos + length > ArrayLengthNode.arrayLength(src) || destPos + length > ArrayLengthNode.arrayLength(dest)) { throw new IndexOutOfBoundsException(); } + } + + @Snippet + public static void arraycopy(byte[] src, int srcPos, byte[] dest, int destPos, int length) { vectorizedCopy(src, srcPos, dest, destPos, length, Kind.Byte); } @Snippet public static void arraycopy(char[] src, int srcPos, char[] dest, int destPos, int length) { - if (src == null || dest == null) { - throw new NullPointerException(); - } - if (srcPos < 0 || destPos < 0 || length < 0 || srcPos + length > src.length || destPos + length > dest.length) { - throw new IndexOutOfBoundsException(); - } vectorizedCopy(src, srcPos, dest, destPos, length, Kind.Char); } @Snippet public static void arraycopy(short[] src, int srcPos, short[] dest, int destPos, int length) { - if (src == null || dest == null) { - throw new NullPointerException(); - } - if (srcPos < 0 || destPos < 0 || length < 0 || srcPos + length > src.length || destPos + length > dest.length) { - throw new IndexOutOfBoundsException(); - } vectorizedCopy(src, srcPos, dest, destPos, length, Kind.Short); } @Snippet public static void arraycopy(int[] src, int srcPos, int[] dest, int destPos, int length) { - if (src == null || dest == null) { - throw new NullPointerException(); - } - if (srcPos < 0 || destPos < 0 || length < 0 || srcPos + length > src.length || destPos + length > dest.length) { - throw new IndexOutOfBoundsException(); - } vectorizedCopy(src, srcPos, dest, destPos, length, Kind.Int); } @Snippet public static void arraycopy(float[] src, int srcPos, float[] dest, int destPos, int length) { - if (src == null || dest == null) { - throw new NullPointerException(); - } - if (srcPos < 0 || destPos < 0 || length < 0 || srcPos + length > src.length || destPos + length > dest.length) { - throw new IndexOutOfBoundsException(); - } vectorizedCopy(src, srcPos, dest, destPos, length, Kind.Float); } @Snippet public static void arraycopy(long[] src, int srcPos, long[] dest, int destPos, int length) { - if (src == null || dest == null) { - throw new NullPointerException(); - } - if (srcPos < 0 || destPos < 0 || length < 0 || srcPos + length > src.length || destPos + length > dest.length) { - throw new IndexOutOfBoundsException(); - } + checkInputs(src, srcPos, dest, destPos, length); Kind baseKind = Kind.Long; int header = arrayBaseOffset(baseKind); long byteLength = (long) length * arrayIndexScale(baseKind); @@ -152,12 +129,7 @@ @Snippet public static void arraycopy(double[] src, int srcPos, double[] dest, int destPos, int length) { - if (src == null || dest == null) { - throw new NullPointerException(); - } - if (srcPos < 0 || destPos < 0 || length < 0 || srcPos + length > src.length || destPos + length > dest.length) { - throw new IndexOutOfBoundsException(); - } + checkInputs(src, srcPos, dest, destPos, length); Kind baseKind = Kind.Double; int header = arrayBaseOffset(baseKind); long byteLength = (long) length * arrayIndexScale(baseKind); @@ -179,12 +151,7 @@ // Does NOT perform store checks @Snippet public static void arraycopy(Object[] src, int srcPos, Object[] dest, int destPos, int length) { - if (src == null || dest == null) { - throw new NullPointerException(); - } - if (srcPos < 0 || destPos < 0 || length < 0 || srcPos + length > src.length || destPos + length > dest.length) { - throw new IndexOutOfBoundsException(); - } + checkInputs(src, srcPos, dest, destPos, length); final int scale = arrayIndexScale(Kind.Object); int header = arrayBaseOffset(Kind.Object); if (src == dest && srcPos < destPos) { // bad aliased case
--- a/mx/projects Fri Nov 30 12:08:38 2012 +0100 +++ b/mx/projects Fri Nov 30 13:46:37 2012 +0100 @@ -19,8 +19,8 @@ library@JACOCOREPORT@path=lib/jacocoreport.jar library@JACOCOREPORT@urls=http://lafo.ssw.uni-linz.ac.at/jacoco/jacocoreport.jar -library@DACAPO_SCALA@path=lib/dacapo-scala-0.1.0.jar -library@DACAPO_SCALA@urls=http://repo.scalabench.org/snapshots/org/scalabench/benchmarks/scala-benchmark-suite/0.1.0-SNAPSHOT/scala-benchmark-suite-0.1.0-20110908.085753-2.jar +library@DACAPO_SCALA@path=lib/dacapo-scala-0.1.0-20120216.jar +library@DACAPO_SCALA@urls=http://repo.scalabench.org/snapshots/org/scalabench/benchmarks/scala-benchmark-suite/0.1.0-SNAPSHOT/scala-benchmark-suite-0.1.0-20120216.103539-3.jar # graal.api.runtime project@com.oracle.graal.api.runtime@subDir=graal