[pypy-commit] pypy stm-thread: Attempt to fix the hints

arigo noreply at buildbot.pypy.org
Mon May 7 11:26:33 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: stm-thread
Changeset: r54927:437ca6fe0118
Date: 2012-05-07 11:23 +0200
http://bitbucket.org/pypy/pypy/changeset/437ca6fe0118/

Log:	Attempt to fix the hints

diff --git a/pypy/interpreter/pyframe.py b/pypy/interpreter/pyframe.py
--- a/pypy/interpreter/pyframe.py
+++ b/pypy/interpreter/pyframe.py
@@ -144,6 +144,13 @@
         else:
             return self.execute_frame()
 
+    def _hints_for_stm(self):
+        self = hint(self, stm_write=True)
+        #hint(self.locals_stack_w, stm_write=True) -- later
+        #hint(self.cells, stm_immutable=True)      -- later
+        self = hint(self, access_directly=True)
+        return self
+
     def execute_frame(self, w_inputvalue=None, operr=None):
         """Execute this frame.  Main entry point to the interpreter.
         The optional arguments are there to handle a generator's frame:
@@ -151,10 +158,7 @@
         generator.throw().
         """
         if self.space.config.translation.stm:
-            self = hint(self, stm_write=True)
-            #hint(self.locals_stack_w, stm_write=True) -- later
-            #hint(self.cells, stm_immutable=True)      -- later
-            self = hint(self, access_directly=True)
+            self = self._hints_for_stm()
         # the following 'assert' is an annotation hint: it hides from
         # the annotator all methods that are defined in PyFrame but
         # overridden in the {,Host}FrameClass subclasses of PyFrame.
@@ -197,13 +201,13 @@
 
     # stack manipulation helpers
     def pushvalue(self, w_object):
-        hint(self, stm_assert_local=True)
+        #hint(self, stm_assert_local=True)    XXX re-enable
         depth = self.valuestackdepth
         self.locals_stack_w[depth] = w_object
         self.valuestackdepth = depth + 1
 
     def popvalue(self):
-        hint(self, stm_assert_local=True)
+        #hint(self, stm_assert_local=True)    XXX re-enable
         depth = self.valuestackdepth - 1
         assert depth >= self.pycode.co_nlocals, "pop from empty value stack"
         w_object = self.locals_stack_w[depth]
diff --git a/pypy/interpreter/pyopcode.py b/pypy/interpreter/pyopcode.py
--- a/pypy/interpreter/pyopcode.py
+++ b/pypy/interpreter/pyopcode.py
@@ -101,6 +101,7 @@
             raise self.__reraise      # re-raise the exception we got
 
     def _dispatch_stm_transaction(self, retry_counter):
+        self = self._hints_for_stm()
         try:
             co_code = self.pycode.co_code
             next_instr = r_uint(self.last_instr)
@@ -198,6 +199,7 @@
     def dispatch_bytecode(self, co_code, next_instr, ec):
         space = self.space
         while True:
+            self = self._hints_for_stm()
             self.last_instr = intmask(next_instr)
             if not jit.we_are_jitted():
                 ec.bytecode_trace(self)


More information about the pypy-commit mailing list