Author: Remi Meier <remi.me...@gmail.com> Branch: stmgc-c8 Changeset: r83563:be250c24a526 Date: 2016-04-07 13:43 +0300 http://bitbucket.org/pypy/pypy/changeset/be250c24a526/
Log: import stmgc diff --git a/rpython/translator/stm/src_stm/revision b/rpython/translator/stm/src_stm/revision --- a/rpython/translator/stm/src_stm/revision +++ b/rpython/translator/stm/src_stm/revision @@ -1,1 +1,1 @@ -ff3079618aaf +5e3551b4e599 diff --git a/rpython/translator/stm/src_stm/stm/core.c b/rpython/translator/stm/src_stm/stm/core.c --- a/rpython/translator/stm/src_stm/stm/core.c +++ b/rpython/translator/stm/src_stm/stm/core.c @@ -1063,7 +1063,7 @@ } #ifdef STM_NO_AUTOMATIC_SETJMP -static int did_abort = 0; +int did_abort = 0; #endif long _stm_start_transaction(stm_thread_local_t *tl) @@ -1075,6 +1075,12 @@ #else long repeat_count = stm_rewind_jmp_setjmp(tl); #endif + if (repeat_count) { + /* only if there was an abort, we need to reset the memory: */ + if (tl->mem_reset_on_abort) + memcpy(tl->mem_reset_on_abort, tl->mem_stored_for_reset_on_abort, + tl->mem_bytes_to_reset_on_abort); + } _do_start_transaction(tl); if (repeat_count == 0) { /* else, 'nursery_mark' was already set @@ -1439,9 +1445,13 @@ if (tl->mem_clear_on_abort) memset(tl->mem_clear_on_abort, 0, tl->mem_bytes_to_clear_on_abort); - if (tl->mem_reset_on_abort) - memcpy(tl->mem_reset_on_abort, tl->mem_stored_for_reset_on_abort, - tl->mem_bytes_to_reset_on_abort); + if (tl->mem_reset_on_abort) { + /* temporarily set the memory of mem_reset_on_abort to zeros since in the + case of vmprof, the old value is really wrong if we didn't do the longjmp + back yet (that restores the C stack). We restore the memory in + _stm_start_transaction() */ + memset(tl->mem_reset_on_abort, 0, tl->mem_bytes_to_reset_on_abort); + } invoke_and_clear_user_callbacks(1); /* for abort */ diff --git a/rpython/translator/stm/src_stm/stm/setup.c b/rpython/translator/stm/src_stm/stm/setup.c --- a/rpython/translator/stm/src_stm/stm/setup.c +++ b/rpython/translator/stm/src_stm/stm/setup.c @@ -69,6 +69,10 @@ commit_log_root.rev_num = 0; commit_log_root.written_count = 0; +#ifdef STM_NO_AUTOMATIC_SETJMP + did_abort = 0; +#endif + long i; /* including seg0 */ for (i = 0; i < NB_SEGMENTS; i++) { diff --git a/rpython/translator/stm/src_stm/stmgc.h b/rpython/translator/stm/src_stm/stmgc.h --- a/rpython/translator/stm/src_stm/stmgc.h +++ b/rpython/translator/stm/src_stm/stmgc.h @@ -117,6 +117,11 @@ object_t *_stm_allocate_old(ssize_t size_rounded_up); char *_stm_real_address(object_t *o); #ifdef STM_TESTS + +#ifdef STM_NO_AUTOMATIC_SETJMP +extern int did_abort; +#endif + #include <stdbool.h> uint8_t _stm_get_transaction_read_version(void); uint8_t _stm_get_card_value(object_t *obj, long idx); _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit