I wouldn’t be so quick to dismiss this. You favor the term “cooking”, and to press the analogy, a meal isn’t usually served as a monolith. There are several courses, each dish has several components and sides, diners can savor a bite at a time. Emergency ration bars are technically monoliths, but they’re actually not trivial to make. Chances are you do in fact have several dishes if you change your perspective.
For example, one of the features you introduced is a heap allocation check. Diving into one example arr = [i for i in 1:n] in your blogpost, the underlying routine is:
julia> analyze_escapes(bad_code,(Int,))
EscapeAnalysisReport(AllocationInfo[AllocationInfo(true, 64, "line 19 (collect)", true)], 0, 0, :bad_code)
And the way that works is that check_allocation_expr examines lowered expressions for array-allocating functions like collect. Neat, let’s try another:
julia> foo() = [1,2,3];
julia> analyze_escapes(foo,())
EscapeAnalysisReport(AllocationInfo[], 0, 0, :foo)
Uh oh, a miss. The problem is that expression lowers to Base.vect, and that is not among the function names that check_allocation_expr checks. You could add that one, but it’s just a drop among all the functions that can allocate, and arrays are not the only thing that need allocations.
julia> bar() = Ref(1);
julia> analyze_escapes(bar,())
EscapeAnalysisReport(AllocationInfo[], 0, 0, :bar)
Another miss, and I haven’t even tried mutable structs. Meanwhile, the rest of your PR is blocked by this problem even if there were no other issues, and if this problem is fixed, the other completely unrelated problems in your PR (say, the overly strict check on abstract types and dubious verification score cutoff) in turn block it from being merged.
StaticCompiler may not even be the right place for these changes. Despite your intended application, static allocation checks do not necessarily concern AOT compilation without the runtime, and it could be a separate package entirely that is suggested as a dependency or as independent tooling (like StaticTools) for StaticCompiler. In fact, the AllocCheck.jl package does just that. I don’t know its limits, but it at least succeeds at the few examples here.