[pypy-commit] pypy conditional_call_value_2: "Test" and fix. It's hard to really test because the test previously

arigo pypy.commits at gmail.com
Sun Sep 11 04:00:57 EDT 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: conditional_call_value_2
Changeset: r86989:4aa76477570f
Date: 2016-09-11 10:00 +0200
http://bitbucket.org/pypy/pypy/changeset/4aa76477570f/

Log:	"Test" and fix. It's hard to really test because the test previously
	passed too, just by emitting gcc warnings

diff --git a/rpython/rlib/test/test_jit.py b/rpython/rlib/test/test_jit.py
--- a/rpython/rlib/test/test_jit.py
+++ b/rpython/rlib/test/test_jit.py
@@ -320,3 +320,13 @@
         assert res == 10
         res = self.interpret(f, [-1, 200])
         assert res == 242
+
+    def test_compiled_conditional_call_value(self):
+        from rpython.translator.c.test.test_genc import compile
+        def g(m):
+            return m + 42
+        def f(n, m):
+            return conditional_call_value(n, -1, g, m)
+        fn = compile(f, [int, int], backendopt=False)
+        assert fn(10, 200) == 10
+        assert fn(-1, 200) == 242
diff --git a/rpython/translator/c/funcgen.py b/rpython/translator/c/funcgen.py
--- a/rpython/translator/c/funcgen.py
+++ b/rpython/translator/c/funcgen.py
@@ -453,7 +453,7 @@
         fnexpr = '((%s)%s)' % (cdecl(typename, ''), self.expr(fnaddr))
         return self.generic_call(FUNC, fnexpr, op.args[1:], op.result)
 
-    def OP_JIT_CONDITIONAL_CALL(self, op):
+    def OP_JIT_CONDITIONAL_CALL_VALUE(self, op):
         return 'abort();  /* jit_conditional_call */'
 
     # low-level operations


More information about the pypy-commit mailing list