Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r65768:a89ed91dc553 Date: 2013-07-29 10:28 +0200 http://bitbucket.org/pypy/pypy/changeset/a89ed91dc553/
Log: Fix 74ec2abeb333: in particular, the line if infobits | T_HAS_GCPTR_IN_VARSIZE... is equivalent to "if True", so the shortcut was never taken. diff --git a/rpython/memory/gc/minimark.py b/rpython/memory/gc/minimark.py --- a/rpython/memory/gc/minimark.py +++ b/rpython/memory/gc/minimark.py @@ -991,9 +991,12 @@ # after a minor or major collection, no object should be in the nursery ll_assert(not self.is_in_nursery(obj), "object in nursery after collection") - # similarily, all objects should have this flag: - ll_assert(self.header(obj).tid & GCFLAG_TRACK_YOUNG_PTRS != 0, - "missing GCFLAG_TRACK_YOUNG_PTRS") + # similarily, all objects should have this flag, except if they + # don't have any GC pointer + typeid = self.get_type_id(obj) + if self.has_gcptr(typeid): + ll_assert(self.header(obj).tid & GCFLAG_TRACK_YOUNG_PTRS != 0, + "missing GCFLAG_TRACK_YOUNG_PTRS") # the GCFLAG_VISITED should not be set between collections ll_assert(self.header(obj).tid & GCFLAG_VISITED == 0, "unexpected GCFLAG_VISITED") diff --git a/rpython/memory/gctypelayout.py b/rpython/memory/gctypelayout.py --- a/rpython/memory/gctypelayout.py +++ b/rpython/memory/gctypelayout.py @@ -203,6 +203,8 @@ offsets = offsets_to_gc_pointers(TYPE) infobits = index info.ofstoptrs = builder.offsets2table(offsets, TYPE) + if len(offsets) > 0: + infobits |= T_HAS_GCPTR # fptrs = builder.special_funcptr_for_type(TYPE) if fptrs: @@ -216,7 +218,7 @@ infobits |= T_HAS_FINALIZER | T_HAS_LIGHTWEIGHT_FINALIZER if "custom_trace" in fptrs: extra.customtracer = fptrs["custom_trace"] - infobits |= T_HAS_CUSTOM_TRACE + infobits |= T_HAS_CUSTOM_TRACE | T_HAS_GCPTR info.extra = extra # if not TYPE._is_varsize(): @@ -249,15 +251,13 @@ else: offsets = () if len(offsets) > 0: - infobits |= T_HAS_GCPTR_IN_VARSIZE + infobits |= T_HAS_GCPTR_IN_VARSIZE | T_HAS_GCPTR varinfo.varofstoptrs = builder.offsets2table(offsets, ARRAY.OF) varinfo.varitemsize = llmemory.sizeof(ARRAY.OF) if builder.is_weakref_type(TYPE): infobits |= T_IS_WEAKREF if is_subclass_of_object(TYPE): infobits |= T_IS_RPYTHON_INSTANCE - if infobits | T_HAS_GCPTR_IN_VARSIZE or offsets: - infobits |= T_HAS_GCPTR info.infobits = infobits | T_KEY_VALUE # ____________________________________________________________ _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit