[pypy-commit] pypy default: clarify the fact that gc_store does *not* uses a negative size

arigo pypy.commits at gmail.com
Thu Dec 24 16:48:20 EST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r81446:04af6667c794
Date: 2015-12-24 22:46 +0100
http://bitbucket.org/pypy/pypy/changeset/04af6667c794/

Log:	clarify the fact that gc_store does *not* uses a negative size

diff --git a/rpython/jit/backend/arm/regalloc.py b/rpython/jit/backend/arm/regalloc.py
--- a/rpython/jit/backend/arm/regalloc.py
+++ b/rpython/jit/backend/arm/regalloc.py
@@ -804,7 +804,7 @@
         base_loc = self.make_sure_var_in_reg(boxes[0], boxes)
         ofs = boxes[1].getint()
         value_loc = self.make_sure_var_in_reg(boxes[2], boxes)
-        size = abs(boxes[3].getint())
+        size = boxes[3].getint()
         ofs_size = default_imm_size if size < 8 else VMEM_imm_size
         if check_imm_arg(ofs, size=ofs_size):
             ofs_loc = imm(ofs)
@@ -849,7 +849,7 @@
         index_loc = self.make_sure_var_in_reg(boxes[1], boxes)
         assert boxes[3].getint() == 1    # scale
         ofs = boxes[4].getint()
-        size = abs(boxes[5].getint())
+        size = boxes[5].getint()
         assert check_imm_arg(ofs)
         return [value_loc, base_loc, index_loc, imm(size), imm(ofs)]
 
diff --git a/rpython/jit/backend/x86/regalloc.py b/rpython/jit/backend/x86/regalloc.py
--- a/rpython/jit/backend/x86/regalloc.py
+++ b/rpython/jit/backend/x86/regalloc.py
@@ -1039,7 +1039,8 @@
         base_loc = self.rm.make_sure_var_in_reg(op.getarg(0), args)
         size_box = op.getarg(3)
         assert isinstance(size_box, ConstInt)
-        size = abs(size_box.value)
+        size = size_box.value
+        assert size >= 1
         if size == 1:
             need_lower_byte = True
         else:
@@ -1061,7 +1062,8 @@
         assert isinstance(size_box, ConstInt)
         factor = scale_box.value
         offset = offset_box.value
-        size = abs(size_box.value)
+        size = size_box.value
+        assert size >= 1
         if size == 1:
             need_lower_byte = True
         else:
diff --git a/rpython/jit/metainterp/resoperation.py b/rpython/jit/metainterp/resoperation.py
--- a/rpython/jit/metainterp/resoperation.py
+++ b/rpython/jit/metainterp/resoperation.py
@@ -1204,8 +1204,12 @@
     '_NOSIDEEFFECT_LAST', # ----- end of no_side_effect operations -----
 
     # same paramters as GC_LOAD, but one additional for the value to store
-    # note that the itemsize is not signed!
+    # note that the itemsize is not signed (always > 0)
     # (gcptr, index, value, [scale, base_offset,] itemsize)
+    # invariants for GC_STORE: index is constant, but can be large
+    # invariants for GC_STORE_INDEXED: index is a non-constant box;
+    #                                  scale is a constant;
+    #                                  base_offset is a small constant
     'GC_STORE/4d/n',
     'GC_STORE_INDEXED/6d/n',
 


More information about the pypy-commit mailing list