[pypy-svn] pypy out-of-line-guards-2: Add a comment describing the implicit assumptions made by this logic.

arigo commits-noreply at bitbucket.org
Mon May 2 22:41:15 CEST 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: out-of-line-guards-2
Changeset: r43852:df19615b3755
Date: 2011-05-02 16:47 +0200
http://bitbucket.org/pypy/pypy/changeset/df19615b3755/

Log:	Add a comment describing the implicit assumptions made by this
	logic.

diff --git a/pypy/jit/backend/x86/assembler.py b/pypy/jit/backend/x86/assembler.py
--- a/pypy/jit/backend/x86/assembler.py
+++ b/pypy/jit/backend/x86/assembler.py
@@ -456,6 +456,17 @@
                 relpos = tok.pos_jump_offset
                 clt.invalidate_positions.append((rawstart + relpos,
                                                  relative_target))
+                # General idea: Although no code was generated by this
+                # guard, the code might be patched with a "JMP rel32" to
+                # the guard recovery code.  This recovery code is
+                # already generated, and looks like the recovery code
+                # for any guard, even if at first it has no jump to it.
+                # So we may later write 5 bytes overriding the existing
+                # instructions; this works because a CALL instruction
+                # would also take at least 5 bytes.  If it could take
+                # less, we would run into the issue that overwriting the
+                # 5 bytes here might get a few nonsense bytes at the
+                # return address of the following CALL.
 
     def get_asmmemmgr_blocks(self, looptoken):
         clt = looptoken.compiled_loop_token


More information about the Pypy-commit mailing list