Commit 05cb62bd authored by Wesley Bland's avatar Wesley Bland Committed by Junchao Zhang
Browse files

Change MPID_Comm_valid_ptr to optionally ignore revoke



Adds a parameter to MPID_Comm_valid_ptr to take a second parameter that will
either cause the macro to ignore the revoke flag or not.
Signed-off-by: default avatarJunchao Zhang <jczhang@mcs.anl.gov>
parent 1f0ee136
......@@ -494,14 +494,13 @@ int MPIU_Handle_free( void *((*)[]), int );
for now */
/* ticket #1441: check (refcount<=0) to cover the case of 0, an "over-free" of
* -1 or similar, and the 0xecec... case when --enable-g=mem is used */
#define MPID_Comm_valid_ptr(ptr,err) { \
#define MPID_Comm_valid_ptr(ptr,err,ignore_rev) { \
MPID_Valid_ptr_class(Comm,ptr,MPI_ERR_COMM,err); \
if ((ptr) && MPIU_Object_get_ref(ptr) <= 0) { \
MPIU_ERR_SET(err,MPI_ERR_COMM,"**comm"); \
ptr = 0; \
} else if (ptr->revoked) { \
} else if (ptr->revoked && !ignore_rev) { \
MPIU_ERR_SET(err,MPIX_ERR_REVOKED,"**comm"); \
ptr = 0; \
} \
}
#define MPID_Group_valid_ptr(ptr,err) MPID_Valid_ptr_class(Group,ptr,MPI_ERR_GROUP,err)
......
......@@ -86,7 +86,7 @@ int MPI_Attr_delete(MPI_Comm comm, int keyval)
MPID_BEGIN_ERROR_CHECKS;
{
/* Validate comm_ptr */
MPID_Comm_valid_ptr( comm_ptr, mpi_errno );
MPID_Comm_valid_ptr( comm_ptr, mpi_errno, TRUE );
/* If comm_ptr is not valid, it will be reset to null */
/* Validate keyval_ptr */
MPID_Keyval_valid_ptr( keyval_ptr, mpi_errno );
......
......@@ -112,7 +112,7 @@ int MPI_Attr_get(MPI_Comm comm, int keyval, void *attribute_val, int *flag)
MPID_BEGIN_ERROR_CHECKS;
{
/* Validate comm_ptr */
MPID_Comm_valid_ptr( comm_ptr, mpi_errno );
MPID_Comm_valid_ptr( comm_ptr, mpi_errno, TRUE );
/* If comm_ptr is not valid, it will be reset to null */
MPIR_ERRTEST_ARGNULL(attribute_val, "attribute_val", mpi_errno);
MPIR_ERRTEST_ARGNULL(flag, "flag", mpi_errno);
......
......@@ -104,7 +104,7 @@ int MPI_Attr_put(MPI_Comm comm, int keyval, void *attribute_val)
MPID_BEGIN_ERROR_CHECKS;
{
/* Validate comm_ptr */
MPID_Comm_valid_ptr( comm_ptr, mpi_errno );
MPID_Comm_valid_ptr( comm_ptr, mpi_errno, TRUE );
/* If comm_ptr is not valid, it will be reset to null */
if (mpi_errno) goto fn_fail;
}
......
......@@ -140,7 +140,7 @@ int MPI_Comm_delete_attr(MPI_Comm comm, int comm_keyval)
MPID_BEGIN_ERROR_CHECKS;
{
/* Validate comm_ptr */
MPID_Comm_valid_ptr( comm_ptr, mpi_errno );
MPID_Comm_valid_ptr( comm_ptr, mpi_errno, TRUE );
/* If comm_ptr is not valid, it will be reset to null */
/* Validate keyval_ptr */
MPID_Keyval_valid_ptr( keyval_ptr, mpi_errno );
......
......@@ -81,7 +81,7 @@ int MPIR_CommGetAttr( MPI_Comm comm, int comm_keyval, void *attribute_val,
MPID_BEGIN_ERROR_CHECKS;
{
/* Validate comm_ptr */
MPID_Comm_valid_ptr( comm_ptr, mpi_errno );
MPID_Comm_valid_ptr( comm_ptr, mpi_errno, TRUE );
/* If comm_ptr is not valid, it will be reset to null */
MPIR_ERRTEST_ARGNULL(attribute_val, "attr_val", mpi_errno);
MPIR_ERRTEST_ARGNULL(flag, "flag", mpi_errno);
......
......@@ -142,7 +142,7 @@ int MPIR_CommSetAttr( MPI_Comm comm, int comm_keyval, void *attribute_val,
MPID_Keyval *keyval_ptr = NULL;
/* Validate comm_ptr */
MPID_Comm_valid_ptr( comm_ptr, mpi_errno );
MPID_Comm_valid_ptr( comm_ptr, mpi_errno, TRUE );
/* If comm_ptr is not valid, it will be reset to null */
/* Validate keyval_ptr */
MPID_Keyval_get_ptr( comm_keyval, keyval_ptr );
......@@ -249,7 +249,7 @@ int MPI_Comm_set_attr(MPI_Comm comm, int comm_keyval, void *attribute_val)
MPID_Keyval *keyval_ptr = NULL;
/* Validate comm_ptr */
MPID_Comm_valid_ptr( comm_ptr, mpi_errno );
MPID_Comm_valid_ptr( comm_ptr, mpi_errno, TRUE );
/* If comm_ptr is not valid, it will be reset to null */
/* Validate keyval_ptr */
MPID_Keyval_get_ptr( comm_keyval, keyval_ptr );
......
......@@ -933,7 +933,7 @@ int MPI_Allgather(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
{
MPID_Datatype *recvtype_ptr=NULL, *sendtype_ptr=NULL;
MPID_Comm_valid_ptr( comm_ptr, mpi_errno );
MPID_Comm_valid_ptr( comm_ptr, mpi_errno, FALSE );
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
if (comm_ptr->comm_kind == MPID_INTERCOMM) {
......
......@@ -1045,7 +1045,7 @@ int MPI_Allgatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
MPID_Datatype *recvtype_ptr=NULL, *sendtype_ptr=NULL;
int i, comm_size;
MPID_Comm_valid_ptr( comm_ptr, mpi_errno );
MPID_Comm_valid_ptr( comm_ptr, mpi_errno, FALSE );
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
if (comm_ptr->comm_kind == MPID_INTERCOMM)
......
......@@ -851,7 +851,7 @@ int MPI_Allreduce(const void *sendbuf, void *recvbuf, int count,
MPID_Datatype *datatype_ptr = NULL;
MPID_Op *op_ptr = NULL;
MPID_Comm_valid_ptr( comm_ptr, mpi_errno );
MPID_Comm_valid_ptr( comm_ptr, mpi_errno, FALSE );
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
MPIR_ERRTEST_COUNT(count, mpi_errno);
MPIR_ERRTEST_DATATYPE(datatype, "datatype", mpi_errno);
......
......@@ -836,7 +836,7 @@ int MPI_Alltoall(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
{
MPID_Datatype *sendtype_ptr=NULL, *recvtype_ptr=NULL;
MPID_Comm_valid_ptr( comm_ptr, mpi_errno );
MPID_Comm_valid_ptr( comm_ptr, mpi_errno, FALSE );
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
if (sendbuf != MPI_IN_PLACE) {
......
......@@ -471,7 +471,7 @@ int MPI_Alltoallv(const void *sendbuf, const int *sendcounts,
int i, comm_size;
int check_send = (comm_ptr->comm_kind == MPID_INTRACOMM && sendbuf != MPI_IN_PLACE);
MPID_Comm_valid_ptr( comm_ptr, mpi_errno );
MPID_Comm_valid_ptr( comm_ptr, mpi_errno, FALSE );
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
if (comm_ptr->comm_kind == MPID_INTRACOMM) {
......
......@@ -466,7 +466,7 @@ int MPI_Alltoallw(const void *sendbuf, const int sendcounts[],
int i, comm_size;
int check_send;
MPID_Comm_valid_ptr( comm_ptr, mpi_errno );
MPID_Comm_valid_ptr( comm_ptr, mpi_errno, FALSE );
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
check_send = (comm_ptr->comm_kind == MPID_INTRACOMM && sendbuf != MPI_IN_PLACE);
......
......@@ -403,7 +403,7 @@ int MPI_Barrier( MPI_Comm comm )
MPID_BEGIN_ERROR_CHECKS;
{
/* Validate communicator */
MPID_Comm_valid_ptr( comm_ptr, mpi_errno );
MPID_Comm_valid_ptr( comm_ptr, mpi_errno, FALSE );
if (mpi_errno) goto fn_fail;
}
MPID_END_ERROR_CHECKS;
......
......@@ -1564,7 +1564,7 @@ int MPI_Bcast( void *buffer, int count, MPI_Datatype datatype, int root,
{
MPID_Datatype *datatype_ptr = NULL;
MPID_Comm_valid_ptr( comm_ptr, mpi_errno );
MPID_Comm_valid_ptr( comm_ptr, mpi_errno, FALSE );
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
MPIR_ERRTEST_COUNT(count, mpi_errno);
MPIR_ERRTEST_DATATYPE(datatype, "datatype", mpi_errno);
......
......@@ -338,7 +338,7 @@ int MPI_Exscan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datat
MPID_Op *op_ptr = NULL;
int rank;
MPID_Comm_valid_ptr( comm_ptr, mpi_errno );
MPID_Comm_valid_ptr( comm_ptr, mpi_errno, FALSE );
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
MPIR_ERRTEST_COMM_INTRA(comm_ptr, mpi_errno);
......
......@@ -794,7 +794,7 @@ int MPI_Gather(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
MPID_Datatype *sendtype_ptr=NULL, *recvtype_ptr=NULL;
int rank;
MPID_Comm_valid_ptr( comm_ptr, mpi_errno );
MPID_Comm_valid_ptr( comm_ptr, mpi_errno, FALSE );
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
if (comm_ptr->comm_kind == MPID_INTRACOMM) {
......
......@@ -319,7 +319,7 @@ int MPI_Gatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
MPID_Datatype *sendtype_ptr=NULL, *recvtype_ptr=NULL;
int i, rank, comm_size;
MPID_Comm_valid_ptr( comm_ptr, mpi_errno );
MPID_Comm_valid_ptr( comm_ptr, mpi_errno, FALSE );
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
if (comm_ptr->comm_kind == MPID_INTRACOMM) {
......
......@@ -695,7 +695,7 @@ int MPI_Iallgather(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
{
MPID_BEGIN_ERROR_CHECKS
{
MPID_Comm_valid_ptr(comm_ptr, mpi_errno);
MPID_Comm_valid_ptr( comm_ptr, mpi_errno, FALSE );
if (sendbuf != MPI_IN_PLACE && HANDLE_GET_KIND(sendtype) != HANDLE_KIND_BUILTIN) {
MPID_Datatype *sendtype_ptr = NULL;
MPID_Datatype_get_ptr(sendtype, sendtype_ptr);
......
......@@ -798,7 +798,7 @@ int MPI_Iallgatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, v
{
MPID_BEGIN_ERROR_CHECKS
{
MPID_Comm_valid_ptr(comm_ptr, mpi_errno);
MPID_Comm_valid_ptr( comm_ptr, mpi_errno, FALSE );
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
if (sendbuf != MPI_IN_PLACE) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment