[pypy-commit] pypy default: fix windows translation bug at the beginning
planrich
pypy.commits at gmail.com
Thu Mar 30 14:55:42 EDT 2017
Author: planrich
Branch:
Changeset: r90875:eba581c00543
Date: 2017-03-30 18:54 +0000
http://bitbucket.org/pypy/pypy/changeset/eba581c00543/
Log: fix windows translation bug at the beginning
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
@@ -16,12 +16,13 @@
SRC = ROOT.join('src')
SHARED = SRC.join('shared')
BACKTRACE = SHARED.join('libbacktrace')
-MSIINTTYPES = SHARED.join('msiinttypes')
-extra_include_dirs = []
compile_extra = ['-DRPYTHON_VMPROF', '-O3']
+separate_module_files = [
+ SHARED.join('symboltable.c')
+]
if sys.platform.startswith('linux'):
- separate_module_files = [
+ separate_module_files += [
BACKTRACE.join('backtrace.c'),
BACKTRACE.join('state.c'),
BACKTRACE.join('elf.c'),
@@ -38,26 +39,24 @@
elif sys.platform == 'darwin':
compile_extra += ['-DVMPROF_UNIX']
compile_extra += ['-DVMPROF_MAC']
- separate_module_files = []
_libs = []
else:
# windows
compile_extra += ['-DVMPROF_WINDOWS']
- extra_include_dirs += [MSIINTTYPES]
separate_module_files = [SHARED.join('vmprof_main_win32.c')]
_libs = []
eci_kwds = dict(
- include_dirs = [SRC, SHARED, BACKTRACE] + extra_include_dirs,
+ include_dirs = [SRC, SHARED, BACKTRACE],
includes = ['rvmprof.h','vmprof_stack.h'],
libraries = _libs,
separate_module_files = [
SRC.join('rvmprof.c'),
SHARED.join('compat.c'),
SHARED.join('machine.c'),
- SHARED.join('symboltable.c'),
SHARED.join('vmp_stack.c'),
+ # symbol table already in separate_module_files
] + separate_module_files,
post_include_bits=[],
compile_extra=compile_extra
diff --git a/rpython/rlib/rvmprof/src/shared/vmp_stack.c b/rpython/rlib/rvmprof/src/shared/vmp_stack.c
--- a/rpython/rlib/rvmprof/src/shared/vmp_stack.c
+++ b/rpython/rlib/rvmprof/src/shared/vmp_stack.c
@@ -49,9 +49,11 @@
PY_EVAL_RETURN_T * vmprof_eval(PY_STACK_FRAME_T *f, int throwflag) { return NULL; }
#endif
-static int vmp_native_traces_enabled = 0;
+#ifdef VMP_SUPPORTS_NATIVE_PROFILING
static intptr_t *vmp_ranges = NULL;
static ssize_t vmp_range_count = 0;
+static int vmp_native_traces_enabled = 0;
+#endif
static int _vmp_profiles_lines = 0;
void vmp_profile_lines(int lines) {
diff --git a/rpython/rlib/rvmprof/src/shared/vmprof.h b/rpython/rlib/rvmprof/src/shared/vmprof.h
--- a/rpython/rlib/rvmprof/src/shared/vmprof.h
+++ b/rpython/rlib/rvmprof/src/shared/vmprof.h
@@ -70,4 +70,3 @@
#endif
-
diff --git a/rpython/rlib/rvmprof/src/shared/vmprof_common.h b/rpython/rlib/rvmprof/src/shared/vmprof_common.h
--- a/rpython/rlib/rvmprof/src/shared/vmprof_common.h
+++ b/rpython/rlib/rvmprof/src/shared/vmprof_common.h
@@ -75,6 +75,7 @@
return "out of memory";
#if VMPROF_UNIX
current_codes = NULL;
+ assert(fd >= 0);
#else
if (memory) {
return "memory tracking only supported on unix";
@@ -83,7 +84,6 @@
return "native profiling only supported on unix";
}
#endif
- assert(fd >= 0);
vmp_set_profile_fileno(fd);
if (opened_profile(interp_name, memory, proflines, native) < 0) {
vmp_set_profile_fileno(0);
@@ -181,7 +181,8 @@
intptr_t *result_p, intptr_t result_length)
{
int n;
-#ifdef _WIN32
+ int enabled;
+#ifdef VMPROF_WINDOWS
intptr_t pc = 0; /* XXX implement me */
#else
intptr_t pc = ucontext ? (intptr_t)GetPC((ucontext_t *)ucontext) : 0;
@@ -189,7 +190,7 @@
if (stack == NULL) {
stack = get_vmprof_stack();
}
- int enabled = vmp_native_enabled();
+ enabled = vmp_native_enabled();
vmp_native_disable();
n = get_stack_trace(stack, result_p, result_length - 2, pc);
if (enabled) {
diff --git a/rpython/rlib/rvmprof/src/shared/vmprof_get_custom_offset.h b/rpython/rlib/rvmprof/src/shared/vmprof_get_custom_offset.h
--- a/rpython/rlib/rvmprof/src/shared/vmprof_get_custom_offset.h
+++ b/rpython/rlib/rvmprof/src/shared/vmprof_get_custom_offset.h
@@ -1,6 +1,10 @@
#pragma once
+#ifdef VMPROF_WINDOWS
+#include "msiinttypes/stdint.h"
+#else
#include <stdint.h>
+#endif
void *pypy_find_codemap_at_addr(long addr, long *start_addr);
long pypy_yield_codemap_at_addr(void *codemap_raw, long addr,
diff --git a/rpython/rlib/rvmprof/src/shared/vmprof_main_win32.c b/rpython/rlib/rvmprof/src/shared/vmprof_main_win32.c
--- a/rpython/rlib/rvmprof/src/shared/vmprof_main_win32.c
+++ b/rpython/rlib/rvmprof/src/shared/vmprof_main_win32.c
@@ -18,6 +18,7 @@
{
int res;
int fd;
+ int count;
res = WaitForSingleObject(write_mutex, INFINITE);
fd = vmp_profile_fileno();
@@ -27,7 +28,7 @@
return -1;
}
while (bufsize > 0) {
- ssize_t count = _write(fd, buf, (long)bufsize);
+ count = _write(fd, buf, (long)bufsize);
if (count <= 0) {
ReleaseMutex(write_mutex);
return -1; /* failed */
diff --git a/rpython/rlib/rvmprof/src/shared/vmprof_main_win32.h b/rpython/rlib/rvmprof/src/shared/vmprof_main_win32.h
--- a/rpython/rlib/rvmprof/src/shared/vmprof_main_win32.h
+++ b/rpython/rlib/rvmprof/src/shared/vmprof_main_win32.h
@@ -19,7 +19,7 @@
int vmp_write_all(const char *buf, size_t bufsize);
-#ifdef VMPROF_RPYTHON
+#ifdef RPYTHON_VMPROF
typedef struct pypy_threadlocal_s PY_WIN_THREAD_STATE;
#else
typedef PyThreadState PY_WIN_THREAD_STATE;
@@ -89,7 +89,7 @@
#endif
}
-#ifdef RPYTHON_VMPROF
+#ifndef RPYTHON_VMPROF
static
PY_WIN_THREAD_STATE * get_current_thread_state(void)
{
@@ -188,3 +188,16 @@
{
enabled = !ignored;
}
+
+int vmp_native_enable(void) {
+ return 0;
+}
+
+void vmp_native_disable(void) {
+}
+
+int get_stack_trace(PY_WIN_THREAD_STATE * current, void** result,
+ int max_depth, intptr_t pc)
+{
+ return 0;
+}
More information about the pypy-commit
mailing list