Author: Richard Plangger <planri...@gmail.com>
Branch: s390x-backend
Changeset: r80481:b39bf57b3e2f
Date: 2015-10-29 16:18 +0100
http://bitbucket.org/pypy/pypy/changeset/b39bf57b3e2f/

Log:    correctly jumping out of the program after guard failure, but there
        is something wrong with the saving to the dead frame

diff --git a/rpython/jit/backend/zarch/assembler.py 
b/rpython/jit/backend/zarch/assembler.py
--- a/rpython/jit/backend/zarch/assembler.py
+++ b/rpython/jit/backend/zarch/assembler.py
@@ -138,18 +138,17 @@
 
         # overwrite the gcmap in the pool
         offset = pool_offset + RECOVERY_GCMAP_POOL_OFFSET
-        self.pool.overwrite_64(self.mc, offset, target)
-        self.mc.LG(r.r2, l.pool(offset))
+        self.mc.LG(r.r3, l.pool(offset))
 
         # overwrite the target in pool
         offset = pool_offset + RECOVERY_TARGET_POOL_OFFSET
         self.pool.overwrite_64(self.mc, offset, target)
-        self.mc.LG(r.r0, l.pool(offset))
+        self.mc.LG(r.r14, l.pool(offset))
 
         # TODO what is the biggest integer an opaque pointer
         # can have? if not < 2**15-1 then we need to put it on the pool
-        self.mc.LGHI(r.r3, l.imm(fail_descr))
-        self.mc.BCR(l.imm(0xf), r.r0)
+        self.mc.LGHI(r.r2, l.imm(fail_descr))
+        self.mc.BCR(l.imm(0xf), r.r14)
         # TODO do we need to patch this memory region?
         # we need to write at least 6 insns here, for patch_jump_for_descr()
         #while self.mc.currpos() < startpos + 6 * 4:
@@ -406,7 +405,6 @@
             if not tok.guard_not_invalidated():
                 mc = InstrBuilder()
                 mc.b_cond_offset(relative_target, tok.fcond)
-                import pdb; pdb.set_trace()
                 mc.copy_to_raw_memory(addr)
             else:
                 # GUARD_NOT_INVALIDATED, record an entry in
diff --git a/rpython/jit/backend/zarch/locations.py 
b/rpython/jit/backend/zarch/locations.py
--- a/rpython/jit/backend/zarch/locations.py
+++ b/rpython/jit/backend/zarch/locations.py
@@ -217,6 +217,7 @@
     return ImmLocation(i)
 
 def pool(off, float=False):
+    print "loading pool", off
     return PoolLoc(off, float)
 
 def get_fp_offset(base_ofs, position):
diff --git a/rpython/jit/backend/zarch/pool.py 
b/rpython/jit/backend/zarch/pool.py
--- a/rpython/jit/backend/zarch/pool.py
+++ b/rpython/jit/backend/zarch/pool.py
@@ -3,6 +3,8 @@
 from rpython.jit.metainterp.history import (INT, REF, FLOAT,
         TargetToken)
 from rpython.rtyper.lltypesystem import lltype, rffi, llmemory
+from rpython.jit.backend.zarch.arch import (WORD,
+        RECOVERY_GCMAP_POOL_OFFSET, RECOVERY_TARGET_POOL_OFFSET)
 
 class LiteralPool(object):
     def __init__(self):
@@ -24,10 +26,12 @@
 
     def reserve_literal(self, size):
         self.size += size
+        print "resized to", self.size, "(+",size,")"
 
     def reset(self):
+        self.pool_start = 0
         self.size = 0
-        self.rel_offset = 0
+        self.offset = 0
 
     def walk_operations(self, operations):
         # O(len(operations)). I do not think there is a way
@@ -57,12 +61,13 @@
             self.size += 1
         assert self.size < 2**16-1
         mc.BRAS(r.POOL, l.imm(self.size+mc.BRAS._byte_count))
-        self.pool_offset = mc.get_relative_pos()
+        self.pool_start = mc.get_relative_pos()
         mc.write('\x00' * self.size)
-        print "pool with %d bytes %d // 8" % (self.size, self.size // 8)
+        print "pool with %d quad words" % (self.size // 8)
 
     def overwrite_64(self, mc, index, value):
-        print("value", hex(value), "at", index)
+        index += self.pool_start
+        print("value", hex(value), "at", index - self.pool_start)
         mc.overwrite(index,   chr(value >> 56 & 0xff))
         mc.overwrite(index+1, chr(value >> 48 & 0xff))
         mc.overwrite(index+2, chr(value >> 40 & 0xff))
@@ -76,6 +81,7 @@
         if self.size == 0:
             return
         for val, offset in self.offset_map.items():
+            print val, offset
             if val.is_constant():
                 if val.type == FLOAT:
                     self.overwrite_64(mc, offset, float2longlong(val.value))
@@ -91,6 +97,6 @@
             offset = self.offset_map[descr]
             guard_token._pool_offset = offset
             ptr = rffi.cast(lltype.Signed, guard_token.gcmap)
-            self.overwrite_64(mc, offset + 8, ptr)
+            self.overwrite_64(mc, offset + RECOVERY_GCMAP_POOL_OFFSET, ptr)
         self.offset_map.clear()
 
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to