[pypy-svn] r11941 - in pypy/dist/pypy: interpreter tool

arigo at codespeak.net arigo at codespeak.net
Wed May 4 16:52:42 CEST 2005


Author: arigo
Date: Wed May  4 16:52:42 2005
New Revision: 11941

Modified:
   pypy/dist/pypy/interpreter/typedef.py
   pypy/dist/pypy/tool/cache.py
Log:
_freeze_() method for TypeDef and Cache classes.


Modified: pypy/dist/pypy/interpreter/typedef.py
==============================================================================
--- pypy/dist/pypy/interpreter/typedef.py	(original)
+++ pypy/dist/pypy/interpreter/typedef.py	Wed May  4 16:52:42 2005
@@ -20,6 +20,9 @@
         self.rawdict = rawdict
         self.acceptable_as_base_class = True
 
+    def _freeze_(self):
+        # hint for the annotator: track individual constant instances of TypeDef
+        return True
 
 unique_interplevel_subclass_cache = Cache()
 def get_unique_interplevel_subclass(cls, hasdict, wants_slots):

Modified: pypy/dist/pypy/tool/cache.py
==============================================================================
--- pypy/dist/pypy/tool/cache.py	(original)
+++ pypy/dist/pypy/tool/cache.py	Wed May  4 16:52:42 2005
@@ -36,3 +36,9 @@
             self.content[key] = result
             return result
     getorbuild._specialize_ = "memo"
+
+    def _freeze_(self):
+        # needs to be SomePBC, but otherwise we can't really freeze the
+        # cache because more getorbuild() calls might be discovered later
+        # during annotation.
+        return True



More information about the Pypy-commit mailing list