[pypy-commit] pypy vmprof-newstack: fixes

fijal pypy.commits at gmail.com
Sun Jan 10 08:27:13 EST 2016


Author: fijal
Branch: vmprof-newstack
Changeset: r81650:17ae8014babf
Date: 2016-01-09 16:23 +0200
http://bitbucket.org/pypy/pypy/changeset/17ae8014babf/

Log:	fixes

diff --git a/rpython/jit/backend/test/test_rvmprof.py b/rpython/jit/backend/test/test_rvmprof.py
--- a/rpython/jit/backend/test/test_rvmprof.py
+++ b/rpython/jit/backend/test/test_rvmprof.py
@@ -15,7 +15,8 @@
             if stackp:
                 # not during tracing
                 stack = rffi.cast(rffi.CArrayPtr(lltype.Signed), stackp)
-                visited.append(rffi.cast(rffi.CArrayPtr(lltype.Signed), stack[1] - WORD)[0])
+                item = rffi.cast(rffi.CArrayPtr(lltype.Signed), stack[1] - WORD)[0]
+                visited.append(item)
             else:
                 visited.append(0)
 
diff --git a/rpython/jit/backend/x86/assembler.py b/rpython/jit/backend/x86/assembler.py
--- a/rpython/jit/backend/x86/assembler.py
+++ b/rpython/jit/backend/x86/assembler.py
@@ -839,24 +839,27 @@
         return frame_depth
 
     def _call_header_vmprof(self):
-        stack = _get_vmprof().cintf.vmprof_address_of_global_stack()
+        stack = rffi.cast(lltype.Signed, _get_vmprof().cintf.vmprof_address_of_global_stack())
         self.mc.MOV_rr(eax.value, esp.value)
         self.mc.ADD_ri(eax.value, (FRAME_FIXED_SIZE - 4) * WORD) # er makes no sense
         # next
-        self.mc.MOV(ecx, heap(stack))
+        self.mc.MOV_ri(ecx.value, stack)
+        self.mc.MOV_rm(ecx.value, (ecx.value, 0))
         self.mc.MOV_mr((eax.value, 0), ecx.value)
         # value
         self.mc.MOV_mr((eax.value, WORD), esp.value)
         # kind
         self.mc.MOV_mi((eax.value, WORD * 2), VMPROF_JITTED_TAG)
-        self.mc.MOV(heap(stack), eax)
+        self.mc.MOV_ri(ecx.value, stack)
+        self.mc.MOV_mr((ecx.value, 0), eax.value)
 
     def _call_footer_vmprof(self):
-        stack = _get_vmprof().cintf.vmprof_address_of_global_stack()
+        stack = rffi.cast(lltype.Signed, _get_vmprof().cintf.vmprof_address_of_global_stack())
         # *stack = stack->next
-        self.mc.MOV(eax, heap(stack))
+        self.mc.MOV_ri(ecx.value, stack)
+        self.mc.MOV_rm(eax.value, (ecx.value, 0))
         self.mc.MOV_rm(eax.value, (eax.value, 0))
-        self.mc.MOV(heap(stack), eax)
+        self.mc.MOV_mr((ecx.value, 0), eax.value)
 
     def _call_header(self):
         self.mc.SUB_ri(esp.value, FRAME_FIXED_SIZE * WORD)
diff --git a/rpython/jit/metainterp/quasiimmut.py b/rpython/jit/metainterp/quasiimmut.py
--- a/rpython/jit/metainterp/quasiimmut.py
+++ b/rpython/jit/metainterp/quasiimmut.py
@@ -51,6 +51,7 @@
 class QuasiImmut(object):
     llopaque = True
     compress_limit = 30
+    looptokens_wrefs = None
 
     def __init__(self, cpu):
         self.cpu = cpu
@@ -75,7 +76,7 @@
     def compress_looptokens_list(self):
         self.looptokens_wrefs = [wref for wref in self.looptokens_wrefs
                                       if wref() is not None]
-        # NB. we must keep around the looptoken_wrefs that are
+        # NB. we must keep around the looptokens_wrefs that are
         # already invalidated; see below
         self.compress_limit = (len(self.looptokens_wrefs) + 15) * 2
 
@@ -83,6 +84,9 @@
         # When this is called, all the loops that we record become
         # invalid: all GUARD_NOT_INVALIDATED in these loops (and
         # in attached bridges) must now fail.
+        if self.looptokens_wrefs is None:
+            # can't happen, but helps compiled tests
+            return
         wrefs = self.looptokens_wrefs
         self.looptokens_wrefs = []
         for wref in wrefs:


More information about the pypy-commit mailing list