[pypy-commit] pypy incremental-gc: adding some more of minimark tests to incminimark
andrewchambers
noreply at buildbot.pypy.org
Thu Aug 8 01:26:13 CEST 2013
Author: Andrew Chambers <andrewchamberss at gmail.com>
Branch: incremental-gc
Changeset: r66005:858acb7c946f
Date: 2013-08-08 11:25 +1200
http://bitbucket.org/pypy/pypy/changeset/858acb7c946f/
Log: adding some more of minimark tests to incminimark
diff --git a/rpython/memory/gc/incminimark.py b/rpython/memory/gc/incminimark.py
--- a/rpython/memory/gc/incminimark.py
+++ b/rpython/memory/gc/incminimark.py
@@ -1672,10 +1672,11 @@
# made incremental.
if not self.objects_to_trace.non_empty():
+ if self.objects_with_finalizers.non_empty():
+ self.deal_with_objects_with_finalizers()
+
self.objects_to_trace.delete()
- if self.objects_with_finalizers.non_empty():
- self.deal_with_objects_with_finalizers()
#
# Weakref support: clear the weak pointers to dying objects
if self.old_objects_with_weakrefs.non_empty():
@@ -1737,9 +1738,12 @@
elif self.gc_state == STATE_FINALIZING:
# XXX This is considered rare,
# so should we make the calling incremental? or leave as is
+
+ # Must be ready to start another scan
+ self.gc_state = STATE_SCANNING
+ # just in case finalizer calls collect again.
self.execute_finalizers()
self.num_major_collects += 1
- self.gc_state = STATE_SCANNING
#END FINALIZING
else:
pass #XXX which exception to raise here. Should be unreachable.
diff --git a/rpython/memory/test/test_incminimark_gc.py b/rpython/memory/test/test_incminimark_gc.py
new file mode 100644
--- /dev/null
+++ b/rpython/memory/test/test_incminimark_gc.py
@@ -0,0 +1,11 @@
+from rpython.rlib.rarithmetic import LONG_BIT
+
+from rpython.memory.test import test_semispace_gc
+
+WORD = LONG_BIT // 8
+
+class TestIncrementalMiniMarkGC(test_semispace_gc.TestSemiSpaceGC):
+ from rpython.memory.gc.incminimark import IncrementalMiniMarkGC as GCClass
+ GC_CAN_SHRINK_BIG_ARRAY = False
+ GC_CAN_MALLOC_NONMOVABLE = True
+ BUT_HOW_BIG_IS_A_BIG_STRING = 11*WORD
diff --git a/rpython/memory/test/test_incminimark_gc_cardmarking.py b/rpython/memory/test/test_incminimark_gc_cardmarking.py
new file mode 100644
--- /dev/null
+++ b/rpython/memory/test/test_incminimark_gc_cardmarking.py
@@ -0,0 +1,4 @@
+from rpython.memory.test import test_incminimark_gc
+
+class TestIncrementalMiniMarkGCCardMarking(test_incminimark_gc.TestIncrementalMiniMarkGC):
+ GC_PARAMS = {'card_page_indices': 4}
diff --git a/rpython/memory/test/test_transformed_gc.py b/rpython/memory/test/test_transformed_gc.py
--- a/rpython/memory/test/test_transformed_gc.py
+++ b/rpython/memory/test/test_transformed_gc.py
@@ -1259,6 +1259,50 @@
res = run([])
assert res == 123
+class TestIncrementalMiniMarkGC(TestHybridGC):
+ gcname = "incminimark"
+ GC_CAN_TEST_ID = True
+
+ class gcpolicy(gc.BasicFrameworkGcPolicy):
+ class transformerclass(shadowstack.ShadowStackFrameworkGCTransformer):
+ from rpython.memory.gc.incminimark \
+ import IncrementalMiniMarkGC as GCClass
+ GC_PARAMS = {'nursery_size': 32*WORD,
+ 'page_size': 16*WORD,
+ 'arena_size': 64*WORD,
+ 'small_request_threshold': 5*WORD,
+ 'large_object': 8*WORD,
+ 'card_page_indices': 4,
+ 'translated_to_c': False,
+ }
+ root_stack_depth = 200
+
+ def define_no_clean_setarrayitems(cls):
+ # The optimization find_clean_setarrayitems() in
+ # gctransformer/framework.py does not work with card marking.
+ # Check that it is turned off.
+ S = lltype.GcStruct('S', ('x', lltype.Signed))
+ A = lltype.GcArray(lltype.Ptr(S))
+ def sub(lst):
+ lst[15] = lltype.malloc(S) # 'lst' is set the single mark "12-15"
+ lst[15].x = 123
+ lst[0] = lst[15] # that would be a "clean_setarrayitem"
+ def f():
+ lst = lltype.malloc(A, 16) # 16 > 10
+ rgc.collect()
+ sub(lst)
+ null = lltype.nullptr(S)
+ lst[15] = null # clear, so that A() is only visible via lst[0]
+ rgc.collect() # -> crash
+ return lst[0].x
+ return f
+
+ def test_no_clean_setarrayitems(self):
+ run = self.runner("no_clean_setarrayitems")
+ res = run([])
+ assert res == 123
+
+
# ________________________________________________________________
# tagged pointers
More information about the pypy-commit
mailing list