Final Report: Raku Dispatch and Compiler Improvements Grant Update
Mon, 25-Oct-2021 by
Jason A. Crome
edit post
(from Jonathan Worthington)
During September, I completed the remaining hours on [my current grant](https://news.perlfoundation.org/post/grant_proposal_raku_dispatch_compiler_improvements).
The key aim of the grant - to bring my work on a new generalized dispatch mechanism to the point where it
could be merged and delivered to Raku users - has been achieved, the merge taking place on 29th September.
I wrote a [blog post](https://6guts.wordpress.com/2021/09/29/the-new-moarvm-dispatch-mechanism-is-here/)
that provides some data on the improvements, as well as identifying future work that can build upon what
has been achieved thus far.
During September, working under the grant, I:
* Implemented specialization and inlining of dispatches that store resume initialization state, to allow
the dispatches to be resumed (for example, if `callsame` is used). This was a critical part of getting
back the level of inlining for method calls and multi dispatches that existed prior to this work, which
is a critical factor in Raku performance.
* Implemented caller-side removal of `Scalar` containers, which in turn avoids various duplicate guards,
leading to much tighter code being produced after specialization and JIT compilation in many common
situations.
* Fixed `Junction` multi-dispatch failover for the case where the `Junction` was in a named argument,
along the way tweaking the semantics to be more consistent with those of positional arguments (there
were some unintended discrepancies in the previous implementation).
* Changed dispatch program compilation to not emit type guards when the types were already proven during
optimization, rather than adding them and relying on them to be optimized out later.
* Reinstated all known missing optimizations from prior to the new dispatch work, and added JIT support
for various new operations introduced during the work.
* Did various modifications to improve startup time, which has regressed. The new dispatch model has
many advantages, however does carry a higher warmup cost.
* Fixed the profiler to work again in programs that use continuations, after changes to the continuation
representation as part of callstack changes.
* Did numerous smaller fixes for bugs identified by `blin` (which runs the tests of all modules in the
ecosystem). In some cases where the modules relied on internals or unspecified behavior, I sent a PR
to the module instead.
The time worked during September was 55 hours and 18 minutes, which was the remaining grant time
available.
Comments (0)