summaryrefslogtreecommitdiff
path: root/libitm/libitm_i.h
diff options
context:
space:
mode:
authortorvald <torvald@138bc75d-0d04-0410-961f-82ee72b054a4>2015-11-09 17:30:24 +0000
committertorvald <torvald@138bc75d-0d04-0410-961f-82ee72b054a4>2015-11-09 17:30:24 +0000
commit9cdb2060ca3fede7731dd86350a9bc8afe707382 (patch)
tree58c417279b864efbb72173956d0999192f531ded /libitm/libitm_i.h
parenta875ad2ee008234406031af0b72316ae465be863 (diff)
downloadgcc-9cdb2060ca3fede7731dd86350a9bc8afe707382.tar.gz
Support sized delete.
This adds transactional clones of the sized version of operator delete. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@230036 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libitm/libitm_i.h')
-rw-r--r--libitm/libitm_i.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/libitm/libitm_i.h b/libitm/libitm_i.h
index 0eda01bacc5..bf8d4d1897e 100644
--- a/libitm/libitm_i.h
+++ b/libitm/libitm_i.h
@@ -97,11 +97,25 @@ enum gtm_restart_reason
namespace GTM HIDDEN {
+// A log of (de)allocation actions. We defer handling of some actions until
+// a commit of the outermost transaction. We also rely on potentially having
+// both an allocation and a deallocation for the same piece of memory in the
+// log; the order in which such entries are processed does not matter because
+// the actions are not in conflict (see below).
// This type is private to alloc.c, but needs to be defined so that
// the template used inside gtm_thread can instantiate.
struct gtm_alloc_action
{
- void (*free_fn)(void *);
+ // Iff free_fn_sz is nonzero, it must be used instead of free_fn.
+ union
+ {
+ void (*free_fn)(void *);
+ void (*free_fn_sz)(void *, size_t);
+ };
+ size_t sz;
+ // If true, this is an allocation; we discard the log entry on outermost
+ // commit, and deallocate on abort. If false, this is a deallocation and
+ // we deallocate on outermost commit and discard the log entry on abort.
bool allocated;
};
@@ -269,6 +283,7 @@ struct gtm_thread
void commit_allocations (bool, aa_tree<uintptr_t, gtm_alloc_action>*);
void record_allocation (void *, void (*)(void *));
void forget_allocation (void *, void (*)(void *));
+ void forget_allocation (void *, size_t, void (*)(void *, size_t));
void drop_references_allocations (const void *ptr)
{
this->alloc_actions.erase((uintptr_t) ptr);