[pypy-svn] r47365 - in pypy/dist/pypy/rpython/memory: gctransform test

cfbolz at codespeak.net cfbolz at codespeak.net
Wed Oct 10 00:39:27 CEST 2007


Author: cfbolz
Date: Wed Oct 10 00:39:25 2007
New Revision: 47365

Modified:
   pypy/dist/pypy/rpython/memory/gctransform/framework.py
   pypy/dist/pypy/rpython/memory/test/test_transformed_gc.py
Log:
make all the semi space tests in test_transformed_gc pass, by inserting
necessary casts (which don't do anything after translation, but are needed on
top of the llinterp to get the layers of translation done correctly).


Modified: pypy/dist/pypy/rpython/memory/gctransform/framework.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/gctransform/framework.py	(original)
+++ pypy/dist/pypy/rpython/memory/gctransform/framework.py	Wed Oct 10 00:39:25 2007
@@ -536,6 +536,12 @@
         c_type = rmodel.inputconst(lltype.Void, llmemory.Address)
         for k,var in enumerate(livevars):
             c_k = rmodel.inputconst(lltype.Signed, k)
+            # this cast doesn't actually do anything after translation to C
+            # however, on top of the llinterp it is needed
+            # see comment in llmemory before cast_ptr_to_weakrefptr
+            if var.concretetype == llmemory.WeakRefPtr:
+                var = hop.llops.genop("cast_weakrefptr_to_ptr", [var],
+                                      resulttype=WEAKREFPTR)
             v_adr = gen_cast(hop.llops, llmemory.Address, var)
             hop.genop("raw_store", [base_addr, c_type, c_k, v_adr])
 
@@ -555,6 +561,18 @@
                 c_k = rmodel.inputconst(lltype.Signed, k)
                 v_newaddr = hop.genop("raw_load", [base_addr, c_type, c_k],
                                       resulttype=llmemory.Address)
+                if var.concretetype == llmemory.WeakRefPtr:
+                    # these casts doesn't actually do anything after
+                    # translation to C however, on top of the llinterp it is
+                    # needed see comment in llmemory before
+                    # cast_ptr_to_weakrefptr
+                    # XXX not nice
+                    nvar = hop.llops.genop("cast_adr_to_ptr", [v_newaddr],
+                                           resulttype=WEAKREFPTR)
+                    nvar = hop.llops.genop("cast_ptr_to_weakrefptr", [nvar],
+                                           resulttype=llmemory.WeakRefPtr)
+                    v_newaddr = hop.llops.genop("cast_ptr_to_adr", [nvar],
+                                                resulttype=llmemory.Address)
                 hop.genop("gc_reload_possibly_moved", [v_newaddr, var])
 
     def compute_borrowed_vars(self, graph):

Modified: pypy/dist/pypy/rpython/memory/test/test_transformed_gc.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/test/test_transformed_gc.py	(original)
+++ pypy/dist/pypy/rpython/memory/test/test_transformed_gc.py	Wed Oct 10 00:39:25 2007
@@ -630,9 +630,6 @@
 
 class TestSemiSpaceGC(GenericGCTests):
 
-    def setup_class(cls):
-        py.test.skip("in-progress")
-
     class gcpolicy(gc.FrameworkGcPolicy):
         class transformerclass(framework.FrameworkGCTransformer):
             from pypy.rpython.memory.gc import SemiSpaceGC as GCClass



More information about the Pypy-commit mailing list