@oasys/oecs 0.5.2 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +208 -14
- package/README.md +198 -145
- package/dist/core/ecs/access_check.d.cts +3 -3
- package/dist/core/ecs/access_check.d.ts +3 -3
- package/dist/core/ecs/archetype.d.cts +103 -43
- package/dist/core/ecs/archetype.d.ts +103 -43
- package/dist/core/ecs/archetype.d.ts.map +1 -1
- package/dist/core/ecs/archetype_graph.d.cts +8 -8
- package/dist/core/ecs/archetype_graph.d.ts +8 -8
- package/dist/core/ecs/archetype_graph.d.ts.map +1 -1
- package/dist/core/ecs/builtin_relations.d.cts +1 -1
- package/dist/core/ecs/builtin_relations.d.ts +1 -1
- package/dist/core/ecs/command_log.d.cts +4 -4
- package/dist/core/ecs/command_log.d.ts +4 -4
- package/dist/core/ecs/command_log.d.ts.map +1 -1
- package/dist/core/ecs/component.d.cts +4 -4
- package/dist/core/ecs/component.d.ts +4 -4
- package/dist/core/ecs/deferred_commands.d.cts +1 -1
- package/dist/core/ecs/deferred_commands.d.ts +1 -1
- package/dist/core/ecs/deferred_commands.d.ts.map +1 -1
- package/dist/core/ecs/ecs.d.cts +85 -43
- package/dist/core/ecs/ecs.d.ts +85 -43
- package/dist/core/ecs/ecs.d.ts.map +1 -1
- package/dist/core/ecs/ecs_memory.d.cts +15 -15
- package/dist/core/ecs/ecs_memory.d.ts +15 -15
- package/dist/core/ecs/ecs_memory.d.ts.map +1 -1
- package/dist/core/ecs/entity_allocator.d.cts +6 -6
- package/dist/core/ecs/entity_allocator.d.ts +6 -6
- package/dist/core/ecs/entity_allocator.d.ts.map +1 -1
- package/dist/core/ecs/event.d.cts +2 -2
- package/dist/core/ecs/event.d.ts +2 -2
- package/dist/core/ecs/event_registry.d.cts +1 -1
- package/dist/core/ecs/event_registry.d.ts +1 -1
- package/dist/core/ecs/event_registry.d.ts.map +1 -1
- package/dist/core/ecs/facades.d.cts +15 -15
- package/dist/core/ecs/facades.d.ts +15 -15
- package/dist/core/ecs/facades.d.ts.map +1 -1
- package/dist/core/ecs/frame_trace.d.cts +2 -2
- package/dist/core/ecs/frame_trace.d.ts +2 -2
- package/dist/core/ecs/host_commands.d.cts +12 -12
- package/dist/core/ecs/host_commands.d.ts +12 -12
- package/dist/core/ecs/host_commands.d.ts.map +1 -1
- package/dist/core/ecs/index.d.cts +1 -1
- package/dist/core/ecs/index.d.ts +1 -1
- package/dist/core/ecs/index.d.ts.map +1 -1
- package/dist/core/ecs/observer.d.cts +9 -9
- package/dist/core/ecs/observer.d.ts +9 -9
- package/dist/core/ecs/observer.d.ts.map +1 -1
- package/dist/core/ecs/query.d.cts +91 -70
- package/dist/core/ecs/query.d.ts +91 -70
- package/dist/core/ecs/query.d.ts.map +1 -1
- package/dist/core/ecs/ref.d.cts +53 -1
- package/dist/core/ecs/ref.d.ts +53 -1
- package/dist/core/ecs/ref.d.ts.map +1 -1
- package/dist/core/ecs/relation.d.cts +15 -15
- package/dist/core/ecs/relation.d.ts +15 -15
- package/dist/core/ecs/relation.d.ts.map +1 -1
- package/dist/core/ecs/relation_service.d.cts +14 -14
- package/dist/core/ecs/relation_service.d.ts +14 -14
- package/dist/core/ecs/relation_service.d.ts.map +1 -1
- package/dist/core/ecs/resource.d.cts +1 -1
- package/dist/core/ecs/resource.d.ts +1 -1
- package/dist/core/ecs/resource_registry.d.cts +2 -2
- package/dist/core/ecs/resource_registry.d.ts +2 -2
- package/dist/core/ecs/resume.d.cts +3 -3
- package/dist/core/ecs/resume.d.ts +3 -3
- package/dist/core/ecs/resume.d.ts.map +1 -1
- package/dist/core/ecs/schedule.d.cts +22 -9
- package/dist/core/ecs/schedule.d.ts +22 -9
- package/dist/core/ecs/schedule.d.ts.map +1 -1
- package/dist/core/ecs/snapshot_service.d.cts +3 -3
- package/dist/core/ecs/snapshot_service.d.ts +3 -3
- package/dist/core/ecs/sparse_store.d.cts +6 -6
- package/dist/core/ecs/sparse_store.d.ts +6 -6
- package/dist/core/ecs/sparse_store.d.ts.map +1 -1
- package/dist/core/ecs/store.d.cts +189 -110
- package/dist/core/ecs/store.d.ts +189 -110
- package/dist/core/ecs/store.d.ts.map +1 -1
- package/dist/core/ecs/store_layout_listener.d.cts +2 -2
- package/dist/core/ecs/store_layout_listener.d.ts +2 -2
- package/dist/core/ecs/system.d.cts +8 -8
- package/dist/core/ecs/system.d.ts +8 -8
- package/dist/core/ecs/system.d.ts.map +1 -1
- package/dist/core/ecs/utils/error.d.cts +7 -0
- package/dist/core/ecs/utils/error.d.ts +7 -0
- package/dist/core/ecs/utils/error.d.ts.map +1 -1
- package/dist/core/store/action_ring.d.cts +7 -8
- package/dist/core/store/action_ring.d.ts +7 -8
- package/dist/core/store/action_ring.d.ts.map +1 -1
- package/dist/core/store/allocator.d.cts +58 -35
- package/dist/core/store/allocator.d.ts +58 -35
- package/dist/core/store/allocator.d.ts.map +1 -1
- package/dist/core/store/buffer_backed_column.d.cts +5 -6
- package/dist/core/store/buffer_backed_column.d.ts +5 -6
- package/dist/core/store/buffer_backed_column.d.ts.map +1 -1
- package/dist/core/store/column_store.d.cts +23 -23
- package/dist/core/store/column_store.d.ts +23 -23
- package/dist/core/store/column_store.d.ts.map +1 -1
- package/dist/core/store/command_dispatch.d.cts +1 -1
- package/dist/core/store/command_dispatch.d.ts +1 -1
- package/dist/core/store/command_ring.d.cts +6 -7
- package/dist/core/store/command_ring.d.ts +6 -7
- package/dist/core/store/command_ring.d.ts.map +1 -1
- package/dist/core/store/descriptor.d.cts +2 -2
- package/dist/core/store/descriptor.d.ts +2 -2
- package/dist/core/store/entity_index.d.cts +3 -3
- package/dist/core/store/entity_index.d.ts +3 -3
- package/dist/core/store/event_ring.d.cts +7 -7
- package/dist/core/store/event_ring.d.ts +7 -7
- package/dist/core/store/extend.d.cts +2 -2
- package/dist/core/store/extend.d.ts +2 -2
- package/dist/core/store/extend.d.ts.map +1 -1
- package/dist/core/store/grow.d.cts +1 -1
- package/dist/core/store/grow.d.ts +1 -1
- package/dist/core/store/grow.d.ts.map +1 -1
- package/dist/core/store/header.d.cts +9 -9
- package/dist/core/store/header.d.ts +9 -9
- package/dist/core/store/header.d.ts.map +1 -1
- package/dist/core/store/layout_ops.d.cts +25 -7
- package/dist/core/store/layout_ops.d.ts +25 -7
- package/dist/core/store/layout_ops.d.ts.map +1 -1
- package/dist/core/store/state_hash.d.cts +3 -3
- package/dist/core/store/state_hash.d.ts +3 -3
- package/dist/extensions/editor/editor.d.cts +4 -4
- package/dist/extensions/editor/editor.d.ts +4 -4
- package/dist/extensions/editor/editor.d.ts.map +1 -1
- package/dist/extensions/editor/field_handle.d.cts +1 -1
- package/dist/extensions/editor/field_handle.d.ts +1 -1
- package/dist/extensions/editor/index.d.cts +2 -2
- package/dist/extensions/editor/index.d.ts +2 -2
- package/dist/extensions/editor/index.development.js +4 -4
- package/dist/extensions/editor/index.js +4 -4
- package/dist/extensions/reactive/ecs_sync.d.cts +4 -4
- package/dist/extensions/reactive/ecs_sync.d.ts +4 -4
- package/dist/extensions/reactive/index.d.cts +4 -4
- package/dist/extensions/reactive/index.d.ts +4 -4
- package/dist/extensions/reactive/index.development.js +3 -3
- package/dist/extensions/reactive/index.js +3 -3
- package/dist/extensions/solid/index.d.cts +1 -1
- package/dist/extensions/solid/index.d.ts +1 -1
- package/dist/extensions/solid/index.development.js +1 -1
- package/dist/extensions/solid/index.js +1 -1
- package/dist/extensions/solid/kernel_solid.d.cts +1 -1
- package/dist/extensions/solid/kernel_solid.d.ts +1 -1
- package/dist/extensions/solid/kernel_solid.d.ts.map +1 -1
- package/dist/{host_commands-BI8pEmjH.js → host_commands-BlR3oZ3x.js} +473 -393
- package/dist/host_commands-C2cpU3yC.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.development.cjs +1 -1
- package/dist/index.development.js +3345 -2963
- package/dist/index.js +1496 -1131
- package/dist/{internal-BMDgWZbt.js → internal-BoxWl4dG.js} +410 -330
- package/dist/internal-CGBEwfeB.cjs +2 -0
- package/dist/internal.cjs +1 -1
- package/dist/internal.development.cjs +1 -1
- package/dist/internal.development.js +1 -1
- package/dist/internal.js +1 -1
- package/dist/primitives.development.js +1 -1
- package/dist/primitives.js +1 -1
- package/dist/reactive/index.d.cts +2 -2
- package/dist/reactive/index.d.ts +2 -2
- package/dist/reactive/index.development.js +1 -1
- package/dist/reactive/index.js +1 -1
- package/dist/reactive/kernel.d.cts +5 -5
- package/dist/reactive/kernel.d.ts +5 -5
- package/dist/reactive/shallow.d.cts +1 -1
- package/dist/reactive/shallow.d.ts +1 -1
- package/dist/{shallow-DfnAm9vG.js → shallow-Bs39EPh1.js} +1 -1
- package/dist/{shallow-9S1pY_Iw.js → shallow-CiFC70Dz.js} +1 -1
- package/dist/{shared-BU1Cd40h.js → shared-B4v0L1cw.js} +41 -35
- package/dist/shared-DU78k0pU.cjs +1 -0
- package/dist/shared.cjs +1 -1
- package/dist/shared.d.cts +1 -1
- package/dist/shared.d.ts +1 -1
- package/dist/shared.development.cjs +1 -1
- package/dist/shared.development.js +1 -1
- package/dist/shared.js +1 -1
- package/dist/type_primitives/typed_arrays/typed_arrays.d.cts +2 -2
- package/dist/type_primitives/typed_arrays/typed_arrays.d.ts +2 -2
- package/dist/{typed_arrays-BcXcnzB4.js → typed_arrays-DIVwVy5_.js} +1 -1
- package/dist/version.d.cts +2 -2
- package/dist/version.d.ts +2 -2
- package/package.json +1 -1
- package/dist/host_commands-CxhpzMx9.cjs +0 -1
- package/dist/internal-LiTSB_tG.cjs +0 -2
- package/dist/shared-BymrGTyR.cjs +0 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Command ring — WASM-side producer / TS-side consumer SPSC ring buffer
|
|
3
|
-
* for structural-change intents emitted during `sim.tick()`.
|
|
4
|
-
* (`docs/ideas/buffer-wasm-sim-plan-2026-05-14T1600.md`).
|
|
3
|
+
* for structural-change intents emitted during `sim.tick()`.
|
|
5
4
|
*
|
|
6
5
|
* Layout:
|
|
7
6
|
*
|
|
@@ -13,13 +12,13 @@
|
|
|
13
12
|
* [ slot 1: 16 B ] ...
|
|
14
13
|
* ...
|
|
15
14
|
*
|
|
16
|
-
* SPSC contract (
|
|
15
|
+
* SPSC contract (single host thread):
|
|
17
16
|
* - Producer: WASM `sim.tick()`. Pushes 0..N commands during one tick;
|
|
18
17
|
* bumps `write_head` after each.
|
|
19
18
|
* - Consumer: TS host, immediately after `wasm.tick()` returns. Drains
|
|
20
19
|
* 0..N pending commands; bumps `read_head` after each.
|
|
21
|
-
* - The two never run concurrently
|
|
22
|
-
*
|
|
20
|
+
* - The two never run concurrently (one host thread orchestrates
|
|
21
|
+
* both). A later worker offload promotes the head
|
|
23
22
|
* bumps to `Atomics.store`; that's an additive change without
|
|
24
23
|
* altering the layout.
|
|
25
24
|
*
|
|
@@ -29,7 +28,7 @@
|
|
|
29
28
|
* a hard error in dev builds; production logs and continues (a command
|
|
30
29
|
* might be lost rather than crash the host).
|
|
31
30
|
*
|
|
32
|
-
* Slot format
|
|
31
|
+
* Slot format:
|
|
33
32
|
* byte 0: opCode (u8). 0 is reserved as the empty-slot marker
|
|
34
33
|
* (`COMMAND_OP_EMPTY`); all other codes are consumer-defined.
|
|
35
34
|
* The engine never interprets a code — it drains
|
|
@@ -52,7 +51,7 @@ export declare const COMMAND_RING_HEADER_BYTES = 16;
|
|
|
52
51
|
export declare const COMMAND_RING_SLOT_BYTES = 16;
|
|
53
52
|
/** Default ring capacity in slots. 256 × 16 B = 4 KiB of ring data plus
|
|
54
53
|
* 16 B header. Sized for the worst-case burst (peak spawn intents per
|
|
55
|
-
* tick) × small safety margin. Tune up if a
|
|
54
|
+
* tick) × small safety margin. Tune up if a burst pushes past it
|
|
56
55
|
* in the bench harness. */
|
|
57
56
|
export declare const COMMAND_RING_DEFAULT_CAPACITY_SLOTS = 256;
|
|
58
57
|
/** Byte offsets within the ring header. Mirrored on the Zig side in
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Command ring — WASM-side producer / TS-side consumer SPSC ring buffer
|
|
3
|
-
* for structural-change intents emitted during `sim.tick()`.
|
|
4
|
-
* (`docs/ideas/buffer-wasm-sim-plan-2026-05-14T1600.md`).
|
|
3
|
+
* for structural-change intents emitted during `sim.tick()`.
|
|
5
4
|
*
|
|
6
5
|
* Layout:
|
|
7
6
|
*
|
|
@@ -13,13 +12,13 @@
|
|
|
13
12
|
* [ slot 1: 16 B ] ...
|
|
14
13
|
* ...
|
|
15
14
|
*
|
|
16
|
-
* SPSC contract (
|
|
15
|
+
* SPSC contract (single host thread):
|
|
17
16
|
* - Producer: WASM `sim.tick()`. Pushes 0..N commands during one tick;
|
|
18
17
|
* bumps `write_head` after each.
|
|
19
18
|
* - Consumer: TS host, immediately after `wasm.tick()` returns. Drains
|
|
20
19
|
* 0..N pending commands; bumps `read_head` after each.
|
|
21
|
-
* - The two never run concurrently
|
|
22
|
-
*
|
|
20
|
+
* - The two never run concurrently (one host thread orchestrates
|
|
21
|
+
* both). A later worker offload promotes the head
|
|
23
22
|
* bumps to `Atomics.store`; that's an additive change without
|
|
24
23
|
* altering the layout.
|
|
25
24
|
*
|
|
@@ -29,7 +28,7 @@
|
|
|
29
28
|
* a hard error in dev builds; production logs and continues (a command
|
|
30
29
|
* might be lost rather than crash the host).
|
|
31
30
|
*
|
|
32
|
-
* Slot format
|
|
31
|
+
* Slot format:
|
|
33
32
|
* byte 0: opCode (u8). 0 is reserved as the empty-slot marker
|
|
34
33
|
* (`COMMAND_OP_EMPTY`); all other codes are consumer-defined.
|
|
35
34
|
* The engine never interprets a code — it drains
|
|
@@ -52,7 +51,7 @@ export declare const COMMAND_RING_HEADER_BYTES = 16;
|
|
|
52
51
|
export declare const COMMAND_RING_SLOT_BYTES = 16;
|
|
53
52
|
/** Default ring capacity in slots. 256 × 16 B = 4 KiB of ring data plus
|
|
54
53
|
* 16 B header. Sized for the worst-case burst (peak spawn intents per
|
|
55
|
-
* tick) × small safety margin. Tune up if a
|
|
54
|
+
* tick) × small safety margin. Tune up if a burst pushes past it
|
|
56
55
|
* in the bench harness. */
|
|
57
56
|
export declare const COMMAND_RING_DEFAULT_CAPACITY_SLOTS = 256;
|
|
58
57
|
/** Byte offsets within the ring header. Mirrored on the Zig side in
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command_ring.d.ts","sourceRoot":"","sources":["../../../src/core/store/command_ring.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"command_ring.d.ts","sourceRoot":"","sources":["../../../src/core/store/command_ring.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH,uCAAuC;AACvC,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAE5C,yDAAyD;AACzD,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAE1C;;;2BAG2B;AAC3B,eAAO,MAAM,mCAAmC,MAAM,CAAC;AAEvD;yDACyD;AACzD,eAAO,MAAM,2BAA2B;;;;;CAK9B,CAAC;AAEX;;;;gEAIgE;AAChE,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAElC,gEAAgE;AAChE,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAE9D;AASD,qBAAa,gBAAiB,SAAQ,KAAK;gBAC9B,OAAO,EAAE,MAAM;CAI3B;AAED;;;mCAGmC;AACnC,wBAAgB,eAAe,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,IAAI,CAU5F;AAED,mCAAmC;AACnC,wBAAgB,aAAa,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAErE;AACD,wBAAgB,YAAY,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAEpE;AACD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAEzE;AACD,wBAAgB,YAAY,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAErE;AAED;;;+CAG+C;AAC/C,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAE3E;AAED;;;+DAG+D;AAC/D,wBAAgB,WAAW,CAC1B,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,UAAU,GACjB,OAAO,CAmCT;AAED;;oDAEoD;AACpD,wBAAgB,UAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,GAAG,MAAM,CAiB1F;AAED;;;;gEAIgE;AAChE,wBAAgB,gBAAgB,CAC/B,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,KAAK,IAAI,GACpD,MAAM,CAWR"}
|
|
@@ -49,7 +49,7 @@ export declare function readColumnDescriptor(view: DataView, off: number): Colum
|
|
|
49
49
|
* ≥ this limit would be invisible there while the heap-side `BitSet` stayed
|
|
50
50
|
* correct — silently conflating archetypes that differ only in such a
|
|
51
51
|
* component. `Store.registerComponent` enforces this as a hard registration
|
|
52
|
-
* ceiling so the overflow fails loudly instead
|
|
52
|
+
* ceiling so the overflow fails loudly instead. The mask is sized to
|
|
53
53
|
* the `BitSet`'s `INITIAL_WORD_COUNT`, so a registry within the limit never
|
|
54
54
|
* grows a component mask past its initial words. */
|
|
55
55
|
export declare const STORE_DESCRIPTOR_COMPONENT_LIMIT: number;
|
|
@@ -60,7 +60,7 @@ export interface ArchetypeDescriptor {
|
|
|
60
60
|
readonly componentMask: readonly number[];
|
|
61
61
|
readonly rowCount: number;
|
|
62
62
|
readonly rowCapacity: number;
|
|
63
|
-
/** Enabled-row count `≤ row_count
|
|
63
|
+
/** Enabled-row count `≤ row_count`. Per-row entity-scan loops in
|
|
64
64
|
* the WASM sim bound on this so disabled entities (swapped to the tail
|
|
65
65
|
* `[enabled_count, row_count)`) are not simulated; row-indexed cross-entity
|
|
66
66
|
* reads still use `row_count`. */
|
|
@@ -49,7 +49,7 @@ export declare function readColumnDescriptor(view: DataView, off: number): Colum
|
|
|
49
49
|
* ≥ this limit would be invisible there while the heap-side `BitSet` stayed
|
|
50
50
|
* correct — silently conflating archetypes that differ only in such a
|
|
51
51
|
* component. `Store.registerComponent` enforces this as a hard registration
|
|
52
|
-
* ceiling so the overflow fails loudly instead
|
|
52
|
+
* ceiling so the overflow fails loudly instead. The mask is sized to
|
|
53
53
|
* the `BitSet`'s `INITIAL_WORD_COUNT`, so a registry within the limit never
|
|
54
54
|
* grows a component mask past its initial words. */
|
|
55
55
|
export declare const STORE_DESCRIPTOR_COMPONENT_LIMIT: number;
|
|
@@ -60,7 +60,7 @@ export interface ArchetypeDescriptor {
|
|
|
60
60
|
readonly componentMask: readonly number[];
|
|
61
61
|
readonly rowCount: number;
|
|
62
62
|
readonly rowCapacity: number;
|
|
63
|
-
/** Enabled-row count `≤ row_count
|
|
63
|
+
/** Enabled-row count `≤ row_count`. Per-row entity-scan loops in
|
|
64
64
|
* the WASM sim bound on this so disabled entities (swapped to the tail
|
|
65
65
|
* `[enabled_count, row_count)`) are not simulated; row-indexed cross-entity
|
|
66
66
|
* reads still use `row_count`. */
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Entity-index SAB region — `EntityID` → `(archetype_id, row, generation)`
|
|
3
|
-
* lookup table shared with the Zig sim.
|
|
3
|
+
* lookup table shared with the Zig sim.
|
|
4
4
|
*
|
|
5
5
|
* Every hot fixed-update system that needs to resolve an `EntityID`
|
|
6
6
|
* held in a column (e.g. a component field that points at another
|
|
7
7
|
* entity → that entity's columns) has to do
|
|
8
|
-
* `entityId → archetype + row` translation.
|
|
9
|
-
*
|
|
8
|
+
* `entityId → archetype + row` translation. WASM-into-TS callbacks
|
|
9
|
+
* during `tick()` are forbidden, so the lookup
|
|
10
10
|
* tables must live in shared memory.
|
|
11
11
|
*
|
|
12
12
|
* Layout:
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Entity-index SAB region — `EntityID` → `(archetype_id, row, generation)`
|
|
3
|
-
* lookup table shared with the Zig sim.
|
|
3
|
+
* lookup table shared with the Zig sim.
|
|
4
4
|
*
|
|
5
5
|
* Every hot fixed-update system that needs to resolve an `EntityID`
|
|
6
6
|
* held in a column (e.g. a component field that points at another
|
|
7
7
|
* entity → that entity's columns) has to do
|
|
8
|
-
* `entityId → archetype + row` translation.
|
|
9
|
-
*
|
|
8
|
+
* `entityId → archetype + row` translation. WASM-into-TS callbacks
|
|
9
|
+
* during `tick()` are forbidden, so the lookup
|
|
10
10
|
* tables must live in shared memory.
|
|
11
11
|
*
|
|
12
12
|
* Layout:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Event ring — SPSC ring buffer for ECS signal/event payloads shared
|
|
3
|
-
* between TS and the Zig sim.
|
|
3
|
+
* between TS and the Zig sim.
|
|
4
4
|
*
|
|
5
5
|
* Same byte layout as the command ring (`command_ring.ts`); the two
|
|
6
6
|
* could share a primitive but keeping them separate makes the
|
|
@@ -19,18 +19,18 @@
|
|
|
19
19
|
* [ slot 1: 16 B ] ...
|
|
20
20
|
*
|
|
21
21
|
* Op codes: event-def IDs (assigned by `ECS.registerEvent()` at
|
|
22
|
-
* registration time
|
|
22
|
+
* registration time). The 0 op-code is
|
|
23
23
|
* reserved as the empty-slot marker so a zero-initialised SAB does not
|
|
24
24
|
* appear to hold a valid event. Event-def registration starts numbering
|
|
25
25
|
* from 1 to honour this; the engine integration in 4D+ enforces it.
|
|
26
26
|
*
|
|
27
|
-
* SPSC contract (
|
|
27
|
+
* SPSC contract (single host thread):
|
|
28
28
|
* - Producer: Zig sim `tick()` (post-4D) OR TS host (test producers /
|
|
29
29
|
* existing JS-side emitters bridged into the ring).
|
|
30
30
|
* - Consumer: TS host drain (post-4D) OR Zig system that reads
|
|
31
31
|
* queued events from a sibling system.
|
|
32
|
-
* - The two never run concurrently
|
|
33
|
-
*
|
|
32
|
+
* - The two never run concurrently (one host thread orchestrates
|
|
33
|
+
* both). A later worker offload promotes the head
|
|
34
34
|
* bumps to `Atomics.store`; that's an additive change without
|
|
35
35
|
* altering the layout.
|
|
36
36
|
*
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
*
|
|
42
42
|
* Region placement: between the entity-index region and the descriptor
|
|
43
43
|
* region so its offset is stable across descriptor / column growth.
|
|
44
|
-
* `header.event_ring_off` (the field promoted out of `_reserved0`
|
|
45
|
-
*
|
|
44
|
+
* `header.event_ring_off` (the field promoted out of `_reserved0`)
|
|
45
|
+
* carries the offset; 0 means absent.
|
|
46
46
|
*/
|
|
47
47
|
/** Total bytes for the ring header. Matches command ring exactly. */
|
|
48
48
|
export declare const EVENT_RING_HEADER_BYTES = 16;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Event ring — SPSC ring buffer for ECS signal/event payloads shared
|
|
3
|
-
* between TS and the Zig sim.
|
|
3
|
+
* between TS and the Zig sim.
|
|
4
4
|
*
|
|
5
5
|
* Same byte layout as the command ring (`command_ring.ts`); the two
|
|
6
6
|
* could share a primitive but keeping them separate makes the
|
|
@@ -19,18 +19,18 @@
|
|
|
19
19
|
* [ slot 1: 16 B ] ...
|
|
20
20
|
*
|
|
21
21
|
* Op codes: event-def IDs (assigned by `ECS.registerEvent()` at
|
|
22
|
-
* registration time
|
|
22
|
+
* registration time). The 0 op-code is
|
|
23
23
|
* reserved as the empty-slot marker so a zero-initialised SAB does not
|
|
24
24
|
* appear to hold a valid event. Event-def registration starts numbering
|
|
25
25
|
* from 1 to honour this; the engine integration in 4D+ enforces it.
|
|
26
26
|
*
|
|
27
|
-
* SPSC contract (
|
|
27
|
+
* SPSC contract (single host thread):
|
|
28
28
|
* - Producer: Zig sim `tick()` (post-4D) OR TS host (test producers /
|
|
29
29
|
* existing JS-side emitters bridged into the ring).
|
|
30
30
|
* - Consumer: TS host drain (post-4D) OR Zig system that reads
|
|
31
31
|
* queued events from a sibling system.
|
|
32
|
-
* - The two never run concurrently
|
|
33
|
-
*
|
|
32
|
+
* - The two never run concurrently (one host thread orchestrates
|
|
33
|
+
* both). A later worker offload promotes the head
|
|
34
34
|
* bumps to `Atomics.store`; that's an additive change without
|
|
35
35
|
* altering the layout.
|
|
36
36
|
*
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
*
|
|
42
42
|
* Region placement: between the entity-index region and the descriptor
|
|
43
43
|
* region so its offset is stable across descriptor / column growth.
|
|
44
|
-
* `header.event_ring_off` (the field promoted out of `_reserved0`
|
|
45
|
-
*
|
|
44
|
+
* `header.event_ring_off` (the field promoted out of `_reserved0`)
|
|
45
|
+
* carries the offset; 0 means absent.
|
|
46
46
|
*/
|
|
47
47
|
/** Total bytes for the ring header. Matches command ring exactly. */
|
|
48
48
|
export declare const EVENT_RING_HEADER_BYTES = 16;
|
|
@@ -14,7 +14,7 @@ export interface ExtendResult {
|
|
|
14
14
|
readonly store: ColumnStore;
|
|
15
15
|
readonly oldViewStamp: number;
|
|
16
16
|
readonly newViewStamp: number;
|
|
17
|
-
/** True when the in-place fast path
|
|
17
|
+
/** True when the in-place fast path was taken: the SAB
|
|
18
18
|
* instance is reused, existing column TypedArray views are unchanged,
|
|
19
19
|
* and callers may skip `refreshViews` on every pre-existing
|
|
20
20
|
* Archetype. False when the slow path ran (fresh SAB or wasm-memory
|
|
@@ -28,7 +28,7 @@ export declare class StoreExtendError extends Error {
|
|
|
28
28
|
/** Allocate a new SAB sized for `old` + `plan.newArchetypes`, copy
|
|
29
29
|
* existing rows, bump `view_stamp`.
|
|
30
30
|
*
|
|
31
|
-
* `allocator
|
|
31
|
+
* `allocator`: pluggable buffer source forwarded into
|
|
32
32
|
* `createColumnStore`. When the allocator is `wasmMemoryAllocator`,
|
|
33
33
|
* `memory.grow` may detach `old`'s typed-array views before the copy
|
|
34
34
|
* runs — so live rows are snapshotted into heap `Uint8Array`s BEFORE the
|
|
@@ -14,7 +14,7 @@ export interface ExtendResult {
|
|
|
14
14
|
readonly store: ColumnStore;
|
|
15
15
|
readonly oldViewStamp: number;
|
|
16
16
|
readonly newViewStamp: number;
|
|
17
|
-
/** True when the in-place fast path
|
|
17
|
+
/** True when the in-place fast path was taken: the SAB
|
|
18
18
|
* instance is reused, existing column TypedArray views are unchanged,
|
|
19
19
|
* and callers may skip `refreshViews` on every pre-existing
|
|
20
20
|
* Archetype. False when the slow path ran (fresh SAB or wasm-memory
|
|
@@ -28,7 +28,7 @@ export declare class StoreExtendError extends Error {
|
|
|
28
28
|
/** Allocate a new SAB sized for `old` + `plan.newArchetypes`, copy
|
|
29
29
|
* existing rows, bump `view_stamp`.
|
|
30
30
|
*
|
|
31
|
-
* `allocator
|
|
31
|
+
* `allocator`: pluggable buffer source forwarded into
|
|
32
32
|
* `createColumnStore`. When the allocator is `wasmMemoryAllocator`,
|
|
33
33
|
* `memory.grow` may detach `old`'s typed-array views before the copy
|
|
34
34
|
* runs — so live rows are snapshotted into heap `Uint8Array`s BEFORE the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extend.d.ts","sourceRoot":"","sources":["../../../src/core/store/extend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAGH,OAAO,EAEN,KAAK,aAAa,EAElB,KAAK,WAAW,EAGhB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAMnD,OAAO,
|
|
1
|
+
{"version":3,"file":"extend.d.ts","sourceRoot":"","sources":["../../../src/core/store/extend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAGH,OAAO,EAEN,KAAK,aAAa,EAElB,KAAK,WAAW,EAGhB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAMnD,OAAO,EAKN,KAAK,iBAAiB,EAEtB,MAAM,cAAc,CAAC;AAEtB,MAAM,WAAW,UAAU;IAC1B;gEAC4D;IAC5D,QAAQ,CAAC,aAAa,EAAE,SAAS,aAAa,EAAE,CAAC;IACjD;;oEAEgE;IAChE,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,iBAAiB,EAAE,CAAC;CACjD;AAED,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B;;;;;2EAKuE;IACvE,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;CACjC;AAED,qBAAa,gBAAiB,SAAQ,KAAK;gBAC9B,OAAO,EAAE,MAAM;CAI3B;AAED;;;;;;;;;sCASsC;AACtC,wBAAgB,iBAAiB,CAChC,GAAG,EAAE,WAAW,EAChB,IAAI,EAAE,UAAU,EAChB,SAAS,CAAC,EAAE,eAAe,GACzB,YAAY,CAoId"}
|
|
@@ -29,6 +29,6 @@ export declare class StoreGrowError extends Error {
|
|
|
29
29
|
* the new views. With a `wasmMemoryAllocator`, `old`'s typed-array
|
|
30
30
|
* views may be detached as soon as `createColumnStore` returns — live
|
|
31
31
|
* data is snapshotted before the allocator call to make both code paths
|
|
32
|
-
* behave identically from the caller's perspective.
|
|
32
|
+
* behave identically from the caller's perspective. */
|
|
33
33
|
export declare function growColumnStore(old: ColumnStore, plan: GrowPlan, allocator?: BufferAllocator): GrowResult;
|
|
34
34
|
//# sourceMappingURL=grow.d.ts.map
|
|
@@ -29,6 +29,6 @@ export declare class StoreGrowError extends Error {
|
|
|
29
29
|
* the new views. With a `wasmMemoryAllocator`, `old`'s typed-array
|
|
30
30
|
* views may be detached as soon as `createColumnStore` returns — live
|
|
31
31
|
* data is snapshotted before the allocator call to make both code paths
|
|
32
|
-
* behave identically from the caller's perspective.
|
|
32
|
+
* behave identically from the caller's perspective. */
|
|
33
33
|
export declare function growColumnStore(old: ColumnStore, plan: GrowPlan, allocator?: BufferAllocator): GrowResult;
|
|
34
34
|
//# sourceMappingURL=grow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grow.d.ts","sourceRoot":"","sources":["../../../src/core/store/grow.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"grow.d.ts","sourceRoot":"","sources":["../../../src/core/store/grow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AASH,OAAO,EAIN,KAAK,WAAW,EAGhB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAKN,KAAK,iBAAiB,EAEtB,MAAM,cAAc,CAAC;AAMtB,YAAY,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEtD,MAAM,WAAW,QAAQ;IACxB,QAAQ,CAAC,UAAU,EAAE,SAAS,iBAAiB,EAAE,CAAC;CAClD;AAED;mEACmE;AACnE,MAAM,WAAW,UAAU;IAC1B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B;;;6DAGyD;IACzD,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC;2BACuB;IACvB,QAAQ,CAAC,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAC;CAC9C;AA4JD,qBAAa,cAAe,SAAQ,KAAK;gBAC5B,OAAO,EAAE,MAAM;CAI3B;AAED;;;;;;uDAMuD;AACvD,wBAAgB,eAAe,CAC9B,GAAG,EAAE,WAAW,EAChB,IAAI,EAAE,QAAQ,EACd,SAAS,CAAC,EAAE,eAAe,GACzB,UAAU,CAmGZ"}
|
|
@@ -8,7 +8,7 @@ export interface StoreHeader {
|
|
|
8
8
|
* the SAB must not be used. */
|
|
9
9
|
readonly simAbiVersion: number;
|
|
10
10
|
/** Monotonic; incremented every time the host reallocates the SAB.
|
|
11
|
-
* Cached TypedArray views become stale on bump.
|
|
11
|
+
* Cached TypedArray views become stale on bump. */
|
|
12
12
|
readonly viewStamp: number;
|
|
13
13
|
/** Total SAB size in bytes. */
|
|
14
14
|
readonly capacity: number;
|
|
@@ -16,17 +16,17 @@ export interface StoreHeader {
|
|
|
16
16
|
readonly archetypeCount: number;
|
|
17
17
|
/** Byte offset into the SAB where the layout descriptor region starts. */
|
|
18
18
|
readonly layoutDescriptorOff: number;
|
|
19
|
-
/** Byte offset of the WASM→TS command ring header.
|
|
19
|
+
/** Byte offset of the WASM→TS command ring header. */
|
|
20
20
|
readonly commandRingOff: number;
|
|
21
|
-
/** Byte offset of the TS→WASM action ring header.
|
|
21
|
+
/** Byte offset of the TS→WASM action ring header. */
|
|
22
22
|
readonly actionRingOff: number;
|
|
23
23
|
/** Byte offset of the entity-index region (entityId → archetype_id,
|
|
24
24
|
* row, generation lookup). 0 means absent — fixtures and bare-SAB
|
|
25
25
|
* tests that don't need the index see the v1 layout (the engine's
|
|
26
|
-
* `Store` always allocates one).
|
|
26
|
+
* `Store` always allocates one). */
|
|
27
27
|
readonly entityIndexOff: number;
|
|
28
28
|
/** Byte offset of the event ring region (ECS signal payloads shared
|
|
29
|
-
* with the Zig sim). 0 means absent.
|
|
29
|
+
* with the Zig sim). 0 means absent. */
|
|
30
30
|
readonly eventRingOff: number;
|
|
31
31
|
/** Byte offset of the region-table directory — a `RegionTableEntry[]`
|
|
32
32
|
* (`(region_id, byte_offset, byte_length)` triples) holding one entry
|
|
@@ -35,9 +35,9 @@ export interface StoreHeader {
|
|
|
35
35
|
* its region with `findRegionOffset(view, header, id)` (TS) /
|
|
36
36
|
* `abi.find_region(header_addr, id)` (Zig). Replaces the five game-named
|
|
37
37
|
* offset fields (`terrain_off`/`spatial_grid_off`/… ) the SAB header
|
|
38
|
-
* used to hard-code.
|
|
38
|
+
* used to hard-code. This de-games the SAB substrate. */
|
|
39
39
|
readonly regionTableOff: number;
|
|
40
|
-
/** Number of `RegionTableEntry` records at `region_table_off`.
|
|
40
|
+
/** Number of `RegionTableEntry` records at `region_table_off`. */
|
|
41
41
|
readonly regionTableCount: number;
|
|
42
42
|
/** Byte offset of the sim-bindings region — an opaque block of `u16`
|
|
43
43
|
* `(component_id, field_id)` IDs (layout owned by the game, in
|
|
@@ -48,14 +48,14 @@ export interface StoreHeader {
|
|
|
48
48
|
* them as call args. Present only when the consumer opts into a WASM backend
|
|
49
49
|
* by passing `bindingsRegionBytes` to `createColumnStore`; 0 = absent (a
|
|
50
50
|
* pure-TS game pays nothing for this region). The size is a runtime input,
|
|
51
|
-
* not an engine ABI constant
|
|
51
|
+
* not an engine ABI constant. (v5 / "SAB-is-the-interface".) */
|
|
52
52
|
readonly bindingsOff: number;
|
|
53
53
|
}
|
|
54
54
|
export declare function writeStoreHeader(view: DataView, h: StoreHeader): void;
|
|
55
55
|
export declare function readStoreHeader(view: DataView): StoreHeader;
|
|
56
56
|
/** Increment `view_stamp` in place after a host-side SAB reallocation. The
|
|
57
57
|
* monotonic counter is the trigger for cached-view invalidation on the TS
|
|
58
|
-
* side and for re-pointing in WASM.
|
|
58
|
+
* side and for re-pointing in WASM. */
|
|
59
59
|
export declare function bumpViewStamp(view: DataView): number;
|
|
60
60
|
/** True iff the buffer's first four bytes are `STORE_MAGIC` AND the ABI
|
|
61
61
|
* version matches the current build. Used by both TS and WASM as a
|
|
@@ -8,7 +8,7 @@ export interface StoreHeader {
|
|
|
8
8
|
* the SAB must not be used. */
|
|
9
9
|
readonly simAbiVersion: number;
|
|
10
10
|
/** Monotonic; incremented every time the host reallocates the SAB.
|
|
11
|
-
* Cached TypedArray views become stale on bump.
|
|
11
|
+
* Cached TypedArray views become stale on bump. */
|
|
12
12
|
readonly viewStamp: number;
|
|
13
13
|
/** Total SAB size in bytes. */
|
|
14
14
|
readonly capacity: number;
|
|
@@ -16,17 +16,17 @@ export interface StoreHeader {
|
|
|
16
16
|
readonly archetypeCount: number;
|
|
17
17
|
/** Byte offset into the SAB where the layout descriptor region starts. */
|
|
18
18
|
readonly layoutDescriptorOff: number;
|
|
19
|
-
/** Byte offset of the WASM→TS command ring header.
|
|
19
|
+
/** Byte offset of the WASM→TS command ring header. */
|
|
20
20
|
readonly commandRingOff: number;
|
|
21
|
-
/** Byte offset of the TS→WASM action ring header.
|
|
21
|
+
/** Byte offset of the TS→WASM action ring header. */
|
|
22
22
|
readonly actionRingOff: number;
|
|
23
23
|
/** Byte offset of the entity-index region (entityId → archetype_id,
|
|
24
24
|
* row, generation lookup). 0 means absent — fixtures and bare-SAB
|
|
25
25
|
* tests that don't need the index see the v1 layout (the engine's
|
|
26
|
-
* `Store` always allocates one).
|
|
26
|
+
* `Store` always allocates one). */
|
|
27
27
|
readonly entityIndexOff: number;
|
|
28
28
|
/** Byte offset of the event ring region (ECS signal payloads shared
|
|
29
|
-
* with the Zig sim). 0 means absent.
|
|
29
|
+
* with the Zig sim). 0 means absent. */
|
|
30
30
|
readonly eventRingOff: number;
|
|
31
31
|
/** Byte offset of the region-table directory — a `RegionTableEntry[]`
|
|
32
32
|
* (`(region_id, byte_offset, byte_length)` triples) holding one entry
|
|
@@ -35,9 +35,9 @@ export interface StoreHeader {
|
|
|
35
35
|
* its region with `findRegionOffset(view, header, id)` (TS) /
|
|
36
36
|
* `abi.find_region(header_addr, id)` (Zig). Replaces the five game-named
|
|
37
37
|
* offset fields (`terrain_off`/`spatial_grid_off`/… ) the SAB header
|
|
38
|
-
* used to hard-code.
|
|
38
|
+
* used to hard-code. This de-games the SAB substrate. */
|
|
39
39
|
readonly regionTableOff: number;
|
|
40
|
-
/** Number of `RegionTableEntry` records at `region_table_off`.
|
|
40
|
+
/** Number of `RegionTableEntry` records at `region_table_off`. */
|
|
41
41
|
readonly regionTableCount: number;
|
|
42
42
|
/** Byte offset of the sim-bindings region — an opaque block of `u16`
|
|
43
43
|
* `(component_id, field_id)` IDs (layout owned by the game, in
|
|
@@ -48,14 +48,14 @@ export interface StoreHeader {
|
|
|
48
48
|
* them as call args. Present only when the consumer opts into a WASM backend
|
|
49
49
|
* by passing `bindingsRegionBytes` to `createColumnStore`; 0 = absent (a
|
|
50
50
|
* pure-TS game pays nothing for this region). The size is a runtime input,
|
|
51
|
-
* not an engine ABI constant
|
|
51
|
+
* not an engine ABI constant. (v5 / "SAB-is-the-interface".) */
|
|
52
52
|
readonly bindingsOff: number;
|
|
53
53
|
}
|
|
54
54
|
export declare function writeStoreHeader(view: DataView, h: StoreHeader): void;
|
|
55
55
|
export declare function readStoreHeader(view: DataView): StoreHeader;
|
|
56
56
|
/** Increment `view_stamp` in place after a host-side SAB reallocation. The
|
|
57
57
|
* monotonic counter is the trigger for cached-view invalidation on the TS
|
|
58
|
-
* side and for re-pointing in WASM.
|
|
58
|
+
* side and for re-pointing in WASM. */
|
|
59
59
|
export declare function bumpViewStamp(view: DataView): number;
|
|
60
60
|
/** True iff the buffer's first four bytes are `STORE_MAGIC` AND the ABI
|
|
61
61
|
* version matches the current build. Used by both TS and WASM as a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../../src/core/store/header.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../../src/core/store/header.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AACvC,wBAAgB,aAAa,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAIpD;AAED;;+DAE+D;AAC/D,wBAAgB,UAAU,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAKlD"}
|
|
@@ -26,7 +26,7 @@ export interface TailArchetypeLayout {
|
|
|
26
26
|
}[];
|
|
27
27
|
}
|
|
28
28
|
/** Tail-cursor column placement — the single home for the in-place paths'
|
|
29
|
-
* layout rule and the 2³¹ offset cap
|
|
29
|
+
* layout rule and the 2³¹ offset cap. Starting at `startCursor`
|
|
30
30
|
* (the current buffer byteLength), each archetype's columns are placed
|
|
31
31
|
* `alignUp(cursor, stride)` then advanced by `stride * rowCapacity`; the
|
|
32
32
|
* final tail (last column's advance, not re-aligned) becomes the grown
|
|
@@ -50,6 +50,24 @@ export declare function growBufferInPlace(old: ColumnStoreInternal, newTotal: nu
|
|
|
50
50
|
grownBuffer: ArrayBufferLike;
|
|
51
51
|
newView: DataView;
|
|
52
52
|
};
|
|
53
|
+
/**
|
|
54
|
+
* Byte offset where the next appended column region begins — the tail cursor
|
|
55
|
+
* the in-place grow/extend paths pass to `layoutColumnsAtTail`.
|
|
56
|
+
*
|
|
57
|
+
* For the growable-SAB and wasm backings the buffer is sized to the live extent
|
|
58
|
+
* (`SharedArrayBuffer.grow` resizes exactly; wasm rounds up to a page, and its
|
|
59
|
+
* fast path deliberately lands new regions past that page-rounded tail), so
|
|
60
|
+
* `buffer.byteLength` IS the tail. For the pure-TS **heap** backing (0.5.3) the
|
|
61
|
+
* buffer is a FIXED `ArrayBuffer` reserved at the full cap for V8 fast-path
|
|
62
|
+
* element access, so its `byteLength` is `maxBytes`, NOT the used size — the
|
|
63
|
+
* true tail is the header `capacity` (the logical high-water; new columns land
|
|
64
|
+
* in still-zero fixed-buffer space just past the last live column).
|
|
65
|
+
*
|
|
66
|
+
* A plain (non-shared) `ArrayBuffer` is uniquely the heap profile's fixed
|
|
67
|
+
* reservation — every other in-place backing is a `SharedArrayBuffer`. Keying
|
|
68
|
+
* off the backing keeps the SAB/wasm layouts byte-for-byte unchanged.
|
|
69
|
+
*/
|
|
70
|
+
export declare function tailCursorBytes(old: ColumnStoreInternal): number;
|
|
53
71
|
/**
|
|
54
72
|
* Derive `CreateColumnStoreOptions` from an old ColumnStore so a slow-path realloc
|
|
55
73
|
* preserves the same set of optional regions at the same byte offsets in the
|
|
@@ -63,12 +81,12 @@ export declare function growBufferInPlace(old: ColumnStoreInternal, newTotal: nu
|
|
|
63
81
|
* separately via `snapshotPrefixRegions`.
|
|
64
82
|
*
|
|
65
83
|
* Also re-applies the descriptor-region headroom policy
|
|
66
|
-
* (`reservedDescriptorBytes
|
|
84
|
+
* (`reservedDescriptorBytes`). Unlike the prefix regions this is NOT
|
|
67
85
|
* read from the SAB bytes — it's a JS-side policy carried on
|
|
68
86
|
* `ColumnStoreInternal._reservedDescriptorBytes` — but it belongs here for the
|
|
69
87
|
* same reason: without it the realloc'd store drops to zero descriptor
|
|
70
88
|
* headroom and every later `extendColumnStore` takes the slow path forever.
|
|
71
|
-
* Re-reserving the same margin (additive, see `planLayout`) keeps the
|
|
89
|
+
* Re-reserving the same margin (additive, see `planLayout`) keeps the
|
|
72
90
|
* in-place fast path alive across reallocs.
|
|
73
91
|
*/
|
|
74
92
|
export declare function optionsFromOld(old: ColumnStore): CreateColumnStoreOptions;
|
|
@@ -125,9 +143,9 @@ export declare function restoreColumnSnapshots(newStore: ColumnStore, snapshots:
|
|
|
125
143
|
* (command ring, entity-index) BEFORE the allocator call — the
|
|
126
144
|
* wasmMemoryAllocator may detach `old`'s views on grow, so everything
|
|
127
145
|
* needed is captured first. The prefix-region preservation is the
|
|
128
|
-
* contract `Store` relies on to keep its entity table across resizes
|
|
129
|
-
*
|
|
130
|
-
*
|
|
146
|
+
* contract `Store` relies on to keep its entity table across resizes;
|
|
147
|
+
* `optionsFromOld` re-reserves regions and descriptor headroom
|
|
148
|
+
* so the republished store keeps its layout and fast paths.
|
|
131
149
|
* 2. `createColumnStore` with the derived options (fresh buffer; the same
|
|
132
150
|
* growable allocator carries forward so the new buffer also grows in
|
|
133
151
|
* place).
|
|
@@ -136,7 +154,7 @@ export declare function restoreColumnSnapshots(newStore: ColumnStore, snapshots:
|
|
|
136
154
|
* overwrite the empty state `createColumnStore` initialised.
|
|
137
155
|
* 4. Bump `view_stamp` from the pre-capture value and patch the returned
|
|
138
156
|
* header so its cached `viewStamp` matches the buffer bytes just
|
|
139
|
-
* written — `createColumnStore` stamped it 0
|
|
157
|
+
* written — `createColumnStore` stamped it 0. `capacity` /
|
|
140
158
|
* `archetype_count` are already correct (createColumnStore sized them),
|
|
141
159
|
* so the spread carries them — and the internal `_allocator` /
|
|
142
160
|
* `_regionBytes` fields — through unchanged.
|
|
@@ -26,7 +26,7 @@ export interface TailArchetypeLayout {
|
|
|
26
26
|
}[];
|
|
27
27
|
}
|
|
28
28
|
/** Tail-cursor column placement — the single home for the in-place paths'
|
|
29
|
-
* layout rule and the 2³¹ offset cap
|
|
29
|
+
* layout rule and the 2³¹ offset cap. Starting at `startCursor`
|
|
30
30
|
* (the current buffer byteLength), each archetype's columns are placed
|
|
31
31
|
* `alignUp(cursor, stride)` then advanced by `stride * rowCapacity`; the
|
|
32
32
|
* final tail (last column's advance, not re-aligned) becomes the grown
|
|
@@ -50,6 +50,24 @@ export declare function growBufferInPlace(old: ColumnStoreInternal, newTotal: nu
|
|
|
50
50
|
grownBuffer: ArrayBufferLike;
|
|
51
51
|
newView: DataView;
|
|
52
52
|
};
|
|
53
|
+
/**
|
|
54
|
+
* Byte offset where the next appended column region begins — the tail cursor
|
|
55
|
+
* the in-place grow/extend paths pass to `layoutColumnsAtTail`.
|
|
56
|
+
*
|
|
57
|
+
* For the growable-SAB and wasm backings the buffer is sized to the live extent
|
|
58
|
+
* (`SharedArrayBuffer.grow` resizes exactly; wasm rounds up to a page, and its
|
|
59
|
+
* fast path deliberately lands new regions past that page-rounded tail), so
|
|
60
|
+
* `buffer.byteLength` IS the tail. For the pure-TS **heap** backing (0.5.3) the
|
|
61
|
+
* buffer is a FIXED `ArrayBuffer` reserved at the full cap for V8 fast-path
|
|
62
|
+
* element access, so its `byteLength` is `maxBytes`, NOT the used size — the
|
|
63
|
+
* true tail is the header `capacity` (the logical high-water; new columns land
|
|
64
|
+
* in still-zero fixed-buffer space just past the last live column).
|
|
65
|
+
*
|
|
66
|
+
* A plain (non-shared) `ArrayBuffer` is uniquely the heap profile's fixed
|
|
67
|
+
* reservation — every other in-place backing is a `SharedArrayBuffer`. Keying
|
|
68
|
+
* off the backing keeps the SAB/wasm layouts byte-for-byte unchanged.
|
|
69
|
+
*/
|
|
70
|
+
export declare function tailCursorBytes(old: ColumnStoreInternal): number;
|
|
53
71
|
/**
|
|
54
72
|
* Derive `CreateColumnStoreOptions` from an old ColumnStore so a slow-path realloc
|
|
55
73
|
* preserves the same set of optional regions at the same byte offsets in the
|
|
@@ -63,12 +81,12 @@ export declare function growBufferInPlace(old: ColumnStoreInternal, newTotal: nu
|
|
|
63
81
|
* separately via `snapshotPrefixRegions`.
|
|
64
82
|
*
|
|
65
83
|
* Also re-applies the descriptor-region headroom policy
|
|
66
|
-
* (`reservedDescriptorBytes
|
|
84
|
+
* (`reservedDescriptorBytes`). Unlike the prefix regions this is NOT
|
|
67
85
|
* read from the SAB bytes — it's a JS-side policy carried on
|
|
68
86
|
* `ColumnStoreInternal._reservedDescriptorBytes` — but it belongs here for the
|
|
69
87
|
* same reason: without it the realloc'd store drops to zero descriptor
|
|
70
88
|
* headroom and every later `extendColumnStore` takes the slow path forever.
|
|
71
|
-
* Re-reserving the same margin (additive, see `planLayout`) keeps the
|
|
89
|
+
* Re-reserving the same margin (additive, see `planLayout`) keeps the
|
|
72
90
|
* in-place fast path alive across reallocs.
|
|
73
91
|
*/
|
|
74
92
|
export declare function optionsFromOld(old: ColumnStore): CreateColumnStoreOptions;
|
|
@@ -125,9 +143,9 @@ export declare function restoreColumnSnapshots(newStore: ColumnStore, snapshots:
|
|
|
125
143
|
* (command ring, entity-index) BEFORE the allocator call — the
|
|
126
144
|
* wasmMemoryAllocator may detach `old`'s views on grow, so everything
|
|
127
145
|
* needed is captured first. The prefix-region preservation is the
|
|
128
|
-
* contract `Store` relies on to keep its entity table across resizes
|
|
129
|
-
*
|
|
130
|
-
*
|
|
146
|
+
* contract `Store` relies on to keep its entity table across resizes;
|
|
147
|
+
* `optionsFromOld` re-reserves regions and descriptor headroom
|
|
148
|
+
* so the republished store keeps its layout and fast paths.
|
|
131
149
|
* 2. `createColumnStore` with the derived options (fresh buffer; the same
|
|
132
150
|
* growable allocator carries forward so the new buffer also grows in
|
|
133
151
|
* place).
|
|
@@ -136,7 +154,7 @@ export declare function restoreColumnSnapshots(newStore: ColumnStore, snapshots:
|
|
|
136
154
|
* overwrite the empty state `createColumnStore` initialised.
|
|
137
155
|
* 4. Bump `view_stamp` from the pre-capture value and patch the returned
|
|
138
156
|
* header so its cached `viewStamp` matches the buffer bytes just
|
|
139
|
-
* written — `createColumnStore` stamped it 0
|
|
157
|
+
* written — `createColumnStore` stamped it 0. `capacity` /
|
|
140
158
|
* `archetype_count` are already correct (createColumnStore sized them),
|
|
141
159
|
* so the spread carries them — and the internal `_allocator` /
|
|
142
160
|
* `_regionBytes` fields — through unchanged.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout_ops.d.ts","sourceRoot":"","sources":["../../../src/core/store/layout_ops.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAMN,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,mBAAmB,EAAoB,YAAY,EAAE,MAAM,cAAc,CAAC;AAGxF,OAAO,EAGN,KAAK,sBAAsB,EAC3B,MAAM,iBAAiB,CAAC;AAEzB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