Author: Armin Rigo <ar...@tunes.org>
Branch: stm
Changeset: r48695:e76f2b79fd27
Date: 2011-11-03 13:38 +0100
http://bitbucket.org/pypy/pypy/changeset/e76f2b79fd27/

Log:    Baaaaah. setjmp() cannot be called on a jmp_buf that belongs to a
        parent frame, because then longjmp()ing to it will not automatically
        recreate the subframe... Need to fix it by introducing macros
        instead of a function call.

diff --git a/pypy/translator/stm/src_stm/et.c b/pypy/translator/stm/src_stm/et.c
--- a/pypy/translator/stm/src_stm/et.c
+++ b/pypy/translator/stm/src_stm/et.c
@@ -862,19 +862,6 @@
   tx_abort(7);     /* manual abort */
 }
 
-void stm_transaction_boundary(jmp_buf* buf)
-{
-#ifdef RPY_STM_ASSERT
-  PYPY_DEBUG_START("stm-transaction-boundary");
-#endif
-  stm_commit_transaction();
-  setjmp(*buf);
-  stm_begin_transaction(buf);
-#ifdef RPY_STM_ASSERT
-  PYPY_DEBUG_STOP("stm-transaction-boundary");
-#endif
-}
-
 // XXX little-endian only!
 void stm_write_partial_word(int fieldsize, char *base, long offset,
                             unsigned long nval)
diff --git a/pypy/translator/stm/src_stm/et.h b/pypy/translator/stm/src_stm/et.h
--- a/pypy/translator/stm/src_stm/et.h
+++ b/pypy/translator/stm/src_stm/et.h
@@ -35,7 +35,6 @@
 void stm_try_inevitable_if(jmp_buf* buf  STM_CCHARP(why));
 void stm_begin_inevitable_transaction(void);
 void stm_abort_and_retry(void);
-void stm_transaction_boundary(jmp_buf* buf);
 void stm_descriptor_init_and_being_inevitable_transaction(void);
 void stm_commit_transaction_and_descriptor_done(void);
 
@@ -48,7 +47,11 @@
 #define STM_DECLARE_VARIABLE()          ; jmp_buf jmpbuf
 #define STM_MAKE_INEVITABLE()           stm_try_inevitable_if(&jmpbuf  \
                                                         STM_EXPLAIN("return"))
-#define STM_TRANSACTION_BOUNDARY()      stm_transaction_boundary(&jmpbuf)
+#define STM_TRANSACTION_BOUNDARY()      \
+       stm_commit_transaction();        \
+       setjmp(jmpbuf);                  \
+       stm_begin_transaction(&jmpbuf);
+
 
 // XXX little-endian only!
 #define STM_read_partial_word(T, base, offset)                          \
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to