[pypy-commit] pypy jitframe-on-heap: Tweak _getregkey(). The essential part is that for StackLocs it should

arigo noreply at buildbot.pypy.org
Mon Feb 11 11:51:56 CET 2013


Author: Armin Rigo <arigo at tunes.org>
Branch: jitframe-on-heap
Changeset: r61078:7dd4f26ec840
Date: 2013-02-11 11:51 +0100
http://bitbucket.org/pypy/pypy/changeset/7dd4f26ec840/

Log:	Tweak _getregkey(). The essential part is that for StackLocs it
	should return the ebp_offset, so that jump.py detects (on 32-bit)
	that some position is partially overlapping with a float because
	_getregkey() returned the previous value + WORD.

diff --git a/rpython/jit/backend/x86/jump.py b/rpython/jit/backend/x86/jump.py
--- a/rpython/jit/backend/x86/jump.py
+++ b/rpython/jit/backend/x86/jump.py
@@ -1,6 +1,7 @@
 import sys
 from rpython.tool.pairtype import extendabletype
-from rpython.jit.backend.x86.regloc import ImmediateAssemblerLocation, StackLoc
+from rpython.jit.backend.x86.regloc import ImmediateAssemblerLocation
+from rpython.jit.backend.x86.regloc import RegLoc, StackLoc
 
 def remap_frame_layout(assembler, src_locations, dst_locations, tmpreg):
     pending_dests = len(dst_locations)
diff --git a/rpython/jit/backend/x86/regloc.py b/rpython/jit/backend/x86/regloc.py
--- a/rpython/jit/backend/x86/regloc.py
+++ b/rpython/jit/backend/x86/regloc.py
@@ -53,9 +53,6 @@
         self.value = value
         self.type = type
 
-    def _getregkey(self):
-        return -(self.value * 2 + 2)
-
     def get_width(self):
         if self.type == FLOAT:
             return 8
@@ -80,11 +77,12 @@
     _location_code = 's'
 
     def __init__(self, value, type):
+        assert value >= 0
         self.value = value
         self.type = type
 
     def _getregkey(self):
-        return -(self.value * 2 + 1)
+        return ~self.value
 
     def get_width(self):
         if self.type == FLOAT:
@@ -107,8 +105,7 @@
         # _getregkey() returns self.value; the value returned must not
         # conflict with RegLoc._getregkey().  It doesn't a bit by chance,
         # so let it fail the following assert if it no longer does.
-        assert ebp_offset >= 0
-        #assert not (0 <= ebp_offset < 8 + 8 * IS_X86_64)
+        assert ebp_offset >= 8 + 8 * IS_X86_64
         self.position = position
         #if position != 9999:
         #    assert (position + JITFRAME_FIXED_SIZE) * WORD == ebp_offset


More information about the pypy-commit mailing list