@@ -123,14 +123,12 @@ void do_write (T *ptr, T val, gtm_dispatch::lock_type lock)
#define ITM_READ(T, LOCK) \
_ITM_TYPE_##T ITM_REGPARM _ITM_##LOCK##T (const _ITM_TYPE_##T *ptr) \
{ \
- gtm_stack_marker marker; \
return do_read (ptr, gtm_dispatch::LOCK); \
}
#define ITM_WRITE(T, LOCK) \
void ITM_REGPARM _ITM_##LOCK##T (_ITM_TYPE_##T *ptr, _ITM_TYPE_##T val) \
{ \
- gtm_stack_marker marker; \
do_write (ptr, val, gtm_dispatch::LOCK); \
}
@@ -161,8 +161,6 @@ _ITM_rollbackTransaction (void)
assert ((tx->prop & pr_hasNoAbort) == 0);
assert ((tx->state & gtm_transaction::STATE_ABORTING) == 0);
- gtm_stack_marker marker;
-
tx->rollback ();
tx->state |= gtm_transaction::STATE_ABORTING;
}
@@ -179,8 +177,6 @@ _ITM_abortTransaction (_ITM_abortReason reason)
if (tx->state & gtm_transaction::STATE_IRREVOCABLE)
abort ();
- gtm_stack_marker marker;
-
tx->rollback ();
gtm_disp()->fini ();
@@ -254,8 +250,6 @@ void ITM_REGPARM
_ITM_commitTransaction(void)
{
gtm_transaction *tx = gtm_tx();
- gtm_stack_marker marker;
-
if (!tx->trycommit_and_finalize ())
tx->restart (RESTART_VALIDATE_COMMIT);
}
@@ -264,8 +258,6 @@ void ITM_REGPARM
_ITM_commitTransactionEH(void *exc_ptr)
{
gtm_transaction *tx = gtm_tx();
- gtm_stack_marker marker;
-
if (!tx->trycommit_and_finalize ())
{
tx->eh_in_flight = exc_ptr;
@@ -92,7 +92,6 @@ _ITM_getTMCloneOrIrrevocable (void *ptr)
if (ret)
return ret;
- gtm_stack_marker marker;
gtm_tx()->serialirr_mode ();
return ptr;
@@ -28,7 +28,7 @@ typedef struct gtm_jmpbuf
{
unsigned long pc;
unsigned long s[7];
- unsigned long cfa;
+ void *cfa;
unsigned long f[8];
} gtm_jmpbuf;
@@ -33,7 +33,7 @@ namespace GTM HIDDEN {
gtm_cacheline_mask __attribute__((noinline))
gtm_mask_stack(gtm_cacheline *line, gtm_cacheline_mask mask)
{
- void *top = gtm_stack_top();
+ void *top = gtm_tx()->jb.cfa;
void *bot = __builtin_dwarf_cfa();
// We must have come through an entry point that set TOP.
@@ -40,10 +40,6 @@ struct gtm_thread
// if the target provides some efficient mechanism for storing this.
gtm_dispatch *disp;
#endif
-#ifndef HAVE_ARCH_GTM_THREAD_STACK_TOP
- // The top of stack on entry to the STM library.
- void *stack_top;
-#endif
// The maximum number of free gtm_transaction structs to be kept.
// This number must be greater than 1 in order for transaction abort
@@ -89,17 +85,6 @@ static inline gtm_dispatch * gtm_disp() { return gtm_thr()->disp; }
static inline void set_gtm_disp(gtm_dispatch *x) { gtm_thr()->disp = x; }
#endif
-#ifndef HAVE_ARCH_GTM_THREAD_STACK_TOP
-static inline void *gtm_stack_top() { return gtm_thr()->stack_top; }
-static inline void set_gtm_stack_top(void *t) { gtm_thr()->stack_top = t; }
-#endif
-
-struct gtm_stack_marker
-{
- gtm_stack_marker(void *t = __builtin_dwarf_cfa()) { set_gtm_stack_top (t); }
- ~gtm_stack_marker() { set_gtm_stack_top (0); }
-};
-
} // namespace GTM
#endif // LIBITM_TLS_H
@@ -28,7 +28,7 @@ namespace GTM HIDDEN {
/* ??? This doesn't work for Win64. */
typedef struct gtm_jmpbuf
{
- unsigned long cfa;
+ void *cfa;
unsigned long rip;
unsigned long rbx;
unsigned long rbp;
@@ -40,7 +40,7 @@ typedef struct gtm_jmpbuf
#else
typedef struct gtm_jmpbuf
{
- unsigned long cfa;
+ void *cfa;
unsigned long ebx;
unsigned long esi;
unsigned long edi;
@@ -302,13 +302,11 @@ do_memmove (uintptr_t idst, uintptr_t isrc, size_t size,
#define ITM_MEM_DEF(NAME, READ, WRITE) \
void ITM_REGPARM _ITM_memcpy##NAME(void *dst, const void *src, size_t size) \
{ \
- gtm_stack_marker marker; \
do_memcpy ((uintptr_t)dst, (uintptr_t)src, size, \
gtm_dispatch::WRITE, gtm_dispatch::READ); \
} \
void ITM_REGPARM _ITM_memmove##NAME(void *dst, const void *src, size_t size) \
{ \
- gtm_stack_marker marker; \
do_memmove ((uintptr_t)dst, (uintptr_t)src, size, \
gtm_dispatch::WRITE, gtm_dispatch::READ); \
}
@@ -70,7 +70,6 @@ do_memset(uintptr_t idst, int c, size_t size, gtm_dispatch::lock_type W)
#define ITM_MEM_DEF(WRITE) \
void ITM_REGPARM _ITM_memset##WRITE(void *dst, int c, size_t size) \
{ \
- gtm_stack_marker marker; \
do_memset ((uintptr_t)dst, c, size, gtm_dispatch::WRITE); \
}
@@ -117,7 +117,6 @@ GTM::gtm_transaction::serialirr_mode ()
void ITM_REGPARM
_ITM_changeTransactionMode (_ITM_transactionState state)
{
- gtm_stack_marker marker;
assert (state == modeSerialIrrevocable);
gtm_tx()->serialirr_mode ();
}
I over-thought the patch I posted last week. The portion of the run-time stack that needs to be protected from update is not as dynamic as it seems from that patch. The begin/commit pair *must* be at the same stack level; something that is enforced by the compiler in the way it generates the calls. Any rollbacks that need protecting will be at a lower or equal stack level and will be immediately followed by a longjmp back to the begin stack level, so again we can use the original begin stack level as our cutoff point. This partially reverts the commit from the 16th. We no longer record the incomming stack level at each entry point, but instead use the value that was recorded during the setjmp. r~ * barrier.tpl, beginend.cc, clone.cc, tls.h, memcpy.cc, memset.cc, method-serial.cc: Revert the 2010-06-16 change. * config/x86/target.h (struct gtm_jmpbuf): Change CFA type to void*. * config/alpha/target.h: Likewise. * config/generic/tls.cc (gtm_mask_stack): Use it.