implements PLN-0125
Intrepid/Prometeu/Studio/pipeline/head This commit looks good
JaCoCo Coverage #### Project Overview
No changes detected, that affect the code coverage.
* Line Coverage: 61.95% (17766/28676)
* Branch Coverage: 52.69% (6860/13019)
* Lines of Code: 28676
* Cyclomatic Complexity: 11490
#### Quality Gates Summary
Output truncated.
Test / Build skipped: 15, passed: 643
Intrepid/Prometeu/Studio/pipeline/pr-master This commit looks good
Intrepid/Prometeu/Studio/pipeline/head This commit looks good
JaCoCo Coverage #### Project Overview
No changes detected, that affect the code coverage.
* Line Coverage: 61.95% (17766/28676)
* Branch Coverage: 52.69% (6860/13019)
* Lines of Code: 28676
* Cyclomatic Complexity: 11490
#### Quality Gates Summary
Output truncated.
Test / Build skipped: 15, passed: 643
Intrepid/Prometeu/Studio/pipeline/pr-master This commit looks good
Move lifecycle assembly out of the PBS frontend into a common AssembleLifecyclePipelineStage. PBS emits a typed IRLifecycleDeclaration; the assembler owns wrappers, boot guard, and single project-init execution. Housekeep DSC-0059 with LSN-0062, and include the DSC-0062 PVM/PBX neutrality spec and lesson already present on this branch.
This commit is contained in:
@@ -194,16 +194,20 @@ At minimum, the PBS diagnostics baseline must cover:
|
||||
- `project init must be colocated with frame`,
|
||||
- `Init attribute target invalid`,
|
||||
- `InitAllowed is valid only on SDK host methods`,
|
||||
- `host call not allowed during init`,
|
||||
- `host call not allowed during init`.
|
||||
9. common lifecycle structural diagnostics owned by lifecycle assembly and backend preconditions, including:
|
||||
- invalid or unresolved lifecycle declaration ids and roles,
|
||||
- missing frame root on an executable declaration,
|
||||
- frontend-preassembled derived lifecycle artifacts,
|
||||
- `synthetic wrapper entrypoint missing`,
|
||||
- `published entrypoint is not function index 0`,
|
||||
- `hidden boot guard is missing`,
|
||||
- `synthetic callable origin missing`.
|
||||
9. symbolic asset-reference diagnostics required by backend-owned `Addressable` resolution, including:
|
||||
10. symbolic asset-reference diagnostics required by backend-owned `Addressable` resolution, including:
|
||||
- unresolved terminal asset reference,
|
||||
- namespace-versus-terminal asset misuse,
|
||||
- structurally invalid symbolic asset path admitted by source syntax but rejected by semantic surface rules.
|
||||
10. ignored-value diagnostics for expression statements, including:
|
||||
11. ignored-value diagnostics for expression statements, including:
|
||||
- a stable warning when a materialized value is produced and then ignored,
|
||||
- and no warning for unit-like expression statements.
|
||||
|
||||
|
||||
@@ -86,10 +86,12 @@ For each admitted PBS source unit and callable in the current lowering slice, PB
|
||||
4. source attribution anchor (`file + span`) for diagnostics and traceability,
|
||||
5. source-observable parse intent for statement/expression structure (including precedence/associativity outcome already fixed by AST shape).
|
||||
6. deterministic `requiredCapabilities` derived from admitted host-binding metadata for packer/runtime-manifest assistance.
|
||||
7. compiler-selected published-wrapper entrypoint identity for backend handoff,
|
||||
8. explicit global and synthetic lifecycle structure required by executable lowering.
|
||||
7. a typed `IRLifecycleDeclaration` for executable programs, with file-init fragment, optional project-init, and required frame-root references,
|
||||
8. explicit user globals and frontend-lowered file-init fragments required by later common lifecycle assembly,
|
||||
9. backend-owned symbolic identities that must survive to later executable lowering, including symbolic asset references when admitted by the source slice.
|
||||
|
||||
PBS lowering MUST NOT emit module init, project-init wrapper, published frame wrapper, physical entrypoint, or boot guard. Those artifacts are produced exclusively by common lifecycle assembly.
|
||||
|
||||
Lowering must not collapse source categories in a way that erases required declaration/callable identity needed by downstream diagnostics or conformance assertions.
|
||||
|
||||
The normative contract is obligation-based, not tied to one mandatory in-memory class graph.
|
||||
@@ -221,20 +223,18 @@ It does not replace:
|
||||
2. `docs/specs/compiler/21. IRVM Optimization Pipeline Specification.md`,
|
||||
3. or `docs/specs/compiler/15. Bytecode and PBX Mapping Specification.md`.
|
||||
|
||||
### 12.7 Executable Lifecycle and Published Wrapper Obligation
|
||||
### 12.7 Executable Lifecycle Declaration Obligation
|
||||
|
||||
For executable PBS frontends, PBS lowering must preserve the compiler-selected published wrapper rather than a frontend-declared nominal entrypoint.
|
||||
For executable PBS frontends, PBS lowering MUST emit a typed `IRLifecycleDeclaration` rather than assembling the published lifecycle.
|
||||
|
||||
At `IRBackend` emission time:
|
||||
At frontend `IRBackend` emission time:
|
||||
|
||||
1. the lowered graph must contain explicit lifecycle structure for:
|
||||
- user-authored globals,
|
||||
- file init fragments,
|
||||
- module init,
|
||||
- project init when present,
|
||||
- and the published frame wrapper,
|
||||
2. the published frame wrapper must be the effective entrypoint identity handed to common backend stages,
|
||||
3. the userland callable marked with `[Frame]` must remain distinguishable as the logical frame root,
|
||||
4. the wrapper must own final `FRAME_RET`,
|
||||
5. common backend stages must not reintroduce manifest-owned or `FrontendSpec`-owned nominal entrypoint authority,
|
||||
6. and hidden compiler-owned lifecycle state such as the boot guard must remain structurally distinguishable from user globals.
|
||||
1. PBS MUST retain marker admission for `[Init]`, `[Frame]`, and `InitAllowed`,
|
||||
2. PBS MUST emit typed references for:
|
||||
- file-init fragments that include global materialization and non-project `[Init]`,
|
||||
- the optional project-init callable, which is the `[Init]` colocated with `[Frame]`,
|
||||
- and the required frame-root callable marked with `[Frame]`,
|
||||
3. the colocated project init MUST be excluded from file-init fragments,
|
||||
4. module order in the declaration MUST propagate the explicit dependency order already derived from resolved project/module data, without sorting by `FileId`, textual module name, or synthetic callable name,
|
||||
5. PBS MUST NOT emit module init, project-init wrapper, published frame wrapper, physical entrypoint, or boot guard,
|
||||
6. and common lifecycle assembly remains the owner of derived artifacts, including the published wrapper that becomes the physical entrypoint and owns the final frame return.
|
||||
|
||||
@@ -250,6 +250,8 @@ Rules:
|
||||
- A file may declare at most one `[Init]`.
|
||||
- The `[Init]` colocated with `[Frame]` is the project init.
|
||||
- Project init must be colocated with `[Frame]`.
|
||||
- PBS static semantics and lowering admit those markers and translate them into a typed `IRLifecycleDeclaration`.
|
||||
- PBS MUST NOT materialize module init, project-init wrapper, published frame wrapper, physical entrypoint, or boot guard; those artifacts belong to common lifecycle assembly.
|
||||
- `InitAllowed` is valid only on SDK host methods and is invalid on userland `fn`, `global`, `service`, `const`, `struct`, `contract`, and callback surfaces.
|
||||
- A host method signature in a reserved stdlib/interface module MUST carry exactly one `Host` attribute.
|
||||
- A host method signature in a reserved stdlib/interface module MUST carry exactly one `Capability` attribute.
|
||||
|
||||
@@ -102,17 +102,21 @@ Executable PBS programs have a logical bootstrap sequence before ordinary frame
|
||||
Normative order:
|
||||
|
||||
1. materialize globals for each file according to dependency order,
|
||||
2. execute that file's `[Init]`, if present,
|
||||
2. execute that file's non-project `[Init]`, if present,
|
||||
3. compose those steps into one synthetic module init per module,
|
||||
4. execute project init, if present,
|
||||
4. execute project init exactly once, if present, after all module initializers,
|
||||
5. then invoke the userland callable marked with `[Frame]`.
|
||||
|
||||
The `[Init]` colocated with `[Frame]` is project init. It MUST NOT also run as a file-init fragment.
|
||||
|
||||
Lifecycle bootstrap is one-shot:
|
||||
|
||||
- no automatic retry occurs after boot failure,
|
||||
- failure during module init aborts boot,
|
||||
- failure during project init aborts boot.
|
||||
|
||||
Common lifecycle assembly materializes this order from the typed declaration. PBS remains the language source of marker meaning; it is not the owner of the published wrapper.
|
||||
|
||||
## 6.2 Logical frame root and physical wrapper
|
||||
|
||||
PBS distinguishes the logical frame root from the physical published entrypoint:
|
||||
|
||||
Reference in New Issue
Block a user