Author: mattip <matti.pi...@gmail.com>
Branch: 
Changeset: r82997:94c2361efe8b
Date: 2016-03-12 20:29 +0200
http://bitbucket.org/pypy/pypy/changeset/94c2361efe8b/

Log:    simplify ifdefs, add arm case

diff --git a/rpython/rlib/rvmprof/src/vmprof_config.h 
b/rpython/rlib/rvmprof/src/vmprof_config.h
--- a/rpython/rlib/rvmprof/src/vmprof_config.h
+++ b/rpython/rlib/rvmprof/src/vmprof_config.h
@@ -1,6 +1,15 @@
 #define HAVE_SYS_UCONTEXT_H
-#if defined(__FreeBSD__) || defined(__APPLE__)
+#if defined(__FreeBSD__)
 #define PC_FROM_UCONTEXT uc_mcontext.mc_rip
+#elif defined( __APPLE__)
+  #if ((ULONG_MAX) == (UINT_MAX))
+    #define PC_FROM_UCONTEXT uc_mcontext->__ss.__eip
+  #else
+    #define PC_FROM_UCONTEXT uc_mcontext->__ss.__rip
+  #endif
+#elif defined(__arm__)
+#define PC_FROM_UCONTEXT uc_mcontext.arm_ip
 #else
+/* linux, gnuc */
 #define PC_FROM_UCONTEXT uc_mcontext.gregs[REG_RIP]
 #endif
diff --git a/rpython/rlib/rvmprof/src/vmprof_getpc.h 
b/rpython/rlib/rvmprof/src/vmprof_getpc.h
--- a/rpython/rlib/rvmprof/src/vmprof_getpc.h
+++ b/rpython/rlib/rvmprof/src/vmprof_getpc.h
@@ -112,13 +112,8 @@
 // PC_FROM_UCONTEXT in config.h.  The only thing we need to do here,
 // then, is to do the magic call-unrolling for systems that support it.
 
-#if defined(__linux) && defined(__i386) && defined(__GNUC__)
-intptr_t GetPC(ucontext_t *signal_ucontext) {
-  return signal_ucontext->uc_mcontext.gregs[REG_EIP];
-}
-
-// Special case #2: Windows, which has to do something totally different.
-#elif defined(_WIN32) || defined(__CYGWIN__) || defined(__CYGWIN32__) || 
defined(__MINGW32__)
+// Special case Windows, which has to do something totally different.
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(__CYGWIN32__) || 
defined(__MINGW32__)
 // If this is ever implemented, probably the way to do it is to have
 // profiler.cc use a high-precision timer via timeSetEvent:
 //    http://msdn2.microsoft.com/en-us/library/ms712713.aspx
@@ -141,18 +136,10 @@
 // Normal cases.  If this doesn't compile, it's probably because
 // PC_FROM_UCONTEXT is the empty string.  You need to figure out
 // the right value for your system, and add it to the list in
-// configure.ac (or set it manually in your config.h).
+// vmrpof_config.h
 #else
 intptr_t GetPC(ucontext_t *signal_ucontext) {
-#ifdef __APPLE__
-#if ((ULONG_MAX) == (UINT_MAX))
-  return (signal_ucontext->uc_mcontext->__ss.__eip);
-#else
-  return (signal_ucontext->uc_mcontext->__ss.__rip);
-#endif
-#else
   return signal_ucontext->PC_FROM_UCONTEXT;   // defined in config.h
-#endif
 }
 
 #endif
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to