[pypy-svn] r47230 - in pypy/branch/kill-keepalives-again/pypy: config config/test doc/config module/_stackless module/_stackless/test rlib rpython/memory/test translator/c translator/c/test
arigo at codespeak.net
arigo at codespeak.net
Sat Oct 6 12:30:24 CEST 2007
Author: arigo
Date: Sat Oct 6 12:30:23 2007
New Revision: 47230
Added:
pypy/branch/kill-keepalives-again/pypy/doc/config/translation.stacklessgc.txt (contents, props changed)
Modified:
pypy/branch/kill-keepalives-again/pypy/config/test/test_pypyoption.py
pypy/branch/kill-keepalives-again/pypy/config/translationoption.py
pypy/branch/kill-keepalives-again/pypy/doc/config/translation.gc.txt
pypy/branch/kill-keepalives-again/pypy/module/_stackless/__init__.py
pypy/branch/kill-keepalives-again/pypy/module/_stackless/test/test_interp_clonable.py
pypy/branch/kill-keepalives-again/pypy/rlib/rgc.py
pypy/branch/kill-keepalives-again/pypy/rpython/memory/test/test_transformed_gc.py
pypy/branch/kill-keepalives-again/pypy/translator/c/gc.py
pypy/branch/kill-keepalives-again/pypy/translator/c/genc.py
pypy/branch/kill-keepalives-again/pypy/translator/c/test/test_boehm.py
pypy/branch/kill-keepalives-again/pypy/translator/c/test/test_newgc.py
pypy/branch/kill-keepalives-again/pypy/translator/c/test/test_stackless.py
Log:
Replace the option --gc=stacklessgc with its own flag --stacklessgc. We
use --gc=framework in all cases. The goal is to make it easier to add
options to choose various framework GCs like Mark&Sweep vs SemiSpace,
which can each use either the stacklessgc root finding or not.
Modified: pypy/branch/kill-keepalives-again/pypy/config/test/test_pypyoption.py
==============================================================================
--- pypy/branch/kill-keepalives-again/pypy/config/test/test_pypyoption.py (original)
+++ pypy/branch/kill-keepalives-again/pypy/config/test/test_pypyoption.py Sat Oct 6 12:30:23 2007
@@ -18,9 +18,10 @@
def test_stacklessgc_required():
conf = get_pypy_config()
- conf.translation.gc = "stacklessgc"
+ conf.translation.stacklessgc = True
assert conf.translation.stackless
assert conf.translation.type_system == "lltype"
+ assert conf.translation.gc == "framework"
def test_check_documentation():
from pypy.doc.config.confrest import all_optiondescrs
Modified: pypy/branch/kill-keepalives-again/pypy/config/translationoption.py
==============================================================================
--- pypy/branch/kill-keepalives-again/pypy/config/translationoption.py (original)
+++ pypy/branch/kill-keepalives-again/pypy/config/translationoption.py Sat Oct 6 12:30:23 2007
@@ -41,14 +41,16 @@
default=False, cmdline="--llvm-via-c",
requires=[("translation.backend", "llvm")]),
ChoiceOption("gc", "Garbage Collection Strategy",
- ["boehm", "ref", "framework", "none", "stacklessgc",
- "exact_boehm"],
+ ["boehm", "ref", "framework", "none", "exact_boehm"],
"ref", requires={
"ref": [("translation.rweakref", False)], # XXX
"none": [("translation.rweakref", False)], # XXX
- "stacklessgc": [("translation.stackless", True),
- ]},
+ },
cmdline="--gc"),
+ BoolOption("stacklessgc", "Use stackless to find roots in a framework GC",
+ default=False, cmdline="--stacklessgc",
+ requires=[("translation.gc", "framework"),
+ ("translation.stackless", True)]),
BoolOption("thread", "enable use of threading primitives",
default=False, cmdline="--thread",
requires=[("translation.gc", "boehm")]),
Modified: pypy/branch/kill-keepalives-again/pypy/doc/config/translation.gc.txt
==============================================================================
--- pypy/branch/kill-keepalives-again/pypy/doc/config/translation.gc.txt (original)
+++ pypy/branch/kill-keepalives-again/pypy/doc/config/translation.gc.txt Sat Oct 6 12:30:23 2007
@@ -6,10 +6,6 @@
- "framework": our custom mark-and-sweep collector. Takes moderately long and
is the fastest option without external dependencies.
- - "stacklessgc": same as "framework" but uses a different method to find the
- garbage collection roots on the stack, by unwinding it, using stackless:
- :config:`translation.stackless`.
-
- "boehm": use the Boehm conservative GC
Added: pypy/branch/kill-keepalives-again/pypy/doc/config/translation.stacklessgc.txt
==============================================================================
--- (empty file)
+++ pypy/branch/kill-keepalives-again/pypy/doc/config/translation.stacklessgc.txt Sat Oct 6 12:30:23 2007
@@ -0,0 +1,8 @@
+Use stackless to find roots in a framework GC.
+
+Only for framework GCs. This uses a different method to find the
+garbage collection roots on the stack, by unwinding it, using stackless:
+:config:`translation.stackless`.
+
+When stacklessgc is not enabled, the default method - which turns out to
+be faster for now - is to maintain a custom root stack.
Modified: pypy/branch/kill-keepalives-again/pypy/module/_stackless/__init__.py
==============================================================================
--- pypy/branch/kill-keepalives-again/pypy/module/_stackless/__init__.py (original)
+++ pypy/branch/kill-keepalives-again/pypy/module/_stackless/__init__.py Sat Oct 6 12:30:23 2007
@@ -27,7 +27,7 @@
from pypy.module._stackless.interp_greenlet import post_install as post_install_greenlet
post_install_greenlet(self)
- if self.space.config.translation.gc in ('framework', 'stacklessgc'):
+ if self.space.config.translation.gc == 'framework':
from pypy.module._stackless.interp_clonable import post_install as post_install_clonable
self.extra_interpdef('clonable', 'interp_clonable.AppClonableCoroutine')
self.extra_interpdef('fork', 'interp_clonable.fork')
Modified: pypy/branch/kill-keepalives-again/pypy/module/_stackless/test/test_interp_clonable.py
==============================================================================
--- pypy/branch/kill-keepalives-again/pypy/module/_stackless/test/test_interp_clonable.py (original)
+++ pypy/branch/kill-keepalives-again/pypy/module/_stackless/test/test_interp_clonable.py Sat Oct 6 12:30:23 2007
@@ -11,7 +11,8 @@
class TestClonableCoroutine(test_transformed_gc.GCTest):
- gcname = "stacklessgc"
+ gcname = "framework"
+ stacklessgc = True
class gcpolicy(gc.StacklessFrameworkGcPolicy):
class transformerclass(stacklessframework.StacklessFrameworkGCTransformer):
GC_PARAMS = {'start_heap_size': 4096 }
Modified: pypy/branch/kill-keepalives-again/pypy/rlib/rgc.py
==============================================================================
--- pypy/branch/kill-keepalives-again/pypy/rlib/rgc.py (original)
+++ pypy/branch/kill-keepalives-again/pypy/rlib/rgc.py Sat Oct 6 12:30:23 2007
@@ -42,7 +42,7 @@
config = rtyper.getconfig()
# if the gc policy doesn't support allocation pools, lltype
# pools as Void.
- if config.translation.gc not in ['framework', 'stacklessgc']:
+ if config.translation.gc != 'framework':
from pypy.annotation.model import s_None
return rtyper.getrepr(s_None)
else:
@@ -66,7 +66,7 @@
opname = 'gc_x_swap_pool'
config = hop.rtyper.getconfig()
- if config.translation.gc not in ['framework', 'stacklessgc']:
+ if config.translation.gc != 'framework':
# when the gc policy doesn't support pools, just return
# the argument (which is lltyped as Void anyway)
opname = 'same_as'
@@ -95,7 +95,7 @@
from pypy.rpython.memory.gc import X_CLONE, X_CLONE_PTR
config = hop.rtyper.getconfig()
- if config.translation.gc not in ['framework', 'stacklessgc']:
+ if config.translation.gc != 'framework':
# if the gc policy does not support allocation pools,
# gc_clone always raises RuntimeError
hop.exception_is_here()
Modified: pypy/branch/kill-keepalives-again/pypy/rpython/memory/test/test_transformed_gc.py
==============================================================================
--- pypy/branch/kill-keepalives-again/pypy/rpython/memory/test/test_transformed_gc.py (original)
+++ pypy/branch/kill-keepalives-again/pypy/rpython/memory/test/test_transformed_gc.py Sat Oct 6 12:30:23 2007
@@ -165,11 +165,12 @@
from pypy import conftest
-def rtype(func, inputtypes, specialize=True, gcname='ref'):
+def rtype(func, inputtypes, specialize=True, gcname='ref', stacklessgc=False):
from pypy.translator.translator import TranslationContext
t = TranslationContext()
# XXX XXX XXX mess
t.config.translation.gc = gcname
+ t.config.translation.stacklessgc = stacklessgc
t.buildannotator().build_types(func, inputtypes)
if specialize:
t.buildrtyper().specialize()
@@ -179,6 +180,7 @@
class GCTest(object):
gcpolicy = None
+ stacklessgc = False
def runner(self, f, nbargs=0, statistics=False):
if nbargs == 2:
@@ -198,14 +200,15 @@
ARGS = lltype.FixedSizeArray(lltype.Signed, nbargs)
s_args = annmodel.SomePtr(lltype.Ptr(ARGS))
- t = rtype(entrypoint, [s_args], gcname=self.gcname)
+ t = rtype(entrypoint, [s_args], gcname=self.gcname,
+ stacklessgc=self.stacklessgc)
cbuild = CStandaloneBuilder(t, entrypoint, config=t.config,
gcpolicy=self.gcpolicy)
db = cbuild.generate_graphs_for_llinterp()
entrypointptr = cbuild.getentrypointptr()
entrygraph = entrypointptr._obj.graph
if conftest.option.view:
- t.view()
+ t.viewcg()
llinterp = LLInterpreter(t.rtyper)
@@ -741,7 +744,7 @@
class TestStacklessMarkSweepGC(TestMarkSweepGC):
- gcname = "stacklessgc"
+ stacklessgc = True
class gcpolicy(gc.StacklessFrameworkGcPolicy):
class transformerclass(stacklessframework.StacklessFrameworkGCTransformer):
GC_PARAMS = {'start_heap_size': 4096 }
Modified: pypy/branch/kill-keepalives-again/pypy/translator/c/gc.py
==============================================================================
--- pypy/branch/kill-keepalives-again/pypy/translator/c/gc.py (original)
+++ pypy/branch/kill-keepalives-again/pypy/translator/c/gc.py Sat Oct 6 12:30:23 2007
@@ -389,7 +389,7 @@
'ref': RefcountingGcPolicy,
'none': NoneGcPolicy,
'framework': FrameworkGcPolicy,
- 'stacklessgc': StacklessFrameworkGcPolicy,
+ 'framework+stacklessgc': StacklessFrameworkGcPolicy,
}
Modified: pypy/branch/kill-keepalives-again/pypy/translator/c/genc.py
==============================================================================
--- pypy/branch/kill-keepalives-again/pypy/translator/c/genc.py (original)
+++ pypy/branch/kill-keepalives-again/pypy/translator/c/genc.py Sat Oct 6 12:30:23 2007
@@ -107,7 +107,10 @@
def get_gcpolicyclass(self):
if self.gcpolicy is None:
- return gc.name_to_gcpolicy[self.config.translation.gc]
+ name = self.config.translation.gc
+ if self.config.translation.stacklessgc:
+ name = "%s+stacklessgc" % (name,)
+ return gc.name_to_gcpolicy[name]
return self.gcpolicy
# use generate_source(defines=DEBUG_DEFINES) to force the #definition
Modified: pypy/branch/kill-keepalives-again/pypy/translator/c/test/test_boehm.py
==============================================================================
--- pypy/branch/kill-keepalives-again/pypy/translator/c/test/test_boehm.py (original)
+++ pypy/branch/kill-keepalives-again/pypy/translator/c/test/test_boehm.py Sat Oct 6 12:30:23 2007
@@ -11,6 +11,7 @@
class AbstractGCTestClass:
gcpolicy = "boehm"
+ stacklessgc = False
# deal with cleanups
def setup_method(self, meth):
@@ -25,6 +26,7 @@
from pypy.config.pypyoption import get_pypy_config
config = get_pypy_config(translating=True)
config.translation.gc = self.gcpolicy
+ config.translation.stacklessgc = self.stacklessgc
config.translation.simplifying = True
t = TranslationContext(config=config)
self.t = t
Modified: pypy/branch/kill-keepalives-again/pypy/translator/c/test/test_newgc.py
==============================================================================
--- pypy/branch/kill-keepalives-again/pypy/translator/c/test/test_newgc.py (original)
+++ pypy/branch/kill-keepalives-again/pypy/translator/c/test/test_newgc.py Sat Oct 6 12:30:23 2007
@@ -775,14 +775,13 @@
assert res == 42
class TestUsingStacklessFramework(TestUsingFramework):
- gcpolicy = "stacklessgc"
def getcompiled(self, f):
# XXX quick hack
from pypy.translator.c.test.test_stackless import StacklessTest
runner = StacklessTest()
runner.gcpolicy = self.gcpolicy
- runner.stacklessmode = True
+ runner.stacklessgc = True
try:
res = runner.wrap_stackless_function(f)
except py.process.cmdexec.Error, e:
Modified: pypy/branch/kill-keepalives-again/pypy/translator/c/test/test_stackless.py
==============================================================================
--- pypy/branch/kill-keepalives-again/pypy/translator/c/test/test_stackless.py (original)
+++ pypy/branch/kill-keepalives-again/pypy/translator/c/test/test_stackless.py Sat Oct 6 12:30:23 2007
@@ -11,8 +11,8 @@
class StacklessTest(object):
backendopt = False
- stacklessmode = True
gcpolicy = "boehm"
+ stacklessgc = False
def setup_class(cls):
import py
@@ -22,7 +22,7 @@
# rpython/extfunctable. Doing so breaks translator/stackless/.
import py
py.test.skip("stackless + refcounting doesn't work any more for now")
- elif cls.gcpolicy is "boehm":
+ elif cls.gcpolicy == "boehm":
from pypy.translator.tool.cbuild import check_boehm_presence
if not check_boehm_presence():
py.test.skip("Boehm GC not present")
@@ -36,6 +36,7 @@
config = get_pypy_config(translating=True)
config.translation.gc = self.gcpolicy
config.translation.stackless = True
+ config.translation.stacklessgc = self.stacklessgc
t = TranslationContext(config=config)
self.t = t
t.buildannotator().build_types(entry_point, [s_list_of_strings])
@@ -47,7 +48,7 @@
insert_ll_stackcheck(t)
cbuilder = CStandaloneBuilder(t, entry_point, config=config)
- cbuilder.stackless = self.stacklessmode
+ cbuilder.stackless = True
cbuilder.generate_source()
cbuilder.compile()
res = cbuilder.cmdexec('')
More information about the Pypy-commit
mailing list