[pypy-svn] r68267 - in pypy/branch/gc-compress/pypy/rpython/memory: . gc gc/test gctransform test
arigo at codespeak.net
arigo at codespeak.net
Fri Oct 9 12:00:19 CEST 2009
Author: arigo
Date: Fri Oct 9 12:00:17 2009
New Revision: 68267
Modified:
pypy/branch/gc-compress/pypy/rpython/memory/gc/base.py
pypy/branch/gc-compress/pypy/rpython/memory/gc/semispace.py
pypy/branch/gc-compress/pypy/rpython/memory/gc/test/test_direct.py
pypy/branch/gc-compress/pypy/rpython/memory/gctransform/framework.py
pypy/branch/gc-compress/pypy/rpython/memory/gctypelayout.py
pypy/branch/gc-compress/pypy/rpython/memory/test/test_gctypelayout.py
Log:
Use the "minimal size" argument of round_up_for_allocation.
Modified: pypy/branch/gc-compress/pypy/rpython/memory/gc/base.py
==============================================================================
--- pypy/branch/gc-compress/pypy/rpython/memory/gc/base.py (original)
+++ pypy/branch/gc-compress/pypy/rpython/memory/gc/base.py Fri Oct 9 12:00:17 2009
@@ -13,6 +13,7 @@
malloc_zero_filled = False
prebuilt_gc_objects_are_static_roots = True
can_realloc = False
+ object_minimal_size = 0
def __init__(self, config, chunk_size=DEFAULT_CHUNK_SIZE):
self.gcheaderbuilder = GCHeaderBuilder(self.HDR)
Modified: pypy/branch/gc-compress/pypy/rpython/memory/gc/semispace.py
==============================================================================
--- pypy/branch/gc-compress/pypy/rpython/memory/gc/semispace.py (original)
+++ pypy/branch/gc-compress/pypy/rpython/memory/gc/semispace.py Fri Oct 9 12:00:17 2009
@@ -58,6 +58,8 @@
('forw', llmemory.Address))
FORWARDSTUBPTR = lltype.Ptr(FORWARDSTUB)
+ object_minimal_size = llmemory.sizeof(FORWARDSTUB)
+
# the following values override the default arguments of __init__ when
# translating to a real backend.
TRANSLATION_PARAMS = {'space_size': 8*1024*1024} # XXX adjust
Modified: pypy/branch/gc-compress/pypy/rpython/memory/gc/test/test_direct.py
==============================================================================
--- pypy/branch/gc-compress/pypy/rpython/memory/gc/test/test_direct.py (original)
+++ pypy/branch/gc-compress/pypy/rpython/memory/gc/test/test_direct.py Fri Oct 9 12:00:17 2009
@@ -68,7 +68,7 @@
self.gc.DEBUG = True
self.rootwalker = DirectRootWalker(self)
self.gc.set_root_walker(self.rootwalker)
- self.layoutbuilder = TypeLayoutBuilder()
+ self.layoutbuilder = TypeLayoutBuilder(self.GCClass)
self.get_type_id = self.layoutbuilder.get_type_id
self.layoutbuilder.initialize_gc_query_function(self.gc)
self.gc.setup()
Modified: pypy/branch/gc-compress/pypy/rpython/memory/gctransform/framework.py
==============================================================================
--- pypy/branch/gc-compress/pypy/rpython/memory/gctransform/framework.py (original)
+++ pypy/branch/gc-compress/pypy/rpython/memory/gctransform/framework.py Fri Oct 9 12:00:17 2009
@@ -130,7 +130,7 @@
if hasattr(translator, '_jit2gc'):
self.layoutbuilder = translator._jit2gc['layoutbuilder']
else:
- self.layoutbuilder = TransformerLayoutBuilder()
+ self.layoutbuilder = TransformerLayoutBuilder(GCClass)
self.layoutbuilder.transformer = self
self.get_type_id = self.layoutbuilder.get_type_id
Modified: pypy/branch/gc-compress/pypy/rpython/memory/gctypelayout.py
==============================================================================
--- pypy/branch/gc-compress/pypy/rpython/memory/gctypelayout.py (original)
+++ pypy/branch/gc-compress/pypy/rpython/memory/gctypelayout.py Fri Oct 9 12:00:17 2009
@@ -23,6 +23,7 @@
("finalizer", FINALIZERTYPE),
("fixedsize", lltype.Signed),
("ofstoptrs", lltype.Ptr(OFFSETS_TO_GC_PTR)),
+ hints={'immutable': True},
)
VARSIZE_TYPE_INFO = lltype.Struct("varsize_type_info",
("header", TYPE_INFO),
@@ -30,6 +31,7 @@
("ofstovar", lltype.Signed),
("ofstolength", lltype.Signed),
("varofstoptrs", lltype.Ptr(OFFSETS_TO_GC_PTR)),
+ hints={'immutable': True},
)
TYPE_INFO_PTR = lltype.Ptr(TYPE_INFO)
VARSIZE_TYPE_INFO_PTR = lltype.Ptr(VARSIZE_TYPE_INFO)
@@ -121,7 +123,7 @@
info.finalizer = builder.make_finalizer_funcptr_for_type(TYPE)
if not TYPE._is_varsize():
info.fixedsize = llarena.round_up_for_allocation(
- llmemory.sizeof(TYPE))
+ llmemory.sizeof(TYPE), builder.GCClass.object_minimal_size)
# note about round_up_for_allocation(): in the 'info' table
# we put a rounded-up size only for fixed-size objects. For
# varsize ones, the GC must anyway compute the size at run-time
@@ -163,7 +165,8 @@
can_add_new_types = True
can_encode_type_shape = True # set to False initially by the JIT
- def __init__(self):
+ def __init__(self, GCClass):
+ self.GCClass = GCClass
self.make_type_info_group()
self.id_of_type = {} # {LLTYPE: type_id}
self.seen_roots = {}
Modified: pypy/branch/gc-compress/pypy/rpython/memory/test/test_gctypelayout.py
==============================================================================
--- pypy/branch/gc-compress/pypy/rpython/memory/test/test_gctypelayout.py (original)
+++ pypy/branch/gc-compress/pypy/rpython/memory/test/test_gctypelayout.py Fri Oct 9 12:00:17 2009
@@ -4,6 +4,9 @@
from pypy.rpython.test.test_llinterp import get_interpreter
from pypy.objspace.flow.model import Constant
+class FakeGC:
+ object_minimal_size = 0
+
def getname(T):
try:
return "field:" + T._name
@@ -34,7 +37,7 @@
def test_layout_builder():
# XXX a very minimal test
- layoutbuilder = TypeLayoutBuilder()
+ layoutbuilder = TypeLayoutBuilder(FakeGC)
for T1, T2 in [(GC_A, GC_S), (GC_A2, GC_S2), (GC_S3, GC_S2)]:
tid1 = layoutbuilder.get_type_id(T1)
tid2 = layoutbuilder.get_type_id(T2)
@@ -44,7 +47,7 @@
assert len(lst1) == len(lst2)
def test_constfold():
- layoutbuilder = TypeLayoutBuilder()
+ layoutbuilder = TypeLayoutBuilder(FakeGC)
tid1 = layoutbuilder.get_type_id(GC_A)
tid2 = layoutbuilder.get_type_id(GC_S3)
class MockGC:
More information about the Pypy-commit
mailing list