Author: David Schneider <[email protected]>
Branch: jitframe-on-heap
Changeset: r60724:bdaf37b11afb
Date: 2013-01-30 13:01 +0100
http://bitbucket.org/pypy/pypy/changeset/bdaf37b11afb/

Log:    merge upstream

diff --git a/rpython/jit/backend/llsupport/gc.py 
b/rpython/jit/backend/llsupport/gc.py
--- a/rpython/jit/backend/llsupport/gc.py
+++ b/rpython/jit/backend/llsupport/gc.py
@@ -139,6 +139,7 @@
         """ Allocate a new frame, overwritten by tests
         """
         frame = jitframe.JITFRAME.allocate(frame_info)
+        llop.gc_assume_young_pointers(lltype.Void, frame)
         return frame
 
 class JitFrameDescrs:
diff --git a/rpython/jit/backend/x86/assembler.py 
b/rpython/jit/backend/x86/assembler.py
--- a/rpython/jit/backend/x86/assembler.py
+++ b/rpython/jit/backend/x86/assembler.py
@@ -1261,7 +1261,8 @@
             dst_locs.append(r10)
             x = r10
         remap_frame_layout(self, src_locs, dst_locs, X86_64_SCRATCH_REG)
-        self.push_gcmap(self.mc, self._regalloc.get_gcmap([eax]), store=True)
+        self.push_gcmap(self.mc, self._regalloc.get_gcmap([eax], noregs=True),
+                        store=True)
         self.mc.CALL(x)
         self._reload_frame_if_necessary(self.mc)
         if align:
diff --git a/rpython/jit/backend/x86/regalloc.py 
b/rpython/jit/backend/x86/regalloc.py
--- a/rpython/jit/backend/x86/regalloc.py
+++ b/rpython/jit/backend/x86/regalloc.py
@@ -749,8 +749,7 @@
         #  - at least the non-callee-saved registers
         #
         #  - for shadowstack, we assume that any call can collect, and we
-        #    save also the callee-saved registers that contain GC pointers,
-        #    so that they can be found by follow_stack_frame_of_assembler()
+        #    save also the callee-saved registers that contain GC pointers.
         #
         #  - for CALL_MAY_FORCE or CALL_ASSEMBLER, we have to save all regs
         #    anyway, in case we need to do cpu.force().  The issue is that
@@ -894,13 +893,14 @@
             gc_ll_descr.get_nursery_top_addr(),
             sizeloc, gcmap)
 
-    def get_gcmap(self, forbidden_regs=[]):
+    def get_gcmap(self, forbidden_regs=[], noregs=False):
         frame_depth = self.fm.get_frame_depth()
         gcmap = self.assembler.allocate_gcmap(frame_depth)
         for box, loc in self.rm.reg_bindings.iteritems():
             if loc in forbidden_regs:
                 continue
             if box.type == REF:
+                assert not noregs
                 assert isinstance(loc, RegLoc)
                 val = gpr_reg_mgr_cls.all_reg_indexes[loc.value]
                 gcmap[val // WORD // 8] |= r_uint(1) << (val % (WORD * 8))
diff --git a/rpython/jit/backend/x86/test/test_zrpy_gc.py 
b/rpython/jit/backend/x86/test/test_zrpy_gc.py
--- a/rpython/jit/backend/x86/test/test_zrpy_gc.py
+++ b/rpython/jit/backend/x86/test/test_zrpy_gc.py
@@ -7,15 +7,13 @@
 import weakref
 import os
 from rpython.rlib import rgc
-from rpython.rtyper.lltypesystem import lltype, llmemory, rffi
+from rpython.rtyper.lltypesystem import lltype
 from rpython.rlib.jit import JitDriver, dont_look_inside
 from rpython.rlib.jit import elidable, unroll_safe
 from rpython.jit.backend.llsupport.gc import GcLLDescr_framework
 from rpython.tool.udir import udir
 from rpython.config.translationoption import DEFL_GC
-from rpython.rlib.libffi import CDLL, types, ArgChain, clibffi
-from rpython.rtyper.annlowlevel import llhelper
-from rpython.rtyper.lltypesystem.ll2ctypes import libc_name
+
 
 class X(object):
     def __init__(self, x=0):
@@ -30,18 +28,6 @@
     if not flag:
         raise CheckError
 
-def get_g(main):
-    main._dont_inline_ = True
-    def g(name, n):
-        x = X()
-        x.foo = 2
-        main(n, x)
-        x.foo = 5
-        return weakref.ref(x)
-    g._dont_inline_ = True
-    return g
-
-
 def get_entry(g):
 
     def entrypoint(args):
@@ -67,7 +53,6 @@
 
     return entrypoint
 
-
 def get_functions_to_patch():
     from rpython.jit.backend.llsupport import gc
     #
@@ -124,31 +109,6 @@
     data = cbuilder.cmdexec(args, env={'PYPYLOG': ':%s' % pypylog})
     return data.strip()
 
-def compile_and_run(f, gc, **kwds):
-    cbuilder = compile(f, gc, **kwds)
-    return run(cbuilder)
-
-
-
-def test_compile_boehm():
-    myjitdriver = JitDriver(greens = [], reds = ['n', 'x'])
-    @dont_look_inside
-    def see(lst, n):
-        assert len(lst) == 3
-        assert lst[0] == n+10
-        assert lst[1] == n+20
-        assert lst[2] == n+30
-    def main(n, x):
-        while n > 0:
-            myjitdriver.can_enter_jit(n=n, x=x)
-            myjitdriver.jit_merge_point(n=n, x=x)
-            y = X()
-            y.foo = x.foo
-            n -= y.foo
-            see([n+10, n+20, n+30], n)
-    res = compile_and_run(get_entry(get_g(main)), "boehm", jit=True)
-    assert int(res) >= 16
-
 # ______________________________________________________________________
 
 
diff --git a/rpython/jit/backend/x86/test/test_zrpy_gc_boehm.py 
b/rpython/jit/backend/x86/test/test_zrpy_gc_boehm.py
new file mode 100644
--- /dev/null
+++ b/rpython/jit/backend/x86/test/test_zrpy_gc_boehm.py
@@ -0,0 +1,51 @@
+
+import weakref
+from rpython.rlib.jit import JitDriver, dont_look_inside
+from rpython.jit.backend.x86.test.test_zrpy_gc import run, get_entry
+
+class X(object):
+    def __init__(self, x=0):
+        self.x = x
+
+    next = None
+
+class CheckError(Exception):
+    pass
+
+def check(flag):
+    if not flag:
+        raise CheckError
+
+def compile_and_run(f, gc, **kwds):
+    cbuilder = compile(f, gc, **kwds)
+    return run(cbuilder)
+
+def get_g(main):
+    main._dont_inline_ = True
+    def g(name, n):
+        x = X()
+        x.foo = 2
+        main(n, x)
+        x.foo = 5
+        return weakref.ref(x)
+    g._dont_inline_ = True
+    return g
+
+def test_compile_boehm():
+    myjitdriver = JitDriver(greens = [], reds = ['n', 'x'])
+    @dont_look_inside
+    def see(lst, n):
+        assert len(lst) == 3
+        assert lst[0] == n+10
+        assert lst[1] == n+20
+        assert lst[2] == n+30
+    def main(n, x):
+        while n > 0:
+            myjitdriver.can_enter_jit(n=n, x=x)
+            myjitdriver.jit_merge_point(n=n, x=x)
+            y = X()
+            y.foo = x.foo
+            n -= y.foo
+            see([n+10, n+20, n+30], n)
+    res = compile_and_run(get_entry(get_g(main)), "boehm", jit=True)
+    assert int(res) >= 16
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to