Author: David Schneider <[email protected]>
Branch: arm-backend-2
Changeset: r48417:8754b1a53808
Date: 2011-10-24 14:32 +0200
http://bitbucket.org/pypy/pypy/changeset/8754b1a53808/
Log: add some asserts
diff --git a/pypy/jit/backend/arm/opassembler.py
b/pypy/jit/backend/arm/opassembler.py
--- a/pypy/jit/backend/arm/opassembler.py
+++ b/pypy/jit/backend/arm/opassembler.py
@@ -640,15 +640,16 @@
def emit_op_setarrayitem_gc(self, op, arglocs, regalloc, fcond):
value_loc, base_loc, ofs_loc, scale, ofs = arglocs
-
+ assert ofs_loc.is_reg()
if scale.value > 0:
scale_loc = r.ip
self.mc.LSL_ri(r.ip.value, ofs_loc.value, scale.value)
else:
scale_loc = ofs_loc
+ # add the base offset
if ofs.value > 0:
- self.mc.ADD_ri(r.ip.value, scale_loc.value, ofs.value)
+ self.mc.ADD_ri(r.ip.value, scale_loc.value, imm=ofs.value)
scale_loc = r.ip
if scale.value == 3:
@@ -670,11 +671,14 @@
def emit_op_getarrayitem_gc(self, op, arglocs, regalloc, fcond):
res, base_loc, ofs_loc, scale, ofs = arglocs
+ assert ofs_loc.is_reg()
if scale.value > 0:
scale_loc = r.ip
self.mc.LSL_ri(r.ip.value, ofs_loc.value, scale.value)
else:
scale_loc = ofs_loc
+
+ # add the base offset
if ofs.value > 0:
self.mc.ADD_ri(r.ip.value, scale_loc.value, imm=ofs.value)
scale_loc = r.ip
diff --git a/pypy/jit/backend/arm/regalloc.py b/pypy/jit/backend/arm/regalloc.py
--- a/pypy/jit/backend/arm/regalloc.py
+++ b/pypy/jit/backend/arm/regalloc.py
@@ -692,7 +692,7 @@
def prepare_op_setarrayitem_gc(self, op, fcond):
a0, a1, a2 = boxes = list(op.getarglist())
- _, scale, ofs, _, ptr = self._unpack_arraydescr(op.getdescr())
+ _, scale, base_ofs, _, ptr = self._unpack_arraydescr(op.getdescr())
base_loc, base_box = self._ensure_value_is_boxed(a0, boxes)
boxes.append(base_box)
@@ -701,12 +701,13 @@
value_loc, value_box = self._ensure_value_is_boxed(a2, boxes)
boxes.append(value_box)
self.possibly_free_vars(boxes)
- return [value_loc, base_loc, ofs_loc, imm(scale), imm(ofs)]
+ assert _check_imm_arg(ConstInt(base_ofs))
+ return [value_loc, base_loc, ofs_loc, imm(scale), imm(base_ofs)]
prepare_op_setarrayitem_raw = prepare_op_setarrayitem_gc
def prepare_op_getarrayitem_gc(self, op, fcond):
a0, a1 = boxes = list(op.getarglist())
- _, scale, ofs, _, ptr = self._unpack_arraydescr(op.getdescr())
+ _, scale, base_ofs, _, ptr = self._unpack_arraydescr(op.getdescr())
base_loc, base_box = self._ensure_value_is_boxed(a0, boxes)
boxes.append(base_box)
@@ -715,7 +716,8 @@
self.possibly_free_vars(boxes)
res = self.force_allocate_reg(op.result)
self.possibly_free_var(op.result)
- return [res, base_loc, ofs_loc, imm(scale), imm(ofs)]
+ assert _check_imm_arg(ConstInt(base_ofs))
+ return [res, base_loc, ofs_loc, imm(scale), imm(base_ofs)]
prepare_op_getarrayitem_raw = prepare_op_getarrayitem_gc
prepare_op_getarrayitem_gc_pure = prepare_op_getarrayitem_gc
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit