Add sk_hermes_decay(), ledgering decay into consumed -- FABRIC-3.6.md task 2.5
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
493d410028
commit
d11eb2e5db
@@ -203,8 +203,8 @@ int sk_hermes_release(SkHermesMessage *msg);
|
||||
* held -= returned amount -- sk_hermes_release(), on success only
|
||||
* pulled += pulled amount -- sk_hermes_alloc(), same site as held's
|
||||
* returned += returned amount -- sk_hermes_release(), same site as held's
|
||||
* consumed += decay delta -- task 2.5, not yet wired; reads 0 until
|
||||
* then
|
||||
* held -= decay delta -- sk_hermes_decay(), same site as consumed's
|
||||
* consumed += decay delta -- sk_hermes_decay() (task 2.5)
|
||||
*
|
||||
* The audit invariant this ledger exists to make checkable (task 2.6,
|
||||
* epsilon zero): held == pulled - returned - consumed. All four are
|
||||
@@ -218,10 +218,32 @@ int sk_hermes_release(SkHermesMessage *msg);
|
||||
* @param returned Set to the cumulative total ever returned (may be
|
||||
* NULL).
|
||||
* @param consumed Set to the cumulative total ever consumed by decay
|
||||
* (may be NULL) -- always 0 until task 2.5.
|
||||
* (may be NULL).
|
||||
*/
|
||||
void sk_hermes_ledger(uint64_t *held, uint64_t *pulled, uint64_t *returned, uint64_t *consumed);
|
||||
|
||||
/*
|
||||
* SK_HERMES_Q_DECAY - per-application decay factor, Q48.16. Identical to
|
||||
* messaging.4th's `65208 CONSTANT Q-DECAY` (65208/65536 ~= 0.99499):
|
||||
* FABRIC-3.5.md SXL.4 rules that the consumption economy is preserved
|
||||
* exactly, not re-tuned.
|
||||
*/
|
||||
#define SK_HERMES_Q_DECAY ((uint64_t)65208)
|
||||
|
||||
/*
|
||||
* sk_hermes_decay - Apply one decay step to a live message (task 2.5,
|
||||
* item 28), mirroring MSG-COOL-ONE (`MSG-HEAT@ Q-DECAY Q.* MSG-HEAT!`):
|
||||
* the message's Stadium-cell heat becomes q48_mul(heat, Q_DECAY). Unlike
|
||||
* MSG-COOL-ONE, the destroyed difference is RECORDED (SXXXVII.3): the
|
||||
* delta heat_before - heat_after is added to `consumed` and subtracted
|
||||
* from `held`, so held == pulled - returned - consumed stays exact.
|
||||
*
|
||||
* @param msg A live slot from sk_hermes_alloc(). Refused (returns -1, no
|
||||
* effect) if NULL, not in use, or holding no Stadium cell.
|
||||
* @return 0 on success, -1 if refused.
|
||||
*/
|
||||
int sk_hermes_decay(SkHermesMessage *msg);
|
||||
|
||||
#endif /* __STARKERNEL__ */
|
||||
|
||||
#endif /* STARKERNEL_VM_KERNEL_HERMES_H */
|
||||
|
||||
Reference in New Issue
Block a user