[pypy-commit] pypy cffi-handle-lifetime: hg merge default
arigo
noreply at buildbot.pypy.org
Mon Oct 12 18:37:17 CEST 2015
Author: Armin Rigo <arigo at tunes.org>
Branch: cffi-handle-lifetime
Changeset: r80143:87fadac2e7a3
Date: 2015-10-12 18:37 +0200
http://bitbucket.org/pypy/pypy/changeset/87fadac2e7a3/
Log: hg merge default
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
@@ -92,13 +92,12 @@
PLT = ""
size_decl = ""
type_decl = ""
- extra_align = ""
else:
PLT = "@PLT"
type_decl = "\t.type\t%s, @function" % (tramp_name,)
size_decl = "\t.size\t%s, .-%s" % (
tramp_name, tramp_name)
- extra_align = "\t.cfi_def_cfa_offset 8"
+
assert detect_cpu.autodetect().startswith(detect_cpu.MODEL_X86_64), (
"rvmprof only supports x86-64 CPUs for now")
@@ -125,17 +124,15 @@
# that don't start with \t are silently ignored (<arigato>: WAT!?)
target.write("""\
\t.text
-\t.section\t__TEXT,__text,regular,pure_instructions
\t.globl\t%(tramp_name)s
-\t.align\t4, 0x90
%(type_decl)s
%(tramp_name)s:
\t.cfi_startproc
\tpushq\t%(reg)s
\t.cfi_def_cfa_offset 16
\tcall %(cont_name)s%(PLT)s
-%(extra_align)s
\taddq\t$8, %%rsp
+\t.cfi_def_cfa_offset 8
\tret
\t.cfi_endproc
%(size_decl)s
diff --git a/rpython/rlib/rvmprof/src/vmprof_main.h b/rpython/rlib/rvmprof/src/vmprof_main.h
--- a/rpython/rlib/rvmprof/src/vmprof_main.h
+++ b/rpython/rlib/rvmprof/src/vmprof_main.h
@@ -31,11 +31,7 @@
#include <sys/stat.h>
#include <fcntl.h>
#include "vmprof_getpc.h"
-#ifdef __APPLE__
-#include "libunwind.h"
-#else
#include "vmprof_unwind.h"
-#endif
#include "vmprof_mt.h"
@@ -43,12 +39,10 @@
// functions copied from libunwind using dlopen
-#ifndef __APPLE__ // should be linux only probably
static int (*unw_get_reg)(unw_cursor_t*, int, unw_word_t*) = NULL;
static int (*unw_step)(unw_cursor_t*) = NULL;
static int (*unw_init_local)(unw_cursor_t *, unw_context_t *) = NULL;
static int (*unw_get_proc_info)(unw_cursor_t *, unw_proc_info_t *) = NULL;
-#endif
static int profile_file = -1;
static long prepare_interval_usec;
@@ -73,7 +67,6 @@
return "bad value for 'interval'";
prepare_interval_usec = (int)(interval * 1000000.0);
-#ifndef __APPLE__
if (!unw_get_reg) {
void *libhandle;
@@ -88,7 +81,6 @@
if (!(unw_step = dlsym(libhandle, UNW_PREFIX "_step")))
goto error;
}
-#endif
if (prepare_concurrent_bufs() < 0)
return "out of memory";
@@ -214,12 +206,7 @@
void *ip;
int n = 0;
unw_cursor_t cursor;
-#ifdef __APPLE__
- unw_context_t uc;
- unw_getcontext(&uc);
-#else
unw_context_t uc = *ucontext;
-#endif
int ret = unw_init_local(&cursor, &uc);
assert(ret >= 0);
diff --git a/rpython/rlib/rvmprof/src/vmprof_unwind.h b/rpython/rlib/rvmprof/src/vmprof_unwind.h
--- a/rpython/rlib/rvmprof/src/vmprof_unwind.h
+++ b/rpython/rlib/rvmprof/src/vmprof_unwind.h
@@ -64,7 +64,8 @@
typedef struct unw_cursor
{
unw_word_t opaque[UNW_TDEP_CURSOR_LEN];
- } unw_cursor_t;
+ }
+unw_cursor_t;
#define UNW_REG_IP UNW_X86_64_RIP
#define UNW_REG_SP UNW_X86_64_RSP
@@ -83,7 +84,7 @@
int format; /* unwind-info format (arch-specific) */
int unwind_info_size; /* size of the information (if applicable) */
void *unwind_info; /* unwind-info (arch-specific) */
- } unw_proc_info_t;
+ }
+unw_proc_info_t;
// end of copy
-
diff --git a/rpython/rlib/rvmprof/test/test_rvmprof.py b/rpython/rlib/rvmprof/test/test_rvmprof.py
--- a/rpython/rlib/rvmprof/test/test_rvmprof.py
+++ b/rpython/rlib/rvmprof/test/test_rvmprof.py
@@ -2,7 +2,6 @@
from rpython.tool.udir import udir
from rpython.rlib import rvmprof
from rpython.translator.c.test.test_genc import compile
-from rpython.rlib.objectmodel import we_are_translated
def test_vmprof_execute_code_1():
@@ -97,12 +96,7 @@
@rvmprof.vmprof_execute_code("xcode1", lambda code, num: code)
def main(code, num):
print num
- s = 0
- for i in range(num):
- s += (i << 1)
- if s % 32423423423 == 0:
- print s
- return s
+ return 42
tmpfilename = str(udir.join('test_rvmprof'))
@@ -110,37 +104,16 @@
code = MyCode()
rvmprof.register_code(code, get_name)
fd = os.open(tmpfilename, os.O_WRONLY | os.O_CREAT, 0666)
- if we_are_translated():
- num = 100000000
- period = 0.0001
- else:
- num = 10000
- period = 0.9
- rvmprof.enable(fd, period)
- res = main(code, num)
- #assert res == 499999500000
+ rvmprof.enable(fd, 0.5)
+ res = main(code, 5)
+ assert res == 42
rvmprof.disable()
os.close(fd)
return 0
- def check_profile(filename):
- from vmprof import read_profile
-
- prof = read_profile(filename)
- assert prof.get_tree().name.startswith("py:")
- assert prof.get_tree().count
-
assert f() == 0
assert os.path.exists(tmpfilename)
fn = compile(f, [], gcpolicy="minimark")
+ os.unlink(tmpfilename)
assert fn() == 0
- try:
- import vmprof
- except ImportError:
- py.test.skip("vmprof unimportable")
- else:
- check_profile(tmpfilename)
- finally:
- assert os.path.exists(tmpfilename)
- os.unlink(tmpfilename)
-
\ No newline at end of file
+ assert os.path.exists(tmpfilename)
More information about the pypy-commit
mailing list