[pypy-svn] pypy jit-virtual_state: fixed forced case

hakanardo commits-noreply at bitbucket.org
Sat Feb 5 11:40:03 CET 2011


Author: Hakan Ardo <hakan at debian.org>
Branch: jit-virtual_state
Changeset: r41628:6fd1e52a389a
Date: 2011-02-05 11:38 +0100
http://bitbucket.org/pypy/pypy/changeset/6fd1e52a389a/

Log:	fixed forced case

diff --git a/pypy/jit/metainterp/optimizeopt/unroll.py b/pypy/jit/metainterp/optimizeopt/unroll.py
--- a/pypy/jit/metainterp/optimizeopt/unroll.py
+++ b/pypy/jit/metainterp/optimizeopt/unroll.py
@@ -199,7 +199,6 @@
             if self.known_class != other.known_class: # FIXME: use issubclass?
                 return False
         return self.intbound.contains_bound(other.intbound)
-            
 
 class UnrollOptimizer(Optimization):
     """Unroll the loop into two iterations. The first one will
@@ -605,8 +604,7 @@
                 args = op.getarglist()
                 modifier = VirtualStateAdder(self.optimizer)
                 virtual_state = modifier.get_virtual_state(args)
-                print 'len', len(short)
-                for sh in short:
+                for sh in short:                                        
                     if sh.virtual_state.more_general_than(virtual_state):
                         # FIXME: Do we still need the dry run
                         if self.inline(sh.operations, sh.inputargs,

diff --git a/pypy/jit/metainterp/test/test_send.py b/pypy/jit/metainterp/test/test_send.py
--- a/pypy/jit/metainterp/test/test_send.py
+++ b/pypy/jit/metainterp/test/test_send.py
@@ -334,6 +334,10 @@
         class State:
             count = 0
             def externfn(self, n):
+                print
+                print
+                print n, 198 - self.count
+                print
                 assert n == 198 - self.count
                 self.count += 1
                 if n % 5:
@@ -439,7 +443,7 @@
         if self.optimizer != OPTIMIZER_FULL:
             self.check_tree_loop_count(1)
         else:
-            self.check_tree_loop_count(2)
+            self.check_tree_loop_count(6)
 
     def test_three_classes(self):
         class Base:

diff --git a/pypy/jit/metainterp/optimizeopt/virtualize.py b/pypy/jit/metainterp/optimizeopt/virtualize.py
--- a/pypy/jit/metainterp/optimizeopt/virtualize.py
+++ b/pypy/jit/metainterp/optimizeopt/virtualize.py
@@ -95,8 +95,12 @@
 
     def _get_field_descr_list(self):
         _cached_sorted_fields = self._cached_sorted_fields
+        if self._fields is None:
+            nfields = 0
+        else:
+            nfields = len(self._fields)
         if (_cached_sorted_fields is not None and
-            len(self._fields) == len(_cached_sorted_fields)):
+            nfields == len(_cached_sorted_fields)):
             lst = self._cached_sorted_fields
         else:
             if self._fields is None:


More information about the Pypy-commit mailing list