Patchwork [trans-mem] issue with openmp

login
register
mail settings
Submitter Aldy Hernandez
Date July 6, 2010, 4:29 p.m.
Message ID <20100706162920.GA20816@redhat.com>
Download mbox | patch
Permalink /patch/58049/
State New
Headers show

Comments

Aldy Hernandez - July 6, 2010, 4:29 p.m.
> >>- libitm : I think it is useful to add _ITM_malloc, _ITM_free,
> >>_ITM_calloc into libitm.h and also to add ITM_REGPARM because I had
> >>problems when I wanted to use directly the library.

Patrick found a problem while calling the _ITM_malloc/etc functions
directly (instead of through the wrappers).  I've added prototypes for
them.

OK for branch?

Patrick, please verify that this fixes any problems on your end.

	* libitm.h (ITM_PURE): Define.
	Declare _ITM_malloc, _ITM_calloc, and _ITM_free.
Richard Henderson - July 6, 2010, 5:48 p.m.
On 07/06/2010 09:29 AM, Aldy Hernandez wrote:
> -__attribute__((transaction_pure))
> -extern void _ITM_dropReferences (void *, size_t) ITM_REGPARM;
> +extern void _ITM_dropReferences (void *, size_t) ITM_REGPARM ITM_PURE;
> +
> +__attribute__((__malloc__)) ITM_REGPARM ITM_PURE
> +extern void *_ITM_malloc (size_t);
> +__attribute__((__malloc__)) ITM_REGPARM ITM_PURE
> +extern void *_ITM_calloc (size_t, size_t);
> +extern  void _ITM_free (void *) ITM_REGPARM ITM_PURE;

I'm not sure that _ITM_malloc et al should include ITM_REGPARM.
Also, it's canonical to place these attributes before the ";",
not before the "extern".


r~

Patch

Index: libitm.h
===================================================================
--- libitm.h	(revision 161512)
+++ libitm.h	(working copy)
@@ -43,6 +43,7 @@  extern "C" {
 #endif
 
 #define ITM_NORETURN	__attribute__((noreturn))
+#define ITM_PURE __attribute__((transaction_pure))
 
 /* The following are externally visible definitions and functions, though
    only very few of these should be called by user code.  */
@@ -152,8 +153,13 @@  extern void _ITM_addUserUndoAction(_ITM_
 
 extern int _ITM_getThreadnum(void) ITM_REGPARM;
 
-__attribute__((transaction_pure))
-extern void _ITM_dropReferences (void *, size_t) ITM_REGPARM;
+extern void _ITM_dropReferences (void *, size_t) ITM_REGPARM ITM_PURE;
+
+__attribute__((__malloc__)) ITM_REGPARM ITM_PURE
+extern void *_ITM_malloc (size_t);
+__attribute__((__malloc__)) ITM_REGPARM ITM_PURE
+extern void *_ITM_calloc (size_t, size_t);
+extern  void _ITM_free (void *) ITM_REGPARM ITM_PURE;
 
 
 /* The following typedefs exist to make the macro expansions below work