[pypy-svn] r28548 - in pypy/dist/pypy: annotation rpython

mwh at codespeak.net mwh at codespeak.net
Thu Jun 8 18:17:58 CEST 2006


Author: mwh
Date: Thu Jun  8 18:17:57 2006
New Revision: 28548

Modified:
   pypy/dist/pypy/annotation/bookkeeper.py
   pypy/dist/pypy/rpython/raddress.py
Log:
(mwh, pedronis)
TREMENDOUSLY obscure fix for the non-trivia constant weakgcaddress support.


Modified: pypy/dist/pypy/annotation/bookkeeper.py
==============================================================================
--- pypy/dist/pypy/annotation/bookkeeper.py	(original)
+++ pypy/dist/pypy/annotation/bookkeeper.py	Thu Jun  8 18:17:57 2006
@@ -462,6 +462,15 @@
             self.descs[pyobj] = result
             return result
 
+    def have_seen(self, x):
+        # this might need to expand some more.
+        if x in self.descs:
+            return True
+        elif x in self.seen_mutable:
+            return True
+        else:
+            return False
+        
     def getfrozen(self, pyobj):
         result = description.FrozenDesc(self, pyobj)
         cls = result.knowntype

Modified: pypy/dist/pypy/rpython/raddress.py
==============================================================================
--- pypy/dist/pypy/rpython/raddress.py	(original)
+++ pypy/dist/pypy/rpython/raddress.py	Thu Jun  8 18:17:57 2006
@@ -152,7 +152,12 @@
             return value
         ob = value.ref()
         assert ob is not None
-        repr = self.rtyper.bindingrepr(Constant(ob))
-        newob = repr.convert_const(ob)
-        return cast_object_to_weakgcaddress(newob)
-
+        bk = self.rtyper.annotator.bookkeeper
+        # obscure!  if the annotator hasn't seen this object before,
+        # we don't want to look at it now (confusion tends to result).
+        if bk.have_seen(ob):
+            repr = self.rtyper.bindingrepr(Constant(ob))
+            newob = repr.convert_const(ob)
+            return cast_object_to_weakgcaddress(newob)
+        else:
+            return llmemory.fakeweakaddress(None)



More information about the Pypy-commit mailing list