feat(pbs): add Set and reusable identity hashing

This commit is contained in:
2026-10-25 12:15:13 +00:00
parent 632ba6d0d6
commit 8105604f92
59 changed files with 4190 additions and 34 deletions
@@ -129,3 +129,11 @@ explicit identity and width; common lowering resolves constant groups against
`IRVMBuiltinConstantDefinition` and checks the declared result width. PBS does
not introduce another catalog. Source execution and the full installed example
are separate consumer gates beyond CSV parity.
The [PBS hashing/Identity facade](../../pbs/specs/sdk-set-and-identity.md#hash-facade-and-typed-query-boundary)
consumes hash.i64@1, hash.float@1 and hash.string@1 with exact schema-2 profiles,
null admission and attempted costs. Reference hash/equality are typed Registry
instructions rather than intrinsic catalog rows. Consumer support includes their
common IR/emission/verification and full source-to-VM/installed qualification;
catalog parity alone does not establish that integration. Collection algorithms
remain source SDK code and do not add provider collection syscalls.
@@ -124,6 +124,8 @@ fallthrough past the end is invalid.
| CALL_TRAIT `0x58` | Trait TypeId, method index |
| DYN_PACK/UNPACK/CAN_UNPACK `0x90`–`0x92` | TypeId |
| Reference operations `0x93`–`0x96` | source TypeId, target TypeId |
| REF_IDENTITY_HASH `0x97` | source TypeId; full source group → Int64 |
| REF_IDENTITY_EQ `0x98` | left TypeId, right TypeId; full left/right groups → Bool |
| STRUCT_NEW `0xa0` | Struct TypeId |
| STRUCT_GET/SET `0xa1`–`0xa2` | Struct TypeId, field index |
| Array operations `0xa3`–`0xa6` | Array TypeId |
@@ -143,6 +145,18 @@ jump-to-end require exact result width and compatible known facts. GET/SET_LOCAL
address only parameters plus extra locals. No implicit numeric, trait or Dynamic
conversion is introduced by linking, writing or verification.
Typed identity queries accept exactly Struct, Array, Fn, Trait and builtin Random.
They do not widen older reference-conversion category rules. Trait validates its
complete receiver/ImplementationId pair, including valid zero, before querying
the receiver. Both operands validate left-to-right; absent/different left does not
short-circuit right-side validation. Scalar String/Dynamic/private value carriers
are ineligible. Hash consumes w(source) slots and costs 8+w(source); equality
consumes both complete groups and costs 4+w(left)+w(right). Immediates are static
program-local TypeIds (u32 LE after u16 LE opcode), and results preserve provider
faults, signed long bits, provenance and charged attempts, including unused results.
Set algorithms and equality policy remain frontend/SDK consumers, described for
PBS in [Set/Identity](../../pbs/specs/sdk-set-and-identity.md).
HOSTCALL references a declared canonical `(module, name, version)` identity
with exact argument/result slot ABI. Duplicate identities with conflicting ABI,
unused declarations and invalid indices are rejected. Only the runtime loader