(j3.2006) (SC22WG5.3584) OPTIONAL arguments and C interop

Bill Long longb
Thu Jul 17 13:37:42 EDT 2008



Jim Xia wrote:
>
> j3-bounces at j3-fortran.org wrote on 07/17/2008 10:43:35 AM:
>
> >
> >
> > Van Snyder wrote:
> > >
> > > >From the point of view of a Fortran programmer who rarely or 
> never uses
> > > C, VALUE just means "copy in."
> >
> > I don't know any other Fortran programmer who thinks this.  VALUE to a
> > Fortran programmer means pass the argument in a register.  The entire
> > purpose, outside the C Interop domain, is performance.  That was the
> > reason VALUE was proposed to apply outside BIND(C) routines.
> >
>
> If that was the reason for VALUE in Fortran language, I'd like to 
> propose for its removal.  Unless your register is big enough to 
> swallow any data type or an entire array (which I'm highly doubtful), 
> the "performance advantage" you're referring to is meaningless. 

Not at all.  The implementation might pass only register sized arguments 
in a register, but that's a very large fraction of arguments, so the 
potential for benefit is large.  A programmer might put VALUE on an 
argument with a large memory footprint.  If he does this it might be 
because he intentionally wants the "copy-in" feature that comes as a 
side-effect of VALUE (which is fine), or because he's just clueless 
about programming (in which case we can interest him in some finalizers 
for his parameterized derived types - why mess with a pistol when he can 
aim a Howitzer at his foot).

Cheers,
Bill




>  The language feature is very general, it even allows structure with 
> allocatable component, and a lot overhead occurs when doing the deep 
> coping of the structures during the procedure calls.  I'm confused 
> about why people buying the arguments in VALUE for performance.  Call 
> by value is known as a performance killer in other languages.  The 
> compiler, not language, should be smart enough to decide what the best 
> calling convention to use (whether or not get registers involved).
>
>
> Jim Xia
>
> RL Fortran Compiler Test
> IBM Toronto Lab at 8200 Warden Ave, Markham, On, L6G 1C7
> Phone (905) 413-3444  Tie-line 313-3444
> email: jimxia at ca.ibm.com
> D2/YF7/8200 /MKM

-- 
Bill Long                                   longb at cray.com
Fortran Technical Support    &              voice: 651-605-9024
Bioinformatics Software Development         fax:   651-605-9142
Cray Inc., 1340 Mendota Heights Rd., Mendota Heights, MN, 55120

            




More information about the J3 mailing list