Armin Rigo avatar Armin Rigo committed 53700ba

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.

Comments (0)

Files changed (5)

pypy/jit/backend/llsupport/gcframework.py

     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):

pypy/jit/backend/llsupport/test/test_gc.py

         class FakeTranslator:
             config = config_
         class FakeCPU:
-            GC_SUPPORTED_CONSTPTR = {rop.SAME_AS: None}
+            pass
         gcdescr = get_description(config_)
         translator = FakeTranslator()
         llop1 = FakeLLOp()

pypy/jit/backend/x86/regalloc.py

         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))

pypy/jit/backend/x86/test/test_gc_integration.py

 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
     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
 

pypy/jit/backend/x86/test/test_zrpy_gc.py

 
     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)
 
         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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.