harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From var...@apache.org
Subject svn commit: r592640 - in /harmony/enhanced/drlvm/trunk: src/test/regression/H5067/ src/test/regression/H5067/Test.java src/test/regression/H5067/run.test.xml vm/jitrino/src/codegenerator/ia32/Ia32APIMagics.cpp
Date Wed, 07 Nov 2007 07:07:18 GMT
Author: varlax
Date: Tue Nov  6 23:07:17 2007
New Revision: 592640

URL: http://svn.apache.org/viewvc?rev=592640&view=rev
Log:
Applied HARMONY-5067 [drlvm][jit] Incorrect string comparison

Added:
    harmony/enhanced/drlvm/trunk/src/test/regression/H5067/
    harmony/enhanced/drlvm/trunk/src/test/regression/H5067/Test.java   (with props)
    harmony/enhanced/drlvm/trunk/src/test/regression/H5067/run.test.xml   (with props)
Modified:
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32APIMagics.cpp

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H5067/Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H5067/Test.java?rev=592640&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H5067/Test.java (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H5067/Test.java Tue Nov  6 23:07:17 2007
@@ -0,0 +1,33 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.harmony.drlvm.tests.regression.h5067;
+
+import junit.framework.TestCase;
+
+public class Test extends TestCase {
+
+    public void test() {
+        char c_max = Character.MAX_VALUE;
+        String max = String.valueOf(Character.MAX_VALUE);
+        String s = String.valueOf("abcde");
+        int res = max.compareTo(s);
+
+        assertEquals(65438, res);
+    }
+
+}

Propchange: harmony/enhanced/drlvm/trunk/src/test/regression/H5067/Test.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H5067/run.test.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H5067/run.test.xml?rev=592640&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H5067/run.test.xml (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H5067/run.test.xml Tue Nov  6 23:07:17
2007
@@ -0,0 +1,25 @@
+<!-- 
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+     
+         http://www.apache.org/licenses/LICENSE-2.0
+     
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License. -->
+
+<project name="RUN HARMONY-5067 Regression Test">
+    <target name="run-test">
+        <run-junit-test 
+             test="org.apache.harmony.drlvm.tests.regression.h5067.Test"
+             vmarg="-Xem:opt">
+        </run-junit-test>
+    </target>
+</project>
+

Propchange: harmony/enhanced/drlvm/trunk/src/test/regression/H5067/run.test.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32APIMagics.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32APIMagics.cpp?rev=592640&r1=592639&r2=592640&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32APIMagics.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32APIMagics.cpp Tue Nov
 6 23:07:17 2007
@@ -397,15 +397,16 @@
     counterIsZeroNode->appendInst(irm->newInstEx(Mnemonic_SUB, 1, res, thisLen, trgtLen));
 
     // strings are different
-    Opnd* two = irm->newImmOpnd(counterType,2);
-    differentStringsNode->appendInst(irm->newInstEx(Mnemonic_SUB, 1, thisAddrReg, thisAddrReg,
two));
-    differentStringsNode->appendInst(irm->newInstEx(Mnemonic_SUB, 1, trgtAddrReg, trgtAddrReg,
two));
+    Opnd* minustwo = irm->newImmOpnd(counterType,-2);
     Type* charType = irm->getTypeManager().getCharType();
-    Opnd* thisChar = irm->newMemOpnd(charType, thisAddrReg);
-    Opnd* trgtChar = irm->newMemOpnd(charType, trgtAddrReg);
-    Opnd* dst = irm->newOpnd(charType);
-    differentStringsNode->appendInst(irm->newInstEx(Mnemonic_SUB, 1, dst, thisChar,
trgtChar));
-    differentStringsNode->appendInst(irm->newInstEx(Mnemonic_MOVSX, 1, res, dst));
+    Opnd* thisChar = irm->newMemOpnd(charType, thisAddrReg, NULL, NULL, minustwo);
+    Opnd* trgtChar = irm->newMemOpnd(charType, trgtAddrReg, NULL, NULL, minustwo);
+    Type* intType = res->getType();
+    Opnd* thisInt = irm->newOpnd(intType);
+    Opnd* trgtInt = irm->newOpnd(intType);
+    differentStringsNode->appendInst(irm->newInstEx(Mnemonic_MOVZX, 1, thisInt, thisChar));
+    differentStringsNode->appendInst(irm->newInstEx(Mnemonic_MOVZX, 1, trgtInt, trgtChar));
+    differentStringsNode->appendInst(irm->newInstEx(Mnemonic_SUB, 1, res, thisInt,
trgtInt));
 
     callInst->unlink();
 }



Mime
View raw message