Author: Maciej Fijalkowski <fij...@gmail.com> Branch: Changeset: r45024:8a15ec81d6b2 Date: 2011-06-19 20:26 +0200 http://bitbucket.org/pypy/pypy/changeset/8a15ec81d6b2/
Log: merge diff --git a/pypy/interpreter/pycode.py b/pypy/interpreter/pycode.py --- a/pypy/interpreter/pycode.py +++ b/pypy/interpreter/pycode.py @@ -95,7 +95,7 @@ if self.co_flags & CO_VARKEYWORDS: argcount += 1 # Cell vars could shadow already-set arguments. - # astcompiler.pyassem used to be clever about the order of + # The compiler used to be clever about the order of # the variables in both co_varnames and co_cellvars, but # it no longer is for the sake of simplicity. Moreover # code objects loaded from CPython don't necessarily follow diff --git a/pypy/jit/metainterp/pyjitpl.py b/pypy/jit/metainterp/pyjitpl.py --- a/pypy/jit/metainterp/pyjitpl.py +++ b/pypy/jit/metainterp/pyjitpl.py @@ -1928,7 +1928,6 @@ self.history.inputargs = original_inputargs self.history.operations.pop() # remove the JUMP - # FIXME: Why is self.history.inputargs not restored? def compile_bridge(self, live_arg_boxes): num_green_args = self.jitdriver_sd.num_green_args @@ -1964,6 +1963,8 @@ start_resumedescr, False) self.history.operations.pop() # remove the JUMP if loop_token is None: + self.history.inputargs = original_inputargs + self.history.operations = original_operations return if loop_token.short_preamble: diff --git a/pypy/jit/metainterp/test/test_ajit.py b/pypy/jit/metainterp/test/test_ajit.py --- a/pypy/jit/metainterp/test/test_ajit.py +++ b/pypy/jit/metainterp/test/test_ajit.py @@ -2230,6 +2230,72 @@ self.check_loops(getfield_gc_pure=0) self.check_loops(getfield_gc_pure=2, everywhere=True) + def test_frame_finished_during_retrace(self): + class Base(object): + pass + class A(Base): + def __init__(self, a): + self.val = a + self.num = 1 + def inc(self): + return A(self.val + 1) + class B(Base): + def __init__(self, a): + self.val = a + self.num = 1000 + def inc(self): + return B(self.val + 1) + myjitdriver = JitDriver(greens = [], reds = ['sa', 'a']) + def f(): + myjitdriver.set_param('threshold', 3) + myjitdriver.set_param('trace_eagerness', 2) + a = A(0) + sa = 0 + while a.val < 8: + myjitdriver.jit_merge_point(a=a, sa=sa) + a = a.inc() + if a.val > 4: + a = B(a.val) + sa += a.num + return sa + res = self.meta_interp(f, []) + assert res == f() + + def test_frame_finished_during_continued_retrace(self): + class Base(object): + pass + class A(Base): + def __init__(self, a): + self.val = a + self.num = 100 + def inc(self): + return A(self.val + 1) + class B(Base): + def __init__(self, a): + self.val = a + self.num = 10000 + def inc(self): + return B(self.val + 1) + myjitdriver = JitDriver(greens = [], reds = ['sa', 'b', 'a']) + def f(b): + myjitdriver.set_param('threshold', 6) + myjitdriver.set_param('trace_eagerness', 4) + a = A(0) + sa = 0 + while a.val < 15: + myjitdriver.jit_merge_point(a=a, b=b, sa=sa) + a = a.inc() + if a.val > 8: + a = B(a.val) + if b == 1: + b = 2 + else: + b = 1 + sa += a.num + b + return sa + res = self.meta_interp(f, [1]) + assert res == f(1) + class TestOOtype(BasicTests, OOJitMixin): def test_oohash(self): diff --git a/pypy/translator/c/gcc/trackgcroot.py b/pypy/translator/c/gcc/trackgcroot.py --- a/pypy/translator/c/gcc/trackgcroot.py +++ b/pypy/translator/c/gcc/trackgcroot.py @@ -1177,7 +1177,7 @@ r_gcroot_marker = re.compile(r"$1") # never matches r_gcroot_marker_var = re.compile(r"DWORD PTR .+_constant_always_one_.+pypy_asm_gcroot") r_gcnocollect_marker = re.compile(r"\spypy_asm_gc_nocollect\(("+OPERAND+")\);") - r_bottom_marker = re.compile(r"; .+\tpypy_asm_stack_bottom\(\);") + r_bottom_marker = re.compile(r"; .+\spypy_asm_stack_bottom\(\);") FUNCTIONS_NOT_RETURNING = { '__exit': None, diff --git a/pypy/translator/c/test/test_newgc.py b/pypy/translator/c/test/test_newgc.py --- a/pypy/translator/c/test/test_newgc.py +++ b/pypy/translator/c/test/test_newgc.py @@ -1117,6 +1117,7 @@ S = lltype.GcStruct('S', ('u', lltype.Ptr(U))) A = lltype.GcArray(lltype.Ptr(S)) filename = self.filename_dump_typeids_z + open_flags = os.O_WRONLY | os.O_CREAT | getattr(os, 'O_BINARY', 0) def fn(): s = lltype.malloc(S) @@ -1128,7 +1129,7 @@ # p = rgc.get_typeids_z() s = ''.join([p[i] for i in range(len(p))]) - fd = os.open(filename, os.O_WRONLY | os.O_CREAT, 0666) + fd = os.open(filename, open_flags, 0666) os.write(fd, s) os.close(fd) return 0 @@ -1137,7 +1138,7 @@ def test_write_typeids_z(self): self.run("write_typeids_z") - f = open(self.filename_dump_typeids_z) + f = open(self.filename_dump_typeids_z, 'rb') data_z = f.read() f.close() import zlib _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit