Пример #1
0
 def debug_check_consistency(self):
     if self.DEBUG:
         self._d_gen2ro = self.gen2_rawmalloced_objects.stack2dict()
         GenerationGC.debug_check_consistency(self)
         self._d_gen2ro.delete()
         self.gen2_rawmalloced_objects.foreach(self._debug_check_gen2, None)
         self.gen3_rawmalloced_objects.foreach(self._debug_check_gen3, None)
Пример #2
0
 def debug_check_consistency(self):
     if self.DEBUG:
         self._d_gen2ro = self.gen2_rawmalloced_objects.stack2dict()
         GenerationGC.debug_check_consistency(self)
         self._d_gen2ro.delete()
         self.gen2_rawmalloced_objects.foreach(self._debug_check_gen2, None)
         self.gen3_rawmalloced_objects.foreach(self._debug_check_gen3, None)
Пример #3
0
 def debug_check_object(self, obj):
     """Check the invariants about 'obj' that should be true
     between collections."""
     GenerationGC.debug_check_object(self, obj)
     tid = self.header(obj).tid
     if tid & GCFLAG_UNVISITED:
         ll_assert(self._d_gen2ro.contains(obj),
                   "GCFLAG_UNVISITED on non-gen2 object")
Пример #4
0
 def debug_check_object(self, obj):
     """Check the invariants about 'obj' that should be true
     between collections."""
     GenerationGC.debug_check_object(self, obj)
     tid = self.header(obj).tid
     if tid & GCFLAG_UNVISITED:
         ll_assert(self._d_gen2ro.contains(obj),
                   "GCFLAG_UNVISITED on non-gen2 object")
Пример #5
0
    def setup(self):
        self.large_objects_collect_trigger = self.param_space_size
        self._initial_trigger = self.large_objects_collect_trigger
        self.rawmalloced_objects_to_trace = self.AddressStack()
        self.count_semispaceonly_collects = 0

        self.gen2_rawmalloced_objects = self.AddressStack()
        self.gen3_rawmalloced_objects = self.AddressStack()
        GenerationGC.setup(self)
Пример #6
0
    def setup(self):
        self.large_objects_collect_trigger = self.param_space_size
        self._initial_trigger = self.large_objects_collect_trigger
        self.rawmalloced_objects_to_trace = self.AddressStack()
        self.count_semispaceonly_collects = 0

        self.gen2_rawmalloced_objects = self.AddressStack()
        self.gen3_rawmalloced_objects = self.AddressStack()
        GenerationGC.setup(self)
Пример #7
0
 def collect_roots(self):
     if not self.is_collecting_gen3():
         GenerationGC.collect_roots(self)
     else:
         # as we don't record which prebuilt gc objects point to
         # rawmalloced generation 3 objects, we have to trace all
         # the prebuilt gc objects.
         self.root_walker.walk_roots(
             SemiSpaceGC._collect_root,  # stack roots
             SemiSpaceGC._collect_root,  # static in prebuilt non-gc structs
             SemiSpaceGC._collect_root)  # static in prebuilt gc objects
Пример #8
0
 def collect_roots(self):
     if not self.is_collecting_gen3():
         GenerationGC.collect_roots(self)
     else:
         # as we don't record which prebuilt gc objects point to
         # rawmalloced generation 3 objects, we have to trace all
         # the prebuilt gc objects.
         self.root_walker.walk_roots(
             SemiSpaceGC._collect_root,  # stack roots
             SemiSpaceGC._collect_root,  # static in prebuilt non-gc structs
             SemiSpaceGC._collect_root)  # static in prebuilt gc objects
Пример #9
0
 def scan_copied(self, scan):
     # Alternate between scanning the regular objects we just moved
     # and scanning the raw_malloc'ed object we just visited.
     progress = True
     while progress:
         newscan = GenerationGC.scan_copied(self, scan)
         progress = newscan != scan
         scan = newscan
         while self.rawmalloced_objects_to_trace.non_empty():
             obj = self.rawmalloced_objects_to_trace.pop()
             self.trace_and_copy(obj)
             progress = True
     return scan
Пример #10
0
 def scan_copied(self, scan):
     # Alternate between scanning the regular objects we just moved
     # and scanning the raw_malloc'ed object we just visited.
     progress = True
     while progress:
         newscan = GenerationGC.scan_copied(self, scan)
         progress = newscan != scan
         scan = newscan
         while self.rawmalloced_objects_to_trace.non_empty():
             obj = self.rawmalloced_objects_to_trace.pop()
             self.trace_and_copy(obj)
             progress = True
     return scan
Пример #11
0
    def __init__(self, *args, **kwds):
        large_object = kwds.pop('large_object', 6 * WORD)
        large_object_gcptrs = kwds.pop('large_object_gcptrs', 8 * WORD)
        self.generation3_collect_threshold = kwds.pop(
            'generation3_collect_threshold', GENERATION3_COLLECT_THRESHOLD)
        GenerationGC.__init__(self, *args, **kwds)

        # Objects whose total size is at least 'large_object' bytes are
        # allocated separately in a mark-n-sweep fashion.  If the object
        # has GC pointers in its varsized part, we use instead the
        # higher limit 'large_object_gcptrs'.  The idea is that
        # separately allocated objects are allocated immediately "old"
        # and it's not good to have too many pointers from old to young
        # objects.

        # In this class, we assume that the 'large_object' limit is not
        # very high, so that all objects that wouldn't easily fit in the
        # nursery are considered large by this limit.  This is the
        # meaning of the 'assert' below.
        self.nonlarge_max = large_object - 1
        self.nonlarge_gcptrs_max = large_object_gcptrs - 1
        assert self.nonlarge_gcptrs_max <= self.lb_young_var_basesize
        assert self.nonlarge_max <= self.nonlarge_gcptrs_max
Пример #12
0
    def __init__(self, *args, **kwds):
        large_object = kwds.pop('large_object', 6*WORD)
        large_object_gcptrs = kwds.pop('large_object_gcptrs', 8*WORD)
        self.generation3_collect_threshold = kwds.pop(
            'generation3_collect_threshold', GENERATION3_COLLECT_THRESHOLD)
        GenerationGC.__init__(self, *args, **kwds)

        # Objects whose total size is at least 'large_object' bytes are
        # allocated separately in a mark-n-sweep fashion.  If the object
        # has GC pointers in its varsized part, we use instead the
        # higher limit 'large_object_gcptrs'.  The idea is that
        # separately allocated objects are allocated immediately "old"
        # and it's not good to have too many pointers from old to young
        # objects.

        # In this class, we assume that the 'large_object' limit is not
        # very high, so that all objects that wouldn't easily fit in the
        # nursery are considered large by this limit.  This is the
        # meaning of the 'assert' below.
        self.nonlarge_max = large_object - 1
        self.nonlarge_gcptrs_max = large_object_gcptrs - 1
        assert self.nonlarge_gcptrs_max <= self.lb_young_var_basesize
        assert self.nonlarge_max <= self.nonlarge_gcptrs_max
Пример #13
0
 def init_gc_object_immortal(
     self,
     addr,
     typeid,
     flags=(GCFLAG_NO_YOUNG_PTRS | GCFLAG_NO_HEAP_PTRS | GCFLAG_AGE_MAX)):
     GenerationGC.init_gc_object_immortal(self, addr, typeid, flags)
Пример #14
0
 def collect(self, gen=2):
     if gen > 1:
         self.count_semispaceonly_collects = self.generation3_collect_threshold
     GenerationGC.collect(self, gen)
Пример #15
0
 def collect(self, gen=2):
     if gen > 1:
         self.count_semispaceonly_collects = self.generation3_collect_threshold
     GenerationGC.collect(self, gen)
Пример #16
0
 def init_gc_object_immortal(self, addr, typeid,
                             flags=(GCFLAG_NO_YOUNG_PTRS |
                                    GCFLAG_NO_HEAP_PTRS |
                                    GCFLAG_AGE_MAX)):
     GenerationGC.init_gc_object_immortal(self, addr, typeid, flags)
Пример #17
0
 def _teardown(self):
     self.__ready = False # collecting here is expected
     GenerationGC._teardown(self)
Пример #18
0
 def _teardown(self):
     self.__ready = False  # collecting here is expected
     GenerationGC._teardown(self)
Пример #19
0
 def setup(self):
     from rpython.memory.gc.generation import GenerationGC
     GenerationGC.setup(self)
     self.__ready = True
Пример #20
0
 def setup(self):
     from rpython.memory.gc.generation import GenerationGC
     GenerationGC.setup(self)
     self.__ready = True