[pypy-svn] r64632 - in pypy/branch/pyjitpl5-simplify/pypy/jit: backend/llgraph metainterp/test

antocuni at codespeak.net antocuni at codespeak.net
Fri Apr 24 12:21:43 CEST 2009


Author: antocuni
Date: Fri Apr 24 12:21:39 2009
New Revision: 64632

Modified:
   pypy/branch/pyjitpl5-simplify/pypy/jit/backend/llgraph/llimpl.py
   pypy/branch/pyjitpl5-simplify/pypy/jit/backend/llgraph/runner.py
   pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/test/test_vlist.py
Log:
- make sure that all OODescr are cached, so that two calls do *descrof(*args)
  returns equal objects with equal args

- typo

- test_list_pass_around passes



Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/backend/llgraph/llimpl.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/backend/llgraph/llimpl.py	(original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/backend/llgraph/llimpl.py	Fri Apr 24 12:21:39 2009
@@ -734,7 +734,7 @@
 
     op_getarrayitem_gc_pure = op_getarrayitem_gc
 
-    def op_setarrayitem_gc(self, arraydescr, array, index, newvalue):
+    def op_setarrayitem_gc(self, typedescr, obj, index, newvalue):
         array = ootype.cast_from_object(typedescr.ARRAY, obj)
         array.ll_setitem_fast(index, newvalue)
 

Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/backend/llgraph/runner.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/backend/llgraph/runner.py	(original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/backend/llgraph/runner.py	Fri Apr 24 12:21:39 2009
@@ -402,25 +402,25 @@
 
     @staticmethod
     def fielddescrof(T, fieldname):
-        return FieldDescr(T, fieldname)
+        return FieldDescr.new(T, fieldname)
 
     @staticmethod
     def calldescrof(FUNC, ARGS, RESULT):
-        return StaticMethDescr(FUNC, ARGS, RESULT)
+        return StaticMethDescr.new(FUNC, ARGS, RESULT)
 
     @staticmethod
     def methdescrof(SELFTYPE, methname):
-        return MethDescr(SELFTYPE, methname)
+        return MethDescr.new(SELFTYPE, methname)
 
     @staticmethod
     def typedescrof(TYPE):
-        return TypeDescr(TYPE)
+        return TypeDescr.new(TYPE)
 
     @staticmethod
     def arraydescrof(A):
         assert isinstance(A, ootype.Array)
         TYPE = A.ITEM
-        return TypeDescr(TYPE)
+        return TypeDescr.new(TYPE)
 
     def get_exception(self):
         if llimpl._last_exception:
@@ -531,7 +531,18 @@
 
 
 class OODescr(history.AbstractDescr):
-    pass
+    _cache = {}
+
+    @classmethod
+    def new(cls, *args):
+        'NOT_RPYTHON'
+        key = (cls, args)
+        try:
+            return cls._cache[key]
+        except KeyError:
+            res = cls(*args)
+            cls._cache[key] = res
+            return res
 
 class StaticMethDescr(OODescr):
 

Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/test/test_vlist.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/test/test_vlist.py	(original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/test/test_vlist.py	Fri Apr 24 12:21:39 2009
@@ -360,7 +360,6 @@
     def skip(self):
         py.test.skip('in-progress')
     
-    test_list_pass_around = skip
     test_cannot_be_virtual = skip
     test_ll_fixed_setitem_fast = skip
 



More information about the Pypy-commit mailing list