[pypy-commit] pypy default: A better interface. Possibly a translation fix.

arigo noreply at buildbot.pypy.org
Thu Oct 27 11:04:49 CEST 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r48497:9f32a507b5be
Date: 2011-10-27 11:04 +0200
http://bitbucket.org/pypy/pypy/changeset/9f32a507b5be/

Log:	A better interface. Possibly a translation 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
@@ -1596,24 +1596,26 @@
     genop_getarrayitem_gc_pure = genop_getarrayitem_gc
     genop_getarrayitem_raw = genop_getarrayitem_gc
 
-    def _get_interiorfield_index(self, temp_loc, index_loc, itemsize_loc):
+    def _get_interiorfield_addr(self, temp_loc, index_loc, itemsize_loc,
+                                base_loc, ofs_loc):
         assert isinstance(itemsize_loc, ImmedLoc)
         if isinstance(index_loc, ImmedLoc):
-            return imm(index_loc.value * itemsize_loc.value)
+            temp_loc = imm(index_loc.value * itemsize_loc.value)
         else:
             # XXX should not use IMUL in most cases
             assert isinstance(temp_loc, RegLoc)
             assert isinstance(index_loc, RegLoc)
             self.mc.IMUL_rri(temp_loc.value, index_loc.value,
                              itemsize_loc.value)
-            return temp_loc
+        assert isinstance(ofs_loc, ImmedLoc)
+        return AddressLoc(base_loc, temp_loc, 0, ofs_loc.value)
 
     def genop_getinteriorfield_gc(self, op, arglocs, resloc):
         (base_loc, ofs_loc, itemsize_loc, fieldsize_loc,
             index_loc, sign_loc) = arglocs
-        temp_loc = self._get_interiorfield_index(resloc, index_loc,
-                                                 itemsize_loc)
-        src_addr = AddressLoc(base_loc, temp_loc, 0, ofs_loc.value)
+        src_addr = self._get_interiorfield_addr(resloc, index_loc,
+                                                itemsize_loc, base_loc,
+                                                ofs_loc)
         self.load_from_mem(resloc, src_addr, fieldsize_loc, sign_loc)
 
 
@@ -1626,9 +1628,9 @@
     def genop_discard_setinteriorfield_gc(self, op, arglocs):
         (base_loc, ofs_loc, itemsize_loc, fieldsize_loc,
             index_loc, temp_loc, value_loc) = arglocs
-        temp_loc = self._get_interiorfield_index(temp_loc, index_loc,
-                                                 itemsize_loc)
-        dest_addr = AddressLoc(base_loc, temp_loc, 0, ofs_loc.value)
+        dest_addr = self._get_interiorfield_addr(temp_loc, index_loc,
+                                                 itemsize_loc, base_loc,
+                                                 ofs_loc)
         self.save_into_mem(dest_addr, value_loc, fieldsize_loc)
 
     def genop_discard_setarrayitem_gc(self, op, arglocs):


More information about the pypy-commit mailing list