The uneventful mid-term week and the future of PAST/Tree Optimization

This has been an uneventful week in my GSoC work.

Parrot's 2.6 release is Tuesday, and I've taken on the task of updating Squaak to modern NQP-rx prior to it. Because of that and my GSoC midterm evaluations, I haven't spent much time hacking on Tree::Pattern or on optimizations using it this week. I plan to finish working on Squaak tonight or tomorrow, commit my fixes to trunk, and finally get back to work on my GSoC project. I'm a little behind schedule now because of that, but I plan to work hard on optimization for the rest of GSoC.

Essentially the only thing I did this week for my GSoC project other than submitting my evaluation was implement and test transformation of PAST::Block.control and .loadinit attributes in Tree::Transformer and Tree::Pattern.

What my proposal had scheduled for this weekend and most of the coming week is the design and implementation of a set of helper classes like LLVM's ModulePass, FunctionPass, LoopPass, etc. I'll catch up on that this week, I hope.

Part of what I have in mind for that is the creation of a library that allows conveniently adding a "past-optimize" stage to a PCT-based HLL compiler and that will allow you to run a number of different optimizations in the compilation process. Hopefully, it will eventually be able to interpret metadata about the dependencies of different optimizations so that it can optimize the order in which the optimizations are ran for maximum effectiveness, much like LLVM's pass manager does, but my immediate goal is to simply provide helper methods for adding new optimizations simply by supplying a sub to invoke on the PAST, a PAST::Pattern with which to transform it, or a PAST::Transformer.

Another thing that I am considering, although it may be too ambitious/foolish a goal to achieve in the remainder of GSoC, is to develop a compiler stage that will convert PAST into some sort of SSA or CPS form to make it easier to apply classic optimization techniques and later transforming it back into a, hopefully more optimized, PAST to be compiled to POST normally. This is an idea that I am only considering. Bacek++ wants it, but I'll need more feedback from chromatic and the Parrot community as a whole before deciding whether I should use the remainder of my GSoC to work on that or to wait and develop it in my free time once GSoC ends.

Regardless of whether I implement a transformation to and from SSA or CPS for PASTs, I will spend the rest of GSoC working primarily on optimizations. Tree::Pattern/Transformer/Walker all work fairly well by now; it's time to focus on using them to make Parrot and its HLLs faster.

Happy hacking and enjoy the upcoming 2.6 release and the revamped Squaak tutorial it will include!