On Thu, 2006-08-24 at 17:23 -0700, Erick Tryzelaar wrote:
> I got one idea, but I'm not sure if it's firm enough, and the felix
> optimizer may already do this.
The way I approach this is:
(a) construct an actual test example
(b) run it thru flxg
(c) examine the output C++ code
If you find the code is optimised, good!
If the code is NOT optimised, then you need to
think about:
(d) a pattern to detect *in terms of the IL*
(intermediate language)
(e) a rule to reduce the code once the pattern is detected
Then we can implement the rule, run your test case thru
flxg, and check if it actually performed the optimisation.
In the process you will find:
(f) it isn't so easy to get a readable print out of
the IL codes
(g) 'reduce' which can do all of the above
in a USER level construction -- could we generalise
this feature?
(h) the optimiser is very hard to understand,
(i) there are LOTS more optimisations that could
be applied. General data flow analysis would be nice ..
heck, even a generalised control flow analysis would
be nice!
The one nice thing about optimisations is that you
can usually be overly cautious at the start, then
widen their scope.
The nasty thing about them is avoiding infinite
recursion and semantic changes: unless you have
a proven normalisation rule, which is very hard
for inlining/substitution optimisations often
do surprising things .. so they need lots of testing.
you will finally discover:
(j) It is VERY hard to test them. The reason is that
there is no unique 'expected output', because the code
generator is far to fragile with respect to changes
in things like the library, since it uses a fresh
variable generator the sequence numbers of things changes
unpredictably.
Point (j) is critical. We need to find a way to actually
measure if optimisations are working or not. I have a couple
of tools that count the number of C++ classes generated,
and a way to see if it goes down, but no reliable way
yet to actually track this, that is, to provide enough
regression data to ensure a new optimisation doesn't
'undo' others.
About time we got Erick looking at the Ocaml code :)
--
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language