Author: fijal Branch: vmprof-newstack Changeset: r81674:a1dd8454d500 Date: 2016-01-11 20:45 +0200 http://bitbucket.org/pypy/pypy/changeset/a1dd8454d500/
Log: fix fix fix diff --git a/rpython/jit/backend/llsupport/test/zrpy_vmprof_test.py b/rpython/jit/backend/llsupport/test/zrpy_vmprof_test.py --- a/rpython/jit/backend/llsupport/test/zrpy_vmprof_test.py +++ b/rpython/jit/backend/llsupport/test/zrpy_vmprof_test.py @@ -19,6 +19,7 @@ from rpython.rlib import rvmprof class MyCode: + _vmprof_unique_id = 0 def __init__(self, name): self.name = name @@ -26,14 +27,18 @@ return code.name code2 = MyCode("py:y:foo:4") + rvmprof.register_code(code2, get_name) try: rvmprof.register_code_object_class(MyCode, get_name) except rvmprof.VMProfPlatformUnsupported, e: py.test.skip(str(e)) + def get_unique_id(code): + return rvmprof.get_unique_id(code) + driver = JitDriver(greens = ['code'], reds = ['i', 's', 'num'], - is_recursive=True) + is_recursive=True, get_unique_id=get_unique_id) @rvmprof.vmprof_execute_code("xcode13", lambda code, num: code) def main(code, num): @@ -45,7 +50,7 @@ while i < num: driver.jit_merge_point(code=code, i=i, s=s, num=num) s += (i << 1) - if s % 3 == 0 and code is not code2: + if i % 3 == 0 and code is not code2: main(code2, 100) i += 1 return s @@ -72,7 +77,7 @@ import pdb pdb.set_trace() - self.meta_interp(f, [1000000]) + self.meta_interp(f, [1000000], inline=True) try: import vmprof except ImportError: diff --git a/rpython/rlib/jit.py b/rpython/rlib/jit.py --- a/rpython/rlib/jit.py +++ b/rpython/rlib/jit.py @@ -623,6 +623,8 @@ raise AttributeError("no 'greens' or 'reds' supplied") if virtualizables is not None: self.virtualizables = virtualizables + if get_unique_id is not None or is_recursive: + assert get_unique_id is not None and is_recursive, "get_unique_id and is_recursive must be specified at the same time" for v in self.virtualizables: assert v in self.reds # if reds are automatic, they won't be passed to jit_merge_point, so diff --git a/rpython/rlib/rvmprof/src/vmprof_get_custom_offset.h b/rpython/rlib/rvmprof/src/vmprof_get_custom_offset.h --- a/rpython/rlib/rvmprof/src/vmprof_get_custom_offset.h +++ b/rpython/rlib/rvmprof/src/vmprof_get_custom_offset.h @@ -11,7 +11,7 @@ #ifdef PYPY_JIT_CODEMAP void *codemap; long current_pos = 0; - intptr_t id; + intptr_t ident; long start_addr = 0; intptr_t addr = (intptr_t)ip; int start, k; @@ -28,21 +28,22 @@ result[n++] = start_addr; start = n; while (n < max_depth) { - id = pypy_yield_codemap_at_addr(codemap, addr, ¤t_pos); - if (id == -1) + ident = pypy_yield_codemap_at_addr(codemap, addr, ¤t_pos); + if (ident == -1) // finish break; - if (id == 0) + if (ident == 0) continue; // not main codemap result[n++] = VMPROF_JITTED_TAG; - result[n++] = id; + result[n++] = ident; } - k = 0; + k = 1; + while (k < (n - start) / 2) { tmp = result[start + k]; - result[start + k] = result[n - k - 1]; - result[n - k - 1] = tmp; - k++; + result[start + k] = result[n - k]; + result[n - k] = tmp; + k += 2; } #endif return n; _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit