Author: Armin Rigo <[email protected]>
Branch: improve-vmprof-testing
Changeset: r86054:e39f9543e5b0
Date: 2016-08-07 10:53 +0200
http://bitbucket.org/pypy/pypy/changeset/e39f9543e5b0/

Log:    Finish the pyjitpl part

diff --git a/rpython/jit/metainterp/pyjitpl.py 
b/rpython/jit/metainterp/pyjitpl.py
--- a/rpython/jit/metainterp/pyjitpl.py
+++ b/rpython/jit/metainterp/pyjitpl.py
@@ -2080,9 +2080,14 @@
                     frame.pc = target
                     raise ChangeFrame
                 if opcode == self.staticdata.op_rvmprof_code:
-                    # do the 'leave_code' for rvmprof, but then continue
-                    # popping frames
-                    import pdb;pdb.set_trace()
+                    # do the 'jit_rvmprof_code(1)' for rvmprof, but then
+                    # continue popping frames.  Decode jit_rvmprof_code
+                    # manually here.
+                    from rpython.rlib.rvmprof import cintf
+                    arg1 = frame.registers_i[ord(code[position+1])].getint()
+                    arg2 = frame.registers_i[ord(code[position+2])].getint()
+                    assert arg1 == 1
+                    cintf.jit_rvmprof_code(arg1, arg2)
             self.popframe()
         try:
             self.compile_exit_frame_with_exception(self.last_exc_box)
diff --git a/rpython/rlib/rvmprof/cintf.py b/rpython/rlib/rvmprof/cintf.py
--- a/rpython/rlib/rvmprof/cintf.py
+++ b/rpython/rlib/rvmprof/cintf.py
@@ -123,22 +123,22 @@
 #   done by a special case in pyjitpl.py and blackhole.py.  The point
 #   is that the above simple pattern can be detected by the blackhole
 #   interp, when it first rebuilds all the intermediate RPython
-#   frames; at that point it needs to call jit_enter_code() on all
+#   frames; at that point it needs to call jit_rvmprof_code(0) on all
 #   intermediate RPython frames, so it does pattern matching to
 #   recognize when it must call that and with which 'unique_id' value.
 #
 # - The jitcode opcode 'rvmprof_code' doesn't produce any resop.  When
-#   meta-interpreting, it causes pyjitpl to call jit_enter_code() or
-#   jit_leave_code().  As mentioned above, there is logic to call
-#   jit_leave_code() even if we exit with an exception, even though
-#   there is no 'catch_exception'.  There is similar logic inside
-#   the blackhole interpreter.
+#   meta-interpreting, it causes pyjitpl to call jit_rvmprof_code().
+#   As mentioned above, there is logic to call jit_rvmprof_code(1)
+#   even if we exit with an exception, even though there is no
+#   'catch_exception'.  There is similar logic inside the blackhole
+#   interpreter.
 
 
-def jit_enter_code(unique_id):
-    enter_code(unique_id)    # ignore the return value
-
-def jit_leave_code(unique_id):
-    s = vmprof_tl_stack.getraw()
-    assert s.c_value == unique_id
-    leave_code(s)
+def jit_rvmprof_code(leaving, unique_id):
+    if leaving == 0:
+        enter_code(unique_id)    # ignore the return value
+    else:
+        s = vmprof_tl_stack.getraw()
+        assert s.c_value == unique_id
+        leave_code(s)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to