[pypy-commit] pypy stmgc-c7: Fix: putting push/pop_marker here avoids duplicating them,

arigo noreply at buildbot.pypy.org
Sat Apr 19 19:47:24 CEST 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: stmgc-c7
Changeset: r70780:885b1d74996a
Date: 2014-04-19 19:46 +0200
http://bitbucket.org/pypy/pypy/changeset/885b1d74996a/

Log:	Fix: putting push/pop_marker here avoids duplicating them, and fixes
	an issue with jitdriver.py rewriting the function in some indirect
	way

diff --git a/pypy/interpreter/pyframe.py b/pypy/interpreter/pyframe.py
--- a/pypy/interpreter/pyframe.py
+++ b/pypy/interpreter/pyframe.py
@@ -1,7 +1,7 @@
 """ PyFrame class implementation with the interpreter main loop.
 """
 
-from rpython.rlib import jit
+from rpython.rlib import jit, rstm
 from rpython.rlib.debug import make_sure_not_resized, check_nonneg
 from rpython.rlib.jit import hint
 from rpython.rlib.objectmodel import we_are_translated, instantiate
@@ -210,12 +210,15 @@
                 if next_instr != 0:
                     self.pushvalue(w_inputvalue)
             #
+            rstm.push_marker(intmask(next_instr) * 2 + 1, self.pycode)
             try:
                 w_exitvalue = self.dispatch(self.pycode, next_instr,
                                             executioncontext)
             except Exception:
+                rstm.pop_marker()
                 executioncontext.return_trace(self, self.space.w_None)
                 raise
+            rstm.pop_marker()
             executioncontext.return_trace(self, w_exitvalue)
             # it used to say self.last_exception = None
             # this is now done by the code in pypyjit module
diff --git a/pypy/interpreter/pyopcode.py b/pypy/interpreter/pyopcode.py
--- a/pypy/interpreter/pyopcode.py
+++ b/pypy/interpreter/pyopcode.py
@@ -71,8 +71,6 @@
         # For the sequel, force 'next_instr' to be unsigned for performance
         next_instr = r_uint(next_instr)
         co_code = pycode.co_code
-        rstm.push_marker(intmask(next_instr) * 2 + 1, pycode)
-
         try:
             while True:
                 if self.space.config.translation.stm:
@@ -86,8 +84,6 @@
                 rstm.update_marker_num(intmask(next_instr) * 2 + 1)
         except ExitFrame:
             return self.popvalue()
-        finally:
-            rstm.pop_marker()
 
     def handle_bytecode(self, co_code, next_instr, ec):
         try:
diff --git a/pypy/module/pypyjit/interp_jit.py b/pypy/module/pypyjit/interp_jit.py
--- a/pypy/module/pypyjit/interp_jit.py
+++ b/pypy/module/pypyjit/interp_jit.py
@@ -48,7 +48,6 @@
         self = hint(self, access_directly=True)
         next_instr = r_uint(next_instr)
         is_being_profiled = self.is_being_profiled
-        rstm.push_marker(intmask(next_instr) * 2 + 1, pycode)
         try:
             while True:
                 pypyjitdriver.jit_merge_point(ec=ec,
@@ -70,8 +69,6 @@
         except ExitFrame:
             self.last_exception = None
             return self.popvalue()
-        finally:
-            rstm.pop_marker()
 
     def jump_absolute(self, jumpto, ec):
         if we_are_jitted():


More information about the pypy-commit mailing list