[pypy-svn] r77536 - in pypy/branch/larger-writebarrier/pypy/rpython/memory: . gc gc/test test
arigo at codespeak.net
arigo at codespeak.net
Fri Oct 1 17:54:06 CEST 2010
Author: arigo
Date: Fri Oct 1 17:54:04 2010
New Revision: 77536
Modified:
pypy/branch/larger-writebarrier/pypy/rpython/memory/gc/base.py
pypy/branch/larger-writebarrier/pypy/rpython/memory/gc/generation.py
pypy/branch/larger-writebarrier/pypy/rpython/memory/gc/markcompact.py
pypy/branch/larger-writebarrier/pypy/rpython/memory/gc/marksweep.py
pypy/branch/larger-writebarrier/pypy/rpython/memory/gc/minimark.py
pypy/branch/larger-writebarrier/pypy/rpython/memory/gc/semispace.py
pypy/branch/larger-writebarrier/pypy/rpython/memory/gc/test/test_direct.py
pypy/branch/larger-writebarrier/pypy/rpython/memory/gcwrapper.py
pypy/branch/larger-writebarrier/pypy/rpython/memory/test/test_transformed_gc.py
Log:
Fix. This really requires doing something different if we are
translated to C or not.
Modified: pypy/branch/larger-writebarrier/pypy/rpython/memory/gc/base.py
==============================================================================
--- pypy/branch/larger-writebarrier/pypy/rpython/memory/gc/base.py (original)
+++ pypy/branch/larger-writebarrier/pypy/rpython/memory/gc/base.py Fri Oct 1 17:54:04 2010
@@ -20,12 +20,15 @@
prebuilt_gc_objects_are_static_roots = True
object_minimal_size = 0
- def __init__(self, config, chunk_size=DEFAULT_CHUNK_SIZE):
+ def __init__(self, config, chunk_size=DEFAULT_CHUNK_SIZE,
+ translated_to_c=True):
self.gcheaderbuilder = GCHeaderBuilder(self.HDR)
self.AddressStack = get_address_stack(chunk_size)
self.AddressDeque = get_address_deque(chunk_size)
self.AddressDict = AddressDict
self.config = config
+ assert isinstance(translated_to_c, bool)
+ self.translated_to_c = translated_to_c
def setup(self):
# all runtime mutable values' setup should happen here
Modified: pypy/branch/larger-writebarrier/pypy/rpython/memory/gc/generation.py
==============================================================================
--- pypy/branch/larger-writebarrier/pypy/rpython/memory/gc/generation.py (original)
+++ pypy/branch/larger-writebarrier/pypy/rpython/memory/gc/generation.py Fri Oct 1 17:54:04 2010
@@ -5,7 +5,6 @@
from pypy.rpython.memory.gc.base import read_from_env
from pypy.rpython.lltypesystem.llmemory import NULL, raw_malloc_usage
from pypy.rpython.lltypesystem import lltype, llmemory, llarena
-from pypy.rpython.memory.support import DEFAULT_CHUNK_SIZE
from pypy.rlib.objectmodel import free_non_gc_object
from pypy.rlib.debug import ll_assert
from pypy.rlib.debug import debug_print, debug_start, debug_stop
@@ -49,15 +48,17 @@
nursery_hash_base = -1
- def __init__(self, config, chunk_size=DEFAULT_CHUNK_SIZE,
+ def __init__(self, config,
nursery_size=32*WORD,
min_nursery_size=32*WORD,
auto_nursery_size=False,
space_size=1024*WORD,
- max_space_size=sys.maxint//2+1):
- SemiSpaceGC.__init__(self, config, chunk_size = chunk_size,
+ max_space_size=sys.maxint//2+1,
+ **kwds):
+ SemiSpaceGC.__init__(self, config,
space_size = space_size,
- max_space_size = max_space_size)
+ max_space_size = max_space_size,
+ **kwds)
assert min_nursery_size <= nursery_size <= space_size // 2
self.initial_nursery_size = nursery_size
self.auto_nursery_size = auto_nursery_size
@@ -160,6 +161,9 @@
def appears_to_be_in_nursery(self, addr):
# same as is_in_nursery(), but may return True accidentally if
# 'addr' is a tagged pointer with just the wrong value.
+ if not self.translated_to_c:
+ if not self.is_valid_gc_object(addr):
+ return False
return self.nursery <= addr < self.nursery_top
def malloc_fixedsize_clear(self, typeid, size, can_collect,
Modified: pypy/branch/larger-writebarrier/pypy/rpython/memory/gc/markcompact.py
==============================================================================
--- pypy/branch/larger-writebarrier/pypy/rpython/memory/gc/markcompact.py (original)
+++ pypy/branch/larger-writebarrier/pypy/rpython/memory/gc/markcompact.py Fri Oct 1 17:54:04 2010
@@ -2,7 +2,6 @@
from pypy.rpython.memory.gc.base import MovingGCBase, read_from_env
from pypy.rlib.debug import ll_assert, have_debug_prints
from pypy.rlib.debug import debug_print, debug_start, debug_stop
-from pypy.rpython.memory.support import DEFAULT_CHUNK_SIZE
from pypy.rpython.memory.support import get_address_stack, get_address_deque
from pypy.rpython.memory.support import AddressDict
from pypy.rpython.lltypesystem.llmemory import NULL, raw_malloc_usage
@@ -86,9 +85,9 @@
free = NULL
next_collect_after = -1
- def __init__(self, config, chunk_size=DEFAULT_CHUNK_SIZE, space_size=4096,
- min_next_collect_after=128):
- MovingGCBase.__init__(self, config, chunk_size)
+ def __init__(self, config, space_size=4096,
+ min_next_collect_after=128, **kwds):
+ MovingGCBase.__init__(self, config, **kwds)
self.space_size = space_size
self.min_next_collect_after = min_next_collect_after
Modified: pypy/branch/larger-writebarrier/pypy/rpython/memory/gc/marksweep.py
==============================================================================
--- pypy/branch/larger-writebarrier/pypy/rpython/memory/gc/marksweep.py (original)
+++ pypy/branch/larger-writebarrier/pypy/rpython/memory/gc/marksweep.py Fri Oct 1 17:54:04 2010
@@ -1,7 +1,6 @@
from pypy.rpython.lltypesystem.llmemory import raw_malloc, raw_free
from pypy.rpython.lltypesystem.llmemory import raw_memcopy, raw_memclear
from pypy.rpython.lltypesystem.llmemory import NULL, raw_malloc_usage
-from pypy.rpython.memory.support import DEFAULT_CHUNK_SIZE
from pypy.rpython.memory.support import get_address_stack
from pypy.rpython.memory.gcheader import GCHeaderBuilder
from pypy.rpython.lltypesystem import lltype, llmemory, rffi, llgroup
@@ -48,9 +47,9 @@
# translating to a real backend.
TRANSLATION_PARAMS = {'start_heap_size': 8*1024*1024} # XXX adjust
- def __init__(self, config, chunk_size=DEFAULT_CHUNK_SIZE, start_heap_size=4096):
+ def __init__(self, config, start_heap_size=4096, **kwds):
self.param_start_heap_size = start_heap_size
- GCBase.__init__(self, config, chunk_size)
+ GCBase.__init__(self, config, **kwds)
def setup(self):
GCBase.setup(self)
@@ -714,8 +713,8 @@
_alloc_flavor_ = "raw"
COLLECT_EVERY = 2000
- def __init__(self, chunk_size=DEFAULT_CHUNK_SIZE, start_heap_size=4096):
- MarkSweepGC.__init__(self, chunk_size, start_heap_size)
+ def __init__(self, config, **kwds):
+ MarkSweepGC.__init__(self, config, **kwds)
self.count_mallocs = 0
def maybe_collect(self):
Modified: pypy/branch/larger-writebarrier/pypy/rpython/memory/gc/minimark.py
==============================================================================
--- pypy/branch/larger-writebarrier/pypy/rpython/memory/gc/minimark.py (original)
+++ pypy/branch/larger-writebarrier/pypy/rpython/memory/gc/minimark.py Fri Oct 1 17:54:04 2010
@@ -4,7 +4,6 @@
from pypy.rpython.lltypesystem.llmemory import raw_malloc_usage
from pypy.rpython.memory.gc.base import GCBase, MovingGCBase
from pypy.rpython.memory.gc import minimarkpage, base, generation
-from pypy.rpython.memory.support import DEFAULT_CHUNK_SIZE
from pypy.rlib.rarithmetic import ovfcheck, LONG_BIT, intmask, r_uint
from pypy.rlib.rarithmetic import LONG_BIT_SHIFT
from pypy.rlib.debug import ll_assert, debug_print, debug_start, debug_stop
@@ -140,7 +139,7 @@
"large_object_gcptrs": 8250*WORD,
}
- def __init__(self, config, chunk_size=DEFAULT_CHUNK_SIZE,
+ def __init__(self, config,
read_from_env=False,
nursery_size=32*WORD,
page_size=16*WORD,
@@ -150,8 +149,9 @@
card_page_indices=0,
large_object=8*WORD,
large_object_gcptrs=10*WORD,
- ArenaCollectionClass=None):
- MovingGCBase.__init__(self, config, chunk_size)
+ ArenaCollectionClass=None,
+ **kwds):
+ MovingGCBase.__init__(self, config, **kwds)
assert small_request_threshold % WORD == 0
self.read_from_env = read_from_env
self.nursery_size = nursery_size
@@ -639,6 +639,9 @@
def appears_to_be_in_nursery(self, addr):
# same as is_in_nursery(), but may return True accidentally if
# 'addr' is a tagged pointer with just the wrong value.
+ if not self.translated_to_c:
+ if not self.is_valid_gc_object(addr):
+ return False
return self.nursery <= addr < self.nursery_top
def is_forwarded(self, obj):
Modified: pypy/branch/larger-writebarrier/pypy/rpython/memory/gc/semispace.py
==============================================================================
--- pypy/branch/larger-writebarrier/pypy/rpython/memory/gc/semispace.py (original)
+++ pypy/branch/larger-writebarrier/pypy/rpython/memory/gc/semispace.py Fri Oct 1 17:54:04 2010
@@ -1,7 +1,6 @@
from pypy.rpython.lltypesystem.llmemory import raw_malloc, raw_free
from pypy.rpython.lltypesystem.llmemory import raw_memcopy, raw_memclear
from pypy.rpython.lltypesystem.llmemory import NULL, raw_malloc_usage
-from pypy.rpython.memory.support import DEFAULT_CHUNK_SIZE
from pypy.rpython.memory.support import get_address_stack, get_address_deque
from pypy.rpython.memory.support import AddressDict
from pypy.rpython.lltypesystem import lltype, llmemory, llarena, rffi, llgroup
@@ -59,11 +58,11 @@
# translating to a real backend.
TRANSLATION_PARAMS = {'space_size': 8*1024*1024} # XXX adjust
- def __init__(self, config, chunk_size=DEFAULT_CHUNK_SIZE, space_size=4096,
- max_space_size=sys.maxint//2+1):
+ def __init__(self, config, space_size=4096, max_space_size=sys.maxint//2+1,
+ **kwds):
self.param_space_size = space_size
self.param_max_space_size = max_space_size
- MovingGCBase.__init__(self, config, chunk_size)
+ MovingGCBase.__init__(self, config, **kwds)
def setup(self):
#self.total_collection_time = 0.0
Modified: pypy/branch/larger-writebarrier/pypy/rpython/memory/gc/test/test_direct.py
==============================================================================
--- pypy/branch/larger-writebarrier/pypy/rpython/memory/gc/test/test_direct.py (original)
+++ pypy/branch/larger-writebarrier/pypy/rpython/memory/gc/test/test_direct.py Fri Oct 1 17:54:04 2010
@@ -70,6 +70,7 @@
GC_PARAMS = self.GC_PARAMS.copy()
if hasattr(meth, 'GC_PARAMS'):
GC_PARAMS.update(meth.GC_PARAMS)
+ GC_PARAMS['translated_to_c'] = False
self.gc = self.GCClass(config, **GC_PARAMS)
self.gc.DEBUG = True
self.rootwalker = DirectRootWalker(self)
Modified: pypy/branch/larger-writebarrier/pypy/rpython/memory/gcwrapper.py
==============================================================================
--- pypy/branch/larger-writebarrier/pypy/rpython/memory/gcwrapper.py (original)
+++ pypy/branch/larger-writebarrier/pypy/rpython/memory/gcwrapper.py Fri Oct 1 17:54:04 2010
@@ -9,7 +9,10 @@
def __init__(self, llinterp, flowgraphs, gc_class, GC_PARAMS={}):
translator = llinterp.typer.annotator.translator
config = translator.config.translation
- self.gc = gc_class(config, chunk_size = 10, **GC_PARAMS)
+ self.gc = gc_class(config,
+ chunk_size = 10,
+ translated_to_c = False,
+ **GC_PARAMS)
self.gc.set_root_walker(LLInterpRootWalker(self))
self.gc.DEBUG = True
self.llinterp = llinterp
Modified: pypy/branch/larger-writebarrier/pypy/rpython/memory/test/test_transformed_gc.py
==============================================================================
--- pypy/branch/larger-writebarrier/pypy/rpython/memory/test/test_transformed_gc.py (original)
+++ pypy/branch/larger-writebarrier/pypy/rpython/memory/test/test_transformed_gc.py Fri Oct 1 17:54:04 2010
@@ -906,7 +906,8 @@
gcname = "marksweep"
class gcpolicy(gc.FrameworkGcPolicy):
class transformerclass(framework.FrameworkGCTransformer):
- GC_PARAMS = {'start_heap_size': 1024*WORD }
+ GC_PARAMS = {'start_heap_size': 1024*WORD,
+ 'translated_to_c': False}
root_stack_depth = 200
@@ -1144,7 +1145,8 @@
class gcpolicy(gc.FrameworkGcPolicy):
class transformerclass(framework.FrameworkGCTransformer):
from pypy.rpython.memory.gc.marksweep import PrintingMarkSweepGC as GCClass
- GC_PARAMS = {'start_heap_size': 1024*WORD }
+ GC_PARAMS = {'start_heap_size': 1024*WORD,
+ 'translated_to_c': False}
root_stack_depth = 200
class TestSemiSpaceGC(GenericMovingGCTests):
@@ -1154,7 +1156,8 @@
class gcpolicy(gc.FrameworkGcPolicy):
class transformerclass(framework.FrameworkGCTransformer):
from pypy.rpython.memory.gc.semispace import SemiSpaceGC as GCClass
- GC_PARAMS = {'space_size': 512*WORD}
+ GC_PARAMS = {'space_size': 512*WORD,
+ 'translated_to_c': False}
root_stack_depth = 200
class TestMarkCompactGC(GenericMovingGCTests):
@@ -1163,7 +1166,8 @@
class gcpolicy(gc.FrameworkGcPolicy):
class transformerclass(framework.FrameworkGCTransformer):
from pypy.rpython.memory.gc.markcompact import MarkCompactGC as GCClass
- GC_PARAMS = {'space_size': 4096*WORD}
+ GC_PARAMS = {'space_size': 4096*WORD,
+ 'translated_to_c': False}
root_stack_depth = 200
class TestGenerationGC(GenericMovingGCTests):
@@ -1175,7 +1179,8 @@
from pypy.rpython.memory.gc.generation import GenerationGC as \
GCClass
GC_PARAMS = {'space_size': 512*WORD,
- 'nursery_size': 32*WORD}
+ 'nursery_size': 32*WORD,
+ 'translated_to_c': False}
root_stack_depth = 200
def define_weakref_across_minor_collection(cls):
@@ -1372,7 +1377,8 @@
GenerationGC._teardown(self)
GC_PARAMS = {'space_size': 512*WORD,
- 'nursery_size': 128*WORD}
+ 'nursery_size': 128*WORD,
+ 'translated_to_c': False}
root_stack_depth = 200
def define_working_nursery(cls):
@@ -1404,7 +1410,8 @@
from pypy.rpython.memory.gc.hybrid import HybridGC as GCClass
GC_PARAMS = {'space_size': 512*WORD,
'nursery_size': 32*WORD,
- 'large_object': 8*WORD}
+ 'large_object': 8*WORD,
+ 'translated_to_c': False}
root_stack_depth = 200
def define_ref_from_rawmalloced_to_regular(cls):
@@ -1477,6 +1484,7 @@
'large_object': 8*WORD,
'large_object_gcptrs': 10*WORD,
'card_page_indices': 4,
+ 'translated_to_c': False,
}
root_stack_depth = 200
@@ -1585,7 +1593,8 @@
gcname = "marksweep"
class gcpolicy(gc.FrameworkGcPolicy):
class transformerclass(framework.FrameworkGCTransformer):
- GC_PARAMS = {'start_heap_size': 1024*WORD }
+ GC_PARAMS = {'start_heap_size': 1024*WORD,
+ 'translated_to_c': False}
root_stack_depth = 200
class TestHybridTaggedPointerGC(TaggedPointerGCTests):
@@ -1596,7 +1605,8 @@
from pypy.rpython.memory.gc.generation import GenerationGC as \
GCClass
GC_PARAMS = {'space_size': 512*WORD,
- 'nursery_size': 32*WORD}
+ 'nursery_size': 32*WORD,
+ 'translated_to_c': False}
root_stack_depth = 200
class TestMarkCompactTaggedpointerGC(TaggedPointerGCTests):
@@ -1605,5 +1615,6 @@
class gcpolicy(gc.FrameworkGcPolicy):
class transformerclass(framework.FrameworkGCTransformer):
from pypy.rpython.memory.gc.markcompact import MarkCompactGC as GCClass
- GC_PARAMS = {'space_size': 4096*WORD}
+ GC_PARAMS = {'space_size': 4096*WORD,
+ 'translated_to_c': False}
root_stack_depth = 200
More information about the Pypy-commit
mailing list