[pypy-svn] pypy jit-virtual_state: make sure we have the same class or type

hakanardo commits-noreply at bitbucket.org
Sun Feb 6 12:58:30 CET 2011


Author: Hakan Ardo <hakan at debian.org>
Branch: jit-virtual_state
Changeset: r41644:94c4b6e6d04c
Date: 2011-02-06 11:30 +0100
http://bitbucket.org/pypy/pypy/changeset/94c4b6e6d04c/

Log:	make sure we have the same class or type

diff --git a/pypy/jit/metainterp/resume.py b/pypy/jit/metainterp/resume.py
--- a/pypy/jit/metainterp/resume.py
+++ b/pypy/jit/metainterp/resume.py
@@ -453,11 +453,6 @@
                         str(untag(self.fieldnums[i])))
 
     def generalization_of(self, other):
-        if not isinstance(other, AbstractVirtualStructInfo):
-            return False
-        if not self.known_class.same_constant(other.known_class):
-            return False
-        
         assert len(self.fielddescrs) == len(self.fieldstate)
         assert len(other.fielddescrs) == len(other.fieldstate)
         if len(self.fielddescrs) != len(other.fielddescrs):
@@ -468,7 +463,11 @@
                 return False
             if not self.fieldstate[i].generalization_of(other.fieldstate[i]):
                 return False
-        return True
+
+        return self._generalization_of(other)
+
+    def _generalization_of(self, other):
+        raise NotImplementedError
             
         
 
@@ -487,6 +486,14 @@
         debug_print("\tvirtualinfo", self.known_class.repr_rpython())
         AbstractVirtualStructInfo.debug_prints(self)
 
+    def _generalization_of(self, other):        
+        if not isinstance(other, VirtualInfo):
+            return False
+        if not self.known_class.same_constant(other.known_class):
+            return False
+        return True
+        
+
 class VStructInfo(AbstractVirtualStructInfo):
     def __init__(self, typedescr, fielddescrs):
         AbstractVirtualStructInfo.__init__(self, fielddescrs)
@@ -502,6 +509,14 @@
         debug_print("\tvstructinfo", self.typedescr.repr_rpython())
         AbstractVirtualStructInfo.debug_prints(self)
 
+    def _generalization_of(self, other):        
+        if not isinstance(other, VStructInfo):
+            return False
+        if self.typedescr is not other.typedescr:
+            return False
+        return True
+        
+
 class VArrayInfo(AbstractVirtualInfo):
     def __init__(self, arraydescr):
         self.arraydescr = arraydescr


More information about the Pypy-commit mailing list