Author: Richard Plangger <planri...@gmail.com>
Branch: s390x-backend
Changeset: r82071:7694772ae0c5
Date: 2016-02-04 10:26 +0100
http://bitbucket.org/pypy/pypy/changeset/7694772ae0c5/

Log:    did not consider normal gc write barrier, crashes with index out of
        bounds!

diff --git a/rpython/jit/backend/zarch/opassembler.py 
b/rpython/jit/backend/zarch/opassembler.py
--- a/rpython/jit/backend/zarch/opassembler.py
+++ b/rpython/jit/backend/zarch/opassembler.py
@@ -527,20 +527,22 @@
         if not is_frame:
             mc.LGR(r.r0, loc_base)    # unusual argument location
 
-        loc_index = arglocs[1]
-        # loc_index may be in r2 to r5.
-        # the wb_slow_path may trash these registers
+        if len(arglocs) > 1:
+            loc_index = arglocs[1]
+            # loc_index may be in r2 to r5.
+            # the wb_slow_path may trash these registers
 
-        if loc_index.is_reg() and loc_index.value < 6:
-            mc.LAY(r.SP, l.addr(-WORD, r.SP))
-            mc.STG(loc_index, l.addr(STD_FRAME_SIZE_IN_BYTES, r.SP))
+            if loc_index.is_reg() and loc_index.value < 6:
+                mc.LAY(r.SP, l.addr(-WORD, r.SP))
+                mc.STG(loc_index, l.addr(STD_FRAME_SIZE_IN_BYTES, r.SP))
 
         mc.load_imm(r.r14, self.wb_slowpath[helper_num])
         mc.BASR(r.r14, r.r14)
 
-        if loc_index.is_reg() and loc_index.value < 6:
-            mc.LG(loc_index, l.addr(STD_FRAME_SIZE_IN_BYTES, r.SP))
-            mc.LAY(r.SP, l.addr(WORD, r.SP))
+        if len(arglocs) > 1:
+            if loc_index.is_reg() and loc_index.value < 6:
+                mc.LG(loc_index, l.addr(STD_FRAME_SIZE_IN_BYTES, r.SP))
+                mc.LAY(r.SP, l.addr(WORD, r.SP))
 
         if card_marking_mask:
             # The helper ends again with a check of the flag in the object.
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to