From: Peter D. <pe...@re...> - 2007-03-30 08:50:42
|
Hi, On 3/21/07, David P Grove <gr...@us...> wrote: > How to deal with the opt compiler. I've held a variety of opinions on this > over time ranging from "invest in fixing all of it" to "junk it and start > over." My current thinking is that the plan with the best expected value is > an intermediate point: where we invest in fixing core data structures, O0 > and O1 and ignore/remove O2. It's appealing to think about starting fresh, > but that's such a significant development effort that my swag is that it > would take much longer to start over and get back to where we are now (both > in terms of performance and stability) than doing the less fun thing of > killing O2 and spending several months of serious effort re-engineering the > core data structures and the remaining O0 and O1 optimizations (possibly > removing some of them too and/or salvaging a few things from O2). One thing I would really, really, really like to see is a unit test framework for the opt compiler - IMHO an integration test framework does not cut it. There have been times I would have liked to have made changes to opt compiler but was not confident that what I was doing was going to produce correct code. So I would suggest that one of the best strategies to make the opt compiler more reliable is to get a test framework in place where you could add tests when modifying the system. Essentially every test would include * an input string that is written in appropriate IR "assembly". * a generation context that you could load runtime data into (like already resolved classes+existing bytecode) + a bunch of constants like memory offsets, endianess etc. * a set of optimizations/phases/etc to apply And each test would produce some output that is IR assembly. In theory you could isolate each optimization phase and test it individually as well as when integrated with specific other optimizations/passes/phases/whatever. Besides making the system easier to verify I think it would also encourage others to start experimenting with the compiler. -- Cheers, Peter Donald |