[pypy-commit] pypy heap-caching-during-tracing: fix len(virtualizable.array)

cfbolz noreply at buildbot.pypy.org
Sun Jul 17 11:06:41 CEST 2011


Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: heap-caching-during-tracing
Changeset: r45695:c5da400baff3
Date: 2011-07-17 08:02 +0200
http://bitbucket.org/pypy/pypy/changeset/c5da400baff3/

Log:	fix len(virtualizable.array)

diff --git a/pypy/jit/metainterp/pyjitpl.py b/pypy/jit/metainterp/pyjitpl.py
--- a/pypy/jit/metainterp/pyjitpl.py
+++ b/pypy/jit/metainterp/pyjitpl.py
@@ -713,8 +713,7 @@
     @arguments("orgpc", "box", "descr", "descr")
     def opimpl_arraylen_vable(self, pc, box, fdescr, adescr):
         if self._nonstandard_virtualizable(pc, box):
-            arraybox = self.metainterp.execute_and_record(rop.GETFIELD_GC,
-                                                          fdescr, box)
+            arraybox = self._opimpl_getfield_gc_any(box, fdescr)
             return self.execute_with_descr(rop.ARRAYLEN_GC, adescr, arraybox)
         vinfo = self.metainterp.jitdriver_sd.virtualizable_info
         virtualizable_box = self.metainterp.virtualizable_boxes[-1]
diff --git a/pypy/jit/metainterp/test/test_tracingopts.py b/pypy/jit/metainterp/test/test_tracingopts.py
--- a/pypy/jit/metainterp/test/test_tracingopts.py
+++ b/pypy/jit/metainterp/test/test_tracingopts.py
@@ -325,7 +325,7 @@
 
             def __init__(self, a, s):
                 self = jit.hint(self, access_directly=True, fresh_virtualizable=True)
-                self.l = [0] * 4
+                self.l = [0] * (4 + a)
                 self.s = s
 
         def f(n, a, i):
@@ -335,7 +335,7 @@
             frame.l[2] = a + 2
             frame.l[3] = a + 3
             if not i:
-                return frame.l[0]
+                return frame.l[0] + len(frame.l)
             x = 0
             while n > 0:
                 myjitdriver.can_enter_jit(frame=frame, n=n, x=x, i=i)


More information about the pypy-commit mailing list