Related articles |
---|
[5 earlier articles] |
Re: By value-result vs by reference nebbe@lglsun.epfl.ch (1994-04-22) |
Re: By value-result vs by reference andrewd@apanix.apana.org.au (1994-04-24) |
Re: By value-result vs by reference hbaker@netcom.com (1994-04-23) |
Re: By value-result vs by reference nebbe@lglsun.epfl.ch (1994-04-26) |
Re: By value-result vs by reference Theo.Norvell@comlab.oxford.ac.uk (1994-04-26) |
Re: By value-result vs by reference hbaker@netcom.com (1994-04-28) |
Re: By value-result vs by reference anton@mips.complang.tuwien.ac.at (1994-04-29) |
Re: By value-result vs by reference nebbe@lglsun.epfl.ch (1994-04-29) |
Re: By value-result vs by reference hbaker@netcom.com (1994-05-01) |
Newsgroups: | comp.compilers |
From: | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
Keywords: | design |
Organization: | Institut fuer Computersprachen, Technische Universitaet Wien |
References: | 94-04-140 |
Date: | Fri, 29 Apr 1994 08:48:10 GMT |
guerin@iro.umontreal.ca (Frederic Guerin) writes:
|> I would like to hear about call-by-value-result vs call-by-reference,
|> which one is better ?
...
|> Is there some good reason to prohibit call-by-value-result that I can't see,
|> or is it coincidental of these days ?
As others have pointed out, the reason for having or not having
value-result is the language specification. If the language specifies
reference parameters, you would need interprocedural alias analysis to
convert reference parameters to value-result parameters. In my experience,
however, even if the compiler can do interprocedural optimization, it's
impractical IMO (no separate compilation).
Someone suggested the following solution to the aliasing problem in this
forum: The compiler should produce two versions of every procedure, one
that assumes no aliasing, and one that is safe. If the compiler can
determine that the parameters are not aliased, it calls the no-aliasing
version. In this framework the no-aliasing version could also pass
appropriate parameters by value-result instead of by-reference.
If the language specifies value-result parameters, the benefits are even
greater than Frederic Guerin wrote. A lot of optimziation opportunities
are revealed, especially to compilers without alias analysis (the
compilers I have seen become quite stupid as soon as memory references are
involved). Hmm, given C++'s emphasis on efficiency and non-emphasis on
keeping the language lean, I wonder why they have not added value-result
parameters (or have they?-).
- anton
--
M. Anton Ertl
anton@mips.complang.tuwien.ac.at
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.