[pypy-svn] r54000 - in pypy/branch/io-improvements/pypy: config rpython/lltypesystem rpython/memory rpython/memory/gc rpython/memory/test translator/backendopt translator/backendopt/test
arigo at codespeak.net
arigo at codespeak.net
Tue Apr 22 11:48:58 CEST 2008
Author: arigo
Date: Tue Apr 22 11:48:57 2008
New Revision: 54000
Removed:
pypy/branch/io-improvements/pypy/translator/backendopt/coalloc.py
pypy/branch/io-improvements/pypy/translator/backendopt/test/test_coalloc.py
Modified:
pypy/branch/io-improvements/pypy/config/translationoption.py
pypy/branch/io-improvements/pypy/rpython/lltypesystem/llheap.py
pypy/branch/io-improvements/pypy/rpython/memory/gc/base.py
pypy/branch/io-improvements/pypy/rpython/memory/gc/generation.py
pypy/branch/io-improvements/pypy/rpython/memory/gcwrapper.py
pypy/branch/io-improvements/pypy/rpython/memory/test/test_gc.py
pypy/branch/io-improvements/pypy/rpython/memory/test/test_transformed_gc.py
pypy/branch/io-improvements/pypy/translator/backendopt/all.py
Log:
Kill all references to coalloc.
Modified: pypy/branch/io-improvements/pypy/config/translationoption.py
==============================================================================
--- pypy/branch/io-improvements/pypy/config/translationoption.py (original)
+++ pypy/branch/io-improvements/pypy/config/translationoption.py Tue Apr 22 11:48:57 2008
@@ -174,9 +174,6 @@
BoolOption("heap2stack", "Escape analysis and stack allocation",
default=False,
requires=[("translation.stackless", False)]),
- BoolOption("coalloc", "Try to replace mallocs by coallocation",
- default=False,
- suggests=[("translation.gc", "generation")]),
# control profile based inlining
StrOption("profile_based_inline",
"Use call count profiling to drive inlining"
Modified: pypy/branch/io-improvements/pypy/rpython/lltypesystem/llheap.py
==============================================================================
--- pypy/branch/io-improvements/pypy/rpython/lltypesystem/llheap.py (original)
+++ pypy/branch/io-improvements/pypy/rpython/lltypesystem/llheap.py Tue Apr 22 11:48:57 2008
@@ -17,7 +17,3 @@
def weakref_create_getlazy(objgetter):
return weakref_create(objgetter())
-
-def coalloc(T, coallocator, n=None, zero=True):
- # ignore the coallocator
- return malloc(T, n, zero=zero)
Modified: pypy/branch/io-improvements/pypy/rpython/memory/gc/base.py
==============================================================================
--- pypy/branch/io-improvements/pypy/rpython/memory/gc/base.py (original)
+++ pypy/branch/io-improvements/pypy/rpython/memory/gc/base.py Tue Apr 22 11:48:57 2008
@@ -44,16 +44,13 @@
def size_gc_header(self, typeid=0):
return self.gcheaderbuilder.size_gc_header
- def malloc(self, typeid, length=0, zero=False, coallocator=None):
+ def malloc(self, typeid, length=0, zero=False):
"""For testing. The interface used by the gctransformer is
the four malloc_[fixed,var]size[_clear]() functions.
- And (if they exist) to the coalloc_[fixed,var]size_clear functions
"""
# Rules about fallbacks in case of missing malloc methods:
# * malloc_fixedsize_clear() and malloc_varsize_clear() are mandatory
# * malloc_fixedsize() and malloc_varsize() fallback to the above
- # * coalloc_fixedsize_clear() and coalloc_varsize_clear() are optional
- # There is no non-clear version of coalloc for now.
# XXX: as of r49360, gctransformer.framework never inserts calls
# to malloc_varsize(), but always uses malloc_varsize_clear()
@@ -72,33 +69,19 @@
assert not contains_weakptr
itemsize = self.varsize_item_sizes(typeid)
offset_to_length = self.varsize_offset_to_length(typeid)
- if (coallocator is not None and
- hasattr(self, "coalloc_varsize_clear")):
- assert not needs_finalizer
- coallocator = llmemory.cast_ptr_to_adr(coallocator)
- ref = self.coalloc_varsize_clear(coallocator, typeid,
- length, size,
- itemsize, offset_to_length)
+ if zero or not hasattr(self, 'malloc_varsize'):
+ malloc_varsize = self.malloc_varsize_clear
else:
- if zero or not hasattr(self, 'malloc_varsize'):
- malloc_varsize = self.malloc_varsize_clear
- else:
- malloc_varsize = self.malloc_varsize
- ref = malloc_varsize(typeid, length, size, itemsize,
- offset_to_length, True, needs_finalizer)
+ malloc_varsize = self.malloc_varsize
+ ref = malloc_varsize(typeid, length, size, itemsize,
+ offset_to_length, True, needs_finalizer)
else:
- if (coallocator is not None and
- hasattr(self, "coalloc_fixedsize_clear")):
- assert not needs_finalizer
- coallocator = llmemory.cast_ptr_to_adr(coallocator)
- ref = self.coalloc_fixedsize_clear(coallocator, typeid, size)
+ if zero or not hasattr(self, 'malloc_fixedsize'):
+ malloc_fixedsize = self.malloc_fixedsize_clear
else:
- if zero or not hasattr(self, 'malloc_fixedsize'):
- malloc_fixedsize = self.malloc_fixedsize_clear
- else:
- malloc_fixedsize = self.malloc_fixedsize
- ref = malloc_fixedsize(typeid, size, True, needs_finalizer,
- contains_weakptr)
+ malloc_fixedsize = self.malloc_fixedsize
+ ref = malloc_fixedsize(typeid, size, True, needs_finalizer,
+ contains_weakptr)
# lots of cast and reverse-cast around...
return llmemory.cast_ptr_to_adr(ref)
Modified: pypy/branch/io-improvements/pypy/rpython/memory/gc/generation.py
==============================================================================
--- pypy/branch/io-improvements/pypy/rpython/memory/gc/generation.py (original)
+++ pypy/branch/io-improvements/pypy/rpython/memory/gc/generation.py Tue Apr 22 11:48:57 2008
@@ -146,18 +146,6 @@
self.young_objects_with_weakrefs.append(result + size_gc_header)
return llmemory.cast_adr_to_ptr(result+size_gc_header, llmemory.GCREF)
- def coalloc_fixedsize_clear(self, coallocator, typeid, size):
- # note: a coallocated object can never return a weakref, since the
- # coallocation analysis is done at a time where weakrefs are
- # represented as opaque objects which aren't allocated using malloc but
- # with weakref_create
- if self.is_in_nursery(coallocator):
- return self.malloc_fixedsize_clear(typeid, size,
- True, False, False)
- else:
- return SemiSpaceGC.malloc_fixedsize_clear(self, typeid, size,
- True, False, False)
-
def malloc_varsize_clear(self, typeid, length, size, itemsize,
offset_to_length, can_collect,
has_finalizer=False):
@@ -205,17 +193,6 @@
self.nursery_free = result + llarena.round_up_for_allocation(totalsize)
return llmemory.cast_adr_to_ptr(result+size_gc_header, llmemory.GCREF)
- def coalloc_varsize_clear(self, coallocator, typeid,
- length, size, itemsize,
- offset_to_length):
- if self.is_in_nursery(coallocator):
- return self.malloc_varsize_clear(typeid, length, size, itemsize,
- offset_to_length, True, False)
- else:
- return SemiSpaceGC.malloc_varsize_clear(self, typeid, length, size,
- itemsize, offset_to_length,
- True, False)
-
# override the init_gc_object methods to change the default value of 'flags',
# used by objects that are directly created outside the nursery by the SemiSpaceGC.
# These objects must have the GCFLAG_NO_YOUNG_PTRS flag set immediately.
Modified: pypy/branch/io-improvements/pypy/rpython/memory/gcwrapper.py
==============================================================================
--- pypy/branch/io-improvements/pypy/rpython/memory/gcwrapper.py (original)
+++ pypy/branch/io-improvements/pypy/rpython/memory/gcwrapper.py Tue Apr 22 11:48:57 2008
@@ -46,17 +46,6 @@
assert flavor != 'gc'
return lltype.free(TYPE, flavor=flavor)
- def coalloc(self, TYPE, coallocator, size=None, zero=False):
- if hasattr(self.gc, "coalloc_fixedsize_clear"):
- typeid = self.get_type_id(TYPE)
- addr = self.gc.malloc(typeid, size, zero=zero,
- coallocator=coallocator)
- result = llmemory.cast_adr_to_ptr(addr, lltype.Ptr(TYPE))
- if not self.gc.malloc_zero_filled:
- gctypelayout.zero_gc_pointers(result)
- return result
- return self.malloc(TYPE, size, 'gc', zero)
-
def setfield(self, obj, fieldname, fieldvalue):
STRUCT = lltype.typeOf(obj).TO
addr = llmemory.cast_ptr_to_adr(obj)
Modified: pypy/branch/io-improvements/pypy/rpython/memory/test/test_gc.py
==============================================================================
--- pypy/branch/io-improvements/pypy/rpython/memory/test/test_gc.py (original)
+++ pypy/branch/io-improvements/pypy/rpython/memory/test/test_gc.py Tue Apr 22 11:48:57 2008
@@ -400,17 +400,3 @@
class TestGenerationalGC(TestSemiSpaceGC):
from pypy.rpython.memory.gc.generation import GenerationGC as GCClass
-
- def test_coalloc(self):
- def malloc_a_lot():
- i = 0
- while i < 10:
- i += 1
- a = [1] * 10
- j = 0
- while j < 30:
- j += 1
- a.append(j)
- return 0
- res = self.interpret(malloc_a_lot, [], backendopt=True, coalloc=True)
- assert res == 0
Modified: pypy/branch/io-improvements/pypy/rpython/memory/test/test_transformed_gc.py
==============================================================================
--- pypy/branch/io-improvements/pypy/rpython/memory/test/test_transformed_gc.py (original)
+++ pypy/branch/io-improvements/pypy/rpython/memory/test/test_transformed_gc.py Tue Apr 22 11:48:57 2008
@@ -762,22 +762,6 @@
res = run([3, 0])
assert res == 1
- def test_coalloc(self):
- def malloc_a_lot():
- i = 0
- while i < 10:
- i += 1
- a = [1] * 10
- j = 0
- while j < 30:
- j += 1
- a.append(j)
- return 0
- run, statistics = self.runner(malloc_a_lot, statistics=True,
- backendopt=True, coalloc=True)
- run([])
-
-
class TestStacklessMarkSweepGC(TestMarkSweepGC):
gcname = "marksweep"
Modified: pypy/branch/io-improvements/pypy/translator/backendopt/all.py
==============================================================================
--- pypy/branch/io-improvements/pypy/translator/backendopt/all.py (original)
+++ pypy/branch/io-improvements/pypy/translator/backendopt/all.py Tue Apr 22 11:48:57 2008
@@ -130,10 +130,6 @@
print "after if-to-switch:"
print_statistics(translator.graphs[0], translator)
- if config.coalloc and not secondary:
- from pypy.translator.backendopt import coalloc
- coalloc.malloc_to_coalloc(translator)
-
remove_obvious_noops()
for graph in graphs:
More information about the Pypy-commit
mailing list