public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Torvald Riegel <triegel@redhat.com>
To: Richard Henderson <rth@redhat.com>, Aldy Hernandez <aldyh@redhat.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [trans-mem] Beginning of refactoring
Date: Wed, 03 Aug 2011 10:50:00 -0000	[thread overview]
Message-ID: <1312368617.3533.221.camel@triegel.csb> (raw)
In-Reply-To: <4E31C065.1010907@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 101 bytes --]

This small patch fixes the rollback of the transaction ID as well as
queries for it.

OK for branch?

[-- Attachment #2: patch1 --]
[-- Type: text/plain, Size: 1473 bytes --]

commit bd83b4594c1f6eee09e0fa7b369557f986291f9b
Author: Torvald Riegel <triegel@redhat.com>
Date:   Fri Jul 29 15:19:04 2011 +0200

    Fix rollback and queries of transaction ID.
    
    	* beginend.cc (GTM::gtm_transaction::rollback): Roll back tx id as well.
    	* query.cc (_ITM_getTransactionId): There is no active transaction if
    	the current nesting level is zero.

diff --git a/libitm/beginend.cc b/libitm/beginend.cc
index 9f84404..d336d60 100644
--- a/libitm/beginend.cc
+++ b/libitm/beginend.cc
@@ -298,6 +298,7 @@ GTM::gtm_transaction::rollback (gtm_transaction_cp *cp)
       if (parent_txns.size() > 0)
         {
           jb = parent_txns[0].jb;
+          id = parent_txns[0].id;
           prop = parent_txns[0].prop;
         }
       // Reset the transaction. Do not reset this->state, which is handled by
diff --git a/libitm/query.cc b/libitm/query.cc
index 4905fc6..9a95211 100644
--- a/libitm/query.cc
+++ b/libitm/query.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2008, 2009, 2011 Free Software Foundation, Inc.
    Contributed by Richard Henderson <rth@redhat.com>.
 
    This file is part of the GNU Transactional Memory Library (libitm).
@@ -59,7 +59,7 @@ _ITM_transactionId_t ITM_REGPARM
 _ITM_getTransactionId (void)
 {
   struct gtm_transaction *tx = gtm_tx();
-  return tx ? tx->id : _ITM_noTransactionId;
+  return (tx && (tx->nesting > 0)) ? tx->id : _ITM_noTransactionId;
 }
 
 

  reply	other threads:[~2011-08-03 10:50 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-25 22:45 Torvald Riegel
2011-06-29 21:22 ` Torvald Riegel
2011-06-29 21:50   ` Richard Henderson
2011-06-29 23:18 ` Richard Henderson
2011-06-30 12:19   ` Torvald Riegel
2011-06-30 15:03     ` Richard Henderson
2011-06-30 17:02       ` Torvald Riegel
2011-07-01 20:23 ` Torvald Riegel
2011-07-01 20:32   ` Richard Henderson
2011-07-09 15:35 ` Torvald Riegel
2011-07-18 23:38   ` Torvald Riegel
2011-07-18 23:44     ` Torvald Riegel
2011-07-27 10:57       ` Torvald Riegel
2011-07-28 17:13         ` Richard Henderson
2011-07-28 16:52       ` Richard Henderson
2011-07-28 19:42         ` Torvald Riegel
2011-07-28 20:26           ` Richard Henderson
2011-08-03 10:50             ` Torvald Riegel [this message]
2011-08-03 15:47               ` Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1312368617.3533.221.camel@triegel.csb \
    --to=triegel@redhat.com \
    --cc=aldyh@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).