[pypy-svn] r23038 - pypy/dist/pypy/jit

arigo at codespeak.net arigo at codespeak.net
Sun Feb 5 14:43:33 CET 2006


Author: arigo
Date: Sun Feb  5 14:43:31 2006
New Revision: 23038

Modified:
   pypy/dist/pypy/jit/hintrconstant.py
   pypy/dist/pypy/jit/hintrtyper.py
Log:
(pedronis, arigo)

Lower obscurity level.  (A bit.)



Modified: pypy/dist/pypy/jit/hintrconstant.py
==============================================================================
--- pypy/dist/pypy/jit/hintrconstant.py	(original)
+++ pypy/dist/pypy/jit/hintrconstant.py	Sun Feb  5 14:43:31 2006
@@ -44,3 +44,9 @@
         return r
 
 fixed_signed_repr = LLFixedConstantRepr(lltype.Signed)
+
+# collect the global precomputed reprs
+PRECOMPUTED_FIXED_REPRS = {}
+for _r in globals().values():
+    if isinstance(_r, LLFixedConstantRepr):
+        PRECOMPUTED_FIXED_REPRS[_r.lowleveltype] = _r

Modified: pypy/dist/pypy/jit/hintrtyper.py
==============================================================================
--- pypy/dist/pypy/jit/hintrtyper.py	(original)
+++ pypy/dist/pypy/jit/hintrtyper.py	Sun Feb  5 14:43:31 2006
@@ -17,11 +17,7 @@
     def __init__(self, hannotator):
     	RPythonTyper.__init__(self, hannotator, 
                               type_system=HintTypeSystem.instance)
-        self._fixed_reprs = {}
-        # insert the precomputed fixed reprs
-        for key, value in hintrconstant.__dict__.items():
-            if isinstance(value, hintrconstant.LLFixedConstantRepr):
-                self._fixed_reprs[value.lowleveltype] = value
+        self._fixed_reprs = hintrconstant.PRECOMPUTED_FIXED_REPRS.copy()
 
 # register operations from model
 HintTyper._registeroperations(hintmodel)



More information about the Pypy-commit mailing list