[pypy-commit] pypy raw-memory-pressure-nursery: fix the test and write another one. fix the typo
fijal
noreply at buildbot.pypy.org
Tue Feb 14 22:32:35 CET 2012
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: raw-memory-pressure-nursery
Changeset: r52479:8f8652b2b601
Date: 2012-02-14 23:32 +0200
http://bitbucket.org/pypy/pypy/changeset/8f8652b2b601/
Log: fix the test and write another one. fix the typo
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
@@ -1466,8 +1466,8 @@
# Copy it. Note that references to other objects in the
# nursery are kept unchanged in this step.
if self.header(obj).tid & GCFLAG_OWNS_RAW_MEMORY:
- raw_memory_size = (obj + size).signed[0]
- self.major_collection_threshold -= raw_memory_size
+ raw_memory_size = (llarena.getfakearenaaddress(obj) + size).signed[0]
+ self.next_major_collection_threshold -= raw_memory_size
self.header(obj).tid &= ~GCFLAG_OWNS_RAW_MEMORY
llmemory.raw_memcopy(obj - size_gc_header, newhdr, totalsize)
#
diff --git a/pypy/rpython/memory/gc/test/test_direct.py b/pypy/rpython/memory/gc/test/test_direct.py
--- a/pypy/rpython/memory/gc/test/test_direct.py
+++ b/pypy/rpython/memory/gc/test/test_direct.py
@@ -602,8 +602,25 @@
obj2 = self.malloc(S)
self.gc.raw_malloc_memory_pressure(llmemory.cast_ptr_to_adr(obj2),
BYTE * (nursery_size / 2))
- # obj should be dead by now
- assert self.gc.nursery_free == self.gc.nursery
+ assert self.gc.nursery_free == self.gc.nursery_top
+
+ def test_memory_pressure_surviving(self):
+ obj = self.malloc(S)
+ self.stackroots.append(obj)
+ nursery_size = self.gc.nursery_size
+ BYTE = llmemory.sizeof(lltype.Char)
+ self.gc.raw_malloc_memory_pressure(llmemory.cast_ptr_to_adr(obj),
+ BYTE * (nursery_size / 2))
+ obj2 = self.malloc(S)
+ self.gc.raw_malloc_memory_pressure(llmemory.cast_ptr_to_adr(obj2),
+ BYTE * (nursery_size / 2))
+ assert self.gc.nursery_free == self.gc.nursery_top
+ one = self.gc.next_major_collection_threshold
+ self.gc.minor_collection()
+ obj = self.stackroots[0]
+ assert not self.gc.is_in_nursery(llmemory.cast_ptr_to_adr(obj))
+ two = self.gc.next_major_collection_threshold
+ assert one - two >= nursery_size / 2
test_writebarrier_before_copy_preserving_cards.GC_PARAMS = {
"card_page_indices": 4}
More information about the pypy-commit
mailing list