[pypy-commit] pypy default: Merged in incminimark-ll_assert (pull request #453)
arigo
pypy.commits at gmail.com
Thu Jun 9 04:48:21 EDT 2016
Author: Armin Rigo <armin.rigo at gmail.com>
Branch:
Changeset: r85054:d0457c3b2fed
Date: 2016-06-09 10:46 +0200
http://bitbucket.org/pypy/pypy/changeset/d0457c3b2fed/
Log: Merged in incminimark-ll_assert (pull request #453)
Use ll_assert (more often) in 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
@@ -281,11 +281,12 @@
large_object=8*WORD,
ArenaCollectionClass=None,
**kwds):
+ "NOT_RPYTHON"
MovingGCBase.__init__(self, config, **kwds)
assert small_request_threshold % WORD == 0
self.read_from_env = read_from_env
self.nursery_size = nursery_size
-
+
self.small_request_threshold = small_request_threshold
self.major_collection_threshold = major_collection_threshold
self.growth_rate_max = growth_rate_max
@@ -644,6 +645,7 @@
# Get the memory from the nursery. If there is not enough space
# there, do a collect first.
result = self.nursery_free
+ ll_assert(result != llmemory.NULL, "uninitialized nursery")
self.nursery_free = new_free = result + totalsize
if new_free > self.nursery_top:
result = self.collect_and_reserve(totalsize)
@@ -703,6 +705,7 @@
# Get the memory from the nursery. If there is not enough space
# there, do a collect first.
result = self.nursery_free
+ ll_assert(result != llmemory.NULL, "uninitialized nursery")
self.nursery_free = new_free = result + totalsize
if new_free > self.nursery_top:
result = self.collect_and_reserve(totalsize)
@@ -1139,7 +1142,8 @@
Implemented a bit obscurely by checking an unrelated flag
that can never be set on a young object -- except if tid == -42.
"""
- assert self.is_in_nursery(obj)
+ ll_assert(self.is_in_nursery(obj),
+ "Can't forward an object outside the nursery.")
tid = self.header(obj).tid
result = (tid & GCFLAG_FINALIZATION_ORDERING != 0)
if result:
@@ -1463,7 +1467,8 @@
objhdr.tid |= GCFLAG_CARDS_SET
remember_young_pointer_from_array2._dont_inline_ = True
- assert self.card_page_indices > 0
+ ll_assert(self.card_page_indices > 0,
+ "non-positive card_page_indices")
self.remember_young_pointer_from_array2 = (
remember_young_pointer_from_array2)
@@ -1513,7 +1518,8 @@
return True
# ^^^ a fast path of write-barrier
#
- if source_hdr.tid & GCFLAG_HAS_CARDS != 0:
+ if (self.card_page_indices > 0 and # check constant-folded
+ source_hdr.tid & GCFLAG_HAS_CARDS != 0):
#
if source_hdr.tid & GCFLAG_TRACK_YOUNG_PTRS == 0:
# The source object may have random young pointers.
@@ -1548,7 +1554,8 @@
def manually_copy_card_bits(self, source_addr, dest_addr, length):
# manually copy the individual card marks from source to dest
- assert self.card_page_indices > 0
+ ll_assert(self.card_page_indices > 0,
+ "non-positive card_page_indices")
bytes = self.card_marking_bytes_for_length(length)
#
anybyte = 0
@@ -1721,12 +1728,15 @@
nursery_barriers = self.AddressDeque()
prev = self.nursery
self.surviving_pinned_objects.sort()
- assert self.pinned_objects_in_nursery == \
- self.surviving_pinned_objects.length()
+ ll_assert(
+ self.pinned_objects_in_nursery == \
+ self.surviving_pinned_objects.length(),
+ "pinned_objects_in_nursery != surviving_pinned_objects.length()")
while self.surviving_pinned_objects.non_empty():
#
cur = self.surviving_pinned_objects.pop()
- assert cur >= prev
+ ll_assert(
+ cur >= prev, "pinned objects encountered in backwards order")
#
# clear the arena between the last pinned object (or arena start)
# and the pinned object
@@ -1784,7 +1794,8 @@
debug_stop("gc-minor")
def _reset_flag_old_objects_pointing_to_pinned(self, obj, ignore):
- assert self.header(obj).tid & GCFLAG_PINNED_OBJECT_PARENT_KNOWN
+ ll_assert(self.header(obj).tid & GCFLAG_PINNED_OBJECT_PARENT_KNOWN != 0,
+ "!GCFLAG_PINNED_OBJECT_PARENT_KNOWN, but requested to reset.")
self.header(obj).tid &= ~GCFLAG_PINNED_OBJECT_PARENT_KNOWN
def _visit_old_objects_pointing_to_pinned(self, obj, ignore):
More information about the pypy-commit
mailing list