Esempio n. 1
0
 def make_a_copy(self, obj, objsize):
     # During a full collect, all copied objects might implicitly come
     # from the nursery.  If they do, we must add the GCFLAG_NO_YOUNG_PTRS.
     # If they don't, we count how many times they are copied and when
     # some threshold is reached we make the copy a non-movable "external"
     # object.  The threshold is MAX_SEMISPACE_AGE.
     tid = self.header(obj).tid
     # XXX the following logic is not doing exactly what is explained
     # above: any object without GCFLAG_NO_YOUNG_PTRS has its age not
     # incremented.  This is accidental: it means that objects that
     # are very often modified to point to young objects don't reach
     # the 3rd generation.  For now I'll leave it this way because
     # I'm not sure that it's a bad thing.
     if not (tid & GCFLAG_NO_YOUNG_PTRS):
         tid |= GCFLAG_NO_YOUNG_PTRS    # object comes from the nursery
     elif (tid & GCFLAG_AGE_MASK) < GCFLAG_AGE_MAX:
         tid += GCFLAG_AGE_ONE
     else:
         newobj = self.make_a_nonmoving_copy(obj, objsize)
         if newobj:
             return newobj
         tid &= ~GCFLAG_AGE_MASK
     # skip GenerationGC.make_a_copy() as we already did the right
     # thing about GCFLAG_NO_YOUNG_PTRS
     newobj = SemiSpaceGC.make_a_copy(self, obj, objsize)
     self.header(newobj).tid = tid
     return newobj
Esempio n. 2
0
 def make_a_copy(self, obj, objsize):
     # During a full collect, all copied objects might implicitly come
     # from the nursery.  If they do, we must add the GCFLAG_NO_YOUNG_PTRS.
     # If they don't, we count how many times they are copied and when
     # some threshold is reached we make the copy a non-movable "external"
     # object.  The threshold is MAX_SEMISPACE_AGE.
     tid = self.header(obj).tid
     # XXX the following logic is not doing exactly what is explained
     # above: any object without GCFLAG_NO_YOUNG_PTRS has its age not
     # incremented.  This is accidental: it means that objects that
     # are very often modified to point to young objects don't reach
     # the 3rd generation.  For now I'll leave it this way because
     # I'm not sure that it's a bad thing.
     if not (tid & GCFLAG_NO_YOUNG_PTRS):
         tid |= GCFLAG_NO_YOUNG_PTRS  # object comes from the nursery
     elif (tid & GCFLAG_AGE_MASK) < GCFLAG_AGE_MAX:
         tid += GCFLAG_AGE_ONE
     else:
         newobj = self.make_a_nonmoving_copy(obj, objsize)
         if newobj:
             return newobj
         tid &= ~GCFLAG_AGE_MASK
     # skip GenerationGC.make_a_copy() as we already did the right
     # thing about GCFLAG_NO_YOUNG_PTRS
     newobj = SemiSpaceGC.make_a_copy(self, obj, objsize)
     self.header(newobj).tid = tid
     return newobj
Esempio n. 3
0
 def make_a_copy(self, obj, objsize):
     newobj = SemiSpaceGC.make_a_copy(self, obj, objsize)
     # During a full collect, all copied objects might implicitly come
     # from the nursery.  In case they do, we must add this flag:
     self.header(newobj).tid |= GCFLAG_NO_YOUNG_PTRS
     return newobj
Esempio n. 4
0
 def make_a_copy(self, obj, objsize):
     newobj = SemiSpaceGC.make_a_copy(self, obj, objsize)
     # During a full collect, all copied objects might implicitly come
     # from the nursery.  In case they do, we must add this flag:
     self.header(newobj).tid |= GCFLAG_NO_YOUNG_PTRS
     return newobj