coalton-lang/coalton

Testing optimizer (and more generally, AST modifier)

Opened this issue · 0 comments

Is there an agreed strategy to test if particular optimizer is working as supposed? Coalton-level functional tests don't cut it, for optimized code should behave functionally equivalent to the unoptimized one.

In my Scheme implementation where Scheme is compiled to VM code, the tests examine the VM instruction sequence (using pattern match) to see if optimizer is working.

In Coalton, we can either (1) examine the generated Lisp code, or (2) extract the rewritten AST and examine it. I prefer looking at AST, for it won't be affected by the changes in the later codegen passes. But test code needs to know the internals of AST.

It may also be convenient to have a general mechanism to turn on/off particular optimizations.

If this has been discussed before, could you point me the reference? Thanks.