diff options
author | Nicolas Koenig <koenigni@student.ethz.ch> | 2021-10-28 22:41:40 +0200 |
---|---|---|
committer | Nicolas Koenig <koenigni@student.ethz.ch> | 2021-10-28 22:41:40 +0200 |
commit | 9fc240973e79d797bd5a5bdcbc8d0affa3e5a08a (patch) | |
tree | 695062c219f0c29cbf38fbd577f7b5fdb8adb50c /libgfortran/caf_shared/shared_memory.h | |
parent | 8df87c9e2c0a31c669625c4942d09b03d36c73e9 (diff) | |
download | gcc-devel/coarray_native.tar.gz |
Only allocate a single chunk of memory on startup.devel/coarray_native
Diffstat (limited to 'libgfortran/caf_shared/shared_memory.h')
-rw-r--r-- | libgfortran/caf_shared/shared_memory.h | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/libgfortran/caf_shared/shared_memory.h b/libgfortran/caf_shared/shared_memory.h index dd0322707e7..a1b5bf44ca8 100644 --- a/libgfortran/caf_shared/shared_memory.h +++ b/libgfortran/caf_shared/shared_memory.h @@ -30,14 +30,14 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see struct shared_memory_act; typedef struct shared_memory_act * shared_memory; -#define SHMPTR_NULL ((shared_mem_ptr) {.offset = -1}) -#define SHMPTR_IS_NULL(x) (x.offset == -1) +#define SHMPTR_NULL ((shared_mem_ptr) {.p = NULL}) +#define SHMPTR_IS_NULL(x) (x.p == NULL) #define SHMPTR_DEREF(x, s, sm) \ - ((x) = *(__typeof(x) *) shared_mem_ptr_to_void_ptr (sm, s); -#define SHMPTR_AS(t, s, sm) ((t) shared_mem_ptr_to_void_ptr(sm, s)) + ((x) = *(__typeof(x) *) s.p) +#define SHMPTR_AS(t, s, sm) ((t) s.p) #define SHMPTR_SET(v, s, sm) (v = SHMPTR_AS(__typeof(v), s, sm)) -#define SHMPTR_EQUALS(s1, s2) (s1.offset == s2.offset) +#define SHMPTR_EQUALS(s1, s2) (s1.p == s2.p) #define SHARED_MEMORY_RAW_ALLOC(mem, t, n) \ shared_memory_get_mem_with_alignment(mem, sizeof(t)*n, __alignof__(t)) @@ -50,7 +50,7 @@ typedef struct shared_memory_act * shared_memory; typedef struct shared_mem_ptr { - ssize_t offset; + void *p; } shared_mem_ptr; void shared_memory_init (shared_memory *, size_t); @@ -63,7 +63,4 @@ shared_mem_ptr shared_memory_get_mem_with_alignment (shared_memory *mem, size_t size, size_t align); internal_proto (shared_memory_get_mem_with_alignment); -void *shared_mem_ptr_to_void_ptr (shared_memory *, shared_mem_ptr); -internal_proto (shared_mem_ptr_to_void_ptr); - #endif |