[pypy-commit] pypy lightweight-finalizers: finish semispace
fijal
noreply at buildbot.pypy.org
Sun Oct 9 14:08:41 CEST 2011
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: lightweight-finalizers
Changeset: r47893:6306cf4fd3ef
Date: 2011-10-09 14:08 +0200
http://bitbucket.org/pypy/pypy/changeset/6306cf4fd3ef/
Log: finish semispace
diff --git a/pypy/jit/backend/llsupport/gc.py b/pypy/jit/backend/llsupport/gc.py
--- a/pypy/jit/backend/llsupport/gc.py
+++ b/pypy/jit/backend/llsupport/gc.py
@@ -678,7 +678,7 @@
# also use it to allocate varsized objects. The tid
# and possibly the length are both set afterward.
gcref = llop1.do_malloc_fixedsize_clear(llmemory.GCREF,
- 0, size, False, False)
+ 0, size, False, False, False)
return rffi.cast(lltype.Signed, gcref)
self.malloc_slowpath = malloc_slowpath
self.MALLOC_SLOWPATH = lltype.FuncType([lltype.Signed], lltype.Signed)
diff --git a/pypy/jit/backend/llsupport/test/test_gc.py b/pypy/jit/backend/llsupport/test/test_gc.py
--- a/pypy/jit/backend/llsupport/test/test_gc.py
+++ b/pypy/jit/backend/llsupport/test/test_gc.py
@@ -247,7 +247,8 @@
self.record = []
def do_malloc_fixedsize_clear(self, RESTYPE, type_id, size,
- has_finalizer, contains_weakptr):
+ has_finalizer, has_light_finalizer,
+ contains_weakptr):
assert not contains_weakptr
p = llmemory.raw_malloc(size)
p = llmemory.cast_adr_to_ptr(p, RESTYPE)
diff --git a/pypy/rpython/memory/gc/generation.py b/pypy/rpython/memory/gc/generation.py
--- a/pypy/rpython/memory/gc/generation.py
+++ b/pypy/rpython/memory/gc/generation.py
@@ -168,7 +168,9 @@
return self.nursery <= addr < self.nursery_top
def malloc_fixedsize_clear(self, typeid, size,
- has_finalizer=False, contains_weakptr=False):
+ has_finalizer=False,
+ has_light_finalizer=False,
+ contains_weakptr=False):
if (has_finalizer or
(raw_malloc_usage(size) > self.lb_young_fixedsize and
raw_malloc_usage(size) > self.largest_young_fixedsize)):
diff --git a/pypy/rpython/memory/gc/minimark.py b/pypy/rpython/memory/gc/minimark.py
--- a/pypy/rpython/memory/gc/minimark.py
+++ b/pypy/rpython/memory/gc/minimark.py
@@ -461,7 +461,9 @@
def malloc_fixedsize_clear(self, typeid, size,
- needs_finalizer=False, contains_weakptr=False):
+ needs_finalizer=False,
+ has_light_finalizer=False,
+ contains_weakptr=False):
size_gc_header = self.gcheaderbuilder.size_gc_header
totalsize = size_gc_header + size
rawtotalsize = raw_malloc_usage(totalsize)
diff --git a/pypy/rpython/memory/gc/semispace.py b/pypy/rpython/memory/gc/semispace.py
--- a/pypy/rpython/memory/gc/semispace.py
+++ b/pypy/rpython/memory/gc/semispace.py
@@ -484,7 +484,15 @@
don't do anything fancy and *just* call them. Among other things
they won't resurrect objects
"""
- xxx
+ new_objects = self.AddressStack()
+ while self.objects_with_light_finalizers.non_empty():
+ obj = self.objects_with_light_finalizers.pop()
+ if self.surviving(obj):
+ new_objects.append(self.get_forwarding_address(obj))
+ else:
+ finalizer = self.getfinalizer(self.get_type_id(obj))
+ finalizer(obj, llmemory.NULL)
+ self.objects_with_light_finalizers = new_objects
def deal_with_objects_with_finalizers(self, scan):
# walk over list of objects with finalizers
More information about the pypy-commit
mailing list