-
Notifications
You must be signed in to change notification settings - Fork 0
Dead code detection and tree-shaking #45
Copy link
Copy link
Open
Labels
codegenJIT, AOT, FIR lowering, runtimeJIT, AOT, FIR lowering, runtimeenhancementNew feature or requestNew feature or requestmediumShould get done, not urgentShould get done, not urgenttype-systemType checker, inference, generics, traitsType checker, inference, generics, traits
Metadata
Metadata
Assignees
Labels
codegenJIT, AOT, FIR lowering, runtimeJIT, AOT, FIR lowering, runtimeenhancementNew feature or requestNew feature or requestmediumShould get done, not urgentShould get done, not urgenttype-systemType checker, inference, generics, traitsType checker, inference, generics, traits
Two related features:
Dead code warnings (typechecker)
The typechecker already knows which symbols are referenced. Add a pass that walks from
main(), builds a reachability graph, and warns on unreferenced top-level functions, classes, and imports. This includes methods on DynamicReceiver classes where match arms inmethod_missingalign to known methods, those branches can be statically resolved and included in the call graph.Tree-shaking (codegen)
Once the typechecker marks unreachable code, the FIR lowerer can skip emitting it entirely. For AOT builds this reduces binary size. For JIT it reduces compile time.