Author: Maciej Fijalkowski <fij...@gmail.com>
Branch: vmprof2
Changeset: r76834:8423127b5892
Date: 2015-04-19 17:50 +0200
http://bitbucket.org/pypy/pypy/changeset/8423127b5892/

Log:    try yet a different approach - enclose stuff in 0x2 0x3 instead of
        stripping (the stripping has a problem of not working when we have
        only one

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
@@ -40,17 +40,18 @@
     // modify the last entry to point to start address and not the random one
     // in the middle
     result[n - 1] = (void*)start_addr;
+    result[n] = (void*)2;
+    n++;
     start = n;
     while (n < max_depth) {
         id = pypy_yield_codemap_at_addr(codemap, addr, &current_pos);
         if (id == -1)
             // finish
             break;
+        if (id == 0)
+            continue; // not main codemap
         result[n++] = (void *)id;
     }
-    // we strip the topmost part - the reason is that it's either
-    // represented in the jitted caller or it's not jitted (we have the
-    // same function essentially twice
     k = 0;
     while (k < (n - start) / 2) {
         tmp = result[start + k];
@@ -58,8 +59,8 @@
         result[n - k - 1] = tmp;
         k++;
     }
-    if (n != max_depth) {
-        n--;
+    if (n < max_depth) {
+        result[n++] = (void*)3;
     }
     return n;
 }
diff --git a/rpython/jit/backend/llsupport/codemap.py 
b/rpython/jit/backend/llsupport/codemap.py
--- a/rpython/jit/backend/llsupport/codemap.py
+++ b/rpython/jit/backend/llsupport/codemap.py
@@ -146,8 +146,6 @@
         self.last_call_depth = -1
 
     def enter_portal_frame(self, jd_id, unique_id, relpos):
-        if jd_id != 0:
-            return
         self.l.append(unique_id)
         self.l.append(relpos)
         self.patch_position.append(len(self.l))
@@ -155,8 +153,6 @@
         self.l.append(0) # second marker
 
     def leave_portal_frame(self, jd_id, relpos):
-        if jd_id != 0:
-            return
         to_patch = self.patch_position.pop()
         self.l[to_patch] = relpos
         self.l[to_patch + 1] = len(self.l)
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to