In this meeting we talked about the language features that our language needs to have to support runtime compilation. We came up with the following requirements:
The second topic was going back to last week's meeting and figuring out how the optimization of the guards in SPIN could be done. Craig proposed that the guard code could be optimized if we have define a little language in which the guards are expressed. Then they are implemented by a little interpreter. That interpreter would use the source code (or some derived IR) to execute the guards. As its input (the IR) would be static it could be optimized away into a compiler, i.e. the guard code would essentially be runtime compiled in a decision tree. There is currently one problem with that scenario. The main loop of such an interpreter would look like that: (interpreting the source tree)
t := root; while ... do if (t.eval_expr) then t := t.left else t := t.right end endCurrently at the end of an IF a merge would be done which would make the t dynamic and no compilation into a decision tree would result. Adding a special annotation to the IF to advise that the two branches should not be merged could solve the problem. Instead of fixing the loop unrolling in that way a recursive implementation of the interpreter could be used if unrolling of recursion were handled well. This needs to be looked at more.