There is a story that the PL/1 compiler at the
Telefunken TR 440 made the following optimization:
SUM = 0;
DO I = 1 TO 100;
SUM = SUM + I;
END;
PUT SKIP LIST (SUM);
The compiler unrolled the loop, threw away the variables,
and computed SUM at compile time. In the end, it only
PUTted the result, which was completely computed at
compile time.
This was the Multics compiler which was bought by Telefunken
and ported to the TR 440 in the early 70s. See the Multics pages
for the complete story. It was bootstrapped with the help of the
IBM machines in the Boeblingen laboratory, which is only some
100 km from Konstanz, where the Telefunken machines were built.
The compile of the Multics compiler - which was written in PL/1 itself -
at IBM lasted the whole night long. In the morning, the output on
magnetic tape
was moved to Konstanz - by train. The train conductor got a suitcase
with the tapes,
and IBM and Telefunken employees brought and fetched the tapes from the
train stations.
This was done several times during the bootstrapping process.
Old stories ...
Kind regards
Bernd
David Crayford schrieb:
Bernd Oppolzer wrote:
john gilmore schrieb:
declare (pi value(3.14159_26535_89793_23846),
sqrt_pi value(sqrt(pi)) binary float(52) ;
What I find most interesting in this example:
will the sqrt(pi) function call be evaluated at compile time?
I hope so.
I doubt that any optimizer will be that "smart". That's usually
achieved by metaprogramming, like
template metaprogramming in C++.
http://en.wikipedia.org/wiki/Template_metaprogramming#Compile-time_code_optimization
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html