Author: Maciej Fijalkowski <fij...@gmail.com> Branch: jitframe-on-heap Changeset: r60721:87e655bb59b1 Date: 2013-01-30 12:21 +0200 http://bitbucket.org/pypy/pypy/changeset/87e655bb59b1/
Log: shuffle those tests around 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 pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit