CompiledProgramRoot
scalus.compiler.CompiledProgramRoot
object CompiledProgramRoot
Home of the compile / compileWithOptions macro emission — and, deliberately, the source position that every compiled program inherits at its outermost node.
Why this lives in its own file, with this name:
PlutusVx.compile(code)expands (viacompileInline*) into thecompileWithOptions(...)call generated below. That call is the outermost node of the whole program, so its source position becomes the program's root position. The Scala→SIR→UPLC pipeline strips source positions from most of the generatedApply/Case/Constrspine, and the post-optimization position-fill (scalus.uplc.Compiled.toUplc) back-fills those nodes from their nearest positioned ancestor — which, for framework glue with no user code inside it, is this root. So a large amount of compiler-generated glue used to be attributed to whatever line this macro happened to sit on (it wasMacros.scala:589), turning that line into a fake profiling hot-spot and a call-graph hub.- Giving the macro its own file with a stable, descriptive name makes that attribution (a) self-documenting in profiles — it reads as
CompiledProgramRoot:N, not a randomMacros:589— and (b) immune to line drift when unrelated macros are edited. - Tooling treats positions in this file as effectively empty (scalus.utils.ScalusSourcePos.isEffectivelyEmpty), so the position-fill and the profiler attribute generated glue to the nearest real user code instead of pooling it here. Keep this file's basename in sync with scalus.utils.ScalusSourcePos.syntheticMarkerFile.
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
CompiledProgramRoot.type
Members list
In this article