blob: a6c8a183715362e78a7573cf3be9a540bc60d646 [file]
// Generated by src/wasm/idl/generate.py from shared_layout.py. Do not edit.
//
// The shared memory words librive and rive_shared_lane.mjs both read,
// as byte offsets into librive's heap.
// What a block holds, its first word.
export const kKindRegion = 0;
export const kKindRing = 1;
export const kKindSnapshot = 2;
export const kKindSignal = 3;
export const kKindBlob = 4;
// Every block starts with these words.
export const kHeaderKind = 0;
export const kHeaderLock = 4;
export const kHeaderCapacity = 8;
// A region after its header.
export const kRegionPoisoned = 16;
export const kRegionData = 32;
// A ring after its header; signals are registry ids.
export const kRingHead = 16;
export const kRingUsed = 20;
export const kRingDataSignal = 24;
export const kRingSpaceSignal = 28;
export const kRingData = 32;
// A snapshot after its header: copies of capacity bytes each, a version per
// copy that is odd while a publish writes it.
export const kSnapshotLatest = 16;
export const kSnapshotSeq = 24;
export const kSnapshotSeqHigh = 28;
export const kSnapshotVersions = 32;
export const kSnapshotSizes = 40;
export const kSnapshotData = 48;
export const kSnapshotCopies = 2;
// A ring record's length word or a snapshot copy's size. With the holds bit
// set, the bytes end in the shared ids the value holds and then their count.
export const kRecordHolds = 0x80000000;
// A signal after its header; watchers point at wake words.
export const kSignalWatcherCount = 16;
export const kSignalSeq = 24;
export const kSignalSeqHigh = 28;
export const kSignalWatchers = 32;
// A blob after its header: bytes fixed once made.
export const kBlobData = 16;
// The futex word a watcher parks on.
export const kWakeWordWord = 0;
// The registry, at SharedRegistry::table().
export const kTableLanes = 16;
export const kTableTokens = 144;
export const kTableChunks = 148;
// A registry slot. Its state packs the generation in the low bits, a live bit,
// then the pins librive holds.
export const kSlotState = 0;
export const kSlotBlock = 4;
export const kSlotOwner = 16;
export const kSlotOwnerHigh = 20;
export const kSlotSize = 24;
export const kSlotLive = 4096;
export const kSlotPin = 8192;
// Slots come in chunks that never move once made.
export const kChunkShift = 10;
export const kChunkSlots = 1024;
// An id: the top bit, its slot, the generation's low bits.
export const kIdBit = 0x80000000;
export const kIdSlotShift = 12;
export const kIdGenerationMask = 4095;
// Lanes without librive.
export const kLaneCount = 32;
export const kLaneIdle = 1;
export const kLaneFirstToken = 2;
// What ring_write answers.
export const kRingWriteFull = 0;
export const kRingWriteWritten = 1;
export const kRingWriteNeverFits = 2;
// What region_lock answers.
export const kRegionLockGone = 0;
// Words of the counter an NRDP page shares with its worklet thread, so it can
// free what the thread held when it ends it.
export const kHoldBlocks = 0;
export const kHoldStarting = 1;
export const kHoldToken = 2;
export const kHoldLock = 3;
export const kHoldWords = 4;