[pypy-commit] pypy stmgc-static-barrier: Hack to avoid the algorithm getting stuck (maybe)
arigo
noreply at buildbot.pypy.org
Thu Aug 22 18:40:19 CEST 2013
Author: Armin Rigo <arigo at tunes.org>
Branch: stmgc-static-barrier
Changeset: r66291:1ffdd0bbbb60
Date: 2013-08-22 18:39 +0200
http://bitbucket.org/pypy/pypy/changeset/1ffdd0bbbb60/
Log: Hack to avoid the algorithm getting stuck (maybe)
diff --git a/rpython/translator/stm/test/test_writebarrier.py b/rpython/translator/stm/test/test_writebarrier.py
--- a/rpython/translator/stm/test/test_writebarrier.py
+++ b/rpython/translator/stm/test/test_writebarrier.py
@@ -463,6 +463,32 @@
assert res == True
assert self.barriers == []
+ def test_infinite_loop_bug(self):
+ class A(object):
+ user_overridden_class = False
+
+ def stuff(self):
+ return 12.3
+
+ def immutable_unique_id(self):
+ if self.user_overridden_class:
+ return None
+ from rpython.rlib.longlong2float import float2longlong
+ from rpython.rlib.rarithmetic import r_ulonglong
+ from rpython.rlib.rbigint import rbigint
+ real = self.stuff()
+ imag = self.stuff()
+ real_b = rbigint.fromrarith_int(float2longlong(real))
+ imag_b = rbigint.fromrarith_int(r_ulonglong(float2longlong(imag)))
+ val = real_b.lshift(64).or_(imag_b).lshift(3)
+ return val
+
+ def f():
+ return A().immutable_unique_id()
+
+ for i in range(10):
+ self.interpret(f, [], run=False)
+
external_release_gil = rffi.llexternal('external_release_gil', [], lltype.Void,
_callable=lambda: None,
diff --git a/rpython/translator/stm/test/transform_support.py b/rpython/translator/stm/test/transform_support.py
--- a/rpython/translator/stm/test/transform_support.py
+++ b/rpython/translator/stm/test/transform_support.py
@@ -38,7 +38,7 @@
return 'I' # allocated with immortal=True
raise AssertionError("unknown category on %r" % (p,))
- def interpret(self, fn, args, gcremovetypeptr=False):
+ def interpret(self, fn, args, gcremovetypeptr=False, run=True):
self.build_state()
clear_tcache()
interp, self.graph = get_interpreter(fn, args, view=False)
@@ -60,8 +60,9 @@
if self.do_jit_driver:
import py
py.test.skip("XXX how to test?")
- result = interp.eval_graph(self.graph, args)
- return result
+ if run:
+ result = interp.eval_graph(self.graph, args)
+ return result
class LLSTMFrame(LLFrame):
@@ -131,7 +132,7 @@
cat = self.check_category(obj, None)
p = opimpl.op_cast_pointer(RESTYPE, obj)
return _stmptr(p, cat)
- return LLFrame.op_cast_pointer(self, RESTYPE, obj)
+ return lltype.cast_pointer(RESTYPE, obj)
op_cast_pointer.need_result_type = True
def op_cast_opaque_ptr(self, RESTYPE, obj):
diff --git a/rpython/translator/stm/writebarrier.py b/rpython/translator/stm/writebarrier.py
--- a/rpython/translator/stm/writebarrier.py
+++ b/rpython/translator/stm/writebarrier.py
@@ -358,7 +358,11 @@
pending.add(bt)
while pending:
- bt = pending.pop()
+ # XXX sadly, this seems to be order-dependent. Picking the minimum
+ # of the blocks seems to be necessary, too, to avoid the situation
+ # of two blocks chasing each other around a loop :-(
+ bt = min(pending)
+ pending.remove(bt)
bt.flow_through_block(graphinfo)
pending |= bt.update_targets(block_transformers)
More information about the pypy-commit
mailing list