From ad5d5b95c8f71af8c40233e38222631609296bb4 Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Wed, 8 Nov 2006 05:08:11 +0000 Subject: [PATCH] Help the compiler to understand what we're doing here. It generate less memory accesses at least with gcc. This commit was SVN r12483. --- opal/class/opal_object.h | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/opal/class/opal_object.h b/opal/class/opal_object.h index a6cdab774d..ffbd1b4126 100644 --- a/opal/class/opal_object.h +++ b/opal/class/opal_object.h @@ -290,23 +290,25 @@ static inline opal_object_t *opal_obj_new_debug(opal_class_t* type, const char* * @param object Pointer to the object */ #if OMPI_ENABLE_DEBUG -#define OBJ_RELEASE(object) \ +#define OBJ_RELEASE(OBJECT) \ do { \ - assert(NULL != ((opal_object_t *) (object))->obj_class); \ - if (0 == opal_obj_update((opal_object_t *) (object), -1)) { \ - opal_obj_run_destructors((opal_object_t *) (object)); \ - OBJ_REMEMBER_FILE_AND_LINENO( object, __FILE__, __LINE__ ); \ - free(object); \ - object = NULL; \ + opal_object_t* _object = (opal_object_t*)(OBJECT); \ + assert(NULL != _object->obj_class); \ + if (0 == opal_obj_update(_object, -1)) { \ + opal_obj_run_destructors(_object); \ + OBJ_REMEMBER_FILE_AND_LINENO( _object, __FILE__, __LINE__ ); \ + free(_object); \ + (OBJECT) = NULL; \ } \ } while (0) #else -#define OBJ_RELEASE(object) \ +#define OBJ_RELEASE(OBJECT) \ do { \ - if (0 == opal_obj_update((opal_object_t *) (object), -1)) { \ - opal_obj_run_destructors((opal_object_t *) (object)); \ - free(object); \ - object = NULL; \ + opal_object_t* _object = (opal_object_t*)(OBJECT); \ + if (0 == opal_obj_update(_object, -1)) { \ + opal_obj_run_destructors(_object); \ + free(_object); \ + (OBJECT) = NULL; \ } \ } while (0) #endif