Author: Armin Rigo <ar...@tunes.org> Branch: fast-gil Changeset: r72186:1c5642278f0f Date: 2014-06-24 12:13 +0200 http://bitbucket.org/pypy/pypy/changeset/1c5642278f0f/
Log: translation fixes diff --git a/rpython/rlib/rgil.py b/rpython/rlib/rgil.py --- a/rpython/rlib/rgil.py +++ b/rpython/rlib/rgil.py @@ -1,6 +1,7 @@ import py from rpython.conftest import cdir from rpython.translator.tool.cbuild import ExternalCompilationInfo +from rpython.rtyper.lltypesystem import lltype, llmemory, rffi # these functions manipulate directly the GIL, whose definition does not # escape the C code itself @@ -13,6 +14,8 @@ export_symbols = ['RPyGilYieldThread', 'RPyGilRelease', 'RPyGilAcquire', 'RPyFetchFastGil']) +llexternal = rffi.llexternal + gil_yield_thread = llexternal('RPyGilYieldThread', [], lltype.Void, _nowrapper=True, sandboxsafe=True, diff --git a/rpython/translator/c/src/thread.h b/rpython/translator/c/src/thread.h --- a/rpython/translator/c/src/thread.h +++ b/rpython/translator/c/src/thread.h @@ -28,13 +28,19 @@ void RPyGilYieldThread(void); void RPyGilAcquire(void); -extern Signed rpy_fastgil; +#ifdef PYPY_USE_ASMGCC +# define RPY_FASTGIL_LOCKED(x) (x == 1) +#else +# define RPY_FASTGIL_LOCKED(x) (x != 0) +#endif + +extern long rpy_fastgil; static inline void RPyGilRelease(void) { - assert(RPY_FASTGIL_HELD(rpy_fastgil)); + assert(RPY_FASTGIL_LOCKED(rpy_fastgil)); rpy_fastgil = 0; } -static inline Signed *RPyFetchFastGil(void) { +static inline long *RPyFetchFastGil(void) { return &rpy_fastgil; } 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 @@ -519,13 +519,7 @@ value of 'rpy_fastgil' to 1. */ -#ifdef PYPY_USE_ASMGCC -# define RPY_FASTGIL_LOCKED(x) (x == 1) -#else -# define RPY_FASTGIL_LOCKED(x) (x != 0) -#endif - -Signed rpy_fastgil = 1; +long rpy_fastgil = 1; static pthread_mutex_t mutex_gil_stealer; static pthread_mutex_t mutex_gil; static pthread_once_t mutex_gil_once = PTHREAD_ONCE_INIT; @@ -558,7 +552,7 @@ { /* Acquires the GIL. Note: this function saves and restores 'errno'. */ - Signed old_fastgil = __sync_lock_test_and_set(&rpy_fastgil, 1); + long old_fastgil = __sync_lock_test_and_set(&rpy_fastgil, 1); if (!RPY_FASTGIL_LOCKED(old_fastgil)) { /* The fastgil was not previously locked: success. @@ -606,7 +600,6 @@ if (!RPY_FASTGIL_LOCKED(old_fastgil)) /* yes, got a non-held value! Now we hold it. */ break; - } } /* Otherwise, loop back. */ } _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit