Author: Armin Rigo <[email protected]>
Branch: stmgc-c7
Changeset: r70539:49bd6de52d50
Date: 2014-04-10 15:23 +0200
http://bitbucket.org/pypy/pypy/changeset/49bd6de52d50/

Log:    Trying to fix the parts of mapdict.py that are enabled and the parts
        that are disabled, in a -stm-jit translation

diff --git a/TODO b/TODO
--- a/TODO
+++ b/TODO
@@ -85,6 +85,12 @@
 
 ------------------------------------------------------------
 
+Re-add the disabled optimization (only outside the jit):
+(1) withmethodcache
+(2) LOAD_ATTR_caching, LOOKUP_METHOD_mapdict
+
+------------------------------------------------------------
+
 
 
 
diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py
--- a/pypy/config/pypyoption.py
+++ b/pypy/config/pypyoption.py
@@ -324,13 +324,15 @@
     # extra optimizations with the JIT
     if level == 'jit':
         config.objspace.std.suggest(withcelldict=True)
-        #if not config.translation.stm:
         config.objspace.std.suggest(withmapdict=True)
 
     # tweaks some parameters with STM
     if config.translation.stm:
         config.objspace.std.suggest(methodcachesizeexp=9)
-        # XXX try at some point to see if withmapdict=True would make sense
+        # having both mapdict and methodcache together is a bad idea:
+        # it creates many conflicts
+        if config.objspace.std.withmapdict:
+            config.objspace.std.withmethodcache = False
 
 
 def enable_allworkingmodules(config):
diff --git a/pypy/interpreter/pycode.py b/pypy/interpreter/pycode.py
--- a/pypy/interpreter/pycode.py
+++ b/pypy/interpreter/pycode.py
@@ -123,7 +123,8 @@
 
         self._compute_flatcall()
 
-        if self.space.config.objspace.std.withmapdict:
+        if (self.space.config.objspace.std.withmapdict and
+            not self.space.config.translation.stm):
             from pypy.objspace.std.mapdict import init_mapdict_cache
             init_mapdict_cache(self)
 
diff --git a/pypy/interpreter/pyopcode.py b/pypy/interpreter/pyopcode.py
--- a/pypy/interpreter/pyopcode.py
+++ b/pypy/interpreter/pyopcode.py
@@ -968,8 +968,9 @@
     def LOAD_ATTR(self, nameindex, next_instr):
         "obj.attributename"
         w_obj = self.popvalue()
-        if (self.space.config.objspace.std.withmapdict
-            and not jit.we_are_jitted()):
+        if (self.space.config.objspace.std.withmapdict and
+                not self.space.config.translation.stm and
+                not jit.we_are_jitted()):
             from pypy.objspace.std.mapdict import LOAD_ATTR_caching
             w_value = LOAD_ATTR_caching(self.getcode(), w_obj, nameindex)
         else:
diff --git a/pypy/objspace/std/callmethod.py b/pypy/objspace/std/callmethod.py
--- a/pypy/objspace/std/callmethod.py
+++ b/pypy/objspace/std/callmethod.py
@@ -33,7 +33,9 @@
     space = f.space
     w_obj = f.popvalue()
 
-    if space.config.objspace.std.withmapdict and not jit.we_are_jitted():
+    if (space.config.objspace.std.withmapdict and
+            not space.config.translation.stm and
+            not jit.we_are_jitted()):
         # mapdict has an extra-fast version of this function
         if LOOKUP_METHOD_mapdict(f, nameindex, w_obj):
             return
@@ -60,6 +62,7 @@
                     f.pushvalue(w_descr)
                     f.pushvalue(w_obj)
                     if (space.config.objspace.std.withmapdict and
+                            not space.config.translation.stm and
                             not jit.we_are_jitted()):
                         # let mapdict cache stuff
                         LOOKUP_METHOD_mapdict_fill_cache_method(
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to