summaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorkargl <kargl@138bc75d-0d04-0410-961f-82ee72b054a4>2015-12-02 21:59:05 +0000
committerkargl <kargl@138bc75d-0d04-0410-961f-82ee72b054a4>2015-12-02 21:59:05 +0000
commitbd47f0bc4f0642c0e15eefa1a0c31dd9bf8bdc0c (patch)
tree8b8c4c4de354d0e49cd44c9ed198749aa58db30e /libgfortran
parentda7b620034cc2fdf772ce7d6aa9ae84f1eced3f7 (diff)
downloadgcc-bd47f0bc4f0642c0e15eefa1a0c31dd9bf8bdc0c.tar.gz
2015-12-02 Tobias Burnus <burnus@net-b.de>
Alessandro Fanfarillo <fanfarillo.gcc@gmail.com> * check.c (gfc_check_event_query): New function. * dump-parse-tree.c (show_code_node): Handle EXEC_EVENT_POST, EXEC_EVENT_WAIT. * expr.c (gfc_check_vardef_context): New check for event variables definition. * gfortran.h (gfc_statement): Add ST_EVENT_POST, ST_EVENT_WAIT. (gfc_isym_id): GFC_ISYM_EVENT_QUERY. (struct symbol_attribute): New field. (gfc_exec_op): Add EXEC_EVENT_POST and EXEC_EVENT_WAIT. * gfortran.texi: Document about new events functions and minor changes. * interface.c (compare_parameter): New check. (gfc_procedure_use): New check for explicit procedure interface. (add_subroutines): Add event_query. * intrinsic.h (gfc_check_event_query,gfc_resolve_event_query): New prototypes. * iresolve.c (gfc_resolve_event_query): New function. * iso-fortran-env.def (event_type): New type. * match.c (event_statement,gfc_match_event_post,gfc_match_event_wait): New functions. (gfc_match_name): New event post and event wait. * match.h (gfc_match_event_post,gfc_match_event_wait): New prototypes. * module.c (ab_attribute): Add AB_EVENT_COMP. (attr_bits): Likewise. (mio_symbol_attribute): Handle event_comp attribute. * parse.c (decode_statement): Add ST_EVENT_POST, ST_EVENT_WAIT. (next_statement): Add ST_EVENT_POST, ST_EVENT_WAIT. (gfc_ascii_statement): Add ST_EVENT_POST, ST_EVENT_WAIT. (parse_derived): Check for event_type components. * resolve.c (resolve_allocate_expr): Check for event variable def. (resolve_lock_unlock): Renamed to resolve_lock_unlock_event. It includes logic for locks and events. (gfc_resolve_code): Call it. (gfc_resolve_symbol): New check for event variable to be a corray. * st.c (gfc_free_statement): Handle new EXEC_EVENT_POST and EXEC_EVENT_WAIT. * trans-decl.c (gfor_fndecl_caf_event_post,gfor_fndecl_caf_event_wait, gfor_fndecl_caf_event_query): New global variables. (generate_coarray_sym_init): Checking for event_type. (gfc_conv_procedure_call): Check for C bind attribute. * trans-intrinsic.c (conv_intrinsic_event_query): New function. (conv_intrinsic_move_alloc): Call it. * trans-stmt.c (gfc_trans_lock_unlock): Passing address of actual argument. (gfc_trans_sync): Likewise. (gfc_trans_event_post_wait): New function. * trans-stmt.h (gfc_trans_event_post_wait): New prototype. * trans-types.c (gfc_get_derived_type): Integer_kind as event_type. * trans.c (gfc_allocate_using_lib): New argument and logic for events. (gfc_allocate_allocatable): Passing new argument. (trans_code): Handle EXEC_EVENT_POST, EXEC_EVENT_WAIT. * trans.h (gfc_coarray_type): New elements. (gfor_fndecl_caf_event_post,gfor_fndecl_caf_event_wait, gfor_fndecl_caf_event_query): Declare them. 2015-12-02 Tobias Burnus <burnus@net-b.de> Alessandro Fanfarillo <fanfarillo.gcc@gmail.com> * gfortran.dg/coarray/event_1.f90: New. * gfortran.dg/coarray/event_2.f90: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@231208 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog8
-rw-r--r--libgfortran/caf/libcaf.h7
-rw-r--r--libgfortran/caf/single.c45
3 files changed, 57 insertions, 3 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 48db71b8df7..4843fd50464 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,11 @@
+2015-11-26 Tobias Burnus <burnus@net-b.de>
+ Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
+
+ * caf/libcaf.h (_gfortran_caf_event_post,
+ _gfortran_caf_event_wait,_gfortran_caf_event_query): New prototypes.
+ * caf/single.c (_gfortran_caf_event_post,
+ _gfortran_caf_event_wait,_gfortran_caf_event_query): Implement.
+
2015-11-22 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/52251
diff --git a/libgfortran/caf/libcaf.h b/libgfortran/caf/libcaf.h
index 660bd7c0945..ebda579d06c 100644
--- a/libgfortran/caf/libcaf.h
+++ b/libgfortran/caf/libcaf.h
@@ -57,7 +57,9 @@ typedef enum caf_register_t {
CAF_REGTYPE_COARRAY_ALLOC,
CAF_REGTYPE_LOCK_STATIC,
CAF_REGTYPE_LOCK_ALLOC,
- CAF_REGTYPE_CRITICAL
+ CAF_REGTYPE_CRITICAL,
+ CAF_REGTYPE_EVENT_STATIC,
+ CAF_REGTYPE_EVENT_ALLOC
}
caf_register_t;
@@ -133,5 +135,8 @@ void _gfortran_caf_atomic_op (int, caf_token_t, size_t, int, void *, void *,
void _gfortran_caf_lock (caf_token_t, size_t, int, int *, int *, char *, int);
void _gfortran_caf_unlock (caf_token_t, size_t, int, int *, char *, int);
+void _gfortran_caf_event_post (caf_token_t, size_t, int, int *, char *, int);
+void _gfortran_caf_event_wait (caf_token_t, size_t, int, int *, char *, int);
+void _gfortran_caf_event_query (caf_token_t, size_t, int, int *, int *);
#endif /* LIBCAF_H */
diff --git a/libgfortran/caf/single.c b/libgfortran/caf/single.c
index 6c582860ebf..9c4b3434f5c 100644
--- a/libgfortran/caf/single.c
+++ b/libgfortran/caf/single.c
@@ -101,7 +101,8 @@ _gfortran_caf_register (size_t size, caf_register_t type, caf_token_t *token,
void *local;
if (type == CAF_REGTYPE_LOCK_STATIC || type == CAF_REGTYPE_LOCK_ALLOC
- || type == CAF_REGTYPE_CRITICAL)
+ || type == CAF_REGTYPE_CRITICAL || type == CAF_REGTYPE_EVENT_STATIC
+ || type == CAF_REGTYPE_EVENT_ALLOC)
local = calloc (size, sizeof (bool));
else
local = malloc (size);
@@ -133,7 +134,8 @@ _gfortran_caf_register (size_t size, caf_register_t type, caf_token_t *token,
*stat = 0;
if (type == CAF_REGTYPE_COARRAY_STATIC || type == CAF_REGTYPE_LOCK_STATIC
- || type == CAF_REGTYPE_CRITICAL)
+ || type == CAF_REGTYPE_CRITICAL || type == CAF_REGTYPE_EVENT_STATIC
+ || type == CAF_REGTYPE_EVENT_ALLOC)
{
caf_static_t *tmp = malloc (sizeof (caf_static_t));
tmp->prev = caf_static_list;
@@ -1071,6 +1073,45 @@ _gfortran_caf_atomic_op (int op, caf_token_t token, size_t offset,
*stat = 0;
}
+void
+_gfortran_caf_event_post (caf_token_t token, size_t index,
+ int image_index __attribute__ ((unused)),
+ int *stat, char *errmsg __attribute__ ((unused)),
+ int errmsg_len __attribute__ ((unused)))
+{
+ uint32_t value = 1;
+ uint32_t *event = (uint32_t *) ((char *) TOKEN (token) + index*sizeof(uint32_t));
+ __atomic_fetch_add (event, (uint32_t) value, __ATOMIC_RELAXED);
+
+ if(stat)
+ *stat = 0;
+}
+
+void
+_gfortran_caf_event_wait (caf_token_t token, size_t index,
+ int until_count, int *stat,
+ char *errmsg __attribute__ ((unused)),
+ int errmsg_len __attribute__ ((unused)))
+{
+ uint32_t *event = (uint32_t *) ((char *) TOKEN (token) + index*sizeof(uint32_t));
+ uint32_t value = (uint32_t)-until_count;
+ __atomic_fetch_add (event, (uint32_t) value, __ATOMIC_RELAXED);
+
+ if(stat)
+ *stat = 0;
+}
+
+void
+_gfortran_caf_event_query (caf_token_t token, size_t index,
+ int image_index __attribute__ ((unused)),
+ int *count, int *stat)
+{
+ uint32_t *event = (uint32_t *) ((char *) TOKEN (token) + index*sizeof(uint32_t));
+ __atomic_load (event, (uint32_t *) count, __ATOMIC_RELAXED);
+
+ if(stat)
+ *stat = 0;
+}
void
_gfortran_caf_lock (caf_token_t token, size_t index,