[pypy-commit] pypy kill-gen-store-back-in: a test and a fix

fijal noreply at buildbot.pypy.org
Thu Jul 11 13:08:57 CEST 2013


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: kill-gen-store-back-in
Changeset: r65340:3b852252d21e
Date: 2013-07-11 13:08 +0200
http://bitbucket.org/pypy/pypy/changeset/3b852252d21e/

Log:	a test and a fix

diff --git a/rpython/jit/metainterp/pyjitpl.py b/rpython/jit/metainterp/pyjitpl.py
--- a/rpython/jit/metainterp/pyjitpl.py
+++ b/rpython/jit/metainterp/pyjitpl.py
@@ -714,6 +714,8 @@
         # that is stored in metainterp.virtualizable_boxes[-1]
         if self.metainterp.heapcache.is_nonstandard_virtualizable(box):
             return True
+        if box is self.metainterp.forced_virtualizable:
+            self.metainterp.forced_virtualizable = None
         if (self.metainterp.jitdriver_sd.virtualizable_info is not None or
             self.metainterp.jitdriver_sd.greenfield_info is not None):
             standard_box = self.metainterp.virtualizable_boxes[-1]
@@ -1613,6 +1615,7 @@
         self.portal_trace_positions = []
         self.free_frames_list = []
         self.last_exc_value_box = None
+        self.forced_virtualizable = None
         self.partial_trace = None
         self.retracing_from = -1
         self.call_pure_results = args_dict_box()
@@ -2277,6 +2280,8 @@
         if vinfo is None:
             return
         vbox = self.virtualizable_boxes[-1]
+        if vbox is self.forced_virtualizable:
+            return # we already forced it by hand
         force_token_box = history.BoxPtr()
         # in case the force_token has not been recorded, record it here
         # to make sure we know the virtualizable can be broken. However, the
@@ -2524,6 +2529,11 @@
                 # ignore the hint on non-standard virtualizable
                 # specifically, ignore it on a virtual
                 return
+            if self.forced_virtualizable is not None:
+                # this can happen only in strange cases, but we don't care
+                # it was already forced
+                return
+            self.forced_virtualizable = vbox
             for i in range(vinfo.num_static_extra_boxes):
                 fieldbox = self.virtualizable_boxes[i]
                 descr = vinfo.static_field_descrs[i]
diff --git a/rpython/jit/metainterp/test/test_virtualizable.py b/rpython/jit/metainterp/test/test_virtualizable.py
--- a/rpython/jit/metainterp/test/test_virtualizable.py
+++ b/rpython/jit/metainterp/test/test_virtualizable.py
@@ -1576,7 +1576,11 @@
         if bridge is not None:
             l = [op for op in
                  bridge.operations if op.getopnum() == rop.SETFIELD_GC]
-            assert len(l) == 2
+            assert "'inst_x'" in str(l[0].getdescr().realdescrref())
+            assert len(l) == 1 # no vable token
+            l = [op for op in bridge.operations if
+                 op.getopnum() == rop.GUARD_NOT_FORCED_2]
+            assert len(l) == 0
 
 class TestLLtype(ExplicitVirtualizableTests,
                  ImplicitVirtualizableTests,


More information about the pypy-commit mailing list