[pypy-commit] pypy arm-backend-2: add an alignment check after malloc calls for debugging

bivab noreply at buildbot.pypy.org
Mon Jan 9 11:56:48 CET 2012


Author: David Schneider <david.schneider at picle.org>
Branch: arm-backend-2
Changeset: r51164:f02dc5c4e43c
Date: 2012-01-03 12:50 +0100
http://bitbucket.org/pypy/pypy/changeset/f02dc5c4e43c/

Log:	add an alignment check after malloc calls for debugging

diff --git a/pypy/jit/backend/arm/assembler.py b/pypy/jit/backend/arm/assembler.py
--- a/pypy/jit/backend/arm/assembler.py
+++ b/pypy/jit/backend/arm/assembler.py
@@ -57,6 +57,8 @@
 
     STACK_FIXED_AREA = -1
 
+    debug = True
+
     def __init__(self, cpu, failargs_limit=1000):
         self.cpu = cpu
         self.fail_boxes_int = values_array(lltype.Signed, failargs_limit)
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
@@ -1191,6 +1191,7 @@
     def emit_op_call_malloc_gc(self, op, arglocs, regalloc, fcond):
         self.emit_op_call(op, arglocs, regalloc, fcond)
         self.propagate_memoryerror_if_r0_is_null()
+        self._alignment_check()
         return fcond
 
     def emit_op_call_malloc_nursery(self, op, arglocs, regalloc, fcond):
@@ -1203,8 +1204,19 @@
             gc_ll_descr.get_nursery_top_addr(),
             size
             )
+        self._alignment_check()
         return fcond
 
+    def _alignment_check(self):
+        if not self.debug:
+            return
+        self.mc.MOV_rr(r.ip.value, r.r0.value)
+        self.mc.AND_ri(r.ip.value, r.ip.value, 3)
+        self.mc.CMP_ri(r.ip.value, 0)
+        self.mc.MOV_rr(r.pc.value, r.pc.value, cond=c.EQ)
+        self.mc.BKPT()
+        self.mc.NOP()
+
 
 class FloatOpAssemlber(object):
     _mixin_ = True


More information about the pypy-commit mailing list