[pypy-svn] r71898 - in pypy/branch/jit-constptr/pypy/jit/backend: llsupport llsupport/test x86 x86/test

arigo at codespeak.net arigo at codespeak.net
Mon Mar 8 18:27:53 CET 2010


Author: arigo
Date: Mon Mar  8 18:27:52 2010
New Revision: 71898

Modified:
   pypy/branch/jit-constptr/pypy/jit/backend/llsupport/gcframework.py
   pypy/branch/jit-constptr/pypy/jit/backend/llsupport/test/test_gc.py
   pypy/branch/jit-constptr/pypy/jit/backend/x86/regalloc.py
   pypy/branch/jit-constptr/pypy/jit/backend/x86/test/test_gc_integration.py
   pypy/branch/jit-constptr/pypy/jit/backend/x86/test/test_zrpy_gc.py
Log:
Intermediate stage.  Random progress, but I still need to write tests
and implement code that notes where in the assembler the
convert_to_imm(ConstPtr(..)) results get written to.



Modified: pypy/branch/jit-constptr/pypy/jit/backend/llsupport/gcframework.py
==============================================================================
--- pypy/branch/jit-constptr/pypy/jit/backend/llsupport/gcframework.py	(original)
+++ pypy/branch/jit-constptr/pypy/jit/backend/llsupport/gcframework.py	Mon Mar  8 18:27:52 2010
@@ -48,24 +48,22 @@
     def __init__(self, layoutbuilder):
         self.constgcref_array_type_id = layoutbuilder.get_type_id(
             self.CONSTGCREF_ARRAY)
-        self.full_constgcref_array_type_id = llop.combine_ushort(
-            lltype.Signed,
-            self.constgcref_array_type_id,
-            0)
 
     def _freeze_(self):
         return True
 
     def start_tracing_varsized_part(self, obj, typeid):
         """Called by the GC just before tracing the object 'obj'."""
-        fulltypeid = llop.combine_ushort(lltype.Signed, typeid, 0)
-        if fulltypeid == self.full_constgcref_array_type_id:
+        fulltypeid = rffi.cast(lltype.Signed, typeid)
+        reftypeid = rffi.cast(lltype.Signed, self.constgcref_array_type_id)
+        if fulltypeid == reftypeid:
             self.do_start_stop_tracing(obj, False)
 
     def stop_tracing_varsized_part(self, obj, typeid):
         """Called by the GC just after tracing the object 'obj'."""
-        fulltypeid = llop.combine_ushort(lltype.Signed, typeid, 0)
-        if fulltypeid == self.full_constgcref_array_type_id:
+        fulltypeid = rffi.cast(lltype.Signed, typeid)
+        reftypeid = rffi.cast(lltype.Signed, self.constgcref_array_type_id)
+        if fulltypeid == reftypeid:
             self.do_start_stop_tracing(obj, True)
 
     def do_start_stop_tracing(self, obj, done):

Modified: pypy/branch/jit-constptr/pypy/jit/backend/llsupport/test/test_gc.py
==============================================================================
--- pypy/branch/jit-constptr/pypy/jit/backend/llsupport/test/test_gc.py	(original)
+++ pypy/branch/jit-constptr/pypy/jit/backend/llsupport/test/test_gc.py	Mon Mar  8 18:27:52 2010
@@ -186,7 +186,7 @@
         class FakeTranslator:
             config = config_
         class FakeCPU:
-            GC_SUPPORTED_CONSTPTR = {rop.SAME_AS: None}
+            pass
         gcdescr = get_description(config_)
         translator = FakeTranslator()
         llop1 = FakeLLOp()

Modified: pypy/branch/jit-constptr/pypy/jit/backend/x86/regalloc.py
==============================================================================
--- pypy/branch/jit-constptr/pypy/jit/backend/x86/regalloc.py	(original)
+++ pypy/branch/jit-constptr/pypy/jit/backend/x86/regalloc.py	Mon Mar  8 18:27:52 2010
@@ -41,7 +41,7 @@
         if isinstance(c, ConstInt):
             return imm(c.value)
         elif isinstance(c, ConstPtr):
-            if we_are_translated() and c.value and rgc.can_move(c.value):
+            if we_are_translated() and c.value:
                 print "convert_to_imm: ConstPtr needs special care"
                 raise AssertionError
             return imm(rffi.cast(lltype.Signed, c.value))

Modified: pypy/branch/jit-constptr/pypy/jit/backend/x86/test/test_gc_integration.py
==============================================================================
--- pypy/branch/jit-constptr/pypy/jit/backend/x86/test/test_gc_integration.py	(original)
+++ pypy/branch/jit-constptr/pypy/jit/backend/x86/test/test_gc_integration.py	Mon Mar  8 18:27:52 2010
@@ -15,7 +15,7 @@
 from pypy.rpython.annlowlevel import llhelper
 from pypy.rpython.lltypesystem import rclass, rstr
 from pypy.jit.backend.x86.ri386 import *
-from pypy.jit.backend.llsupport.gc import GcLLDescr_framework, GcRefList, GcPtrFieldDescr
+from pypy.jit.backend.llsupport.gcframework import GcLLDescr_framework
 
 from pypy.jit.backend.x86.test.test_regalloc import MockAssembler
 from pypy.jit.backend.x86.test.test_regalloc import BaseTestRegalloc
@@ -49,9 +49,7 @@
     gcrootmap = MockGcRootMap()
 
     def initialize(self):
-        self.gcrefs = GcRefList()
-        self.gcrefs.initialize()
-        self.single_gcref_descr = GcPtrFieldDescr(0)
+        pass
         
     rewrite_assembler = GcLLDescr_framework.rewrite_assembler.im_func
 

Modified: pypy/branch/jit-constptr/pypy/jit/backend/x86/test/test_zrpy_gc.py
==============================================================================
--- pypy/branch/jit-constptr/pypy/jit/backend/x86/test/test_zrpy_gc.py	(original)
+++ pypy/branch/jit-constptr/pypy/jit/backend/x86/test/test_zrpy_gc.py	Mon Mar  8 18:27:52 2010
@@ -412,8 +412,29 @@
 
     def test_compile_hybrid_external_exception_handling(self):
         self.run('compile_hybrid_external_exception_handling')
-            
-    def define_compile_hybrid_bug1(self):
+
+    def define_compile_hybrid_movable_gcref(self):
+        @purefunction
+        def moving():
+            return X(1)
+
+        @dont_look_inside
+        def do_more_stuff():
+            rgc.collect()
+            return X(5)
+
+        def f(n, x, x0, x1, x2, x3, x4, x5, x6, x7, l, s):
+            x0 = do_more_stuff()
+            check(moving().x == 1)
+            n -= 1
+            return n, x, x0, x1, x2, x3, x4, x5, x6, x7, l, s
+
+        return None, f, None
+
+    def test_compile_hybrid_movable_gcref(self):
+        self.run('compile_hybrid_movable_gcref', 200)
+
+    def define_compile_hybrid_nonmovable_gcref(self):
         @purefunction
         def nonmoving():
             x = X(1)
@@ -436,8 +457,8 @@
 
         return None, f, None
 
-    def test_compile_hybrid_bug1(self):
-        self.run('compile_hybrid_bug1', 200)
+    def test_compile_hybrid_nonmovable_gcref(self):
+        self.run('compile_hybrid_nonmovable_gcref', 200)
 
     def define_compile_hybrid_vref(self):
         from pypy.rlib.jit import virtual_ref, virtual_ref_finish



More information about the Pypy-commit mailing list