fixed for jump control flow
This commit is contained in:
+1
-62
@@ -19,68 +19,7 @@
|
||||
|
||||
---
|
||||
|
||||
## PR-00 — Compiler: Enforce PBS entry point and inject FRAME_SYNC in main.pbs::frame()
|
||||
|
||||
### Briefing
|
||||
|
||||
PBS requires a single logical entry point: `src/main/modules/main.pbs::frame(): void`. The VM relies on `FRAME_SYNC` as a **signal-only safe point** to perform GC work between logical frames. Today the compiler does not guarantee either the existence of this entry point nor the injection of `FRAME_SYNC`.
|
||||
|
||||
### Target
|
||||
|
||||
1. **Entry point validation** (fatal error at compile time):
|
||||
|
||||
* Ensure the root project contains file `src/main/modules/main.pbs`.
|
||||
* Ensure that file declares `fn frame(): void`.
|
||||
* If missing, emit a **fatal diagnostic** and abort compilation.
|
||||
2. **FRAME_SYNC injection** (only for the entry point):
|
||||
|
||||
* In lowering/codegen for `main.pbs::frame(): void`, ensure the epilogue emits:
|
||||
|
||||
* `FRAME_SYNC` **immediately before** `RET`.
|
||||
|
||||
### Non-goals
|
||||
|
||||
* Do not inject `FRAME_SYNC` into any other function named `frame`.
|
||||
* Do not add any GC opcode or GC scheduling metadata into bytecode.
|
||||
* Do not change runtime behavior besides the presence of `FRAME_SYNC` at the safe point.
|
||||
|
||||
### Implementation notes
|
||||
|
||||
* Identify the entry point by **(file path + function name + signature)**:
|
||||
|
||||
* file: `src/main/modules/main.pbs`
|
||||
* function: `frame`
|
||||
* return: `void`
|
||||
* (parameters: must be none)
|
||||
* The safest place to inject is at the end of lowering for `Return` in that function:
|
||||
|
||||
* Emit `FRAME_SYNC` just before emitting `RET`.
|
||||
* Prefer to implement entry point existence checks in an early phase (project scan / module discovery) so errors are clear.
|
||||
|
||||
### Tests
|
||||
|
||||
1. **Positive**: project with `main.pbs` and `fn frame(): void` compiles.
|
||||
2. **Injection**: compiled bytecode for entry point contains `FRAME_SYNC` right before `RET`.
|
||||
|
||||
* Acceptable test forms:
|
||||
|
||||
* bytecode disasm snapshot test, or
|
||||
* inspect emitted instruction stream before encoding.
|
||||
3. **Negative**:
|
||||
|
||||
* Missing `main.pbs` => fatal compile error.
|
||||
* `main.pbs` exists but missing `frame` => fatal compile error.
|
||||
* `frame` exists with wrong signature (params or non-void) => fatal compile error.
|
||||
|
||||
### Acceptance criteria
|
||||
|
||||
* Compiler rejects projects without the entry point with a clear fatal diagnostic.
|
||||
* Compiler injects `FRAME_SYNC` **only** in `main.pbs::frame(): void`.
|
||||
* `FRAME_SYNC` is placed **immediately before** `RET` in the entry point epilogue.
|
||||
|
||||
---
|
||||
|
||||
## PR-01 — Linker: Relocate control-flow jump targets when concatenating modules
|
||||
# PR-01 — Linker: Relocate control-flow jump targets when concatenating modules
|
||||
|
||||
### Briefing
|
||||
|
||||
|
||||
Reference in New Issue
Block a user