Skip to content

Commit 030a5f2

Browse files
committed
sentinel: use type uintptr_t for sentinel
MSB is now automatically cleared when right shifting Thanks George for pointing this
1 parent 7850517 commit 030a5f2

File tree

7 files changed

+19
-14
lines changed

7 files changed

+19
-14
lines changed

ompi/communicator/comm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* Copyright (c) 2012 Oak Ridge National Labs. All rights reserved.
1919
* Copyright (c) 2012-2015 Los Alamos National Security, LLC.
2020
* All rights reserved.
21-
* Copyright (c) 2014 Research Organization for Information Science
21+
* Copyright (c) 2014-2016 Research Organization for Information Science
2222
* and Technology (RIST). All rights reserved.
2323
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
2424
* Copyright (c) 2015 Mellanox Technologies. All rights reserved.
@@ -699,7 +699,7 @@ static int ompi_comm_split_type_get_part (ompi_group_t *group, int *results, int
699699
int include = false;
700700

701701
if (ompi_proc_is_sentinel (proc)) {
702-
opal_process_name_t proc_name = ompi_proc_sentinel_to_name ((intptr_t) proc);
702+
opal_process_name_t proc_name = ompi_proc_sentinel_to_name ((uintptr_t) proc);
703703

704704
u16ptr = &locality;
705705

ompi/dpm/dpm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ int ompi_dpm_connect_accept(ompi_communicator_t *comm, int root,
169169
for (i=0; i < size; i++) {
170170
opal_process_name_t proc_name;
171171
if (ompi_proc_is_sentinel (proc_list[i])) {
172-
proc_name = ompi_proc_sentinel_to_name ((intptr_t) proc_list[i]);
172+
proc_name = ompi_proc_sentinel_to_name ((uintptr_t) proc_list[i]);
173173
} else {
174174
proc_name = proc_list[i]->super.proc_name;
175175
}
@@ -532,7 +532,7 @@ static int construct_peers(ompi_group_t *group, opal_list_t *peers)
532532
return OMPI_ERR_NOT_FOUND;
533533
}
534534
if (ompi_proc_is_sentinel (proct)) {
535-
proc_name = ompi_proc_sentinel_to_name ((intptr_t)proct);
535+
proc_name = ompi_proc_sentinel_to_name ((uintptr_t)proct);
536536
} else {
537537
proc_name = proct->super.proc_name;
538538
}

ompi/group/group.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
* Copyright (c) 2012 Oak Ridge National Labs. All rights reserved.
1717
* Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights
1818
* reserved.
19+
* Copyright (c) 2016 Research Organization for Information Science
20+
* and Technology (RIST). All rights reserved.
1921
* $COPYRIGHT$
2022
*
2123
* Additional copyrights may follow
@@ -352,7 +354,7 @@ static inline struct ompi_proc_t *ompi_group_dense_lookup (ompi_group_t *group,
352354

353355
/* replace sentinel value with an actual ompi_proc_t */
354356
ompi_proc_t *real_proc =
355-
(ompi_proc_t *) ompi_proc_for_name (ompi_proc_sentinel_to_name ((intptr_t) proc));
357+
(ompi_proc_t *) ompi_proc_for_name (ompi_proc_sentinel_to_name ((uintptr_t) proc));
356358

357359
if (opal_atomic_cmpset_ptr (group->grp_proc_pointers + peer_id, proc, real_proc)) {
358360
OBJ_RETAIN(real_proc);

ompi/group/group_plist.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
1515
* Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights
1616
* reserved.
17+
* Copyright (c) 2016 Research Organization for Information Science
18+
* and Technology (RIST). All rights reserved.
1719
* $COPYRIGHT$
1820
*
1921
* Additional copyrights may follow
@@ -61,7 +63,7 @@ static struct ompi_proc_t *ompi_group_dense_lookup_raw (ompi_group_t *group, con
6163
{
6264
if (OPAL_UNLIKELY(ompi_proc_is_sentinel (group->grp_proc_pointers[peer_id]))) {
6365
ompi_proc_t *proc =
64-
(ompi_proc_t *) ompi_proc_lookup (ompi_proc_sentinel_to_name ((intptr_t) group->grp_proc_pointers[peer_id]));
66+
(ompi_proc_t *) ompi_proc_lookup (ompi_proc_sentinel_to_name ((uintptr_t) group->grp_proc_pointers[peer_id]));
6567
if (NULL != proc) {
6668
/* replace sentinel value with an actual ompi_proc_t */
6769
group->grp_proc_pointers[peer_id] = proc;

ompi/mca/pml/monitoring/pml_monitoring.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
* reserved.
55
* Copyright (c) 2013-2015 Inria. All rights reserved.
66
* Copyright (c) 2015 Bull SAS. All rights reserved.
7+
* Copyright (c) 2016 Research Organization for Information Science
8+
* and Technology (RIST). All rights reserved.
79
* $COPYRIGHT$
810
*
911
* Additional copyrights may follow
@@ -77,7 +79,7 @@ int mca_pml_monitoring_add_procs(struct ompi_proc_t **procs,
7779
my_rank = i;
7880
/* Extract the peer procname from the procs array */
7981
if( ompi_proc_is_sentinel(procs[i]) ) {
80-
tmp = ompi_proc_sentinel_to_name((intptr_t)procs[i]);
82+
tmp = ompi_proc_sentinel_to_name((uintptr_t)procs[i]);
8183
} else {
8284
tmp = procs[i]->super.proc_name;
8385
}

ompi/proc/proc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights
1515
* reserved.
1616
* Copyright (c) 2013-2015 Intel, Inc. All rights reserved
17-
* Copyright (c) 2014-2015 Research Organization for Information Science
17+
* Copyright (c) 2014-2016 Research Organization for Information Science
1818
* and Technology (RIST). All rights reserved.
1919
* Copyright (c) 2015 Mellanox Technologies. All rights reserved.
2020
*
@@ -642,7 +642,7 @@ ompi_proc_pack(ompi_proc_t **proclist, int proclistsize,
642642
ompi_proc_t *proc = proclist[i];
643643

644644
if (ompi_proc_is_sentinel (proc)) {
645-
proc = ompi_proc_for_name_nolock (ompi_proc_sentinel_to_name ((intptr_t) proc));
645+
proc = ompi_proc_for_name_nolock (ompi_proc_sentinel_to_name ((uintptr_t) proc));
646646
}
647647

648648
/* send proc name */

ompi/proc/proc.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Copyright (c) 2007-2012 Los Alamos National Security, LLC. All rights
1414
* reserved.
1515
* Copyright (c) 2013-2014 Intel, Inc. All rights reserved
16-
* Copyright (c) 2015 Research Organization for Information Science
16+
* Copyright (c) 2015-2016 Research Organization for Information Science
1717
* and Technology (RIST). All rights reserved.
1818
* $COPYRIGHT$
1919
*
@@ -369,15 +369,14 @@ static inline bool ompi_proc_is_sentinel (ompi_proc_t *proc)
369369
return (intptr_t) proc & 0x1;
370370
}
371371

372-
static inline intptr_t ompi_proc_name_to_sentinel (opal_process_name_t name)
372+
static inline uintptr_t ompi_proc_name_to_sentinel (opal_process_name_t name)
373373
{
374-
return (*((intptr_t *) &name) << 1) | 0x1;
374+
return (*((uintptr_t *) &name) << 1) | 0x1;
375375
}
376376

377-
static inline opal_process_name_t ompi_proc_sentinel_to_name (intptr_t sentinel)
377+
static inline opal_process_name_t ompi_proc_sentinel_to_name (uintptr_t sentinel)
378378
{
379379
sentinel >>= 1;
380-
sentinel &= 0x7FFFFFFFFFFFFFFF;
381380
return *((opal_process_name_t *) &sentinel);
382381
}
383382

0 commit comments

Comments
 (0)