Author: Carl Friedrich Bolz <[email protected]>
Branch: improve-heap-caching-tracing
Changeset: r47211:6be75d4f91c3
Date: 2011-09-08 22:02 +0200
http://bitbucket.org/pypy/pypy/changeset/6be75d4f91c3/

Log:    - fix XXXs in tests
        - use dict.keys() instead of list(dict)

diff --git a/pypy/jit/metainterp/heapcache.py b/pypy/jit/metainterp/heapcache.py
--- a/pypy/jit/metainterp/heapcache.py
+++ b/pypy/jit/metainterp/heapcache.py
@@ -1,4 +1,3 @@
-from pypy.jit.codewriter.effectinfo import EffectInfo
 from pypy.jit.metainterp.history import ConstInt
 from pypy.jit.metainterp.resoperation import rop
 
@@ -45,14 +44,14 @@
                 return
             # A special case for ll_arraycopy, because it is so common, and its
             # effects are so well defined.
-            elif effectinfo.oopspecindex == EffectInfo.OS_ARRAYCOPY:
+            elif effectinfo.oopspecindex == effectinfo.OS_ARRAYCOPY:
                 # The destination box
                 if argboxes[2] in self.new_boxes:
                     # XXX: no descr here so we invalidate any of them, not just
                     # of the correct type
                     for descr, cache in self.heap_array_cache.iteritems():
                         for idx, cache in cache.iteritems():
-                            for frombox in list(cache):
+                            for frombox in cache.keys():
                                 if frombox not in self.new_boxes:
                                     del cache[frombox]
                     return
diff --git a/pypy/jit/metainterp/test/test_heapcache.py 
b/pypy/jit/metainterp/test/test_heapcache.py
--- a/pypy/jit/metainterp/test/test_heapcache.py
+++ b/pypy/jit/metainterp/test/test_heapcache.py
@@ -25,6 +25,8 @@
     EF_FORCES_VIRTUAL_OR_VIRTUALIZABLE = 5 #can raise and force virtualizables
     EF_RANDOM_EFFECTS                  = 6 #can do whatever
 
+    OS_ARRAYCOPY = 0
+
     def __init__(self, extraeffect, oopspecindex):
         self.extraeffect = extraeffect
         self.oopspecindex = oopspecindex
@@ -305,14 +307,13 @@
         # Just need the destination box for this call
         h.invalidate_caches(
             rop.CALL,
-            # XXX: hardcoded oopspecindex
-            FakeCallDescr(FakeEffektinfo.EF_CANNOT_RAISE, 1),
+            FakeCallDescr(FakeEffektinfo.EF_CANNOT_RAISE, 
FakeEffektinfo.OS_ARRAYCOPY),
             [None, None, box2, None, None]
         )
         assert h.getarrayitem(box1, descr1, index1) is box2
         h.invalidate_caches(
             rop.CALL,
-            FakeCallDescr(FakeEffektinfo.EF_CANNOT_RAISE, 1),
+            FakeCallDescr(FakeEffektinfo.EF_CANNOT_RAISE, 
FakeEffektinfo.OS_ARRAYCOPY),
             [None, None, box3, None, None]
         )
         assert h.getarrayitem(box1, descr1, index1) is None
@@ -321,8 +322,7 @@
         assert h.getarrayitem(box4, descr1, index1) is box2
         h.invalidate_caches(
             rop.CALL,
-            # XXX: hardcoded oopspecindex
-            FakeCallDescr(FakeEffektinfo.EF_CANNOT_RAISE, 1),
+            FakeCallDescr(FakeEffektinfo.EF_CANNOT_RAISE, 
FakeEffektinfo.OS_ARRAYCOPY),
             [None, None, box2, None, None]
         )
         assert h.getarrayitem(box4, descr1, index1) is None
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to