Author: Armin Rigo <[email protected]>
Branch: vmprof-review
Changeset: r78744:ff54f7fd27c2
Date: 2015-08-02 17:11 +0200
http://bitbucket.org/pypy/pypy/changeset/ff54f7fd27c2/
Log: Tweaks tweaks until the tests pass
diff --git a/rpython/rlib/rvmprof/cintf.py b/rpython/rlib/rvmprof/cintf.py
--- a/rpython/rlib/rvmprof/cintf.py
+++ b/rpython/rlib/rvmprof/cintf.py
@@ -42,9 +42,12 @@
## [rffi.CCHARP, rffi.VOIDP, rffi.VOIDP], lltype.Void,
## compilation_info=eci, _nowrapper=True)
+vmprof_ignore_signals = rffi.llexternal("rpython_vmprof_ignore_signals",
+ [rffi.INT], lltype.Void,
+ compilation_info=eci)
+
def vmprof_enable(fileno, interval_usec): return 0
-def vmprof_ignore_signals(ignore): pass
def token2lltype(tok):
diff --git a/rpython/rlib/rvmprof/src/rvmprof.c
b/rpython/rlib/rvmprof/src/rvmprof.c
--- a/rpython/rlib/rvmprof/src/rvmprof.c
+++ b/rpython/rlib/rvmprof/src/rvmprof.c
@@ -1,8 +1,18 @@
#define _GNU_SOURCE 1
-#include "common_header.h"
-#ifndef VMPROF_ADDR_OF_TRAMPOLINE
-# error "RPython program using rvmprof, but not calling vmprof_execute_code()"
+
+#if defined(RPY_EXTERN) && !defined(RPY_EXPORTED)
+ /* only for testing: ll2ctypes sets RPY_EXTERN from the command-line */
+# define RPY_EXPORTED extern __attribute__((visibility("default")))
+
+#else
+
+# include "common_header.h"
+# include "rvmprof.h"
+# ifndef VMPROF_ADDR_OF_TRAMPOLINE
+# error "RPython program using rvmprof, but not calling
vmprof_execute_code()"
+# endif
+
#endif
@@ -21,6 +31,7 @@
static int (*unw_get_proc_info)(unw_cursor_t *, unw_proc_info_t *) = NULL;
+RPY_EXTERN
char *rpython_vmprof_init(void)
{
if (!unw_get_reg) {
@@ -44,3 +55,18 @@
}
/************************************************************/
+
+static long volatile ignore_signals = 0;
+
+RPY_EXTERN
+void rpython_vmprof_ignore_signals(int ignored)
+{
+#ifndef _MSC_VER
+ if (ignored)
+ __sync_lock_test_and_set(&ignore_signals, 1);
+ else
+ __sync_lock_release(&ignore_signals);
+#else
+ _InterlockedExchange(&ignore_signals, (long)ignored);
+#endif
+}
diff --git a/rpython/rlib/rvmprof/src/rvmprof.h
b/rpython/rlib/rvmprof/src/rvmprof.h
--- a/rpython/rlib/rvmprof/src/rvmprof.h
+++ b/rpython/rlib/rvmprof/src/rvmprof.h
@@ -1,2 +1,3 @@
-char *rpython_vmprof_init(void);
+RPY_EXTERN char *rpython_vmprof_init(void);
+RPY_EXTERN void vmprof_ignore_signals(int);
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit