[pypy-svn] r69912 - in pypy/branch/listcopyop/pypy/rpython/memory: . gc

fijal at codespeak.net fijal at codespeak.net
Sat Dec 5 12:58:24 CET 2009


Author: fijal
Date: Sat Dec  5 12:58:24 2009
New Revision: 69912

Modified:
   pypy/branch/listcopyop/pypy/rpython/memory/gc/base.py
   pypy/branch/listcopyop/pypy/rpython/memory/gctypelayout.py
Log:
Revert up to 69890 - these were two irrelevant changes


Modified: pypy/branch/listcopyop/pypy/rpython/memory/gc/base.py
==============================================================================
--- pypy/branch/listcopyop/pypy/rpython/memory/gc/base.py	(original)
+++ pypy/branch/listcopyop/pypy/rpython/memory/gc/base.py	Sat Dec  5 12:58:24 2009
@@ -46,7 +46,6 @@
     DEBUG = False
 
     def set_query_functions(self, is_varsize, has_gcptr_in_varsize,
-                            has_gcptr,
                             is_gcarrayofgcptr,
                             getfinalizer,
                             offsets_to_gc_pointers,
@@ -59,7 +58,6 @@
         self.getfinalizer = getfinalizer
         self.is_varsize = is_varsize
         self.has_gcptr_in_varsize = has_gcptr_in_varsize
-        self.has_gcptr = has_gcptr
         self.is_gcarrayofgcptr = is_gcarrayofgcptr
         self.offsets_to_gc_pointers = offsets_to_gc_pointers
         self.fixed_size = fixed_size
@@ -155,18 +153,6 @@
     def x_clone(self, clonedata):
         raise RuntimeError("no support for x_clone in the GC")
 
-    def trace_gcarray(self, obj, callback, arg):
-        # a performance shortcut for GcArray(gcptr)
-        length = (obj + llmemory.gcarrayofptr_lengthoffset).signed[0]
-        item = obj + llmemory.gcarrayofptr_itemsoffset
-        while length > 0:
-            if self.points_to_valid_gc_object(item):
-                callback(item, arg)
-            item += llmemory.gcarrayofptr_singleitemoffset
-            length -= 1
-    trace_gcarray._dont_inline_ = True
-    trace_gcarray._annspecialcase_ = 'specialize:arg(2)'
-
     def trace(self, obj, callback, arg):
         """Enumerate the locations inside the given obj that can contain
         GC pointers.  For each such location, callback(pointer, arg) is
@@ -174,10 +160,15 @@
         Typically, 'callback' is a bound method and 'arg' can be None.
         """
         typeid = self.get_type_id(obj)
-        if not self.has_gcptr(typeid):
-            return
         if self.is_gcarrayofgcptr(typeid):
-            self.trace_gcarray(obj, callback, arg)
+            # a performance shortcut for GcArray(gcptr)
+            length = (obj + llmemory.gcarrayofptr_lengthoffset).signed[0]
+            item = obj + llmemory.gcarrayofptr_itemsoffset
+            while length > 0:
+                if self.points_to_valid_gc_object(item):
+                    callback(item, arg)
+                item += llmemory.gcarrayofptr_singleitemoffset
+                length -= 1
             return
         offsets = self.offsets_to_gc_pointers(typeid)
         i = 0

Modified: pypy/branch/listcopyop/pypy/rpython/memory/gctypelayout.py
==============================================================================
--- pypy/branch/listcopyop/pypy/rpython/memory/gctypelayout.py	(original)
+++ pypy/branch/listcopyop/pypy/rpython/memory/gctypelayout.py	Sat Dec  5 12:58:24 2009
@@ -62,10 +62,6 @@
         infobits = self.get(typeid).infobits
         return (infobits & T_HAS_GCPTR_IN_VARSIZE) != 0
 
-    def q_has_gcptrs(self, typeid):
-        infobits = self.get(typeid).infobits
-        return (infobits & T_HAS_GCPTR) != 0        
-
     def q_is_gcarrayofgcptr(self, typeid):
         infobits = self.get(typeid).infobits
         return (infobits & T_IS_GCARRAY_OF_GCPTR) != 0
@@ -105,7 +101,6 @@
         gc.set_query_functions(
             self.q_is_varsize,
             self.q_has_gcptr_in_varsize,
-            self.q_has_gcptrs,
             self.q_is_gcarrayofgcptr,
             self.q_finalizer,
             self.q_offsets_to_gc_pointers,
@@ -122,9 +117,8 @@
 T_MEMBER_INDEX         = 0xffff
 T_IS_VARSIZE           = 0x10000
 T_HAS_GCPTR_IN_VARSIZE = 0x20000
-T_HAS_GCPTR            = 0x40000
-T_IS_GCARRAY_OF_GCPTR  = 0x80000
-T_IS_WEAKREF           = 0x100000
+T_IS_GCARRAY_OF_GCPTR  = 0x40000
+T_IS_WEAKREF           = 0x80000
 
 def _check_typeid(typeid):
     ll_assert(llop.is_group_member_nonzero(lltype.Bool, typeid),
@@ -137,7 +131,6 @@
     infobits = index
     info.ofstoptrs = builder.offsets2table(offsets, TYPE)
     info.finalizer = builder.make_finalizer_funcptr_for_type(TYPE)
-    arroffsets = None
     if not TYPE._is_varsize():
         info.fixedsize = llarena.round_up_for_allocation(
             llmemory.sizeof(TYPE), builder.GCClass.object_minimal_size)
@@ -164,18 +157,15 @@
             varinfo.ofstovar = llmemory.itemoffsetof(TYPE, 0)
         assert isinstance(ARRAY, lltype.Array)
         if ARRAY.OF != lltype.Void:
-            arroffsets = offsets_to_gc_pointers(ARRAY.OF)
+            offsets = offsets_to_gc_pointers(ARRAY.OF)
         else:
-            arroffsets = ()
-        if len(arroffsets) > 0:
+            offsets = ()
+        if len(offsets) > 0:
             infobits |= T_HAS_GCPTR_IN_VARSIZE
-        varinfo.varofstoptrs = builder.offsets2table(arroffsets, ARRAY.OF)
+        varinfo.varofstoptrs = builder.offsets2table(offsets, ARRAY.OF)
         varinfo.varitemsize = llmemory.sizeof(ARRAY.OF)
     if TYPE == WEAKREF:
         infobits |= T_IS_WEAKREF
-    if offsets or arroffsets:
-        infobits |= T_HAS_GCPTR
-
     info.infobits = infobits
 
 # ____________________________________________________________



More information about the Pypy-commit mailing list