feat(supervisor): add first-class pool views with Option-returning get#2672
Open
slepp wants to merge 1 commit into
Open
feat(supervisor): add first-class pool views with Option-returning get#2672slepp wants to merge 1 commit into
slepp wants to merge 1 commit into
Conversation
Bare sup.pool now yields a SupervisorPool<S,T> view supporting len(), trapping [i], and get(i) -> Option<LocalPid<T>>; the former compile-time rejections for whole-pool field access are removed. The (supervisor, pool_key) pair travels as a typed runtime value, replacing the HIR fail-closed gate and its span-rekeyed plumbing. LocalPid remains a borrow handle — no retain/release.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Supervisor pool accessors were fail-closed in two places: whole-field access on a
ChildKind::Poolfield (let workers = sup.workers) was rejected at HIR withSupervisorPoolChildAccessorUnsupported, andsup.pool.get(i)had no Option-returning form — only the trappingpool[i]. Both gaps were deferred from the earlier static-child accessor work; this completes the surface.What
Pool accessors are now complete end-to-end via one substrate change — a first-class
BuiltinType::SupervisorPoolview type{ LocalPid<S>, i64 pool_key }. The (supervisor, pool_key) pair travels as a typed runtime value, solen(), trapping[i], andget(i)all work on a bound view, not just the syntacticsup.pool.…form.SupervisorPool<S,T>;get(i)types asOption<LocalPid<T>>; pool indexed assignment and unknown pool methods are rejected with typed errorsNotYetImplementedPool arm emitsRecordInit{ sup_handle, pool_key };getroutes the existinghew_supervisor_pool_child_getaggregate-return ABI through ahew_supervisor_pool_get_optionterminator; the old span-rekeyedPoolAccessorside table shrinks to{kind}lower_supervisor_pool_get_option_callmaterialises the registered tagged Option layout (Some=0 / None=1) via the shared enum-variant emission shell, mirroring the string/vec get-option precedent; all new error paths fail closedLocalPidis a borrow handle (supervisor owns the actor) — no retain/release, same contract as the shipped static-child accessorTest
supervisor_pool_get_option.hewfixture: exact stdout84, proves Some-liveness viaawait worker.id()and None at both boundaries (get(-1),get(count))supervisor_pool_field_access.hewfixture: exact stdout37, whole-field pool view bound and usedhew-codegen-rsemission test pinsstore i8 0/store i8 1for both Option arms and the payload-then-tag orderinghew-miractor tests assertRecordInit(SupervisorPool), thehew_supervisor_pool_child_getcall, and the get-option terminator are all reachedhew-typesaddspool_field_view_preserves_accessor_types_after_bindingQuality Checklist
.ok()?orunwrap_or_default()in codegen without// JUSTIFIEDcomment// WASM-TODO(#NNN):marker, and newhew_*exports are classified inscripts/jit-symbol-classification.toml(no new runtime exports — consumes the existinghew_supervisor_pool_child_get)Out of scope
{ptr, i64}SupervisorPool struct layouts (resolve_ty/record_struct_for) into a shared helper