[pypy-svn] r33048 - in pypy/branch/even-more-config2/pypy: rpython/memory/test translator/c translator/c/test

cfbolz at codespeak.net cfbolz at codespeak.net
Mon Oct 9 14:46:40 CEST 2006


Author: cfbolz
Date: Mon Oct  9 14:46:37 2006
New Revision: 33048

Modified:
   pypy/branch/even-more-config2/pypy/rpython/memory/test/test_transformed_gc.py
   pypy/branch/even-more-config2/pypy/translator/c/genc.py
   pypy/branch/even-more-config2/pypy/translator/c/test/test_stackless.py
Log:
allow the explicit specification of a gc policy class again, to make
test_transformed_gc work.


Modified: pypy/branch/even-more-config2/pypy/rpython/memory/test/test_transformed_gc.py
==============================================================================
--- pypy/branch/even-more-config2/pypy/rpython/memory/test/test_transformed_gc.py	(original)
+++ pypy/branch/even-more-config2/pypy/rpython/memory/test/test_transformed_gc.py	Mon Oct  9 14:46:37 2006
@@ -197,7 +197,7 @@
         ARGS = lltype.FixedSizeArray(lltype.Signed, nbargs)
         s_args = annmodel.SomePtr(lltype.Ptr(ARGS))
         t = rtype(entrypoint, [s_args])
-        cbuild = CStandaloneBuilder(t, entrypoint, self.gcpolicy)
+        cbuild = CStandaloneBuilder(t, entrypoint, gcpolicy=self.gcpolicy)
         db = cbuild.generate_graphs_for_llinterp()
         entrypointptr = cbuild.getentrypointptr()
         entrygraph = entrypointptr._obj.graph

Modified: pypy/branch/even-more-config2/pypy/translator/c/genc.py
==============================================================================
--- pypy/branch/even-more-config2/pypy/translator/c/genc.py	(original)
+++ pypy/branch/even-more-config2/pypy/translator/c/genc.py	Mon Oct  9 14:46:37 2006
@@ -22,14 +22,18 @@
     symboltable = None
     modulename = None
     
-    def __init__(self, translator, entrypoint, config=None, libraries=None):
+    def __init__(self, translator, entrypoint, config=None, libraries=None,
+                 gcpolicy=None):
         self.translator = translator
         self.entrypoint = entrypoint
         self.originalentrypoint = entrypoint
+        self.gcpolicy = gcpolicy
         if config is None:
             from pypy.config.config import Config
             from pypy.config.pypyoption import pypy_optiondescription
             config = Config(pypy_optiondescription)
+        if gcpolicy is not None and gcpolicy.requires_stackless:
+            config.translation.stackless = True
         self.config = config
 
         if libraries is None:
@@ -40,7 +44,7 @@
     def build_database(self, exports=[], pyobj_options=None):
         translator = self.translator
 
-        gcpolicyclass = gc.name_to_gcpolicy[self.config.translation.gc]
+        gcpolicyclass = self.get_gcpolicyclass()
 
         if self.config.translation.stackless:
             if not self.standalone:
@@ -102,6 +106,12 @@
 
     have___thread = None
 
+
+    def get_gcpolicyclass(self):
+        if self.gcpolicy is None:
+            return gc.name_to_gcpolicy[self.config.translation.gc]
+        return self.gcpolicy
+
     def generate_source(self, db=None, defines={}):
         assert self.c_source_filename is None
         translator = self.translator

Modified: pypy/branch/even-more-config2/pypy/translator/c/test/test_stackless.py
==============================================================================
--- pypy/branch/even-more-config2/pypy/translator/c/test/test_stackless.py	(original)
+++ pypy/branch/even-more-config2/pypy/translator/c/test/test_stackless.py	Mon Oct  9 14:46:37 2006
@@ -17,13 +17,13 @@
 
     def setup_class(cls):
         import py
-        if cls.gcpolicy in (None, gc.RefcountingGcPolicy):
+        if cls.gcpolicy in (None, "ref"):
             # to re-enable this, remove the two characters 'gc' in the
             # declaregcptrtype(rstack.frame_stack_top,...) call in
             # 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 gc.BoehmGcPolicy:
+        elif cls.gcpolicy is "boehm":
             from pypy.translator.tool.cbuild import check_boehm_presence
             if not check_boehm_presence():
                 py.test.skip("Boehm GC not present")



More information about the Pypy-commit mailing list