[pypy-commit] pypy arm64: pass the first loop test!

fijal pypy.commits at gmail.com
Wed Mar 6 08:35:24 EST 2019


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: arm64
Changeset: r96216:144deb45999c
Date: 2019-03-06 13:34 +0000
http://bitbucket.org/pypy/pypy/changeset/144deb45999c/

Log:	pass the first loop test!

diff --git a/rpython/jit/backend/aarch64/assembler.py b/rpython/jit/backend/aarch64/assembler.py
--- a/rpython/jit/backend/aarch64/assembler.py
+++ b/rpython/jit/backend/aarch64/assembler.py
@@ -151,9 +151,8 @@
         # XXX add special case if ignored_regs are a block at the start of regs
         if not ignored_regs:  # we want to push a contiguous block of regs
             assert base_ofs < 0x100
-            mc.ADD_ri(r.ip0.value, r.fp.value, base_ofs)
-            # should explode the test
-            #mc.STM(r.ip.value, [reg.value for reg in regs])
+            for i, reg in enumerate(regs):
+                mc.STR_ri(reg.value, r.fp.value, base_ofs + i * WORD)
         else:
             for reg in ignored_regs:
                 assert not reg.is_vfp_reg()  # sanity check
@@ -195,22 +194,10 @@
         # _call_header_with_stack_check().  The LEA in _call_footer below
         # throws away most of the frame, including all the PUSHes that we
         # did just above.
-        ofs = self.cpu.get_ofs_of_frame_field('jf_descr')
-        assert ofs <= 0x100
-        ofs2 = self.cpu.get_ofs_of_frame_field('jf_gcmap')
-        assert ofs2 <= 0x100
-        # store the gcmap
-        mc.LDR_ri(r.ip0.value, r.sp.value, 0)
-        mc.STR_ri(r.ip0.value, r.fp.value, ofs2)
-        # store the descr
-        mc.LDR_ri(r.ip0.value, r.sp.value, WORD)
-        mc.STR_ri(r.ip0.value, r.fp.value, ofs)
 
         # set return value
         mc.MOV_rr(r.x0.value, r.fp.value)
-        # move the stack
-        mc.ADD_ri(r.sp.value, r.sp.value, 2 * WORD)
-        #
+
         self.gen_func_epilog(mc)
         rawstart = mc.materialize(self.cpu, [])
         self.failure_recovery_code[exc + 2 * withfloats] = rawstart
@@ -240,7 +227,6 @@
     def generate_quick_failure(self, guardtok):
         startpos = self.mc.currpos()
         faildescrindex, target = self.store_info_on_descr(startpos, guardtok)
-        self.mc.SUB_ri(r.sp.value, r.sp.value, 2 * WORD)
         self.load_from_gc_table(r.ip0.value, faildescrindex)
         self.store_reg(self.mc, r.ip0, r.fp, WORD)
         self.push_gcmap(self.mc, gcmap=guardtok.gcmap, ofs=0)
@@ -270,8 +256,8 @@
         self.setup_gcrefs_list(allgcrefs)
 
     def patch_gcref_table(self, looptoken, rawstart):
-	# the gc table is at the start of the machine code
-	self.gc_table_addr = rawstart
+        # the gc table is at the start of the machine code
+        self.gc_table_addr = rawstart
         tracer = self.cpu.gc_ll_descr.make_gcref_tracer(rawstart,
                                                         self._allgcrefs)
         gcreftracers = self.get_asmmemmgr_gcreftracers(looptoken)
diff --git a/rpython/jit/backend/aarch64/codebuilder.py b/rpython/jit/backend/aarch64/codebuilder.py
--- a/rpython/jit/backend/aarch64/codebuilder.py
+++ b/rpython/jit/backend/aarch64/codebuilder.py
@@ -7,7 +7,7 @@
 from rpython.rtyper.lltypesystem import lltype, rffi
 from rpython.tool.udir import udir
 
-PC_OFFSET = 8
+PC_OFFSET = 0 # XXX
 
 class AbstractAarch64Builder(object):
     def write32(self, word):
@@ -121,8 +121,10 @@
         target_ofs = ofs - (pos + PC_OFFSET)
         assert -(1 << (26 + 2)) < target_ofs < 1<<(26 + 2)
         if target_ofs < 0:
-            target_ofs = 1<<25 | (~target_ofs)
-        self.write32((base << 26) | (target_ofs >> 2))
+            target_ofs = (1 << 26) - (-target_ofs >> 2)
+        else:
+            target_ofs = target_ofs >> 2
+        self.write32((base << 26) | target_ofs)
 
     def B_ofs_cond(self, ofs, cond):
         base = 0b01010100
diff --git a/rpython/jit/backend/test/runner_test.py b/rpython/jit/backend/test/runner_test.py
--- a/rpython/jit/backend/test/runner_test.py
+++ b/rpython/jit/backend/test/runner_test.py
@@ -185,9 +185,7 @@
         """, namespace={'targettoken': targettoken,
                         'fdescr': BasicFailDescr(2)})
         self.cpu.compile_loop(loop.inputargs, loop.operations, looptoken)
-        print "ONE"
         deadframe = self.cpu.execute_token(looptoken, 10)
-        print "TWO"
         fail = self.cpu.get_latest_descr(deadframe)
         assert fail.identifier == 2
         deadframe = self.cpu.execute_token(looptoken, 2)


More information about the pypy-commit mailing list