Repository metrics
- Stars
- (1,169 stars)
- PR merge metrics
- (PR metrics pending)
Description
We would like to be able to modify IRs at various levels to simulate the effects of a compiler change. In most cases the plumbing for this would be very difficult, but labLang is nearly identical in scope to a traditional assembly language and it would be possible to dump labLang as editable assembly in arch-specific syntax.
Have a theory that the garbage collector is slow because it copies one word at a time? Make some changes in _Gc and see what happens.
Want to do rough call-stack profiling, but debug information isn't even on the roadmap yet? Calls and returns are easy to pattern match at this point, the dumper could have a feature to maintain a C-compatible shadow stack.
Want to recognize allocation sites and add a tracepoint? Also doable.
My initial plan is an unverified SML program which parses --explore output and translates the labLang JSON dump into assembly syntax, initially x64 only but with allowance for other targets, probably also with a hook in compilationLib. There's an argument to be made for better integration with the bootstrapped compiler but I don't want to pay the size and bootstrapping time cost there.
Since this is duplicating encoder logic there's some potential to get out of sync with the encoder used for normal compilation. Hopefully won't be an issue.