Author: Maciej Fijalkowski <fij...@gmail.com> Branch: vmprof Changeset: r76715:5275e224f8c8 Date: 2015-04-05 09:16 +0200 http://bitbucket.org/pypy/pypy/changeset/5275e224f8c8/
Log: swap the order of codemap entries diff --git a/pypy/module/_vmprof/src/get_custom_offset.c b/pypy/module/_vmprof/src/get_custom_offset.c --- a/pypy/module/_vmprof/src/get_custom_offset.c +++ b/pypy/module/_vmprof/src/get_custom_offset.c @@ -29,6 +29,8 @@ intptr_t id; long start_addr = 0; intptr_t addr = (intptr_t)ip; + int start, k; + void *tmp; codemap = pypy_find_codemap_at_addr(addr, &start_addr); if (codemap == NULL) @@ -38,6 +40,7 @@ // modify the last entry to point to start address and not the random one // in the middle result[n - 1] = (void*)start_addr; + start = n; while (n < max_depth) { id = pypy_yield_codemap_at_addr(codemap, addr, ¤t_pos); if (id == 0) @@ -45,5 +48,12 @@ break; result[n++] = (void *)id; } + k = 0; + while (k < (n - start) / 2) { + tmp = result[start + k]; + result[start + k] = result[n - k - 1]; + result[n - k - 1] = tmp; + k++; + } return n; } _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit