Author: Carl Friedrich Bolz <[email protected]>
Branch: small-unroll-improvements
Changeset: r70481:9a05f922f9ee
Date: 2014-04-07 17:21 +0200
http://bitbucket.org/pypy/pypy/changeset/9a05f922f9ee/

Log:    rename confusing _generalization_of and remove useless copies

diff --git a/rpython/jit/metainterp/optimizeopt/virtualstate.py 
b/rpython/jit/metainterp/optimizeopt/virtualstate.py
--- a/rpython/jit/metainterp/optimizeopt/virtualstate.py
+++ b/rpython/jit/metainterp/optimizeopt/virtualstate.py
@@ -76,7 +76,7 @@
         self.fielddescrs = fielddescrs
 
     def generalization_of_renumbering_done(self, other, renum, bad):
-        if not self._generalization_of(other):
+        if not self._generalization_of_structpart(other):
             return False
 
         assert isinstance(other, AbstractVirtualStructStateInfo)
@@ -94,7 +94,7 @@
 
         return True
 
-    def _generalization_of(self, other):
+    def _generalization_of_structpart(self, other):
         raise NotImplementedError
 
     def enum_forced_boxes(self, boxes, value, optimizer):
@@ -121,7 +121,7 @@
         AbstractVirtualStructStateInfo.__init__(self, fielddescrs)
         self.known_class = known_class
 
-    def _generalization_of(self, other):
+    def _generalization_of_structpart(self, other):
         return (isinstance(other, VirtualStateInfo) and
                 self.known_class.same_constant(other.known_class))
 
@@ -134,7 +134,7 @@
         AbstractVirtualStructStateInfo.__init__(self, fielddescrs)
         self.typedescr = typedescr
 
-    def _generalization_of(self, other):
+    def _generalization_of_structpart(self, other):
         return (isinstance(other, VStructStateInfo) and
                 self.typedescr is other.typedescr)
 
@@ -147,12 +147,10 @@
     def __init__(self, arraydescr):
         self.arraydescr = arraydescr
 
-    def _generalization_of(self, other):
-        return (isinstance(other, VArrayStateInfo) and
-            self.arraydescr is other.arraydescr)
-
     def generalization_of_renumbering_done(self, other, renum, bad):
-        if not self._generalization_of(other):
+        if not isinstance(other, VArrayStateInfo):
+            return False
+        if self.arraydescr is not other.arraydescr:
             return False
         if len(self.fieldstate) != len(other.fieldstate):
             return False
@@ -189,10 +187,11 @@
         self.fielddescrs = fielddescrs
 
     def generalization_of_renumbering_done(self, other, renum, bad):
-        if not self._generalization_of(other):
+        if not isinstance(other, VArrayStructStateInfo):
+            return False
+        if not self.arraydescr is not other.arraydescr:
             return False
 
-        assert isinstance(other, VArrayStructStateInfo)
         if len(self.fielddescrs) != len(other.fielddescrs):
             return False
 
@@ -209,10 +208,6 @@
                 p += 1
         return True
 
-    def _generalization_of(self, other):
-        return (isinstance(other, VArrayStructStateInfo) and
-            self.arraydescr is other.arraydescr)
-
     def _enum(self, virtual_state):
         for s in self.fieldstate:
             s.enum(virtual_state)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to