[pypy-commit] pypy default: Add another test that switch() calls are supposed to have an

arigo noreply at buildbot.pypy.org
Wed Nov 30 02:43:56 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r49990:36e3174f324f
Date: 2011-11-30 02:24 +0100
http://bitbucket.org/pypy/pypy/changeset/36e3174f324f/

Log:	Add another test that switch() calls are supposed to have an
	effectinfo of EF_RANDOM_EFFECTS. I thought it was tested already,
	but it's not, and it fails.

diff --git a/pypy/jit/codewriter/test/test_call.py b/pypy/jit/codewriter/test/test_call.py
--- a/pypy/jit/codewriter/test/test_call.py
+++ b/pypy/jit/codewriter/test/test_call.py
@@ -192,3 +192,21 @@
     [op] = block.operations
     call_descr = cc.getcalldescr(op)
     assert call_descr.extrainfo.has_random_effects()
+
+def test_random_effects_on_stacklet_switch():
+    from pypy.jit.backend.llgraph.runner import LLtypeCPU
+    from pypy.rlib._rffi_stacklet import switch, thread_handle, handle
+    @jit.dont_look_inside
+    def f():
+        switch(rffi.cast(thread_handle, 0), rffi.cast(handle, 0))
+
+    rtyper = support.annotate(f, [])
+    jitdriver_sd = FakeJitDriverSD(rtyper.annotator.translator.graphs[0])
+    cc = CallControl(LLtypeCPU(rtyper), jitdrivers_sd=[jitdriver_sd])
+    res = cc.find_all_graphs(FakePolicy())
+
+    [f_graph] = [x for x in res if x.func is f]
+    [block, _] = list(f_graph.iterblocks())
+    op = block.operations[-1]
+    call_descr = cc.getcalldescr(op)
+    assert call_descr.extrainfo.has_random_effects()


More information about the pypy-commit mailing list