aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/io/file_pos.c
diff options
context:
space:
mode:
authorAndre Vieira <andre.simoesdiasvieira@arm.com>2018-07-31 08:42:21 +0000
committerAndre Vieira <avieira@gcc.gnu.org>2018-07-31 08:42:21 +0000
commit1d4a51cf5079c11a44126bf7d5cf63fd9b202fbd (patch)
treeb84d7bd3f44ac09a6d9dee531a4e6509440ef56a /libgfortran/io/file_pos.c
parent58691d4a04c2c8d81298441a7621e6e6df69b21a (diff)
downloadgcc-1d4a51cf5079c11a44126bf7d5cf63fd9b202fbd.zip
gcc-1d4a51cf5079c11a44126bf7d5cf63fd9b202fbd.tar.gz
gcc-1d4a51cf5079c11a44126bf7d5cf63fd9b202fbd.tar.bz2
Reverting 'AsyncI/O patch committed' as it is breaking bare-metal builds.
2018-07-31 Andre Vieira <andre.simoesdiasvieira@arm.com> Revert 'AsyncI/O patch committed' 2018-07-25 Nicolas Koenig <koenigni@gcc.gnu.org> Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/25829 * gfortran.texi: Add description of asynchronous I/O. * trans-decl.c (gfc_finish_var_decl): Treat asynchronous variables as volatile. * trans-io.c (gfc_build_io_library_fndecls): Rename st_wait to st_wait_async and change argument spec from ".X" to ".w". (gfc_trans_wait): Pass ID argument via reference. 2018-07-31 Andre Vieira <andre.simoesdiasvieira@arm.com> Revert 'AsyncI/O patch committed' 2018-07-25 Nicolas Koenig <koenigni@gcc.gnu.org> Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/25829 * gfortran.dg/f2003_inquire_1.f03: Add write statement. * gfortran.dg/f2003_io_1.f03: Add wait statement. 2018-07-31 Andre Vieira <andre.simoesdiasvieira@arm.com> Revert 'AsyncI/O patch committed' 2018-07-25 Nicolas Koenig <koenigni@gcc.gnu.org> Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/25829 * Makefile.am: Add async.c to gfor_io_src. Add async.h to gfor_io_headers. * Makefile.in: Regenerated. * gfortran.map: Add _gfortran_st_wait_async. * io/async.c: New file. * io/async.h: New file. * io/close.c: Include async.h. (st_close): Call async_wait for an asynchronous unit. * io/file_pos.c (st_backspace): Likewise. (st_endfile): Likewise. (st_rewind): Likewise. (st_flush): Likewise. * io/inquire.c: Add handling for asynchronous PENDING and ID arguments. * io/io.h (st_parameter_dt): Add async bit. (st_parameter_wait): Correct. (gfc_unit): Add au pointer. (st_wait_async): Add prototype. (transfer_array_inner): Likewise. (st_write_done_worker): Likewise. * io/open.c: Include async.h. (new_unit): Initialize asynchronous unit. * io/transfer.c (async_opt): New struct. (wrap_scalar_transfer): New function. (transfer_integer): Call wrap_scalar_transfer to do the work. (transfer_real): Likewise. (transfer_real_write): Likewise. (transfer_character): Likewise. (transfer_character_wide): Likewise. (transfer_complex): Likewise. (transfer_array_inner): New function. (transfer_array): Call transfer_array_inner. (transfer_derived): Call wrap_scalar_transfer. (data_transfer_init): Check for asynchronous I/O. Perform a wait operation on any pending asynchronous I/O if the data transfer is synchronous. Copy PDT and enqueue thread for data transfer. (st_read_done_worker): New function. (st_read_done): Enqueue transfer or call st_read_done_worker. (st_write_done_worker): New function. (st_write_done): Enqueue transfer or call st_read_done_worker. (st_wait): Document as no-op for compatibility reasons. (st_wait_async): New function. * io/unit.c (insert_unit): Use macros LOCK, UNLOCK and TRYLOCK; add NOTE where necessary. (get_gfc_unit): Likewise. (init_units): Likewise. (close_unit_1): Likewise. Call async_close if asynchronous. (close_unit): Use macros LOCK and UNLOCK. (finish_last_advance_record): Likewise. (newunit_alloc): Likewise. * io/unix.c (find_file): Likewise. (flush_all_units_1): Likewise. (flush_all_units): Likewise. * libgfortran.h (generate_error_common): Add prototype. * runtime/error.c: Include io.h and async.h. (generate_error_common): New function. 2018-07-31 Andre Vieira <andre.simoesdiasvieira@arm.com> Revert 'AsyncI/O patch committed'. 2018-07-25 Nicolas Koenig <koenigni@gcc.gnu.org> Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/25829 * testsuite/libgomp.fortran/async_io_1.f90: New test. * testsuite/libgomp.fortran/async_io_2.f90: New test. * testsuite/libgomp.fortran/async_io_3.f90: New test. * testsuite/libgomp.fortran/async_io_4.f90: New test. * testsuite/libgomp.fortran/async_io_5.f90: New test. * testsuite/libgomp.fortran/async_io_6.f90: New test. * testsuite/libgomp.fortran/async_io_7.f90: New test. From-SVN: r263082
Diffstat (limited to 'libgfortran/io/file_pos.c')
-rw-r--r--libgfortran/io/file_pos.c70
1 files changed, 3 insertions, 67 deletions
diff --git a/libgfortran/io/file_pos.c b/libgfortran/io/file_pos.c
index 362885a..75f58f0 100644
--- a/libgfortran/io/file_pos.c
+++ b/libgfortran/io/file_pos.c
@@ -25,7 +25,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "io.h"
#include "fbuf.h"
#include "unix.h"
-#include "async.h"
#include <string.h>
/* file_pos.c-- Implement the file positioning statements, i.e. BACKSPACE,
@@ -188,7 +187,6 @@ void
st_backspace (st_parameter_filepos *fpp)
{
gfc_unit *u;
- bool needs_unlock = false;
library_start (&fpp->common);
@@ -216,17 +214,6 @@ st_backspace (st_parameter_filepos *fpp)
goto done;
}
- if (u->au)
- {
- if (async_wait (&(fpp->common), u->au))
- return;
- else
- {
- needs_unlock = true;
- LOCK (&u->au->io_lock);
- }
- }
-
/* Make sure format buffer is flushed and reset. */
if (u->flags.form == FORM_FORMATTED)
{
@@ -280,12 +267,7 @@ st_backspace (st_parameter_filepos *fpp)
done:
if (u != NULL)
- {
- unlock_unit (u);
-
- if (u->au && needs_unlock)
- UNLOCK (&u->au->io_lock);
- }
+ unlock_unit (u);
library_end ();
}
@@ -298,7 +280,6 @@ void
st_endfile (st_parameter_filepos *fpp)
{
gfc_unit *u;
- bool needs_unlock = false;
library_start (&fpp->common);
@@ -313,17 +294,6 @@ st_endfile (st_parameter_filepos *fpp)
goto done;
}
- if (u->au)
- {
- if (async_wait (&(fpp->common), u->au))
- return;
- else
- {
- needs_unlock = true;
- LOCK (&u->au->io_lock);
- }
- }
-
if (u->flags.access == ACCESS_SEQUENTIAL
&& u->endfile == AFTER_ENDFILE)
{
@@ -406,11 +376,8 @@ st_endfile (st_parameter_filepos *fpp)
}
}
- done:
- if (u->au && needs_unlock)
- UNLOCK (&u->au->io_lock);
-
- unlock_unit (u);
+ done:
+ unlock_unit (u);
library_end ();
}
@@ -423,7 +390,6 @@ void
st_rewind (st_parameter_filepos *fpp)
{
gfc_unit *u;
- bool needs_unlock = true;
library_start (&fpp->common);
@@ -435,17 +401,6 @@ st_rewind (st_parameter_filepos *fpp)
"Cannot REWIND a file opened for DIRECT access");
else
{
- if (u->au)
- {
- if (async_wait (&(fpp->common), u->au))
- return;
- else
- {
- needs_unlock = true;
- LOCK (&u->au->io_lock);
- }
- }
-
/* If there are previously written bytes from a write with ADVANCE="no",
add a record marker before performing the ENDFILE. */
@@ -481,10 +436,6 @@ st_rewind (st_parameter_filepos *fpp)
}
/* Update position for INQUIRE. */
u->flags.position = POSITION_REWIND;
-
- if (u->au && needs_unlock)
- UNLOCK (&u->au->io_lock);
-
unlock_unit (u);
}
@@ -499,24 +450,12 @@ void
st_flush (st_parameter_filepos *fpp)
{
gfc_unit *u;
- bool needs_unlock = false;
library_start (&fpp->common);
u = find_unit (fpp->common.unit);
if (u != NULL)
{
- if (u->au)
- {
- if (async_wait (&(fpp->common), u->au))
- return;
- else
- {
- needs_unlock = true;
- LOCK (&u->au->io_lock);
- }
- }
-
/* Make sure format buffer is flushed. */
if (u->flags.form == FORM_FORMATTED)
fbuf_flush (u, u->mode);
@@ -530,8 +469,5 @@ st_flush (st_parameter_filepos *fpp)
generate_error (&fpp->common, LIBERROR_BAD_OPTION,
"Specified UNIT in FLUSH is not connected");
- if (needs_unlock)
- UNLOCK (&u->au->io_lock);
-
library_end ();
}