feat(pbs): implement first-class functions and explicit captures
This commit is contained in:
@@ -7,7 +7,7 @@ From the Studio root:
|
||||
|
||||
```sh
|
||||
./gradlew :prometeu-compiler:prometeu-build-pipeline:test --tests '*LinkedRegistryTest' --tests '*PbxRegistryConformanceTest' --tests '*TypedCommonPipelineTest' --tests '*RuntimeCatalogPipelineTest'
|
||||
./gradlew :prometeu-architecture-tests:test --tests '*PbsRuntimeAlignmentTest' --tests '*PbsStructuredValuesTest'
|
||||
./gradlew :prometeu-architecture-tests:test --tests '*PbsRuntimeAlignmentTest' --tests '*PbsStructuredValuesTest' --tests '*PbsClosuresTest'
|
||||
python3 tools/pbx-conformance/run.py --runtime ../runtime
|
||||
```
|
||||
|
||||
@@ -112,3 +112,22 @@ nested references, tuples and strings remain readable. `resource-diagnostics`
|
||||
is enabled solely for observation. Default production ceilings and GC threshold
|
||||
are unchanged outside the explicitly lowered quota runs. This is semantic and
|
||||
resource conformance, not a performance benchmark or installed game qualification.
|
||||
|
||||
## PBS first-class functions and closure lifetime
|
||||
|
||||
`PbsClosuresTest` adds nine mandatory source/load/execute fixtures: named and
|
||||
anonymous functions, snapshots, shared objects/arrays, nested function captures,
|
||||
complete tuple groups and contract receivers, independent environments, Fn fields
|
||||
and overload selection, imported functions, and the installed example. Each
|
||||
returns 42. Six additional GuestBytes/HandleSlots runs at limits 0, 1 and 2 check
|
||||
closure allocation faults and session ownership, bringing structured quota runs
|
||||
to 24.
|
||||
|
||||
The tenth fixture, `closure-frame-lifecycle.pbx`, uses the existing production
|
||||
lifecycle assembler without bytecode patching. Its first frame stores a closure
|
||||
capturing an object; the next frame invokes it twice (41, then 42) and drops the
|
||||
reference. Each of three frames also discards 1,200 closures. The harness asserts
|
||||
threshold collections, retained closure/object reachability after frame one,
|
||||
and reclamation after release. The remaining root is the global array.
|
||||
PBS publishes FRAME_ROOT and the existing guarded wrapper returns normally.
|
||||
No sync syntax, new frame integration, suspension or coroutine is introduced.
|
||||
|
||||
Reference in New Issue
Block a user