[patch, fortran, RFC] Separate READ from WRITE

Jerry DeLisle jvdelisle@frontier.com
Sun Oct 10 22:08:00 GMT 2010


On 10/10/2010 01:44 PM, Tobias Burnus wrote:
> Thomas Koenig wrote:
>> this RFC patch separates reads from writes in Fortran, by establishing
>> separate transfer functions for writing, with a different spec. For
>> now, the write functions just call the original transfer functions, with
>> the spec making all the difference.
>
> I think you are currently trading non-clobber for having a function call
> overhead: The newly generated functions in libgfortran will probably not be
> inlined as the called procedure is also publicly visible. Though, they might be
> cloned and inlined - as least in the cases when the transfer function is small.
>
> The question is whether one can do without duplication of code, e.g., by having
> two different decls but with the same assembler name - though, I am not sure
> whether this will work - including with LTO.
>
> What do our middle end experts think?
> a) Status quo: Read and write I/O call the same libgfortran function, i.e. the
> non-clobbering is not taken into account.
> b) Thomas' patch: Adding a wrapper function for write, i.e. a function call
> overhead but allows to use fn-spec to mark the arguments as noclobber.

I don't think this function call overhead is that significant, however it would 
be nice to run some tests and measure it.  Also, It would make sense to me to 
separate the READ and WRITE in the library.  I will be looking into doing this 
soon.  This would clear the over head issue, if any, and we woud also be able to 
get rid of runtime tests for whether we are doing READ or WRITE which is 
additional overhead we have now. So over all, it looks like a step in the right 
direction.

> c) Other ideas?

Yes I would really like to see other ideas.

>
> Tobias
>



More information about the Fortran mailing list