This would be the best solution to test if an optimization works as expected. We can create the following framework inside Jitrino compiler to test individual optimizations and optimizations inter-dependencies:
Create a special optimization ("test") that that works only for "special" Java method (jitrino.TestCase.testJitrino) during the compilation. It works in the following way: 1) Cleans current IR 2) Set up some kind of template IR: e.g. IR with 1 loop and a const inside the loop 3) Runs a test that uses internal Jitrino API and checks the results: e.g. runs some loop optimizations and checks that constant is moved out from the loop. 4) Restores initial IR of the method. Such tests could be run from junit with a special adapter as usual Java tests. Does it makes sense? Any other ideas or experience how to test compiler optimizations predictably? On 9/14/06, Pavel Ozhdikhin <[EMAIL PROTECTED]> wrote:
*Re-sending to the new thread:* The right solution might also be a JIT testing framework which would understand the JIT IRs and check if some code patterns have been optimized as expected. Such way we can guarantee necessary optimizations are done independently of the user environment.
-- Mikhail Fursov