harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r490306 - /harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/simplifier.cpp
Date Tue, 26 Dec 2006 15:01:02 GMT
Author: apetrenko
Date: Tue Dec 26 07:01:01 2006
New Revision: 490306

URL: http://svn.apache.org/viewvc?view=rev&rev=490306
Log:
Patch for HARMONY-2806 "[drlvm][jit][opt] Simplifier does not optimize loading of fun addr
slot of known type"

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

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/simplifier.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/simplifier.cpp?view=diff&rev=490306&r1=490305&r2=490306
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/simplifier.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/simplifier.cpp Tue Dec 26 07:01:01
2006
@@ -3541,23 +3541,30 @@
     // if vtable is an interface vtable and the base of that
     // interface vtable is exact or final then change this
     // to a ldvirtfunaddrslot
+    // if vtable is of exact type (loaded by getvtable) then
+    // change this to a ldvirtfunaddrslot
     Inst* ldVTableInst = vtable->getInst();
+    Type* baseType = NULL;
     if (ldVTableInst->getOpcode() == Op_TauLdVTableAddr || 
         ldVTableInst->getOpcode() == Op_TauLdIntfcVTableAddr) {
         Opnd* baseRef = ldVTableInst->getSrc(0);
         if (isExactType(baseRef)) {
             // base has exact type
-            Type* baseType = baseRef->getType();
-            MethodDesc* newMethodDesc =
-                irManager.getCompilationInterface().getOverriddenMethod(
-                    (NamedType*)baseType, methodDesc);
-            //
+            baseType = baseRef->getType();
+        }
+    } else if (ldVTableInst->getOpcode() == Op_GetVTableAddr) {
+        TypeInst* typeInst = ldVTableInst->asTypeInst();
+        assert(typeInst != NULL);
+        baseType = typeInst->getTypeInfo();
+    }
+    if (baseType != NULL) {
+        MethodDesc* newMethodDesc =
+            irManager.getCompilationInterface().getOverriddenMethod((NamedType*)baseType,
methodDesc);
+        if (newMethodDesc) {
             // change to ldvirtfunaddrslot of newMethodDesc
-            //
-            if (newMethodDesc)
-                return genLdFunAddrSlot(newMethodDesc)->getDst();
+            return genLdFunAddrSlot(newMethodDesc)->getDst();
         }
-    } else {
+
     }
     return NULL;
 }



Mime
View raw message