[pypy-commit] pypy s390x-backend: added guard no exception, second cond_call now passing

plan_rich pypy.commits at gmail.com
Wed Dec 16 09:48:52 EST 2015


Author: Richard Plangger <planrichi at gmail.com>
Branch: s390x-backend
Changeset: r81346:2d4a2bf50e28
Date: 2015-12-16 15:05 +0100
http://bitbucket.org/pypy/pypy/changeset/2d4a2bf50e28/

Log:	added guard no exception, second cond_call now passing

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
@@ -283,7 +283,6 @@
         fcond = self.guard_success_cc
         self.guard_success_cc = c.cond_none
         assert fcond != c.cond_none
-        orig_cond = fcond
         fcond = c.negate(fcond)
 
         jmp_adr = self.mc.get_relative_pos()
@@ -326,7 +325,7 @@
         pmc.overwrite()
         # might be overridden again to skip over the following
         # guard_no_exception too
-        self.previous_cond_call_jcond = jmp_adr, orig_cond
+        self.previous_cond_call_jcond = jmp_adr, fcond
 
 class AllocOpAssembler(object):
     _mixin_ = True
@@ -943,6 +942,21 @@
     def emit_leave_portal_frame(self, op, arglocs, regalloc):
         self.leave_portal_frame(op)
 
+    def emit_guard_no_exception(self, op, arglocs, regalloc):
+        self.mc.load_imm(r.SCRATCH, self.cpu.pos_exception())
+        self.mc.LG(r.SCRATCH2, l.addr(0,r.SCRATCH))
+        self.mc.cmp_op(r.SCRATCH2, l.imm(0), imm=True)
+        self.guard_success_cc = c.EQ
+        self._emit_guard(op, arglocs)
+        # If the previous operation was a COND_CALL, overwrite its conditional
+        # jump to jump over this GUARD_NO_EXCEPTION as well, if we can
+        if self._find_nearby_operation(regalloc,-1).getopnum() == rop.COND_CALL:
+            jmp_adr, fcond = self.previous_cond_call_jcond
+            relative_target = self.mc.currpos() - jmp_adr
+            pmc = OverwritingBuilder(self.mc, jmp_adr, 1)
+            pmc.BRCL(fcond, l.imm(relative_target))
+            pmc.overwrite()
+
 class OpAssembler(IntOpAssembler, FloatOpAssembler,
                   GuardOpAssembler, CallOpAssembler,
                   AllocOpAssembler, MemoryOpAssembler,


More information about the pypy-commit mailing list