Skip to content

Auto-infer transitive inline directives on synthetic specializations #241

Description

@Unisay

Problem

With graduated directives in place, a user still has to annotate every compiler-synthesized specialization by hand. The compiler can infer them: after optimizing a binding, if it reduced to an eta-alias (a reference applied to k arguments), copy the target's policy with arity=N becoming arity=(N - k); if the binding is a synthetic dictionary specialization applied to at least its arity, mark it always-inline. A specialized instance method then inherits unconditional inlining with no annotation.

Approach

After the optimize fixpoint settles a binding, inspect its final shape. An eta-alias inherits the target's directive with the arity decremented by the applied arguments; a synthetic specialization saturated to its arity is annotated always-inline. Emit these as derived directives that feed back into the inliner, bounded so the derivation itself terminates.

Prerequisites / Relations

Blocked by #232 (the graduated @inline directives issue): there is no arity policy to propagate without it. Pairs with the default-directive pack: together they remove the need to hand-annotate both the library primitives and their compiler-generated specializations.

Verification / Measurement

A synthetic specialization of a directive-carrying combinator inlines at its saturated sites with no hand-written pragma, in an end-to-end golden; a non-saturated alias keeps the arity-decremented policy rather than inlining. Corpus size effect through #172.

Metadata

Metadata

Assignees

No one assigned

    Labels

    OptimisationA Compiler Optimisationarea: irIR / optimizer / DCE / inlinerenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions