[pypy-commit] pypy default: theoretical fix for signed chars. It might be the case that

arigo pypy.commits at gmail.com
Sun Dec 20 02:55:57 EST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r81401:9e73e592a9b0
Date: 2015-12-20 08:55 +0100
http://bitbucket.org/pypy/pypy/changeset/9e73e592a9b0/

Log:	theoretical fix for signed chars. It might be the case that gc_store
	is never called with a negative size, so this doesn't change
	anything, but the abs() here is confusing

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,8 +1039,7 @@
         base_loc = self.rm.make_sure_var_in_reg(op.getarg(0), args)
         size_box = op.getarg(3)
         assert isinstance(size_box, ConstInt)
-        size = size_box.value
-        itemsize = abs(size)
+        size = abs(size_box.value)
         if size == 1:
             need_lower_byte = True
         else:
@@ -1049,7 +1048,7 @@
                                           need_lower_byte=need_lower_byte)
         ofs_loc = self.rm.make_sure_var_in_reg(op.getarg(1), args)
         self.perform_discard(op, [base_loc, ofs_loc, value_loc,
-                                 imm(itemsize)])
+                                 imm(size)])
 
     def consider_gc_store_indexed(self, op):
         args = op.getarglist()
@@ -1062,8 +1061,7 @@
         assert isinstance(size_box, ConstInt)
         factor = scale_box.value
         offset = offset_box.value
-        size = size_box.value
-        itemsize = abs(size)
+        size = abs(size_box.value)
         if size == 1:
             need_lower_byte = True
         else:
@@ -1072,7 +1070,7 @@
                                           need_lower_byte=need_lower_byte)
         ofs_loc = self.rm.make_sure_var_in_reg(op.getarg(1), args)
         self.perform_discard(op, [base_loc, ofs_loc, value_loc,
-                                  imm(factor), imm(offset), imm(itemsize)])
+                                  imm(factor), imm(offset), imm(size)])
 
     def consider_increment_debug_counter(self, op):
         base_loc = self.loc(op.getarg(0))


More information about the pypy-commit mailing list