[pypy-commit] pypy guard-compatible: in-progress

arigo pypy.commits at gmail.com
Fri Feb 10 11:32:12 EST 2017


Author: Armin Rigo <arigo at tunes.org>
Branch: guard-compatible
Changeset: r90035:291ea6b8def5
Date: 2017-02-10 17:19 +0100
http://bitbucket.org/pypy/pypy/changeset/291ea6b8def5/

Log:	in-progress

diff --git a/rpython/jit/backend/llsupport/guard_compat.py b/rpython/jit/backend/llsupport/guard_compat.py
--- a/rpython/jit/backend/llsupport/guard_compat.py
+++ b/rpython/jit/backend/llsupport/guard_compat.py
@@ -97,19 +97,16 @@
     return rffi.cast(lltype.Unsigned, gcref)
 
 
-P_ARG = lltype.Struct('P_ARG', ('new_gcref', llmemory.GCREF),
-                               ('bchoices', lltype.Ptr(BACKEND_CHOICES)),
-                               ('jump_to', lltype.Signed))
-
 INVOKE_FIND_COMPATIBLE_FUNC = lltype.Ptr(lltype.FuncType(
-                [lltype.Ptr(P_ARG), lltype.Ptr(jitframe.JITFRAME)],
+                [rffi.SIGNEDP, lltype.Ptr(jitframe.JITFRAME)],
                 lltype.Void))
 
 @specialize.memo()
 def make_invoke_find_compatible(cpu):
     def invoke_find_compatible(p_arg, jitframe):
-        bchoices = p_arg.bchoices
-        new_gcref = p_arg.new_gcref
+        new_gcref = rffi.cast(llmemory.GCREF, p_arg[0])
+        bchoices = rffi.cast(lltype.Ptr(BACKEND_CHOICES), p_arg[1])
+        # ---GC operations cannot occur above---
         descr = bchoices.bc_faildescr
         descr = cast_gcref_to_instance(GuardCompatibleDescr, descr)
         try:
@@ -136,8 +133,9 @@
                 pdb.post_mortem(sys.exc_info()[2])
             result = cpu.assembler.guard_compat_recovery
         jitframe.jf_gcmap = lltype.nullptr(lltype.typeOf(jitframe.jf_gcmap).TO)
-        p_arg.bchoices = bchoices
-        p_arg.jump_to = result
+        # ---GC operations cannot occur below---
+        p_arg[0] = result
+        p_arg[1] = rffi.cast(lltype.Signed, bchoices)
     return invoke_find_compatible
 
 def add_in_tree(bchoices, new_gcref, new_asmaddr):
diff --git a/rpython/jit/backend/x86/assembler.py b/rpython/jit/backend/x86/assembler.py
--- a/rpython/jit/backend/x86/assembler.py
+++ b/rpython/jit/backend/x86/assembler.py
@@ -785,7 +785,6 @@
                 guard_compat.patch_guard_compatible(
                     tok, self._addr_from_gc_table,
                     self.gc_table_tracer, self.guard_compat_search_tree)
-                continue
             descr = tok.faildescr
             if descr.loop_version():
                 continue # patch them later
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
@@ -242,7 +242,7 @@
 
     # The _backend_choices object is still referenced from [RSP+16]
     # (which becomes [RSP+8] after the POP), where it is the second of a
-    # three-words array passed as argument to invoke_find_compatible().
+    # two-words array passed as argument to invoke_find_compatible().
     # The first word is the value, from RAX, which we store in (*)
     # below.
 
@@ -275,13 +275,13 @@
     # restore them all.
     assembler._pop_all_regs_from_frame(mc, [], withfloats=True)
 
-    # jump to the result, which is passed as the third word of the
+    # jump to the result, which is returned as the first word of the
     # array.  In case this goes to guard_compat_recovery, we also reload
     # the _backend_choices object from the second word of the array (the
     # GC may have moved it, or it may be a completely new object).
     if IS_X86_64:
-        mc.MOV_rs(r11, 1 * WORD)            # MOV R11, [RSP]
-        mc.JMP_s(2 * WORD)                  # JMP *[RSP+16]
+        mc.MOV_rs(r11, 1 * WORD)            # MOV R11, [RSP+8]
+        mc.JMP_s(0)                         # JMP *[RSP]
     elif IS_X86_32:
         XXX
         mc.JMP_s(0)


More information about the pypy-commit mailing list