Author: Armin Rigo <ar...@tunes.org> Branch: reverse-debugger Changeset: r86985:a82acaa0d692 Date: 2016-09-10 19:03 +0200 http://bitbucket.org/pypy/pypy/changeset/a82acaa0d692/
Log: emit the byte "release gil" before actually releasing the GIL diff --git a/rpython/translator/revdb/gencsupp.py b/rpython/translator/revdb/gencsupp.py --- a/rpython/translator/revdb/gencsupp.py +++ b/rpython/translator/revdb/gencsupp.py @@ -92,10 +92,9 @@ # reading the 0xFD or 0xFE, we switch to a different thread if needed # (actually implemented with stacklets). if call_code == 'RPyGilAcquire();': - byte = '0xFD' + return 'RPY_REVDB_CALL_GIL_ACQUIRE();' else: - byte = '0xFE' - return 'RPY_REVDB_CALL_GIL(%s, %s);' % (call_code, byte) + return 'RPY_REVDB_CALL_GIL_RELEASE();' # tp = funcgen.lltypename(v_result) if tp == 'void @': diff --git a/rpython/translator/revdb/src-revdb/revdb.c b/rpython/translator/revdb/src-revdb/revdb.c --- a/rpython/translator/revdb/src-revdb/revdb.c +++ b/rpython/translator/revdb/src-revdb/revdb.c @@ -1730,10 +1730,10 @@ } RPY_EXTERN -void rpy_reverse_db_bad_acquire_gil(void) +void rpy_reverse_db_bad_acquire_gil(const char *name) { fprintf(stderr, "out of sync: unexpected byte in log " - " (at acquire_gil or release_gil)\n"); + " (at %s_gil)\n", name); exit(1); } diff --git a/rpython/translator/revdb/src-revdb/revdb_include.h b/rpython/translator/revdb/src-revdb/revdb_include.h --- a/rpython/translator/revdb/src-revdb/revdb_include.h +++ b/rpython/translator/revdb/src-revdb/revdb_include.h @@ -151,23 +151,32 @@ rpy_reverse_db_invoke_callback(_re); \ } -#define RPY_REVDB_CALL_GIL(call_code, byte) \ +#define RPY_REVDB_CALL_GIL_ACQUIRE() \ if (!RPY_RDB_REPLAY) { \ - call_code \ + RPyGilAcquire(); \ _RPY_REVDB_LOCK(); \ - _RPY_REVDB_EMIT_RECORD_L(unsigned char _e, byte) \ + _RPY_REVDB_EMIT_RECORD_L(unsigned char _e, 0xFD) \ _RPY_REVDB_UNLOCK(); \ } \ else { \ unsigned char _re; \ _RPY_REVDB_EMIT_REPLAY(unsigned char _e, _re) \ - if (_re != byte) \ - rpy_reverse_db_bad_acquire_gil(); \ + if (_re != 0xFD) \ + rpy_reverse_db_bad_acquire_gil("acquire"); \ } -#define RPY_REVDB_CALL_GILCTRL(call_code) \ +#define RPY_REVDB_CALL_GIL_RELEASE() \ if (!RPY_RDB_REPLAY) { \ - call_code \ + _RPY_REVDB_LOCK(); \ + _RPY_REVDB_EMIT_RECORD_L(unsigned char _e, 0xFE) \ + _RPY_REVDB_UNLOCK(); \ + RPyGilRelease(); \ + } \ + else { \ + unsigned char _re; \ + _RPY_REVDB_EMIT_REPLAY(unsigned char _e, _re) \ + if (_re != 0xFE) \ + rpy_reverse_db_bad_acquire_gil("release"); \ } #define RPY_REVDB_CALLBACKLOC(locnum) \ @@ -284,7 +293,7 @@ RPY_EXTERN void rpy_reverse_db_invoke_callback(unsigned char); RPY_EXTERN void rpy_reverse_db_callback_loc(int); RPY_EXTERN void rpy_reverse_db_lock_acquire(bool_t lock_contention); -RPY_EXTERN void rpy_reverse_db_bad_acquire_gil(void); +RPY_EXTERN void rpy_reverse_db_bad_acquire_gil(const char *name); RPY_EXTERN void rpy_reverse_db_set_thread_breakpoint(int64_t tnum); RPY_EXTERN double rpy_reverse_db_strtod(RPyString *s); RPY_EXTERN RPyString *rpy_reverse_db_dtoa(double d); _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit