diff options
author | Torvald Riegel <triegel@redhat.com> | 2015-11-09 17:30:24 +0000 |
---|---|---|
committer | Torvald Riegel <torvald@gcc.gnu.org> | 2015-11-09 17:30:24 +0000 |
commit | c518678b144f79a55ef4d3b80d3b80c289c24122 (patch) | |
tree | 58c417279b864efbb72173956d0999192f531ded /libitm/alloc_cpp.cc | |
parent | d1f0d3769edfb2217f19f0937f30423e6298f744 (diff) | |
download | gcc-c518678b144f79a55ef4d3b80d3b80c289c24122.zip gcc-c518678b144f79a55ef4d3b80d3b80c289c24122.tar.gz gcc-c518678b144f79a55ef4d3b80d3b80c289c24122.tar.bz2 |
Support sized delete.
This adds transactional clones of the sized version of operator delete.
From-SVN: r230036
Diffstat (limited to 'libitm/alloc_cpp.cc')
-rw-r--r-- | libitm/alloc_cpp.cc | 57 |
1 files changed, 44 insertions, 13 deletions
diff --git a/libitm/alloc_cpp.cc b/libitm/alloc_cpp.cc index 8514618..13185a7 100644 --- a/libitm/alloc_cpp.cc +++ b/libitm/alloc_cpp.cc @@ -35,41 +35,50 @@ using namespace GTM; #define _ZnwX S(_Znw,MANGLE_SIZE_T) #define _ZnaX S(_Zna,MANGLE_SIZE_T) +#define _ZdlPvX S(_ZdlPv,MANGLE_SIZE_T) #define _ZnwXRKSt9nothrow_t S(S(_Znw,MANGLE_SIZE_T),RKSt9nothrow_t) #define _ZnaXRKSt9nothrow_t S(S(_Zna,MANGLE_SIZE_T),RKSt9nothrow_t) +#define _ZdlPvXRKSt9nothrow_t S(S(_ZdlPv,MANGLE_SIZE_T),RKSt9nothrow_t) #define _ZGTtnwX S(_ZGTtnw,MANGLE_SIZE_T) #define _ZGTtnaX S(_ZGTtna,MANGLE_SIZE_T) +#define _ZGTtdlPvX S(_ZGTtdlPv,MANGLE_SIZE_T) #define _ZGTtnwXRKSt9nothrow_t S(S(_ZGTtnw,MANGLE_SIZE_T),RKSt9nothrow_t) #define _ZGTtnaXRKSt9nothrow_t S(S(_ZGTtna,MANGLE_SIZE_T),RKSt9nothrow_t) +#define _ZGTtdlPvXRKSt9nothrow_t S(S(_ZGTtdlPv,MANGLE_SIZE_T),RKSt9nothrow_t) /* Everything from libstdc++ is weak, to avoid requiring that library to be linked into plain C applications using libitm.so. */ extern "C" { -extern void *_ZnwX (size_t) __attribute__((weak)); -extern void _ZdlPv (void *) __attribute__((weak)); -extern void *_ZnaX (size_t) __attribute__((weak)); -extern void _ZdaPv (void *) __attribute__((weak)); +extern void *_ZnwX (size_t) __attribute__((weak)); +extern void _ZdlPv (void *) __attribute__((weak)); +extern void _ZdlPvX (void *, size_t) __attribute__((weak)); +extern void *_ZnaX (size_t) __attribute__((weak)); +extern void _ZdaPv (void *) __attribute__((weak)); typedef const struct nothrow_t { } *c_nothrow_p; extern void *_ZnwXRKSt9nothrow_t (size_t, c_nothrow_p) __attribute__((weak)); extern void _ZdlPvRKSt9nothrow_t (void *, c_nothrow_p) __attribute__((weak)); +extern void _ZdlPvXRKSt9nothrow_t +(void *, size_t, c_nothrow_p) __attribute__((weak)); extern void *_ZnaXRKSt9nothrow_t (size_t, c_nothrow_p) __attribute__((weak)); extern void _ZdaPvRKSt9nothrow_t (void *, c_nothrow_p) __attribute__((weak)); #if !defined (HAVE_ELF_STYLE_WEAKREF) -void *_ZnwX (size_t) { return NULL; } -void _ZdlPv (void *) { return; } -void *_ZnaX (size_t) { return NULL; } -void _ZdaPv (void *) { return; } - -void *_ZnwXRKSt9nothrow_t (size_t, c_nothrow_p) { return NULL; } -void _ZdlPvRKSt9nothrow_t (void *, c_nothrow_p) { return; } -void *_ZnaXRKSt9nothrow_t (size_t, c_nothrow_p) { return NULL; } -void _ZdaPvRKSt9nothrow_t (void *, c_nothrow_p) { return; } +void *_ZnwX (size_t) { return NULL; } +void _ZdlPv (void *) { return; } +void _ZdlPvX (void *, size_t) { return; } +void *_ZnaX (size_t) { return NULL; } +void _ZdaPv (void *) { return; } + +void *_ZnwXRKSt9nothrow_t (size_t, c_nothrow_p) { return NULL; } +void _ZdlPvRKSt9nothrow_t (void *, c_nothrow_p) { return; } +void _ZdlPvXRKSt9nothrow_t (void *, size_t, c_nothrow_p) { return; } +void *_ZnaXRKSt9nothrow_t (size_t, c_nothrow_p) { return NULL; } +void _ZdaPvRKSt9nothrow_t (void *, c_nothrow_p) { return; } #endif /* HAVE_ELF_STYLE_WEAKREF */ /* Wrap the delete nothrow symbols for usage with a single argument. @@ -89,6 +98,12 @@ del_opvnt (void *ptr) _ZdaPvRKSt9nothrow_t (ptr, NULL); } +static void +delsz_opnt (void *ptr, size_t sz) +{ + _ZdlPvXRKSt9nothrow_t (ptr, sz, NULL); +} + /* Wrap: operator new (std::size_t sz) */ void * _ZGTtnwX (size_t sz) @@ -161,4 +176,20 @@ _ZGTtdaPvRKSt9nothrow_t (void *ptr, c_nothrow_p nt UNUSED) gtm_thr()->forget_allocation (ptr, del_opvnt); } +/* Wrap: operator delete(void* ptr, std::size_t sz) */ +void +_ZGTtdlPvX (void *ptr, size_t sz) +{ + if (ptr) + gtm_thr()->forget_allocation (ptr, sz, _ZdlPvX); +} + +/* Wrap: operator delete (void *ptr, std::size_t sz, const std::nothrow_t&) */ +void +_ZGTtdlPvXRKSt9nothrow_t (void *ptr, size_t sz, c_nothrow_p nt UNUSED) +{ + if (ptr) + gtm_thr()->forget_allocation (ptr, sz, delsz_opnt); +} + } // extern "C" |