[pypy-svn] r77719 - in pypy/branch/32ptr-on-64bit/pypy/rpython/memory: gc test
arigo at codespeak.net
arigo at codespeak.net
Fri Oct 8 13:26:17 CEST 2010
Author: arigo
Date: Fri Oct 8 13:26:16 2010
New Revision: 77719
Modified:
pypy/branch/32ptr-on-64bit/pypy/rpython/memory/gc/minimark.py
pypy/branch/32ptr-on-64bit/pypy/rpython/memory/gc/minimarkpage.py
pypy/branch/32ptr-on-64bit/pypy/rpython/memory/gc/minimarkpage2.py
pypy/branch/32ptr-on-64bit/pypy/rpython/memory/test/test_gc.py
Log:
Tweaks.
Modified: pypy/branch/32ptr-on-64bit/pypy/rpython/memory/gc/minimark.py
==============================================================================
--- pypy/branch/32ptr-on-64bit/pypy/rpython/memory/gc/minimark.py (original)
+++ pypy/branch/32ptr-on-64bit/pypy/rpython/memory/gc/minimark.py Fri Oct 8 13:26:16 2010
@@ -190,6 +190,13 @@
else:
from pypy.rpython.memory.gc import minimarkpage
ArenaCollectionClass = minimarkpage.ArenaCollection
+ #
+ if self.config and self.config.compressptr:
+ # increase the limit to the maximum
+ small_request_threshold = (
+ page_size - ArenaCollectionClass.PAGE_HEADER_SIZE_MAX)
+ self.small_request_threshold = small_request_threshold
+ #
self.ac = ArenaCollectionClass(arena_size, page_size,
small_request_threshold)
#
@@ -325,6 +332,15 @@
totalsize = size_gc_header + size
rawtotalsize = raw_malloc_usage(totalsize)
#
+ # It is necessary that rawtotalsize fits within
+ # small_request_threshold if self.config.compressptr is set.
+ # Note that in this case we increased small_request_threshold at
+ # start-up to make this more likely to always hold. The
+ # following check should be constant-folded.
+ if self.config.compressptr:
+ if rawtotalsize > self.small_request_threshold:
+ raise FixedSizeObjectTooLarge
+ #
# If the object needs a finalizer, ask for a rawmalloc.
# The following check should be constant-folded.
if needs_finalizer:
@@ -1534,6 +1550,7 @@
# list.
class SimpleArenaCollection(object):
+ PAGE_HEADER_SIZE_MAX = 0
def __init__(self, arena_size, page_size, small_request_threshold):
self.arena_size = arena_size # ignored
Modified: pypy/branch/32ptr-on-64bit/pypy/rpython/memory/gc/minimarkpage.py
==============================================================================
--- pypy/branch/32ptr-on-64bit/pypy/rpython/memory/gc/minimarkpage.py (original)
+++ pypy/branch/32ptr-on-64bit/pypy/rpython/memory/gc/minimarkpage.py Fri Oct 8 13:26:16 2010
@@ -86,6 +86,7 @@
class ArenaCollection(object):
_alloc_flavor_ = "raw"
+ PAGE_HEADER_SIZE_MAX = 32
def __init__(self, arena_size, page_size, small_request_threshold):
# 'small_request_threshold' is the largest size that we
Modified: pypy/branch/32ptr-on-64bit/pypy/rpython/memory/gc/minimarkpage2.py
==============================================================================
--- pypy/branch/32ptr-on-64bit/pypy/rpython/memory/gc/minimarkpage2.py (original)
+++ pypy/branch/32ptr-on-64bit/pypy/rpython/memory/gc/minimarkpage2.py Fri Oct 8 13:26:16 2010
@@ -62,6 +62,7 @@
# '(512-2) % N' is zero or very small for various small N's,
# i.e. there is not much wasted space.
)
+PAGE_HEADER_SIZE_MAX = 16 # the PAGE_HEADER is at most 16 bytes
PAGE_PTR.TO.become(PAGE_HEADER)
PAGE_NULL = lltype.nullptr(PAGE_HEADER)
@@ -73,6 +74,7 @@
class ArenaCollection2(object):
_alloc_flavor_ = "raw"
+ PAGE_HEADER_SIZE_MAX = PAGE_HEADER_SIZE_MAX
def __init__(self, arena_size, page_size, small_request_threshold):
# 'small_request_threshold' is the largest size that we
@@ -266,7 +268,9 @@
# and become available for reuse by any size class. Pages
# not completely freed are re-chained either in
# 'full_page_for_size[]' or 'page_for_size[]'.
- self.mass_free_in_pages(size_class, ok_to_free_func)
+ if (self.full_page_for_size[size_class] != PAGE_NULL or
+ self.page_for_size[size_class] != PAGE_NULL):
+ self.mass_free_in_pages(size_class, ok_to_free_func)
#
size_class -= 1
Modified: pypy/branch/32ptr-on-64bit/pypy/rpython/memory/test/test_gc.py
==============================================================================
--- pypy/branch/32ptr-on-64bit/pypy/rpython/memory/test/test_gc.py (original)
+++ pypy/branch/32ptr-on-64bit/pypy/rpython/memory/test/test_gc.py Fri Oct 8 13:26:16 2010
@@ -817,6 +817,7 @@
GC_PARAMS = {'card_page_indices': 4}
class TestMiniMarkGCCompressPtr(TestMiniMarkGC):
+ GC_PARAMS = {'page_size': 32*WORD}
def setup_class(cls):
TestMiniMarkGC.setup_class.im_func(cls)
#
More information about the Pypy-commit
mailing list