|
10 | 10 | implicit none |
11 | 11 |
|
12 | 12 | ! placeholder variables that simplify the macro logic below |
13 | | - integer(PRIF_ATOMIC_INT_KIND) :: dummyti |
14 | | - logical(PRIF_ATOMIC_LOGICAL_KIND) :: dummytl |
15 | | - integer(PRIF_ATOMIC_INT_KIND), parameter :: dummyvi = 0 |
16 | | - logical(PRIF_ATOMIC_LOGICAL_KIND), parameter :: dummyvl = .false. |
| 13 | + integer(PRIF_ATOMIC_INT_KIND) :: out_placeholder_int |
| 14 | + logical(PRIF_ATOMIC_LOGICAL_KIND) :: out_placeholder_logical |
| 15 | + integer(PRIF_ATOMIC_INT_KIND), parameter :: in_placeholder_int = 0 |
| 16 | + logical(PRIF_ATOMIC_LOGICAL_KIND), parameter :: in_placeholder_logical = .false. |
17 | 17 | contains |
18 | 18 |
|
19 | 19 | #define ATOMIC_OP(OPNAME, OPCODE, caf_op) \ |
|
22 | 22 | call_assert(offset >= 0); \ |
23 | 23 | call base_pointer(coarray_handle, image_num, remote_base); \ |
24 | 24 | call CAF_CONCAT3(prif_atomic_,OPNAME,_indirect) \ |
25 | | - ( image_num, remote_base + offset, OPPASSI, stat ); \ |
| 25 | + ( image_num, remote_base + offset, OPPASSF, stat ); \ |
26 | 26 | end procedure ; \ |
27 | 27 | module procedure CAF_CONCAT3(prif_atomic_,OPNAME,_indirect) ; \ |
28 | | - call_assert(c_sizeof(dummyti) == 8); call_assert(c_sizeof(dummytl) == 8); \ |
| 28 | + call_assert(c_sizeof(out_placeholder_int) == 8); call_assert(c_sizeof(out_placeholder_logical) == 8); \ |
29 | 29 | call_assert_describe(image_num > 0 .and. image_num <= initial_team%num_images, "image_num not within valid range"); \ |
30 | 30 | call caf_op(CAF_CONCAT2(CAF_OP_,OPCODE), image_num, atom_remote_ptr, OPPASSC); \ |
31 | 31 | if (present(stat)) stat = 0; \ |
|
35 | 35 | #define ATOMIC_INT_OP(OPNAME,_,OPCODE) ATOMIC_OP(OPNAME,OPCODE,caf_atomic_int) |
36 | 36 | #define ATOMIC_LOG_OP(OPNAME,_,OPCODE) ATOMIC_OP(OPNAME,OPCODE,caf_atomic_logical) |
37 | 37 |
|
38 | | -#undef OPPASSI |
39 | | -#define OPPASSI value |
| 38 | +! OPPASSF defines the dummy argument pass-thru in Fortran, |
| 39 | +! from the direct module procedure to the indirect variant |
| 40 | +#undef OPPASSF |
| 41 | +#define OPPASSF value |
| 42 | +! OPPASSC defines the dummy argument pass-thru to C, |
| 43 | +! from the indirect module procedure to the BIND(C) call |
40 | 44 | #undef OPPASSC |
41 | | -#define OPPASSC value, dummyvi, dummyvi |
| 45 | +#define OPPASSC value, in_placeholder_int, in_placeholder_int |
42 | 46 | ATOMIC_INT_OP(ref_int, ,GET) |
43 | 47 | #undef OPPASSC |
44 | | -#define OPPASSC value, dummyvl, dummyvl |
| 48 | +#define OPPASSC value, in_placeholder_logical, in_placeholder_logical |
45 | 49 | ATOMIC_LOG_OP(ref_logical, ,GET) |
46 | 50 | #undef OPPASSC |
47 | | -#define OPPASSC dummytl, value, dummyvl |
| 51 | +#define OPPASSC out_placeholder_logical, value, in_placeholder_logical |
48 | 52 | ATOMIC_LOG_OP(define_logical, ,SET) |
49 | 53 | #undef OPPASSC |
50 | | -#define OPPASSC dummyti, value, dummyvi |
| 54 | +#define OPPASSC out_placeholder_int, value, in_placeholder_int |
51 | 55 | ATOMIC_INT_OP(define_int, ,SET) |
52 | 56 |
|
53 | 57 | ATOMIC_INT_OP(add, ,ADD) |
54 | 58 | ATOMIC_INT_OP(and, ,AND) |
55 | 59 | ATOMIC_INT_OP(or, ,OR) |
56 | 60 | ATOMIC_INT_OP(xor, ,XOR) |
57 | 61 |
|
58 | | -#undef OPPASSI |
59 | | -#define OPPASSI value, old |
| 62 | +#undef OPPASSF |
| 63 | +#define OPPASSF value, old |
60 | 64 | #undef OPPASSC |
61 | | -#define OPPASSC old, value, dummyvi |
| 65 | +#define OPPASSC old, value, in_placeholder_int |
62 | 66 | ATOMIC_INT_OP(fetch_add, ,FADD) |
63 | 67 | ATOMIC_INT_OP(fetch_and, ,FAND) |
64 | 68 | ATOMIC_INT_OP(fetch_or, ,FOR) |
65 | 69 | ATOMIC_INT_OP(fetch_xor, ,FXOR) |
66 | 70 |
|
67 | | -#undef OPPASSI |
68 | | -#define OPPASSI old, compare, new |
| 71 | +#undef OPPASSF |
| 72 | +#define OPPASSF old, compare, new |
69 | 73 | #undef OPPASSC |
70 | 74 | #define OPPASSC old, compare, new |
71 | 75 | ATOMIC_INT_OP(cas_int, ,FCAS) |
|
0 commit comments