harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From var...@apache.org
Subject svn commit: r541557 - in /harmony/enhanced/drlvm/trunk: src/test/regression/H3954/ src/test/regression/H3954/Test.java src/test/regression/H3954/run.test.xml vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.cpp
Date Fri, 25 May 2007 05:46:39 GMT
Author: varlax
Date: Thu May 24 22:46:38 2007
New Revision: 541557

URL: http://svn.apache.org/viewvc?view=rev&rev=541557
Log:
Applied HARMONY-3954 [drlvm][jit] Jitrino.OPT arraycopy optimization fails when Class[] array
is used

Added:
    harmony/enhanced/drlvm/trunk/src/test/regression/H3954/
    harmony/enhanced/drlvm/trunk/src/test/regression/H3954/Test.java
    harmony/enhanced/drlvm/trunk/src/test/regression/H3954/run.test.xml
Modified:
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.cpp

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H3954/Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H3954/Test.java?view=auto&rev=541557
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H3954/Test.java (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H3954/Test.java Thu May 24 22:46:38 2007
@@ -0,0 +1,111 @@
+package org.apache.harmony.drlvm.tests.regression.h3954;
+
+import junit.framework.TestCase;
+import org.vmmagic.unboxed.*;
+
+public class Test extends TestCase {
+
+ 
+    public static void testClass() {
+        Class[] arr1 = new Class[100];
+        Class elem = arr1.getClass();
+        arr1[1] = elem;
+        Class[] arr2 = new Class[100];
+        System.arraycopy(arr1, 0, arr2, 0, 100);
+
+        assertEquals(elem, arr2[1]);
+    }
+
+
+    public static void testString() {
+        String[] arr1 = new String[100];
+        String elem = "Hello!";
+        arr1[1] = elem;
+        String[] arr2 = new String[100];
+        System.arraycopy(arr1, 0, arr2, 0, 100);
+
+        assertEquals(elem, arr2[1]);
+    }
+
+
+    public static void testObject() {
+        Object[] arr1 = new Object[100];
+        Object elem = new Object();
+        arr1[1] = elem;
+        Object[] arr2 = new Object[100];
+        System.arraycopy(arr1, 0, arr2, 0, 100);
+
+        assertEquals(elem, arr2[1]);
+    }
+
+    public static void testByte() {
+        byte[] arr1 = new byte[100];
+        byte elem = 1;
+        arr1[1] = elem;
+        byte[] arr2 = new byte[100];
+        System.arraycopy(arr1, 0, arr2, 0, 100);
+
+        assertEquals(elem, arr2[1]);
+    }
+
+
+    public static void testShort() {
+        short[] arr1 = new short[100];
+        short elem = 1;
+        arr1[1] = elem;
+        short[] arr2 = new short[100];
+        System.arraycopy(arr1, 0, arr2, 0, 100);
+
+        assertEquals(elem, arr2[1]);
+    }
+
+    public static void testChar() {
+        char[] arr1 = new char[100];
+        char elem = 1;
+        arr1[1] = elem;
+        char[] arr2 = new char[100];
+        System.arraycopy(arr1, 0, arr2, 0, 100);
+
+        assertEquals(elem, arr2[1]);
+    }
+
+    public static void testInt() {
+        int[] arr1 = new int[100];
+        int elem = 1;
+        arr1[1] = elem;
+        int[] arr2 = new int[100];
+        System.arraycopy(arr1, 0, arr2, 0, 100);
+
+        assertEquals(elem, arr2[1]);
+    }
+
+    public static void testLong() {
+        long[] arr1 = new long[100];
+        long elem = 1;
+        arr1[1] = elem;
+        long[] arr2 = new long[100];
+        System.arraycopy(arr1, 0, arr2, 0, 100);
+
+        assertEquals(elem, arr2[1]);
+    }
+
+    public static void testFloat() {
+        float[] arr1 = new float[100];
+        float elem = 1;
+        arr1[1] = elem;
+        float[] arr2 = new float[100];
+        System.arraycopy(arr1, 0, arr2, 0, 100);
+
+        assertEquals(elem, arr2[1]);
+    }
+
+    public static void testDouble() {
+        double[] arr1 = new double[100];
+        double elem = 1;
+        arr1[1] = elem;
+        double[] arr2 = new double[100];
+        System.arraycopy(arr1, 0, arr2, 0, 100);
+
+        assertEquals(elem, arr2[1]);
+    }
+}

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H3954/run.test.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H3954/run.test.xml?view=auto&rev=541557
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H3954/run.test.xml (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H3954/run.test.xml Thu May 24 22:46:38
2007
@@ -0,0 +1,9 @@
+<project name="RUN HARMONY-3954 Regression Test">
+    <target name="run-test">
+        <run-junit-test 
+            test="org.apache.harmony.drlvm.tests.regression.h3954.Test"
+            vmarg="-Xem:opt">
+        </run-junit-test>
+    </target>
+</project>
+

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.cpp?view=diff&rev=541557&r1=541556&r2=541557
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.cpp
(original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.cpp
Thu May 24 22:46:38 2007
@@ -2535,44 +2535,18 @@
     assert(srcAddrType);
     Type::Tag tag = srcAddrType->getPointedToType()->tag;
     Mnemonic mn = Mnemonic_NULL;
-    switch(tag) {
-        case Type::Int8   :
-        case Type::UInt8  :
-        case Type::Boolean:
-        {
-            mn = Mnemonic_MOVS8; break;
-        }
-        case Type::Char   :
-        case Type::Int16  :
-        case Type::UInt16 :
-        {
-            mn = Mnemonic_MOVS16; break;
-        }
-        case Type::IntPtr :
-        case Type::Int32  :
-        case Type::UIntPtr:
-        case Type::UInt32 :
-        case Type::Single :
-        case Type::Float  : 
-        case Type::Object  : 
-        case Type::SystemObject  : 
-        case Type::SystemString  : 
-        case Type::Array  : 
-        {
-            mn = Mnemonic_MOVS32; break;
-        }
-        case Type::Int64  :
-        case Type::UInt64 :
-        case Type::Double :
-        {
-            appendInsts(irManager.newInst(Mnemonic_SHL, counter, irManager.newImmOpnd(counterType,
(int32)1)));
-            mn = Mnemonic_MOVS32; break;
-        }
-    default:
-        assert(0);
-        mn = Mnemonic_MOVS32; break;
+    OpndSize typeSize = IRManager::getTypeSize(tag);
+    switch(typeSize) {
+        case OpndSize_8:   mn = Mnemonic_MOVS8; break;
+        case OpndSize_16:  mn = Mnemonic_MOVS16; break;
+        case OpndSize_32:  mn = Mnemonic_MOVS32; break;
+        case OpndSize_64: {
+                            appendInsts(irManager.newInst(Mnemonic_SHL, counter, irManager.newImmOpnd(counterType,
(int32)1)));
+                            mn = Mnemonic_MOVS32;
+                          }
+                          break;
+        default: assert(0); mn = Mnemonic_MOVS32; break;
     }
-
     Inst* copyInst = irManager.newInst(mn,dstAddrReg,srcAddrReg,counter);
     copyInst->setPrefix(InstPrefix_REP);
     appendInsts(copyInst);



Mime
View raw message