[pypy-commit] pypy default: Windows translation fixes

arigo pypy.commits at gmail.com
Sat Jul 16 13:18:20 EDT 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r85728:1ae65e532da8
Date: 2016-07-16 11:46 +0200
http://bitbucket.org/pypy/pypy/changeset/1ae65e532da8/

Log:	Windows translation fixes

diff --git a/rpython/translator/c/src/thread_gil.c b/rpython/translator/c/src/thread_gil.c
--- a/rpython/translator/c/src/thread_gil.c
+++ b/rpython/translator/c/src/thread_gil.c
@@ -157,7 +157,7 @@
                 break;
             }
             RPy_YieldProcessor();
-            asm volatile("":::"memory");   /* compiler memory barrier */
+            RPy_CompilerMemoryBarrier();
 
             if (!RPY_FASTGIL_LOCKED(rpy_fastgil)) {
                 old_fastgil = pypy_lock_test_and_set(&rpy_fastgil, 1);
diff --git a/rpython/translator/c/src/thread_nt.c b/rpython/translator/c/src/thread_nt.c
--- a/rpython/translator/c/src/thread_nt.c
+++ b/rpython/translator/c/src/thread_nt.c
@@ -258,8 +258,11 @@
 //#define pypy_lock_test_and_set(ptr, value)  see thread_nt.h
 #define atomic_increment(ptr)          InterlockedIncrement(ptr)
 #define atomic_decrement(ptr)          InterlockedDecrement(ptr)
-#ifndef YieldProcessor
-#  define YieldProcessor()             __asm { rep nop }
+#ifdef YieldProcessor
+#  define RPy_YieldProcessor()         YieldProcessor()
+#else
+#  define RPy_YieldProcessor()         __asm { rep nop }
 #endif
+#define RPy_CompilerMemoryBarrier()    _ReadWriteBarrier()
 
 #include "src/thread_gil.c"
diff --git a/rpython/translator/c/src/thread_pthread.c b/rpython/translator/c/src/thread_pthread.c
--- a/rpython/translator/c/src/thread_pthread.c
+++ b/rpython/translator/c/src/thread_pthread.c
@@ -554,6 +554,7 @@
 //#define pypy_lock_test_and_set(ptr, value)  see thread_pthread.h
 #define atomic_increment(ptr)          __sync_add_and_fetch(ptr, 1)
 #define atomic_decrement(ptr)          __sync_sub_and_fetch(ptr, 1)
+#define RPy_CompilerMemoryBarrier()    asm("":::"memory")
 #define HAVE_PTHREAD_ATFORK            1
 
 #include "src/asm.h"   /* for RPy_YieldProcessor() */


More information about the pypy-commit mailing list