Skip to content

coll/base: do not drop const qualifier #8207

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions ompi/datatype/ompi_datatype.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
* Copyright (c) 2010-2017 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2015-2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2015-2020 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
* $COPYRIGHT$
*
Expand Down Expand Up @@ -408,5 +408,15 @@ OMPI_DECLSPEC int ompi_datatype_pack_external_size( const char datarep[], int in
} \
}

#define OMPI_DATATYPE_RELEASE_NO_NULLIFY(ddt) \
{ \
if( !ompi_datatype_is_predefined((ddt)) ) { \
OPAL_OUTPUT_VERBOSE((0, 100, "Datatype %p [%s] refcount %d in file %s:%d\n", \
(void*)(ddt), (ddt)->name, (ddt)->super.super.obj_reference_count, \
__func__, __LINE__)); \
OBJ_RELEASE_NO_NULLIFY((ddt)); \
} \
}

END_C_DECLS
#endif /* OMPI_DATATYPE_H_HAS_BEEN_INCLUDED */
6 changes: 3 additions & 3 deletions ompi/mca/coll/base/coll_base_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2014-2019 Research Organization for Information Science
* Copyright (c) 2014-2020 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
Expand Down Expand Up @@ -220,15 +220,15 @@ static void release_vecs_callback(ompi_coll_base_nbc_request_t *request) {
if (NULL != request->data.vecs.stypes) {
for (int i=0; i<scount; i++) {
if (NULL != request->data.vecs.stypes[i]) {
OMPI_DATATYPE_RELEASE(request->data.vecs.stypes[i]);
OMPI_DATATYPE_RELEASE_NO_NULLIFY(request->data.vecs.stypes[i]);
}
}
request->data.vecs.stypes = NULL;
}
if (NULL != request->data.vecs.rtypes) {
for (int i=0; i<rcount; i++) {
if (NULL != request->data.vecs.rtypes[i]) {
OMPI_DATATYPE_RELEASE(request->data.vecs.rtypes[i]);
OMPI_DATATYPE_RELEASE_NO_NULLIFY(request->data.vecs.rtypes[i]);
}
}
request->data.vecs.rtypes = NULL;
Expand Down
6 changes: 3 additions & 3 deletions ompi/mca/coll/base/coll_base_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2014-2019 Research Organization for Information Science
* Copyright (c) 2014-2020 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
Expand Down Expand Up @@ -58,8 +58,8 @@ struct ompi_coll_base_nbc_request_t {
opal_object_t *objs[2];
} objs;
struct {
ompi_datatype_t **stypes;
ompi_datatype_t **rtypes;
ompi_datatype_t * const *stypes;
ompi_datatype_t * const *rtypes;
} vecs;
} data;
};
Expand Down
25 changes: 23 additions & 2 deletions opal/class/opal_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2007-2014 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2014-2020 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
Expand Down Expand Up @@ -345,6 +345,27 @@ static inline opal_object_t *opal_obj_new_debug(opal_class_t* type, const char*
} while (0)
#endif

#if OPAL_ENABLE_DEBUG
#define OBJ_RELEASE_NO_NULLIFY(object) \
do { \
assert(OPAL_OBJ_MAGIC_ID == ((opal_object_t *) (object))->obj_magic_id); \
assert(NULL != ((opal_object_t *) (object))->obj_class); \
if (0 == opal_obj_update((opal_object_t *) (object), -1)) { \
OBJ_SET_MAGIC_ID((object), 0); \
opal_obj_run_destructors((opal_object_t *) (object)); \
OBJ_REMEMBER_FILE_AND_LINENO( object, __FILE__, __LINE__ ); \
free((void *) object); \
} \
} while (0)
#else
#define OBJ_RELEASE_NO_NULLIFY(object) \
do { \
if (0 == opal_obj_update((opal_object_t *) (object), -1)) { \
opal_obj_run_destructors((opal_object_t *) (object)); \
free((void *) object); \
} \
} while (0)
#endif

/**
* Construct (initialize) objects that are not dynamically allocated.
Expand Down