[pypy-commit] pypy vmprof-newstack: improve the test and make sure we emit the footer

fijal pypy.commits at gmail.com
Sat Jan 9 08:07:51 EST 2016


Author: fijal
Branch: vmprof-newstack
Changeset: r81639:b14e3b107fdf
Date: 2016-01-09 15:07 +0200
http://bitbucket.org/pypy/pypy/changeset/b14e3b107fdf/

Log:	improve the test and make sure we emit the footer

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
@@ -36,9 +36,12 @@
 
         hooks = Hooks()
 
+        stackp = _get_vmprof().cintf.vmprof_address_of_global_stack()
+        stackp[0] = 0 # make it empty
         self.meta_interp(f, [10], policy=JitPolicy(hooks))
         v = set(visited)
         assert 0 in v
         v.remove(0)
         assert len(v) == 1
         assert 0 <= list(v)[0] - hooks.raw_start <= 10*1024
+        assert stackp[0] == 0 # make sure we didn't leave anything dangling
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
@@ -851,6 +851,13 @@
         self.mc.MOV_mi((eax.value, WORD * 2), VMPROF_JITTED_TAG)
         self.mc.MOV(heap(stack), eax)
 
+    def _call_footer_vmprof(self):
+        stack = _get_vmprof().cintf.vmprof_address_of_global_stack()
+        # *stack = stack->next
+        self.mc.MOV(eax, heap(stack))
+        self.mc.MOV_rm(eax.value, (eax.value, 0))
+        self.mc.MOV(heap(stack), eax)
+
     def _call_header(self):
         self.mc.SUB_ri(esp.value, FRAME_FIXED_SIZE * WORD)
         self.mc.MOV_sr(PASS_ON_MY_FRAME * WORD, ebp.value)
@@ -888,6 +895,7 @@
 
     def _call_footer(self):
         # the return value is the jitframe
+        self._call_footer_vmprof()
         self.mc.MOV_rr(eax.value, ebp.value)
 
         gcrootmap = self.cpu.gc_ll_descr.gcrootmap


More information about the pypy-commit mailing list