[pypy-commit] pypy jit-simplify-backendintf: redirect_call_assembler() fix.
arigo
noreply at buildbot.pypy.org
Mon Dec 12 10:01:17 CET 2011
Author: Armin Rigo <arigo at tunes.org>
Branch: jit-simplify-backendintf
Changeset: r50410:dbe437dbf368
Date: 2011-12-12 09:33 +0100
http://bitbucket.org/pypy/pypy/changeset/dbe437dbf368/
Log: redirect_call_assembler() fix.
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
@@ -804,10 +804,11 @@
# we overwrite the instructions at the old _x86_direct_bootstrap_code
# to start with a JMP to the new _x86_direct_bootstrap_code.
# Ideally we should rather patch all existing CALLs, but well.
- oldadr = oldlooptoken._x86_direct_bootstrap_code
- target = newlooptoken._x86_direct_bootstrap_code
+ oldadr = oldlooptoken._x86_function_addr
+ target = newlooptoken._x86_function_addr
mc = codebuf.MachineCodeBlockWrapper()
mc.JMP(imm(target))
+ assert mc.get_relative_pos() <= 13 #keep in sync with consider_label()
mc.copy_to_raw_memory(oldadr)
def dump(self, text):
diff --git a/pypy/jit/backend/x86/regalloc.py b/pypy/jit/backend/x86/regalloc.py
--- a/pypy/jit/backend/x86/regalloc.py
+++ b/pypy/jit/backend/x86/regalloc.py
@@ -1490,6 +1490,12 @@
nonfloatlocs[i] = loc
if isinstance(loc, RegLoc):
self.fm.mark_as_free(arg)
+ #
+ # if we are too close to the start of the loop, the label's target may
+ # get overridden by redirect_call_assembler(). (rare case)
+ while self.assembler.mc.get_relative_pos() < 13:
+ self.assembler.mc.NOP()
+ #
descr._x86_arglocs = nonfloatlocs, floatlocs
descr._x86_loop_code = self.assembler.mc.get_relative_pos()
descr._x86_clt = self.assembler.current_clt
More information about the pypy-commit
mailing list