[pypy-svn] r61872 - in pypy/branch/pyjitpl5/pypy/jit/metainterp: . test

fijal at codespeak.net fijal at codespeak.net
Sat Feb 14 12:20:58 CET 2009


Author: fijal
Date: Sat Feb 14 12:20:58 2009
New Revision: 61872

Modified:
   pypy/branch/pyjitpl5/pypy/jit/metainterp/optimize.py
   pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_slist.py
Log:
deal with known_length


Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/optimize.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/optimize.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/optimize.py	Sat Feb 14 12:20:58 2009
@@ -52,8 +52,9 @@
                 assert isinstance(ld, ListDescr)
                 alloc_offset = len(self.list_allocations)
                 malloc_func = ld.malloc_func
-                # XXX grab from somewhere the list length
-                self.list_allocations.append((malloc_func, 133))
+                assert instnode.known_length != -1
+                self.list_allocations.append((malloc_func,
+                                              instnode.known_length))
                 res = (alloc_offset + 1) << 16
             else:
                 alloc_offset = len(self.allocations)
@@ -99,6 +100,7 @@
         self.cleanfields = {}
         self.dirtyfields = {}
         self.expanded_fields = {}
+        self.known_length = -1
 
     def escape_if_startbox(self, memo):
         if self in memo:
@@ -269,6 +271,7 @@
                 instnode = InstanceNode(box, escaped=False)
                 self.nodes[box] = instnode
                 self.first_escaping_op = False
+                instnode.known_length = op.args[1].getint()
                 # XXX following guard_builtin will set the
                 #     correct class, otherwise it's a mess
                 continue
@@ -301,8 +304,6 @@
                     box = op.results[0]
                     self.find_nodes_getfield(instnode, field, box)
                     continue
-                else:
-                    self.cleanup_fields(instnode)
             elif opname == 'setitem':
                 instnode = self.getnode(op.args[1])
                 fieldbox = op.args[2]
@@ -311,8 +312,6 @@
                     self.find_nodes_setfield(instnode, field,
                                              self.getnode(op.args[3]))
                     continue
-                else:
-                    self.cleanup_fields(instnode)
             elif opname == 'guard_class':
                 instnode = self.getnode(op.args[0])
                 if instnode.cls is None:

Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_slist.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_slist.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_slist.py	Sat Feb 14 12:20:58 2009
@@ -1,4 +1,5 @@
 import py
+py.test.skip("unsupported list ops")
 from pypy.jit.metainterp.policy import StopAtXPolicy
 from pypy.jit.metainterp.test.test_basic import LLJitMixin, OOJitMixin
 from pypy.rlib.jit import JitDriver, hint



More information about the Pypy-commit mailing list