Skip to content

Commit 67421c5

Browse files
authored
Merge pull request #8207 from ggouaillardet/topic/retain_datatypes_w
coll/base: do not drop const qualifier
2 parents f9ef4b4 + c49e5e5 commit 67421c5

File tree

4 files changed

+41
-10
lines changed

4 files changed

+41
-10
lines changed

ompi/datatype/ompi_datatype.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
* Copyright (c) 2010-2017 Cisco Systems, Inc. All rights reserved
88
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
99
* reserved.
10-
* Copyright (c) 2015-2018 Research Organization for Information Science
11-
* and Technology (RIST). All rights reserved.
10+
* Copyright (c) 2015-2020 Research Organization for Information Science
11+
* and Technology (RIST). All rights reserved.
1212
* Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
1313
* $COPYRIGHT$
1414
*
@@ -408,5 +408,15 @@ OMPI_DECLSPEC int ompi_datatype_pack_external_size( const char datarep[], int in
408408
} \
409409
}
410410

411+
#define OMPI_DATATYPE_RELEASE_NO_NULLIFY(ddt) \
412+
{ \
413+
if( !ompi_datatype_is_predefined((ddt)) ) { \
414+
OPAL_OUTPUT_VERBOSE((0, 100, "Datatype %p [%s] refcount %d in file %s:%d\n", \
415+
(void*)(ddt), (ddt)->name, (ddt)->super.super.obj_reference_count, \
416+
__func__, __LINE__)); \
417+
OBJ_RELEASE_NO_NULLIFY((ddt)); \
418+
} \
419+
}
420+
411421
END_C_DECLS
412422
#endif /* OMPI_DATATYPE_H_HAS_BEEN_INCLUDED */

ompi/mca/coll/base/coll_base_util.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* University of Stuttgart. All rights reserved.
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
12-
* Copyright (c) 2014-2019 Research Organization for Information Science
12+
* Copyright (c) 2014-2020 Research Organization for Information Science
1313
* and Technology (RIST). All rights reserved.
1414
* $COPYRIGHT$
1515
*
@@ -220,15 +220,15 @@ static void release_vecs_callback(ompi_coll_base_nbc_request_t *request) {
220220
if (NULL != request->data.vecs.stypes) {
221221
for (int i=0; i<scount; i++) {
222222
if (NULL != request->data.vecs.stypes[i]) {
223-
OMPI_DATATYPE_RELEASE(request->data.vecs.stypes[i]);
223+
OMPI_DATATYPE_RELEASE_NO_NULLIFY(request->data.vecs.stypes[i]);
224224
}
225225
}
226226
request->data.vecs.stypes = NULL;
227227
}
228228
if (NULL != request->data.vecs.rtypes) {
229229
for (int i=0; i<rcount; i++) {
230230
if (NULL != request->data.vecs.rtypes[i]) {
231-
OMPI_DATATYPE_RELEASE(request->data.vecs.rtypes[i]);
231+
OMPI_DATATYPE_RELEASE_NO_NULLIFY(request->data.vecs.rtypes[i]);
232232
}
233233
}
234234
request->data.vecs.rtypes = NULL;

ompi/mca/coll/base/coll_base_util.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* University of Stuttgart. All rights reserved.
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
12-
* Copyright (c) 2014-2019 Research Organization for Information Science
12+
* Copyright (c) 2014-2020 Research Organization for Information Science
1313
* and Technology (RIST). All rights reserved.
1414
* $COPYRIGHT$
1515
*
@@ -58,8 +58,8 @@ struct ompi_coll_base_nbc_request_t {
5858
opal_object_t *objs[2];
5959
} objs;
6060
struct {
61-
ompi_datatype_t **stypes;
62-
ompi_datatype_t **rtypes;
61+
ompi_datatype_t * const *stypes;
62+
ompi_datatype_t * const *rtypes;
6363
} vecs;
6464
} data;
6565
};

opal/class/opal_object.h

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
* Copyright (c) 2004-2005 The Regents of the University of California.
1212
* All rights reserved.
1313
* Copyright (c) 2007-2014 Cisco Systems, Inc. All rights reserved.
14-
* Copyright (c) 2014 Research Organization for Information Science
15-
* and Technology (RIST). All rights reserved.
14+
* Copyright (c) 2014-2020 Research Organization for Information Science
15+
* and Technology (RIST). All rights reserved.
1616
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
1717
* reserved.
1818
* $COPYRIGHT$
@@ -345,6 +345,27 @@ static inline opal_object_t *opal_obj_new_debug(opal_class_t* type, const char*
345345
} while (0)
346346
#endif
347347

348+
#if OPAL_ENABLE_DEBUG
349+
#define OBJ_RELEASE_NO_NULLIFY(object) \
350+
do { \
351+
assert(OPAL_OBJ_MAGIC_ID == ((opal_object_t *) (object))->obj_magic_id); \
352+
assert(NULL != ((opal_object_t *) (object))->obj_class); \
353+
if (0 == opal_obj_update((opal_object_t *) (object), -1)) { \
354+
OBJ_SET_MAGIC_ID((object), 0); \
355+
opal_obj_run_destructors((opal_object_t *) (object)); \
356+
OBJ_REMEMBER_FILE_AND_LINENO( object, __FILE__, __LINE__ ); \
357+
free((void *) object); \
358+
} \
359+
} while (0)
360+
#else
361+
#define OBJ_RELEASE_NO_NULLIFY(object) \
362+
do { \
363+
if (0 == opal_obj_update((opal_object_t *) (object), -1)) { \
364+
opal_obj_run_destructors((opal_object_t *) (object)); \
365+
free((void *) object); \
366+
} \
367+
} while (0)
368+
#endif
348369

349370
/**
350371
* Construct (initialize) objects that are not dynamically allocated.

0 commit comments

Comments
 (0)