Author: Carl Friedrich Bolz-Tereick <[email protected]>
Branch: guard-compatible
Changeset: r93695:09d66ba1f81c
Date: 2018-01-22 11:36 +0100
http://bitbucket.org/pypy/pypy/changeset/09d66ba1f81c/

Log:    test and fix

diff --git a/rpython/jit/backend/llsupport/test/zrpy_gc_test.py 
b/rpython/jit/backend/llsupport/test/zrpy_gc_test.py
--- a/rpython/jit/backend/llsupport/test/zrpy_gc_test.py
+++ b/rpython/jit/backend/llsupport/test/zrpy_gc_test.py
@@ -903,3 +903,41 @@
 
     def test_multiple_pinned(self):
         self.run('multiple_pinned')
+
+    def define_guard_compatible(cls):
+        from rpython.rlib.jit import elidable_compatible
+        # a simple smoke test to see whether guard_compatible works at all
+        class S(object):
+            pass
+        p1 = S()
+        p1.x = 5
+
+        p2 = S()
+        p2.x = 5
+
+        p3 = S()
+        p3.x = 6
+
+        class A(object):
+            pass
+
+        c = A()
+        c.count = 0
+        @elidable_compatible()
+        def g(s, ignored):
+            c.count += 1
+            return s.x
+
+        def f(n, x, *args):
+            if x.x:
+                a = p1
+            else:
+                a = p3
+            n -= g(a, "abc")
+            return (n, x) + args
+
+        return None, f, None
+
+    def test_guard_compatible(self):
+        self.run('guard_compatible')
+
diff --git a/rpython/jit/backend/x86/guard_compat.py 
b/rpython/jit/backend/x86/guard_compat.py
--- a/rpython/jit/backend/x86/guard_compat.py
+++ b/rpython/jit/backend/x86/guard_compat.py
@@ -183,6 +183,7 @@
     # contains one extra word on the stack:
     #    - saved RAX
 
+    assembler.pending_slowpaths = []
     mc = codebuf.MachineCodeBlockWrapper()
     mc.force_frame_size(frame_size)
     if IS_X86_32:    # save edi as an extra scratch register
@@ -286,6 +287,7 @@
         XXX
         mc.JMP_s(0)
 
+    assembler.flush_pending_slowpaths(mc)
     assembler.guard_compat_search_tree = mc.materialize(assembler.cpu, [])
 
 
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to