feat(vm): add reference identity and deterministic value hashing

This commit is contained in:
2026-10-23 14:29:00 +01:00
parent 57992cf214
commit 69ad1931de
41 changed files with 2521 additions and 121 deletions
+17 -2
View File
@@ -107,9 +107,10 @@ Example:
- Rows must remain unique by both `(canonical_name, canonical_version)` and `final_id_hex` / `final_id_dec`.
- Rows must remain deterministically ordered by final ID.
- parameter_names uses ordered | separated names for flattened argument slots.
- cost_model is fixed or random_rejection_v1. cost_cycles is the full fixed
- cost_model is fixed, random_rejection_v1, or argument_utf8_bytes_v1. cost_cycles is the full fixed
cost or the variable base. attempt_cost_cycles/max_attempts are zero for
fixed entries; random.range publishes base 4, attempt 8, maximum 64.
fixed and String byte-cost entries; random.range publishes base 4, attempt 8, maximum 64.
hash.string publishes base 8, argument index 0 and one cycle per UTF-8 byte.
- Mathematical and random attempts charge upfront, including failure, without
an additional generic INTRINSIC cycle. Random draws retain attempt costs.
- mutates_guest_state distinguishes reproducible stateful calls from pure
@@ -207,3 +208,17 @@ source-selected Struct destinations. Its schema is an ordinary Registry Struct;
no new category, request object, syscall or safepoint is introduced. Exact nullable
destination rules, stack effects, validation, costs and commit semantics are in the
[canonical instruction contract](../specs/runtime/02-vm-instruction-set.md#atomic-publication-of-multiple-struct-instances).
## Identity/hash and catalog schema 2
The [identity/hash specification](../specs/runtime/02f-vm-identity-and-value-hashing.md)
defines opcodes 0x0097/0x0098, intrinsics 0x4100–0x4102, XXH64 hash-v1 and
borrowed_inline_v1. INTRINSICS.csv schema 2 retains its original eighteen columns
and appends schema_version, arg_nullable, invocation_model, scratch_model,
context_access, cost_arg_index and cost_per_byte. Descriptors remain authoritative;
unknown or inconsistent schemas/profiles/models must fail explicitly. Existing
canonical versions, signatures, effects and costs remain unchanged.
See the [identity/hash producer handoff](identity-hashing-producer-handoff.md) and
[qualification record](IDENTITY_HASHING_QUALIFICATION.md) for emitted PBX, catalog
provenance and consumer acceptance evidence.