[pypy-commit] pypy default: Change the repr of 'lib.func' to include the full signature
Author: Armin Rigo Branch: Changeset: r83832:7e2e9ca21aac Date: 2016-04-23 09:19 +0200 http://bitbucket.org/pypy/pypy/changeset/7e2e9ca21aac/ Log:Change the repr of 'lib.func' to include the full signature diff --git a/pypy/module/_cffi_backend/wrapper.py b/pypy/module/_cffi_backend/wrapper.py --- a/pypy/module/_cffi_backend/wrapper.py +++ b/pypy/module/_cffi_backend/wrapper.py @@ -92,7 +92,8 @@ return ctype._call(self.fnptr, args_w) def descr_repr(self, space): -return space.wrap("" % (self.fnname,)) +doc = self.rawfunctype.repr_fn_type(self.ffi, self.fnname) +return space.wrap("" % (doc,)) def descr_get_doc(self, space): doc = self.rawfunctype.repr_fn_type(self.ffi, self.fnname) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy remove-objspace-options: remove the withmapdict option and turn it on by default
Author: Carl Friedrich Bolz Branch: remove-objspace-options Changeset: r83833:48959a7aa4db Date: 2016-04-22 11:37 +0300 http://bitbucket.org/pypy/pypy/changeset/48959a7aa4db/ Log:remove the withmapdict option and turn it on by default there is still some cleanup needed in get_unique_interplevel_subclass diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py --- a/pypy/config/pypyoption.py +++ b/pypy/config/pypyoption.py @@ -218,10 +218,6 @@ default=False, requires=[("objspace.honor__builtins__", False)]), -BoolOption("withmapdict", - "make instances really small but slow without the JIT", - default=False), - BoolOption("withliststrategies", "enable optimized ways to store lists of primitives ", default=True), @@ -277,14 +273,12 @@ config.objspace.std.suggest(withprebuiltint=True) config.objspace.std.suggest(withliststrategies=True) config.objspace.std.suggest(sharesmallstr=True) -config.objspace.std.suggest(withmapdict=True) if not IS_64_BITS: config.objspace.std.suggest(withsmalllong=True) # extra optimizations with the JIT if level == 'jit': config.objspace.std.suggest(withcelldict=True) -config.objspace.std.suggest(withmapdict=True) def enable_allworkingmodules(config): diff --git a/pypy/config/test/test_pypyoption.py b/pypy/config/test/test_pypyoption.py --- a/pypy/config/test/test_pypyoption.py +++ b/pypy/config/test/test_pypyoption.py @@ -11,12 +11,6 @@ assert conf.objspace.usemodules.gc -conf.objspace.std.withmapdict = True -assert conf.objspace.std.withtypeversion -conf = get_pypy_config() -conf.objspace.std.withtypeversion = False -py.test.raises(ConfigError, "conf.objspace.std.withmapdict = True") - def test_conflicting_gcrootfinder(): conf = get_pypy_config() conf.translation.gc = "boehm" @@ -47,10 +41,10 @@ def test_set_pypy_opt_level(): conf = get_pypy_config() set_pypy_opt_level(conf, '2') -assert conf.objspace.std.getattributeshortcut +assert conf.objspace.std.intshortcut conf = get_pypy_config() set_pypy_opt_level(conf, '0') -assert not conf.objspace.std.getattributeshortcut +assert not conf.objspace.std.intshortcut def test_check_documentation(): def check_file_exists(fn): diff --git a/pypy/doc/config/objspace.std.withmapdict.txt b/pypy/doc/config/objspace.std.withmapdict.txt deleted file mode 100644 --- a/pypy/doc/config/objspace.std.withmapdict.txt +++ /dev/null @@ -1,5 +0,0 @@ -Enable the new version of "sharing dictionaries". - -See the section in `Standard Interpreter Optimizations`_ for more details. - -.. _`Standard Interpreter Optimizations`: ../interpreter-optimizations.html#sharing-dicts diff --git a/pypy/interpreter/pycode.py b/pypy/interpreter/pycode.py --- a/pypy/interpreter/pycode.py +++ b/pypy/interpreter/pycode.py @@ -114,6 +114,7 @@ e.write_unraisable(self.space, "new_code_hook()") def _initialize(self): +from pypy.objspace.std.mapdict import init_mapdict_cache if self.co_cellvars: argcount = self.co_argcount assert argcount >= 0 # annotator hint @@ -149,9 +150,7 @@ self._compute_flatcall() -if self.space.config.objspace.std.withmapdict: -from pypy.objspace.std.mapdict import init_mapdict_cache -init_mapdict_cache(self) +init_mapdict_cache(self) def _init_ready(self): "This is a hook for the vmprof module, which overrides this method." diff --git a/pypy/interpreter/pyopcode.py b/pypy/interpreter/pyopcode.py --- a/pypy/interpreter/pyopcode.py +++ b/pypy/interpreter/pyopcode.py @@ -951,8 +951,7 @@ 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 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/interpreter/typedef.py b/pypy/interpreter/typedef.py --- a/pypy/interpreter/typedef.py +++ b/pypy/interpreter/typedef.py @@ -160,7 +160,7 @@ typedef = cls.typedef if wants_dict and typedef.hasdict: wants_dict = False -if config.objspace.std.withmapdict and not typedef.hasdict: +if not typedef.hasdict: # mapdict only works if the type does not already have a dict if wants_del: parentcls = get_unique_interplevel_subclass(config, cls, True, True, @@ -226,7 +226,7 @@ value = func_with_new_name(value, value.func_name) body[key] = value -if (config.objspace.std.withmapdict and "dict" in fea
[pypy-commit] pypy remove-objspace-options: use mapdict for all the subclassing
Author: Carl Friedrich Bolz Branch: remove-objspace-options Changeset: r83834:311cb478ad96 Date: 2016-04-23 11:41 +0300 http://bitbucket.org/pypy/pypy/changeset/311cb478ad96/ Log:use mapdict for all the subclassing replace a huge mess by a different kind of (smaller) mess diff --git a/pypy/interpreter/typedef.py b/pypy/interpreter/typedef.py --- a/pypy/interpreter/typedef.py +++ b/pypy/interpreter/typedef.py @@ -98,175 +98,51 @@ # reason is that it is missing a place to store the __dict__, the slots, # the weakref lifeline, and it typically has no interp-level __del__. # So we create a few interp-level subclasses of W_XxxObject, which add -# some combination of features. -# -# We don't build 2**4 == 16 subclasses for all combinations of requested -# features, but limit ourselves to 6, chosen a bit arbitrarily based on -# typical usage (case 1 is the most common kind of app-level subclasses; -# case 2 is the memory-saving kind defined with __slots__). -# -# ++ -# | NOTE: if withmapdict is enabled, the following doesn't apply! | -# | Map dicts can flexibly allow any slots/__dict__/__weakref__ to | -# | show up only when needed. In particular there is no way with | -# | mapdict to prevent some objects from being weakrefable.| -# ++ -# -# dict slots del weakrefable -# -# 1.Y N N Y UserDictWeakref -# 2.N Y N N UserSlots -# 3.Y Y N Y UserDictWeakrefSlots -# 4.N Y N Y UserSlotsWeakref -# 5.Y Y Y Y UserDictWeakrefSlotsDel -# 6.N Y Y Y UserSlotsWeakrefDel -# -# Note that if the app-level explicitly requests no dict, we should not -# provide one, otherwise storing random attributes on the app-level -# instance would unexpectedly work. We don't care too much, though, if -# an object is weakrefable when it shouldn't really be. It's important -# that it has a __del__ only if absolutely needed, as this kills the -# performance of the GCs. -# -# Interp-level inheritance is like this: -# -#W_XxxObject base -# / \ -#1 2 -# / \ -# 3 4 -# / \ -#5 6 +# some combination of features. This is done using mapdict. -def get_unique_interplevel_subclass(config, cls, hasdict, wants_slots, -needsdel=False, weakrefable=False): +# we need two subclasses of the app-level type, one to add mapdict, and then one +# to add del to not slow down the GC. + +def get_unique_interplevel_subclass(config, cls, needsdel=False): "NOT_RPYTHON: initialization-time only" if hasattr(cls, '__del__') and getattr(cls, "handle_del_manually", False): needsdel = False assert cls.typedef.acceptable_as_base_class -key = config, cls, hasdict, wants_slots, needsdel, weakrefable +key = config, cls, needsdel try: return _subclass_cache[key] except KeyError: -subcls = _getusercls(config, cls, hasdict, wants_slots, needsdel, - weakrefable) +# XXX can save a class if cls already has a __del__ +if needsdel: +cls = get_unique_interplevel_subclass(config, cls, False) +subcls = _getusercls(config, cls, needsdel) assert key not in _subclass_cache _subclass_cache[key] = subcls return subcls get_unique_interplevel_subclass._annspecialcase_ = "specialize:memo" _subclass_cache = {} -def _getusercls(config, cls, wants_dict, wants_slots, wants_del, weakrefable): +def _getusercls(config, cls, wants_del, reallywantdict=False): +from rpython.rlib import objectmodel +from pypy.objspace.std.mapdict import (BaseUserClassMapdict, +MapdictDictSupport, MapdictWeakrefSupport, +_make_storage_mixin_size_n) typedef = cls.typedef -if wants_dict and typedef.hasdict: -wants_dict = False -if not typedef.hasdict: -# mapdict only works if the type does not already have a dict -if wants_del: -parentcls = get_unique_interplevel_subclass(config, cls, True, True, -False, True) -return _usersubclswithfeature(config, parentcls, "del") -return _usersubclswithfeature(config, cls, "user", "dict", "weakref", "slots") -# Forest of if's - see the comment above. +name = cls.__name__ + "User" + +mixins_needed = [BaseUserClassMapdict, _make_storage_mixin_size_n()] +if reallywantdict or not typedef.hasdict: +# the type has no dict, mapdict to provide the dict +mixins_needed.append(MapdictDictSupport) +name += "Dict" +if not typedef.weakrefable: +# the type d
[pypy-commit] pypy.org extradoc: update the values
Author: Armin Rigo Branch: extradoc Changeset: r734:feb526a4d4e1 Date: 2016-04-23 17:39 +0200 http://bitbucket.org/pypy/pypy.org/changeset/feb526a4d4e1/ Log:update the values diff --git a/don1.html b/don1.html --- a/don1.html +++ b/don1.html @@ -9,13 +9,13 @@ $(function() { $("#progressbar").progressbar({ - value: 60.5 + value: 60.7 }); }); - $63553 of $105000 (60.5%) + $63753 of $105000 (60.7%) @@ -23,7 +23,7 @@ This donation goes towards supporting Python 3 in PyPy. Current status: -we have $8652 left +we have $8834 left in the account. Read proposal diff --git a/don4.html b/don4.html --- a/don4.html +++ b/don4.html @@ -17,7 +17,7 @@ 2nd call: - $30620 of $8 (38.3%) + $30660 of $8 (38.3%) @@ -25,7 +25,7 @@ This donation goes towards supporting the Transactional Memory in PyPy. Current status: -we have $23312 left +we have $23346 left in the account. Read proposal (2nd call) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy remove-objspace-options: problems that the enabling mapdict by default found:
Author: Carl Friedrich Bolz Branch: remove-objspace-options Changeset: r83835:9df69444009e Date: 2016-04-23 13:37 +0300 http://bitbucket.org/pypy/pypy/changeset/9df69444009e/ Log:problems that the enabling mapdict by default found: - the mapdict cache needed an extra lookup, that is fixed - looking up non-method things via the class is bad 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 @@ -23,6 +23,7 @@ def LOOKUP_METHOD(f, nameindex, *ignored): +from pypy.objspace.std.typeobject import MutableCell # stack before after # ----fast-methodfallback-case # @@ -44,7 +45,18 @@ w_type = space.type(w_obj) if w_type.has_object_getattribute(): name = space.str_w(w_name) -w_descr = w_type.lookup(name) +# bit of a mess to use these internal functions, but it allows the +# mapdict caching below to work without an additional lookup +version_tag = w_type.version_tag() +if version_tag is None: +_, w_descr = w_type._lookup_where(name) +w_descr_cell = None +else: +_, w_descr_cell = w_type._pure_lookup_where_possibly_with_method_cache( +name, version_tag) +w_descr = w_descr_cell +if isinstance(w_descr, MutableCell): +w_descr = w_descr.unwrap_cell(space) if w_descr is None: # this handles directly the common case # module.function(args..) @@ -62,7 +74,8 @@ if not jit.we_are_jitted(): # let mapdict cache stuff LOOKUP_METHOD_mapdict_fill_cache_method( -space, f.getcode(), name, nameindex, w_obj, w_type) +space, f.getcode(), name, nameindex, w_obj, w_type, +w_descr_cell) return if w_value is None: w_value = space.getattr(w_obj, w_name) diff --git a/pypy/objspace/std/mapdict.py b/pypy/objspace/std/mapdict.py --- a/pypy/objspace/std/mapdict.py +++ b/pypy/objspace/std/mapdict.py @@ -1011,22 +1011,15 @@ return False def LOOKUP_METHOD_mapdict_fill_cache_method(space, pycode, name, nameindex, -w_obj, w_type): +w_obj, w_type, w_method): +if w_method is None or isinstance(w_method, MutableCell): +# don't cache the MutableCell XXX could be fixed +return version_tag = w_type.version_tag() -if version_tag is None: -return +assert version_tag is not None map = w_obj._get_mapdict_map() if map is None or isinstance(map.terminator, DevolvedDictTerminator): return -# We know here that w_obj.getdictvalue(space, name) just returned None, -# so the 'name' is not in the instance. We repeat the lookup to find it -# in the class, this time taking care of the result: it can be either a -# quasi-constant class attribute, or actually a MutableCell --- which we -# must not cache. (It should not be None here, but you never know...) -_, w_method = w_type._pure_lookup_where_possibly_with_method_cache( -name, version_tag) -if w_method is None or isinstance(w_method, MutableCell): -return _fill_cache(pycode, nameindex, map, version_tag, -1, w_method) # XXX fix me: if a function contains a loop with both LOAD_ATTR and diff --git a/pypy/objspace/std/test/test_methodcache.py b/pypy/objspace/std/test/test_methodcache.py --- a/pypy/objspace/std/test/test_methodcache.py +++ b/pypy/objspace/std/test/test_methodcache.py @@ -202,7 +202,8 @@ l = [type.__getattribute__(A, "__new__")(A)] * 10 __pypy__.reset_method_cache_counter() for i, a in enumerate(l): -assert a.f() == 42 +# use getattr to circumvent the mapdict cache +assert getattr(a, "f")() == 42 cache_counter = __pypy__.method_cache_counter("f") assert sum(cache_counter) == 10 if cache_counter == (9, 1): @@ -225,9 +226,11 @@ assert a.x == i + 1 A.x += 1 cache_counter = __pypy__.method_cache_counter("x") -assert cache_counter[0] >= 350 +# XXX this is the bad case for the mapdict cache: looking up +# non-method attributes from the class +assert cache_counter[0] >= 450 assert cache_counter[1] >= 1 -assert sum(cache_counter) == 400 +assert sum(cache_counter) == 500 __pypy__.reset_method_cache_counter() a = A() ___ pypy-commit mailing list pypy-commit@python.org https://m
[pypy-commit] pypy.org extradoc: update the values
Author: Armin Rigo Branch: extradoc Changeset: r735:da20ab795cc8 Date: 2016-04-23 23:39 +0200 http://bitbucket.org/pypy/pypy.org/changeset/da20ab795cc8/ Log:update the values diff --git a/don1.html b/don1.html --- a/don1.html +++ b/don1.html @@ -15,7 +15,7 @@ - $63753 of $105000 (60.7%) + $63767 of $105000 (60.7%) @@ -23,7 +23,7 @@ This donation goes towards supporting Python 3 in PyPy. Current status: -we have $8834 left +we have $8847 left in the account. Read proposal diff --git a/don4.html b/don4.html --- a/don4.html +++ b/don4.html @@ -17,7 +17,7 @@ 2nd call: - $30660 of $8 (38.3%) + $30670 of $8 (38.3%) @@ -25,7 +25,7 @@ This donation goes towards supporting the Transactional Memory in PyPy. Current status: -we have $23346 left +we have $23355 left in the account. Read proposal (2nd call) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy gcheader-decl: GC headers don't need to be in the database
Author: Ronan Lamy Branch: gcheader-decl Changeset: r83836:b05e778c895c Date: 2016-04-24 05:08 +0100 http://bitbucket.org/pypy/pypy/changeset/b05e778c895c/ Log:GC headers don't need to be in the database diff --git a/rpython/translator/c/node.py b/rpython/translator/c/node.py --- a/rpython/translator/c/node.py +++ b/rpython/translator/c/node.py @@ -547,7 +547,6 @@ gct = self.db.gctransformer if gct is not None: self.gc_init = gct.gcheader_initdata(self.obj) -db.getcontainernode(self.gc_init) else: self.gc_init = None @@ -678,7 +677,6 @@ gct = self.db.gctransformer if gct is not None: self.gc_init = gct.gcheader_initdata(self.obj) -db.getcontainernode(self.gc_init) else: self.gc_init = None ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit