[pypy-commit] pypy default: fix a very rare segfault in the JIT, shown by Pycket

cfbolz pypy.commits at gmail.com
Fri May 4 09:26:34 EDT 2018


Author: Carl Friedrich Bolz-Tereick <cfbolz at gmx.de>
Branch: 
Changeset: r94470:b0fdbba6aeab
Date: 2018-05-04 15:25 +0200
http://bitbucket.org/pypy/pypy/changeset/b0fdbba6aeab/

Log:	fix a very rare segfault in the JIT, shown by Pycket

	(neither did I manage to write a test, nor to fix the broken
	invariant, which we've seen in other contexts before already.)

diff --git a/rpython/jit/metainterp/optimizeopt/info.py b/rpython/jit/metainterp/optimizeopt/info.py
--- a/rpython/jit/metainterp/optimizeopt/info.py
+++ b/rpython/jit/metainterp/optimizeopt/info.py
@@ -260,6 +260,12 @@
             # we don't know about this item
             return
         op = optimizer.get_box_replacement(self._fields[fielddescr.get_index()])
+        if op is None:
+            # XXX same bug as in serialize_opt:
+            # op should never be None, because that's an invariant violation in
+            # AbstractCachedEntry. But it still seems to happen when the info
+            # is attached to a Constant. At least we shouldn't crash.
+            return
         opnum = OpHelpers.getfield_for_descr(fielddescr)
         getfield_op = ResOperation(opnum, [structbox], descr=fielddescr)
         shortboxes.add_heap_op(op, getfield_op)
@@ -589,6 +595,7 @@
             return
         item = self._items[index]
         if item is not None:
+            # see comment in AbstractStructPtrInfo.produce_short_preamble_ops
             op = optimizer.get_box_replacement(item)
             opnum = OpHelpers.getarrayitem_for_descr(descr)
             getarrayitem_op = ResOperation(opnum, [structbox, ConstInt(index)],


More information about the pypy-commit mailing list