You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by eg...@apache.org on 2008/01/23 07:29:28 UTC

svn commit: r614435 - /harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/abcd/classic_abcd.cpp

Author: egor
Date: Tue Jan 22 22:29:24 2008
New Revision: 614435

URL: http://svn.apache.org/viewvc?rev=614435&view=rev
Log:
small enhancement of ABCD allowing to prove redundant checks where operands are
converted back and forth between int and long. The comment in code tells why it
should be safe.

No effect on benchmarks. Synthetic tests show extra eliminated checks, but not
much effect on performance.


Modified:
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/abcd/classic_abcd.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/abcd/classic_abcd.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/abcd/classic_abcd.cpp?rev=614435&r1=614434&r2=614435&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/abcd/classic_abcd.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/abcd/classic_abcd.cpp Tue Jan 22 22:29:24 2008
@@ -253,6 +253,11 @@
 }
 //------------------------------------------------------------------------------
 
+bool isIntOrLong(Type* t) {
+    return t->isInt4() || t->isInt8();
+}
+//------------------------------------------------------------------------------
+
 void BuildInequalityGraphWalker::applyToInst(Inst* inst)
 {
     assert(inst);
@@ -292,6 +297,25 @@
             proxy_dst = addOldOrCreateOpnd(inst->getDst());
             addDistance(proxy_dst, findProxy(inst->getSrc(0)), 0, 
                         false /* negate */);
+        }
+            break;
+        case Op_Conv:
+        {
+            // adding conversions int<->long as zero-length edges to the
+            // inequality graph. This is a small enhancement to the paper's
+            // algorithm, but it is safe. The proof is as follows: if we ensure
+            // that a value of type 'long' is in good bounds for array access,
+            // then is is proven to be not outside bounds for type 'int'
+            Opnd* src = inst->getSrc(0);
+            Opnd* dst = inst->getDst();
+            if ( isIntOrLong(src->getType()) &&
+                 isIntOrLong(dst->getType()) ) {
+                proxy_dst = addOldOrCreateOpnd(inst->getDst());
+                addDistance(proxy_dst, findProxy(inst->getSrc(0)), 0, 
+                            false /* negate */);
+            }else{
+                addOldOrCreateOpnd(inst->getDst())->setUnconstrained(true);
+            }
         }
             break;
         case Op_Add: