re PR libfortran/38199 (missed optimization: I/O performance)

2012-04-15  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR libfortran/38199
	PR libfortran/50673
	* intrinsics/string_intriniscs_inc.c (string_len_trim):
	Remove prototypes for string_len_trim and move to...
	* libgfortran.h (string_len_trim): ... here and
	(string_len_trim_char4): ...here.
	* io/unit.c: For non-array internal arrays where we do reading,
	adjust the record length to the last non-blank character.
	* io/unix.c:  Fix typo.

From-SVN: r186466
This commit is contained in:
Thomas Koenig 2012-04-15 11:52:44 +00:00
parent 9b63dcab1e
commit 79617d7e2e
5 changed files with 41 additions and 5 deletions

View File

@ -1,3 +1,15 @@
2012-04-15 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/38199
PR libfortran/50673
* intrinsics/string_intriniscs_inc.c (string_len_trim):
Remove prototypes for string_len_trim and move to...
* libgfortran.h (string_len_trim): ... here and
(string_len_trim_char4): ...here.
* io/unit.c: For non-array internal arrays where we do reading,
adjust the record length to the last non-blank character.
* io/unix.c: Fix typo.
2012-04-10 Michael Matz <matz@suse.de>
* m4/cshift0.m4 (cshift0_'rtype_code`): Guard use of modulo.

View File

@ -44,9 +44,6 @@ extern void concat_string (gfc_charlen_type, CHARTYPE *,
gfc_charlen_type, const CHARTYPE *);
export_proto(concat_string);
extern gfc_charlen_type string_len_trim (gfc_charlen_type, const CHARTYPE *);
export_proto(string_len_trim);
extern void adjustl (CHARTYPE *, gfc_charlen_type, const CHARTYPE *);
export_proto(adjustl);

View File

@ -415,6 +415,26 @@ get_internal_unit (st_parameter_dt *dtp)
start_record *= iunit->recl;
}
else
{
/* If we are not processing an array, adjust the unit record length not
to include trailing blanks for list-formatted reads. */
if (dtp->u.p.mode == READING && dtp->format == NULL)
{
if (dtp->common.unit == 0)
{
dtp->internal_unit_len =
string_len_trim (dtp->internal_unit_len, dtp->internal_unit);
iunit->recl = dtp->internal_unit_len;
}
else
{
dtp->internal_unit_len =
string_len_trim_char4 (dtp->internal_unit_len, dtp->internal_unit);
iunit->recl = dtp->internal_unit_len;
}
}
}
/* Set initial values for unit parameters. */
if (dtp->common.unit)

View File

@ -736,7 +736,7 @@ mem_alloc_w4 (stream * strm, int * len)
}
/* Stream read function for character(kine=1) internal units. */
/* Stream read function for character(kind=1) internal units. */
static ssize_t
mem_read (stream * s, void * buf, ssize_t nbytes)

View File

@ -791,6 +791,13 @@ internal_proto(fstrcpy);
extern gfc_charlen_type cf_strcpy (char *, gfc_charlen_type, const char *);
internal_proto(cf_strcpy);
extern gfc_charlen_type string_len_trim (gfc_charlen_type, const char *);
export_proto(string_len_trim);
extern gfc_charlen_type string_len_trim_char4 (gfc_charlen_type,
const gfc_char4_t *);
export_proto(string_len_trim_char4);
/* io/intrinsics.c */
extern void flush_all_units (void);