The C# runtime that MAGIC-compiled assemblies call into for dynamic dispatch.
Two projects:
Magic.Runtime/is the runtime proper. Compiles toMagic.Runtime.dll, which compiled.clj.dlls reference by name.Dispatchresolves zero-arity members, instance methods, static methods, and constructors at call time when MAGIC could not statically bind them.BinderandEmissionback the call-site cache that the compiler emits inline.Runtimeexposes entry points used at host load time (InvokeInitType,TryLoadInitType,FindType).Magic.Runtime.Callsites/is a build-time code generator (a standalone .NET program, not loaded at runtime). It reads the*.mustachetemplates in that directory and writes per-arity call-site, cache, and delegate-helper classes intoMagic.Runtime/Generated/*.g.csfor arities 1 through 20. The compiler emits IL that targets those generated types directly, so editing a template requires regenerating the.g.csfiles before the runtime can be rebuilt.
| You changed | Run |
|---|---|
Magic.Runtime/**/*.cs |
bb dev-runtime |
Magic.Runtime.Callsites/*.mustache |
bb dev-callsites (regenerates .g.cs first, then rebuilds the runtime) |
See the top-level README for the full development workflow.
bb check-drift fails CI if .g.cs files are stale relative to the mustache sources, so regenerated output must be committed alongside template edits.
Compiled .clj.dlls reference Magic.Runtime.dll by name. New runtime bodies are picked up at load time, no compiler rebootstrap needed. This is why bb dev-runtime is the fast iteration loop (seconds) and bb dev-compiler is the slow one (minutes).
Copyright (c) 2017-2023 Ramsey Nasser and contributors. Licensed under the Apache License, Version 2.0.