Author: Maciej Fijalkowski <[email protected]>
Branch: vmprof
Changeset: r76073:e6bed8caddf8
Date: 2015-02-23 15:03 +0200
http://bitbucket.org/pypy/pypy/changeset/e6bed8caddf8/

Log:    (fijal, arigo) fix the frame handling race conditions in unjitted
        trampoline

diff --git a/pypy/module/_vmprof/interp_vmprof.py 
b/pypy/module/_vmprof/interp_vmprof.py
--- a/pypy/module/_vmprof/interp_vmprof.py
+++ b/pypy/module/_vmprof/interp_vmprof.py
@@ -56,7 +56,7 @@
 
 pypy_execute_frame_trampoline = rffi.llexternal(
     "pypy_execute_frame_trampoline",
-    [llmemory.GCREF, llmemory.GCREF, llmemory.GCREF],
+    [llmemory.GCREF, llmemory.GCREF, llmemory.GCREF, lltype.Signed],
     llmemory.GCREF,
     compilation_info=eci,
     _nowrapper=True, sandboxsafe=True,
@@ -96,23 +96,18 @@
             gc_frame = cast_instance_to_gcref(frame)
             gc_inputvalue = cast_instance_to_gcref(w_inputvalue)
             gc_operr = cast_instance_to_gcref(operr)
-            gc_result = pypy_execute_frame_trampoline(gc_frame, gc_inputvalue, 
gc_operr)
+            unique_id = frame.pycode._unique_id
+            gc_result = pypy_execute_frame_trampoline(gc_frame, gc_inputvalue,
+                                                      gc_operr, unique_id)
             return cast_base_ptr_to_instance(W_Root, gc_result)
         else:
             return original_execute_frame(frame, w_inputvalue, operr)
 
 
[email protected]_lowlevel('main', [llmemory.GCREF],
[email protected]_lowlevel('main', [lltype.Signed],
                                 'pypy_vmprof_get_virtual_ip', True)
-def get_virtual_ip(gc_frame):
-    frame = cast_base_ptr_to_instance(PyFrame, gc_frame)
-    if jit._get_virtualizable_token(frame):
-        return rffi.cast(rffi.VOIDP, 0)
-    virtual_ip = do_get_virtual_ip(frame)
-    return rffi.cast(rffi.VOIDP, virtual_ip)
-
-def do_get_virtual_ip(frame):
-    return frame.pycode._unique_id
+def get_virtual_ip(unique_id):
+    return rffi.cast(rffi.VOIDP, unique_id)
 
 def write_long_to_string_builder(l, b):
     if sys.maxint == 2147483647:
diff --git a/pypy/module/_vmprof/src/trampoline.asmgcc.s 
b/pypy/module/_vmprof/src/trampoline.asmgcc.s
--- a/pypy/module/_vmprof/src/trampoline.asmgcc.s
+++ b/pypy/module/_vmprof/src/trampoline.asmgcc.s
@@ -6,11 +6,11 @@
        .type   pypy_execute_frame_trampoline, @function
 pypy_execute_frame_trampoline:
        .cfi_startproc
-       pushq   %rdi
+       pushq   %rcx
        .cfi_def_cfa_offset 16
        call pypy_pyframe_execute_frame@PLT
        /* GCROOT 0(%rsp) */
-       popq    %rdi
+       popq    %rcx
        .cfi_def_cfa_offset 8
        ret
        .cfi_endproc
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to