harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From var...@apache.org
Subject svn commit: r538151 - in /harmony/enhanced/drlvm/trunk: src/test/regression/H1861/ src/test/regression/H1861/Test.java src/test/regression/H1861/run.test.xml vm/jitrino/src/jet/cg_regs.cpp
Date Tue, 15 May 2007 12:21:53 GMT
Author: varlax
Date: Tue May 15 05:21:52 2007
New Revision: 538151

URL: http://svn.apache.org/viewvc?view=rev&rev=538151
Log:
Fixed HARMONY-1861 [drlvm][jit] Double arithmetic instructions work incorrectly (Jitrino JET)

Added:
    harmony/enhanced/drlvm/trunk/src/test/regression/H1861/
    harmony/enhanced/drlvm/trunk/src/test/regression/H1861/Test.java
    harmony/enhanced/drlvm/trunk/src/test/regression/H1861/run.test.xml
Modified:
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_regs.cpp

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H1861/Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H1861/Test.java?view=auto&rev=538151
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H1861/Test.java (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H1861/Test.java Tue May 15 05:21:52 2007
@@ -0,0 +1,30 @@
+package org.apache.harmony.drlvm.tests.regression.h1861;
+
+import junit.framework.TestCase;
+
+public class Test extends TestCase {
+    public static long [] arr = new long [] {6, 25, 50};
+    public static Test t = new Test();
+    public double d = 30d;
+
+
+    public void test() {
+        double d1 = t.d / arr[0];
+        assertEquals(5.0d, d1, 0);
+
+        d1 = t.d % arr[1];
+        assertEquals(5.0d, d1, 0);
+
+        d1= t.d - arr[1];
+        assertEquals(5.0d, d1, 0);
+
+        d1= t.d + arr[0];
+        assertEquals(36.0d, d1, 0);
+
+        boolean b = (t.d >= arr[0]);
+        assertTrue(b);
+
+        b = (t.d < arr[1]);
+        assertFalse(b);
+    }
+}

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H1861/run.test.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H1861/run.test.xml?view=auto&rev=538151
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H1861/run.test.xml (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H1861/run.test.xml Tue May 15 05:21:52
2007
@@ -0,0 +1,9 @@
+<project name="RUN HARMONY-1861 Regression Test">
+    <target name="run-test">
+        <run-junit-test 
+             test="org.apache.harmony.drlvm.tests.regression.h1861.Test"
+             vmarg="-Xem:jet">
+        </run-junit-test>
+    </target>
+</project>
+

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_regs.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_regs.cpp?view=diff&rev=538151&r1=538150&r2=538151
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_regs.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_regs.cpp Tue May 15 05:21:52 2007
@@ -149,7 +149,7 @@
         s.to_mem(m_base, vstack_off(i));
         rref(s);
     }
-    
+    // Next, free out the locals, which are the register
     for (unsigned i=0; i<m_jframe->num_vars(); i++) {
         Val& s = m_jframe->var(i);
         if (!s.is_reg() || s.reg() != ar) { continue; };
@@ -161,15 +161,26 @@
     }
     //
     // Now, free up the stack items that are the memory
+    // addressed via register (e.g. an instance field value)
     //
     for (unsigned i=0; is_gr(ar) && i<m_jframe->size(); i++) {
         Val& s = m_jframe->dip(i);
         if (!s.is_mem() || !s.uses(ar)) { continue; };
-        push(s.as_opnd(jobj));
+        bool need_double_slot = is_ia32() && is_wide(s.jt());
+        push(s.as_opnd(iplatf));
+        if (need_double_slot) {
+            Opnd hi_mem(iplatf, s.base(), s.disp() + STACK_SLOT_SIZE, s.index(), s.scale());
+            push(hi_mem);
+        }
         rfree(s);
-        s.to_mem(m_base, vstack_off(i));
+        int stack_off = vstack_off(i);
+        s.to_mem(m_base, stack_off);
         rref(s);
-        Opnd stk(jobj, m_base, vstack_off(i));
+        if (need_double_slot) {
+            Opnd hi_stk(iplatf, m_base, stack_off + STACK_SLOT_SIZE);
+            pop(hi_stk);
+        }
+        Opnd stk(iplatf, m_base, stack_off);
         pop(stk);
     }
     if (is_set(DBG_TRACE_CG)) { dbg(";;>~spill\n"); }



Mime
View raw message