@geastack/compiler 1.0.33 → 1.0.35

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.
Files changed (215) hide show
  1. package/README.md +1 -1
  2. package/dist/cli-coverage.js +2 -4
  3. package/dist/cli-emit.js +1 -1
  4. package/dist/cli-module-graph.js +1 -1
  5. package/dist/cli.js +2 -1
  6. package/dist/compiler.js +14 -6
  7. package/dist/conversion/array-view.js +9 -0
  8. package/dist/conversion/build.js +15 -8
  9. package/dist/conversion/dictionary-view.js +2 -2
  10. package/dist/conversion/nodes.d.ts +7 -0
  11. package/dist/conversion/nodes.js +58 -11
  12. package/dist/identity/ids.d.ts +4 -0
  13. package/dist/identity/ids.js +4 -0
  14. package/dist/ir/build.d.ts +4 -3
  15. package/dist/ir/build.js +14 -5
  16. package/dist/ir/call-dispatch.js +67 -7
  17. package/dist/ir/call-entry.js +1 -1
  18. package/dist/ir/callable-class-flow.d.ts +4 -0
  19. package/dist/ir/callable-class-flow.js +123 -1
  20. package/dist/ir/certify/parallel-region.js +698 -20
  21. package/dist/ir/certify.d.ts +3 -0
  22. package/dist/ir/certify.js +44 -9
  23. package/dist/ir/class-allocation-domain.js +2 -2
  24. package/dist/ir/class-construction-status.d.ts +10 -0
  25. package/dist/ir/class-construction-status.js +36 -0
  26. package/dist/ir/convert-carriers.d.ts +10 -1
  27. package/dist/ir/convert-carriers.js +18 -1
  28. package/dist/ir/dynamic-constructor-conversions.js +4 -2
  29. package/dist/ir/finite-iterator-close.d.ts +14 -0
  30. package/dist/ir/finite-iterator-close.js +50 -0
  31. package/dist/ir/host-template-conversions.js +9 -0
  32. package/dist/ir/lower-allocation.js +1 -1
  33. package/dist/ir/lower-flow.js +24 -3
  34. package/dist/ir/lower-operands.js +88 -7
  35. package/dist/ir/lower-protocol.js +1 -1
  36. package/dist/ir/lower.js +9 -4
  37. package/dist/ir/model.d.ts +39 -1
  38. package/dist/ir/native-accessor-definition.d.ts +3 -2
  39. package/dist/ir/native-accessor-definition.js +29 -10
  40. package/dist/ir/native-array-transport.js +2 -2
  41. package/dist/ir/native-field-view-domains.d.ts +23 -0
  42. package/dist/ir/native-field-view-domains.js +115 -9
  43. package/dist/ir/native-field-view-facts.d.ts +46 -2
  44. package/dist/ir/native-field-view-facts.js +159 -4
  45. package/dist/ir/native-iterable.d.ts +17 -0
  46. package/dist/ir/native-iterable.js +72 -0
  47. package/dist/ir/native-key-query.js +1 -1
  48. package/dist/ir/operation-conversions.js +15 -3
  49. package/dist/ir/program-conversions.js +2 -2
  50. package/dist/ir/publish-native-field-view-facts.js +9 -4
  51. package/dist/ir/pure-conversion-reuse.d.ts +58 -0
  52. package/dist/ir/pure-conversion-reuse.js +263 -0
  53. package/dist/ir/queries.js +1 -0
  54. package/dist/ir/reflection-demand.js +70 -18
  55. package/dist/ir/shake.js +2 -2
  56. package/dist/ir/unobserved-callable-inputs.d.ts +37 -0
  57. package/dist/ir/unobserved-callable-inputs.js +111 -0
  58. package/dist/native-signatures.d.ts +1 -1
  59. package/dist/native-signatures.js +27 -2
  60. package/dist/plugins/gea/component-classes.d.ts +2 -1
  61. package/dist/plugins/gea/component-classes.js +3 -3
  62. package/dist/plugins/gea/contract.d.ts +26 -3
  63. package/dist/plugins/gea/contract.js +42 -43
  64. package/dist/plugins/gea/host.d.ts +9 -0
  65. package/dist/plugins/gea/host.js +25 -4
  66. package/dist/plugins/gea/plugin.js +12 -6
  67. package/dist/plugins/gea/producer.d.ts +2 -2
  68. package/dist/plugins/gea/producer.js +2 -2
  69. package/dist/plugins/load.js +18 -1
  70. package/dist/plugins/model.d.ts +5 -0
  71. package/dist/plugins/native-iterable-providers.d.ts +18 -0
  72. package/dist/plugins/native-iterable-providers.js +51 -0
  73. package/dist/project-preparation.d.ts +8 -0
  74. package/dist/project-preparation.js +49 -7
  75. package/dist/projection/bindings.d.ts +13 -0
  76. package/dist/projection/bindings.js +20 -1
  77. package/dist/projection/classes.d.ts +4 -2
  78. package/dist/projection/classes.js +12 -5
  79. package/dist/representation/collections.js +2 -0
  80. package/dist/representation/derive.js +1 -0
  81. package/dist/representation/model.d.ts +2 -0
  82. package/dist/representation/model.js +1 -0
  83. package/dist/representation/policies.d.ts +2 -0
  84. package/dist/representation/primitive-domain.d.ts +1 -1
  85. package/dist/representation/primitive-domain.js +1 -1
  86. package/dist/representation/unassigned-binding-cells.js +6 -1
  87. package/dist/representation/union.js +6 -6
  88. package/dist/semantics/frontend.d.ts +2 -0
  89. package/dist/semantics/frontend.js +34 -5
  90. package/dist/semantics/host-methods.js +4 -1
  91. package/dist/semantics/jsx-runtime-provider.d.ts +5 -0
  92. package/dist/semantics/jsx-runtime-provider.js +16 -0
  93. package/dist/semantics/model/native-iterable.d.ts +14 -0
  94. package/dist/semantics/model/native-iterable.js +7 -0
  95. package/dist/semantics/model/operands.d.ts +30 -0
  96. package/dist/semantics/model/operations.d.ts +15 -0
  97. package/dist/semantics/model/primitive-domain.d.ts +15 -0
  98. package/dist/semantics/model/primitive-domain.js +27 -4
  99. package/dist/semantics/module-resolution.js +13 -2
  100. package/dist/semantics/normalize/any-cast-member-call.d.ts +1 -1
  101. package/dist/semantics/normalize/callback-parameter-contracts.d.ts +32 -4
  102. package/dist/semantics/normalize/callback-parameter-contracts.js +66 -6
  103. package/dist/semantics/normalize/census.d.ts +3 -0
  104. package/dist/semantics/normalize/census.js +17 -12
  105. package/dist/semantics/normalize/deferred-intrinsic-protocols.d.ts +4 -1
  106. package/dist/semantics/normalize/deferred-intrinsic-protocols.js +29 -9
  107. package/dist/semantics/normalize/flow/callable-reach.js +94 -3
  108. package/dist/semantics/normalize/flow/component-solver.js +144 -55
  109. package/dist/semantics/normalize/flow/member-call-forwarding.d.ts +9 -0
  110. package/dist/semantics/normalize/flow/member-call-forwarding.js +30 -4
  111. package/dist/semantics/normalize/flow/proof-hypotheses.d.ts +2 -0
  112. package/dist/semantics/normalize/flow/proof-hypotheses.js +27 -0
  113. package/dist/semantics/normalize/flow/source-callable-own-data.js +87 -14
  114. package/dist/semantics/normalize/flow/source-commonjs-exports.d.ts +2 -0
  115. package/dist/semantics/normalize/flow/source-commonjs-exports.js +2 -0
  116. package/dist/semantics/normalize/flow/source-native-iterable-integrity.d.ts +17 -0
  117. package/dist/semantics/normalize/flow/source-native-iterable-integrity.js +125 -0
  118. package/dist/semantics/normalize/flow/source-native-origin.d.ts +6 -0
  119. package/dist/semantics/normalize/flow/source-native-origin.js +38 -0
  120. package/dist/semantics/normalize/flow/source-proxy-operation.d.ts +37 -0
  121. package/dist/semantics/normalize/flow/source-proxy-operation.js +201 -0
  122. package/dist/semantics/normalize/flow/source-raw-constructor-entry.d.ts +20 -0
  123. package/dist/semantics/normalize/flow/source-raw-constructor-entry.js +73 -0
  124. package/dist/semantics/normalize/flow/source-value-session.d.ts +50 -1
  125. package/dist/semantics/normalize/flow/source-value-session.js +596 -57
  126. package/dist/semantics/normalize/flow/value-flow.d.ts +17 -0
  127. package/dist/semantics/normalize/flow/value-flow.js +84 -0
  128. package/dist/semantics/normalize/fresh-dictionary-storage.js +2 -2
  129. package/dist/semantics/normalize/fresh-table-last-use.d.ts +52 -0
  130. package/dist/semantics/normalize/fresh-table-last-use.js +129 -0
  131. package/dist/semantics/normalize/gating.js +5 -1
  132. package/dist/semantics/normalize/global-host-mutations.js +190 -13
  133. package/dist/semantics/normalize/identities.js +20 -1
  134. package/dist/semantics/normalize/local-bindings.js +2 -2
  135. package/dist/semantics/normalize/parameter-bindings.js +10 -1
  136. package/dist/semantics/normalize/producer-context.d.ts +5 -0
  137. package/dist/semantics/normalize/producers/binding-kind.js +2 -0
  138. package/dist/semantics/normalize/producers/cited-value-type.d.ts +2 -2
  139. package/dist/semantics/normalize/producers/cited-value-type.js +2 -2
  140. package/dist/semantics/normalize/producers/class-lifecycle.js +39 -9
  141. package/dist/semantics/normalize/producers/computations.js +36 -5
  142. package/dist/semantics/normalize/producers/conditional-guard.d.ts +6 -0
  143. package/dist/semantics/normalize/producers/conditional-guard.js +5 -0
  144. package/dist/semantics/normalize/producers/control.js +7 -1
  145. package/dist/semantics/normalize/producers/destructuring.js +8 -9
  146. package/dist/semantics/normalize/producers/invocations.js +55 -2
  147. package/dist/semantics/normalize/producers/properties.d.ts +13 -0
  148. package/dist/semantics/normalize/producers/properties.js +21 -3
  149. package/dist/semantics/normalize/producers/references.js +8 -4
  150. package/dist/semantics/normalize/reachability.d.ts +15 -3
  151. package/dist/semantics/normalize/reachability.js +128 -20
  152. package/dist/semantics/normalize/return-bindings.js +3 -3
  153. package/dist/semantics/normalize/source-native-iterable.d.ts +19 -0
  154. package/dist/semantics/normalize/source-native-iterable.js +74 -0
  155. package/dist/semantics/normalize/structural-any-binding-consumer.d.ts +1 -1
  156. package/dist/semantics/normalize/structural-declarations.js +1 -1
  157. package/dist/semantics/normalize/structural-indexed-access.js +9 -0
  158. package/dist/semantics/normalize/structural.js +11 -0
  159. package/dist/semantics/normalize/unshared-array-result.d.ts +42 -0
  160. package/dist/semantics/normalize/unshared-array-result.js +269 -0
  161. package/dist/semantics/package-sources.js +3 -2
  162. package/dist/semantics/program.d.ts +8 -0
  163. package/dist/semantics/program.js +55 -0
  164. package/dist/semantics/source-transform-exports.d.ts +8 -0
  165. package/dist/semantics/source-transform-exports.js +145 -0
  166. package/dist/semantics/source-transform-protocol.d.ts +22 -0
  167. package/dist/semantics/this-constructor-source-transform.js +19 -1
  168. package/dist/targets/cpp/class-layout.d.ts +2 -0
  169. package/dist/targets/cpp/class-layout.js +35 -1
  170. package/dist/targets/cpp/class-properties/emit-class-properties.d.ts +11 -1
  171. package/dist/targets/cpp/class-properties/emit-class-properties.js +33 -4
  172. package/dist/targets/cpp/conversions.js +6 -3
  173. package/dist/targets/cpp/emit-callable.js +73 -7
  174. package/dist/targets/cpp/emit-context.d.ts +23 -9
  175. package/dist/targets/cpp/emit-context.js +19 -8
  176. package/dist/targets/cpp/emit-equality.js +41 -1
  177. package/dist/targets/cpp/emit-exceptions.js +29 -11
  178. package/dist/targets/cpp/emit-iterator-object-view.js +2 -2
  179. package/dist/targets/cpp/emit-iterator.js +33 -9
  180. package/dist/targets/cpp/emit-live-field-view.js +6 -1
  181. package/dist/targets/cpp/emit-narrowing.d.ts +11 -3
  182. package/dist/targets/cpp/emit-narrowing.js +58 -18
  183. package/dist/targets/cpp/emit-native-field-view.d.ts +3 -1
  184. package/dist/targets/cpp/emit-native-field-view.js +84 -8
  185. package/dist/targets/cpp/emit-properties.d.ts +1 -0
  186. package/dist/targets/cpp/emit-properties.js +26 -7
  187. package/dist/targets/cpp/emit-protocol-iterator.js +5 -2
  188. package/dist/targets/cpp/emit-record-view.js +14 -2
  189. package/dist/targets/cpp/emit-tostring.js +23 -1
  190. package/dist/targets/cpp/emit-union-properties.js +1 -1
  191. package/dist/targets/cpp/emit.d.ts +1 -1
  192. package/dist/targets/cpp/emit.js +99 -13
  193. package/dist/targets/cpp/host/emit-host-invoke.js +2 -2
  194. package/dist/targets/cpp/host/emit-host-object.js +28 -2
  195. package/dist/targets/cpp/host/emit-host-properties.js +9 -1
  196. package/dist/targets/cpp/host/emit-host-value.d.ts +1 -1
  197. package/dist/targets/cpp/host/emit-host-value.js +8 -6
  198. package/dist/targets/cpp/host/host-members.js +2 -1
  199. package/dist/targets/cpp/prototype/emit-prototype-array.js +69 -5
  200. package/dist/targets/cpp/prototype/emit-prototype-invoke.js +9 -9
  201. package/dist/targets/cpp/prototype/emit-prototype-iterator.js +2 -2
  202. package/dist/targets/cpp/prototype/emit-prototype-promise.js +7 -7
  203. package/dist/targets/cpp/records.d.ts +1 -0
  204. package/dist/targets/cpp/records.js +83 -22
  205. package/dist/targets/cpp/translation-unit.js +30 -16
  206. package/package.json +8 -7
  207. package/src/targets/cpp/runtime/gea_dynamic_proxy.h +42 -3
  208. package/src/targets/cpp/runtime/gea_eval.h +3 -0
  209. package/src/targets/cpp/runtime/gea_runtime.h +2399 -676
  210. package/dist/representation/any-null-record-members.d.ts +0 -41
  211. package/dist/representation/any-null-record-members.js +0 -115
  212. package/dist/semantics/any-null-member-declarations.d.ts +0 -32
  213. package/dist/semantics/any-null-member-declarations.js +0 -90
  214. package/dist/semantics/normalize/fresh-array-result.d.ts +0 -32
  215. package/dist/semantics/normalize/fresh-array-result.js +0 -125
@@ -0,0 +1,263 @@
1
+ import { NATIVE_SUM_MATERIALIZER } from '../conversion/native-sum.js';
2
+ import { representationKey } from '../representation/model.js';
3
+ import { dominatorTreeOf } from './dominance.js';
4
+ import { allOperationsOf } from './model.js';
5
+ import { operandsOfIrOperation } from './queries.js';
6
+ import { verifyIrBody } from './verify.js';
7
+ /** A conversion that reads its source's tag and payload and nothing else, and makes no object. */
8
+ export const pureNativeConversion = (operation, conversions) => {
9
+ if (operation.presence !== undefined ||
10
+ operation.rebuild !== undefined ||
11
+ operation.releasesSource !== undefined ||
12
+ operation.nativeObjectSample !== undefined ||
13
+ operation.nativeCallableSource !== undefined ||
14
+ operation.nativeCallablePrototypeObservation !== undefined ||
15
+ operation.readOnlyDictionaryProof !== undefined ||
16
+ (operation.conversionRecipes?.length ?? 0) > 0)
17
+ return false;
18
+ const target = operation.result.representation;
19
+ if (target.kind === 'void' || target.kind === 'native-handle')
20
+ return false;
21
+ const node = conversions.nodeById(operation.conversionUse);
22
+ if (node === null)
23
+ return false;
24
+ if (representationKey(node.source) !== representationKey(operation.source.representation))
25
+ return false;
26
+ if (representationKey(node.target) !== representationKey(target))
27
+ return false;
28
+ const capability = node.capability;
29
+ if (capability.kind !== 'atom' && capability.kind !== 'static')
30
+ return false;
31
+ const materializer = capability.materializer;
32
+ if (materializer.allocates)
33
+ return false;
34
+ const pair = `${representationKey(node.source)}->${representationKey(node.target)}`;
35
+ if (materializer.id === 'gea::native-sum::select')
36
+ return (materializer.nativeSelection !== undefined &&
37
+ materializer.domain === `native-selection:${pair}` &&
38
+ materializer.nativeSelection.source === representationKey(node.source) &&
39
+ materializer.nativeSelection.target === representationKey(node.target));
40
+ return materializer.id === NATIVE_SUM_MATERIALIZER && materializer.domain === `sum-widen:${pair}`;
41
+ };
42
+ /**
43
+ * Deletes every pure conversion (`pureNativeConversion`) nothing reads.
44
+ *
45
+ * `call-dispatch.ts` tests `instanceof` on a selection's own source, which
46
+ * leaves the selection that only fed the test unread. The printer keeps an
47
+ * unread conversion of a non-primitive -- it cannot tell one that may abort
48
+ * from one that cannot; this pass can -- so such a selection would still copy
49
+ * the union and destroy the copy. Deleting an operation nothing names removes
50
+ * only its own certification demands; no other operation's provenance runs
51
+ * through it.
52
+ */
53
+ export const dropUnreadPureConversions = (bodies, conversions) => {
54
+ let output = null;
55
+ for (const [id, body] of bodies) {
56
+ const dropped = droppedBody(body, conversions);
57
+ if (dropped === body)
58
+ continue;
59
+ output ??= new Map(bodies);
60
+ output.set(id, dropped);
61
+ }
62
+ return output ?? bodies;
63
+ };
64
+ const droppedBody = (body, conversions) => {
65
+ const read = new Set();
66
+ for (const block of body.blocks.values())
67
+ for (const operation of allOperationsOf(block))
68
+ for (const operand of operandsOfIrOperation(operation))
69
+ read.add(operand.value);
70
+ for (const region of body.iteratorCloseRegions ?? [])
71
+ read.add(region.iterator.value);
72
+ const unread = new Set();
73
+ for (const block of body.blocks.values())
74
+ for (const operation of block.operations)
75
+ if (operation.kind === 'convert' && !read.has(operation.result.id) && pureNativeConversion(operation, conversions))
76
+ unread.add(operation.result.id);
77
+ if (unread.size === 0)
78
+ return body;
79
+ // A result some proof or plan names by id outside an operand stays.
80
+ const cited = new Set();
81
+ const seen = new Set();
82
+ for (const block of body.blocks.values())
83
+ for (const operation of allOperationsOf(block))
84
+ for (const [key, value] of Object.entries(operation))
85
+ if (key !== 'result')
86
+ collectCitations(value, cited, seen);
87
+ collectCitations(body.hostNamespaceCensus, cited, seen);
88
+ collectCitations(body.denseLoopPlan, cited, seen);
89
+ collectCitations(body.facts, cited, seen);
90
+ for (const value of [...unread])
91
+ if (cited.has(value))
92
+ unread.delete(value);
93
+ if (unread.size === 0)
94
+ return body;
95
+ const blocks = new Map();
96
+ for (const [blockId, block] of body.blocks) {
97
+ const operations = block.operations.filter((operation) => !(operation.kind === 'convert' && unread.has(operation.result.id)));
98
+ blocks.set(blockId, operations.length === block.operations.length ? block : { ...block, operations });
99
+ }
100
+ const values = new Map(body.values);
101
+ for (const value of unread)
102
+ values.delete(value);
103
+ const rewritten = { ...body, blocks, values };
104
+ return verifyIrBody(rewritten).length === 0 ? rewritten : body;
105
+ };
106
+ /** Every SSA id named outside an operand's `value` field, carriers skipped. */
107
+ const collectCitations = (node, cited, seen) => {
108
+ if (typeof node === 'string') {
109
+ if (node.startsWith('ssa|'))
110
+ cited.add(node);
111
+ return;
112
+ }
113
+ if (node === null || typeof node !== 'object' || seen.has(node))
114
+ return;
115
+ seen.add(node);
116
+ if (node instanceof Map) {
117
+ for (const [key, value] of node) {
118
+ collectCitations(key, cited, seen);
119
+ collectCitations(value, cited, seen);
120
+ }
121
+ return;
122
+ }
123
+ if (node instanceof Set) {
124
+ for (const value of node)
125
+ collectCitations(value, cited, seen);
126
+ return;
127
+ }
128
+ const record = node;
129
+ const operand = typeof record['value'] === 'string' && 'representation' in record && Object.keys(record).length === 2;
130
+ for (const [key, value] of Object.entries(record)) {
131
+ if (key === 'representation' || (operand && key === 'value'))
132
+ continue;
133
+ collectCitations(value, cited, seen);
134
+ }
135
+ };
136
+ /**
137
+ * Conversions the printer may spell as the name of a dominating conversion of
138
+ * the same value, by result: later result -> the earlier one it repeats.
139
+ *
140
+ * Each member read of a narrowed union names the union again, and lowering
141
+ * converts it again: `WebGLAttributes.update` re-selected its `attribute`
142
+ * union into the same class-arm union once per member it read -- 21 native
143
+ * selections of 3 distinct pairs, each one a union copy out of the source and
144
+ * a destruction at the end of the scope, per attribute per draw. The C++
145
+ * compiler cannot merge them: every copy is a reference-count increment it
146
+ * must assume a later release observes.
147
+ *
148
+ * Only the RENDERING merges. The IR keeps both conversions, so every
149
+ * certification proof that walks an operand back to the semantic read it came
150
+ * from (`native-property-presence.ts` and its siblings) still finds its own
151
+ * read; the printer names the earlier conversion's storage for the later
152
+ * result instead of converting again. A later conversion is merged only when:
153
+ *
154
+ * - **Both convert the same value.** The same SSA value, or two reads of a
155
+ * cell that is this frame's own (`privateCell`: a local no closure shares,
156
+ * so no call can write it) written exactly once, by a write that dominates
157
+ * every read of it. Two such reads observe the same execution of the write
158
+ * -- see `string-length-reuse.ts`'s `stableStringReceiversOf`, whose
159
+ * argument this is.
160
+ * - **The conversion is a pure function of that value**
161
+ * (`pureNativeConversion`), cited by the same certified node. A selection
162
+ * keeps the identity of every reference it selects, so a value selected
163
+ * twice is the same object both times.
164
+ * - **The earlier one dominates the later one**, so its storage is assigned on
165
+ * every path to the later one and is in scope there (the printer's
166
+ * dominator-nested layout).
167
+ * - **The earlier one is read where it stands.** It has a use of its own and
168
+ * feeds no cell write, so it gets storage rather than being withheld into a
169
+ * forwarded binding.
170
+ *
171
+ * The caller pins both: neither may be withheld as an expression, and neither
172
+ * may be moved from, since one storage now answers both results' uses.
173
+ * Bodies with try or iterator-close regions, generators and async bodies are
174
+ * left alone: an exception edge is not a CFG edge.
175
+ */
176
+ export const redundantPureConversionsOf = (body, conversions, privateCell) => {
177
+ const result = new Map();
178
+ if (body.tryRegions.length > 0 ||
179
+ (body.iteratorCloseRegions?.length ?? 0) > 0 ||
180
+ body.generator === true ||
181
+ body.async === true ||
182
+ body.generatorPrologueBoundary)
183
+ return result;
184
+ const candidates = [];
185
+ const uses = new Map();
186
+ const writtenValues = new Set();
187
+ const writes = new Map();
188
+ const reads = new Map();
189
+ const readDeclaration = new Map();
190
+ for (const block of body.blocks.values()) {
191
+ for (const [position, operation] of block.operations.entries()) {
192
+ for (const operand of operandsOfIrOperation(operation))
193
+ uses.set(operand.value, (uses.get(operand.value) ?? 0) + 1);
194
+ if (operation.kind === 'binding-write') {
195
+ writtenValues.add(operation.value.value);
196
+ writes.set(operation.declaration, [...(writes.get(operation.declaration) ?? []), { block: block.id, position }]);
197
+ }
198
+ // A renewal starts a new binding: count it as a second write.
199
+ if (operation.kind === 'binding-renew')
200
+ writes.set(operation.declaration, [
201
+ ...(writes.get(operation.declaration) ?? []),
202
+ { block: block.id, position },
203
+ { block: block.id, position }
204
+ ]);
205
+ if (operation.kind === 'binding-read') {
206
+ reads.set(operation.declaration, [...(reads.get(operation.declaration) ?? []), { block: block.id, position }]);
207
+ if (operation.reactive !== true)
208
+ readDeclaration.set(operation.result.id, operation.declaration);
209
+ }
210
+ if (operation.kind !== 'convert')
211
+ continue;
212
+ const kind = operation.result.representation.kind;
213
+ if ((kind === 'tagged-union' || kind === 'optional' || kind === 'class-ref') && pureNativeConversion(operation, conversions))
214
+ candidates.push({ operation, site: { block: block.id, position } });
215
+ }
216
+ for (const operand of operandsOfIrOperation(block.terminator))
217
+ uses.set(operand.value, (uses.get(operand.value) ?? 0) + 1);
218
+ }
219
+ if (candidates.length < 2)
220
+ return result;
221
+ const dominance = dominatorTreeOf(body);
222
+ const precedes = (first, second) => first.block === second.block ? first.position < second.position : dominance.dominates(first.block, second.block);
223
+ const stableCell = new Map();
224
+ const isStableCell = (declaration) => {
225
+ const known = stableCell.get(declaration);
226
+ if (known !== undefined)
227
+ return known;
228
+ const sites = writes.get(declaration) ?? [];
229
+ const only = sites[0];
230
+ const stable = privateCell(declaration) &&
231
+ sites.length === 1 &&
232
+ only !== undefined &&
233
+ dominance.reachable.has(only.block) &&
234
+ (reads.get(declaration) ?? []).every((read) => precedes(only, read));
235
+ stableCell.set(declaration, stable);
236
+ return stable;
237
+ };
238
+ const identityOf = (value) => {
239
+ const declaration = readDeclaration.get(value);
240
+ return declaration !== undefined && isStableCell(declaration) ? `cell:${declaration}` : `value:${value}`;
241
+ };
242
+ const groups = new Map();
243
+ for (const candidate of candidates) {
244
+ if (!dominance.reachable.has(candidate.site.block) || writtenValues.has(candidate.operation.result.id))
245
+ continue;
246
+ const operation = candidate.operation;
247
+ const key = `${identityOf(operation.source.value)}|${operation.conversionUse}|${representationKey(operation.result.representation)}`;
248
+ groups.set(key, [...(groups.get(key) ?? []), candidate]);
249
+ }
250
+ for (const members of groups.values()) {
251
+ if (members.length < 2)
252
+ continue;
253
+ for (const later of members) {
254
+ // The outermost dominating member that is read where it stands: dominance
255
+ // is a tree order, so it is unique among the members dominating `later`.
256
+ const dominating = members.filter((member) => member !== later && (uses.get(member.operation.result.id) ?? 0) > 0 && precedes(member.site, later.site));
257
+ const root = dominating.find((member) => !dominating.some((other) => other !== member && precedes(other.site, member.site)));
258
+ if (root !== undefined)
259
+ result.set(later.operation.result.id, root.operation.result.id);
260
+ }
261
+ }
262
+ return result;
263
+ };
@@ -188,6 +188,7 @@ export const operandsOfIrOperation = (operation) => {
188
188
  case 'constant':
189
189
  return [];
190
190
  case 'binding-read':
191
+ return [];
191
192
  case 'binding-renew':
192
193
  return [];
193
194
  case 'parameter':
@@ -1,4 +1,5 @@
1
1
  import { nativeReflectFieldTransportOf } from './native-reflect-field.js';
2
+ import { unsharedDictionaryPairOf } from './convert-carriers.js';
2
3
  import { canonicalIndexLiteral } from '../representation/array-index.js';
3
4
  import { objectPrototypeMemberNames, staticOwnFieldsOf } from '../representation/record-fields.js';
4
5
  import { indexedRecordViewOf, spreadFieldRecordReceiverOf } from './certify/carrier-keys.js';
@@ -36,6 +37,7 @@ import { closePhysicalClassReflection } from './physical-class-reflection.js';
36
37
  import { absentClassArmRead, classFamilyLacksKey } from './absent-class-arm.js';
37
38
  import { nativeAbsentPropertyReadOf } from './native-absent-property.js';
38
39
  import { isPrivateNameKey } from '../semantics/model/structural-types.js';
40
+ import { createUnobservedCallableInputs } from './unobserved-callable-inputs.js';
39
41
  /** A constructor carrier's own construct convention, seen through presence and borrowing; see its use in `closedConstructOperations`. */
40
42
  const constructorCarrierOf = (representation) => {
41
43
  if (representation.kind === 'optional')
@@ -259,7 +261,7 @@ const publishedChildrenOf = (representation, classes, deriver) => {
259
261
  // A `#private` element is reachable only from the class's own body,
260
262
  // never by dynamic code holding the instance: the reflected protocol
261
263
  // leaves it out (`records.ts`), so publishing the instance publishes
262
- // none of what it holds there. Hono's Context keeps the router's
264
+ // none of what it holds there. An HTTP framework's Context keeps the router's
263
265
  // `#matchResult` that way; walking it made every handler tuple in the
264
266
  // router fully reflected.
265
267
  const layout = classes.get(representation.declaration);
@@ -468,8 +470,25 @@ const unwrappedCallableAbi = (representation) => {
468
470
  * calls. An input the source convention states in the target's own carrier is
469
471
  * forwarded unchanged; only a converted one can reach a dynamic listener.
470
472
  */
471
- const callableAdapterInputsOf = (sourceAbi, targetAbi) => {
472
- const forwarded = (target, source) => source !== undefined && representationKey(source) === representationKey(target);
473
+ const callableAdapterInputsOf = (sourceAbi, targetAbi,
474
+ // Target parameter positions the source body is proven never to observe
475
+ // (`unobserved-callable-inputs.ts`): the adapter's conversion of such an
476
+ // input is dropped unread, so it publishes nothing.
477
+ ignored = null) => {
478
+ // A class input carried beside `dynamic` -- three's `renderer` slot, joined
479
+ // from the JS declaration's unresolved JSDoc type and the typed one, is
480
+ // `WebGLRenderer | any` -- narrowed to exactly that class for a listener that
481
+ // states it: the class arm passes through as itself, and a dynamic arm is
482
+ // unboxed by the class's identity test, never adopted through a view (a class
483
+ // has no Document adoption). Neither reads a field of the instance, so the
484
+ // listener sees a typed value and the adapter publishes nothing; whoever
485
+ // boxed a dynamic arm published it there.
486
+ const narrowedToOwnClassArm = (target, source) => source !== undefined &&
487
+ source.kind === 'class-ref' &&
488
+ target.kind === 'tagged-union' &&
489
+ target.arms.some((arm) => representationKey(arm.value) === representationKey(source)) &&
490
+ target.arms.every((arm) => arm.value.kind === 'dynamic' || representationKey(arm.value) === representationKey(source));
491
+ const forwarded = (target, source) => source !== undefined && (representationKey(source) === representationKey(target) || narrowedToOwnClassArm(target, source));
473
492
  const inputs = [];
474
493
  if (targetAbi.receiver !== null &&
475
494
  (sourceAbi === null || (sourceAbi.receiver !== null && !forwarded(targetAbi.receiver, sourceAbi.receiver))))
@@ -478,7 +497,7 @@ const callableAdapterInputsOf = (sourceAbi, targetAbi) => {
478
497
  const source = sourceAbi !== null && sourceAbi.restFrom === targetAbi.restFrom && sourceAbi.argumentsFrame === targetAbi.argumentsFrame
479
498
  ? sourceAbi.parameters[index]?.value
480
499
  : undefined;
481
- if (!forwarded(parameter.value, source))
500
+ if (!forwarded(parameter.value, source) && ignored?.(index) !== true)
482
501
  inputs.push(parameter.value);
483
502
  });
484
503
  return inputs;
@@ -489,11 +508,11 @@ const callableAdapterInputsOf = (sourceAbi, targetAbi) => {
489
508
  * not two native callables joined by an installed conversion. The adapter is
490
509
  * the same one a `convert` installs, so it publishes exactly what that
491
510
  * `convert` would (`callableAdapterInputsOf`) and never the callable's own
492
- * result graph. Hono's `this.match = match` stores a receiver-less arrow into
493
- * RegExpRouter's `this`-stating `match` slot; as an unproven slot value it
511
+ * result graph. A router's `this.match = match` stores a receiver-less arrow
512
+ * into a regular-expression router's `this`-stating `match` slot; as an unproven slot value it
494
513
  * published every handler tuple the router returns.
495
514
  */
496
- const inlineCallableAdapterInputsOf = (source, target, node) => {
515
+ const inlineCallableAdapterInputsOf = (source, target, node, ignored = null) => {
497
516
  const sourceAbi = unwrappedCallableAbi(source);
498
517
  const targetAbi = unwrappedCallableAbi(target);
499
518
  if (sourceAbi === null || targetAbi === null || node === null || node === undefined)
@@ -502,7 +521,7 @@ const inlineCallableAdapterInputsOf = (source, target, node) => {
502
521
  return null;
503
522
  if (representationKey(node.source) !== representationKey(source) || representationKey(node.target) !== representationKey(target))
504
523
  return null;
505
- return callableAdapterInputsOf(sourceAbi, targetAbi);
524
+ return callableAdapterInputsOf(sourceAbi, targetAbi, ignored);
506
525
  };
507
526
  const promote = (rows, representation, reason, classes, deriver, visited = new Set(), publishedChildrenCache = new Map(), observe) => {
508
527
  const work = [];
@@ -1177,10 +1196,10 @@ export const reflectionExposureOf = (bodies, classes, deriver, options) => {
1177
1196
  // element goes through (`ConvertOperation.rebuild`), so its node pairs
1178
1197
  // the element carriers, not the arrays this operation converts between.
1179
1198
  // Matched against the arrays it never cited, and an element converted
1180
- // into a live view (hono's RegExpRouter maps routes to `[handler, any]`
1199
+ // into a live view (a regular-expression router maps routes to `[handler, any]`
1181
1200
  // tuples stored as `[handler, ParamIndexMap]`) read through a source
1182
1201
  // protocol nothing demanded.
1183
- const node = operation.rebuild === 'unshared-array' ? options.conversions?.nodeById(operation.conversionUse) : null;
1202
+ const node = operation.rebuild !== undefined ? options.conversions?.nodeById(operation.conversionUse) : null;
1184
1203
  if (node)
1185
1204
  citeViewNode(node.id, node.source, node.target, operation);
1186
1205
  else
@@ -1418,6 +1437,16 @@ export const reflectionExposureOf = (bodies, classes, deriver, options) => {
1418
1437
  const key = String(body.sourceOwner);
1419
1438
  bodyByFunction.set(key, bodyByFunction.has(key) ? null : body);
1420
1439
  }
1440
+ const unobservedInputs = createUnobservedCallableInputs(bodies, (operation) => bodyByOperation.get(operation));
1441
+ const storedCallableIgnores = (operation, value, field) => {
1442
+ if (operation.kind !== 'set' && operation.kind !== 'define-own-property')
1443
+ return null;
1444
+ const sourceAbi = unwrappedCallableAbi(value);
1445
+ const targetAbi = unwrappedCallableAbi(field);
1446
+ return sourceAbi === null || targetAbi === null
1447
+ ? null
1448
+ : unobservedInputs.ignoredParametersOf(operation, operation.value, sourceAbi, targetAbi);
1449
+ };
1421
1450
  const knownCallFunctionIds = (operation) => {
1422
1451
  if (operation.argumentsAreSpread || operation.closedCallee === undefined)
1423
1452
  return null;
@@ -1494,8 +1523,8 @@ export const reflectionExposureOf = (bodies, classes, deriver, options) => {
1494
1523
  // A member read whose value is only ever the callee of a closed call is
1495
1524
  // that call's own dispatch, not a value: the printer calls each proven
1496
1525
  // function with the receiver it was read from and never materializes the
1497
- // read. Hono's `this.router.match(method, path)` over a union of routers is
1498
- // the shape -- RegExpRouter's `match` states its `this` in its ABI and the
1526
+ // read. An HTTP framework's `this.router.match(method, path)` over a union of routers is
1527
+ // the shape -- a regular-expression router's `match` states its `this` in its ABI and the
1499
1528
  // joined read cannot, so the read looked inexact and published the
1500
1529
  // router's whole match result.
1501
1530
  // Read lazily: `closedCallOperations` is completed by later loops.
@@ -1985,7 +2014,10 @@ export const reflectionExposureOf = (bodies, classes, deriver, options) => {
1985
2014
  if (operation.kind === 'get' && operation.result.representation.kind === 'dynamic')
1986
2015
  for (const source of operation.nativeFieldViewRead.sources)
1987
2016
  promoteLogicalReceiver(source.source, 'native-view-dynamic-result');
1988
- continue;
2017
+ // An open write's plain allocation still stores an unnamed key through
2018
+ // its ordinary route, whose demand follows below.
2019
+ if (operation.kind !== 'set' || operation.nativeFieldViewWrite?.openKeys !== true)
2020
+ continue;
1989
2021
  }
1990
2022
  if (operation.kind === 'own-property-keys' || (operation.kind === 'get-iterator' && operation.protocol === 'enumerate'))
1991
2023
  demandEnumeratedViewOrigins(operation.receiver.representation, operation);
@@ -2005,7 +2037,7 @@ export const reflectionExposureOf = (bodies, classes, deriver, options) => {
2005
2037
  // (`IrArrayElement.element`) copies each element through the ordinary
2006
2038
  // `array-element` recipe (`internal-operation-conversions.ts`), so its
2007
2039
  // demand is that recipe's, exactly as a `convert` citing the same node.
2008
- // Hono's `routes.push(...(ownRoute as [string, H[]][]))` is the case: the
2040
+ // A router's `routes.push(...(ownRoute as [string, H[]][]))` is the case: the
2009
2041
  // elements are read by index and converted, never through a field protocol.
2010
2042
  if (operation.kind === 'allocate-array-object' && operation.result.representation.kind === 'array-object') {
2011
2043
  const element = operation.result.representation.element;
@@ -2181,7 +2213,7 @@ export const reflectionExposureOf = (bodies, classes, deriver, options) => {
2181
2213
  const inputs = operation.kind === 'get'
2182
2214
  ? inlineCallableAdapterInputsOf(field.value, value, options.conversions?.nodeById(conversionNodeIdOf(field.value, value)))
2183
2215
  : storesIntoDeclaredSlot(operation)
2184
- ? inlineCallableAdapterInputsOf(value, field.value, options.conversions?.nodeById(conversionNodeIdOf(value, field.value)))
2216
+ ? inlineCallableAdapterInputsOf(value, field.value, options.conversions?.nodeById(conversionNodeIdOf(value, field.value)), storedCallableIgnores(operation, value, field.value))
2185
2217
  : null;
2186
2218
  if (inputs === null)
2187
2219
  return false;
@@ -2236,10 +2268,27 @@ export const reflectionExposureOf = (bodies, classes, deriver, options) => {
2236
2268
  // An unshared array rebuilt at another element carrier
2237
2269
  // (`ConvertOperation.rebuild`) cites the ELEMENT conversion each copied
2238
2270
  // element goes through, so its demand is that conversion's -- the copy
2239
- // itself is `appendRangeConverted` over native storage. Hono's static
2271
+ // itself is `appendRangeConverted` over native storage. A router's static
2240
2272
  // route table (`[handlers.map(([h]) => [h, Object.create(null)]),
2241
2273
  // emptyParam]`) is the case: the `[T, any]` tuples are rebuilt as `[T,
2242
2274
  // ParamIndexMap]`, and only the unboxed dictionary is read dynamically.
2275
+ if (operation.kind === 'convert' && operation.rebuild === 'unshared-dictionary') {
2276
+ const pair = unsharedDictionaryPairOf(operation.source.representation, operation.result.representation);
2277
+ const node = options.conversions?.nodeById(operation.conversionUse);
2278
+ if (pair !== null &&
2279
+ node !== null &&
2280
+ node !== undefined &&
2281
+ representationKey(node.source) === representationKey(pair.source.value) &&
2282
+ representationKey(node.target) === representationKey(pair.target.value)) {
2283
+ const capability = node.capability;
2284
+ if (capability.kind === 'identity' ||
2285
+ ((capability.kind === 'atom' || capability.kind === 'static' || capability.kind === 'class-family') &&
2286
+ capability.materializer.nativeFieldProtocol === 'unused'))
2287
+ continue;
2288
+ promoteCitedConversion(operation.conversionUse, pair.source.value, pair.target.value, 'unshared-dictionary-entry-conversion');
2289
+ continue;
2290
+ }
2291
+ }
2243
2292
  if (operation.kind === 'convert' && operation.rebuild === 'unshared-array') {
2244
2293
  const unwrap = (value) => (value.kind === 'promise' ? value.value : value);
2245
2294
  const source = unwrap(operation.source.representation);
@@ -2308,9 +2357,12 @@ export const reflectionExposureOf = (bodies, classes, deriver, options) => {
2308
2357
  // conversion that installs it.
2309
2358
  if (reflectionWatch !== undefined && targetAbi !== null)
2310
2359
  console.error(`[REFLECTION-ADAPTER] lineage=${String(operation.lineage)} node=${operation.conversionUse} capability=${node?.capability.kind ?? 'none'}`);
2311
- if (targetAbi !== null)
2312
- for (const input of callableAdapterInputsOf(unwrappedCallableAbi(operation.source.representation), targetAbi))
2360
+ if (targetAbi !== null) {
2361
+ const sourceAbi = unwrappedCallableAbi(operation.source.representation);
2362
+ const ignored = sourceAbi === null ? null : unobservedInputs.ignoredParametersOf(operation, operation.source, sourceAbi, targetAbi);
2363
+ for (const input of callableAdapterInputsOf(sourceAbi, targetAbi, ignored))
2313
2364
  promoteFull(input, 'callable-adapter-input');
2365
+ }
2314
2366
  }
2315
2367
  if (observesNativeCarrierOnly(operation))
2316
2368
  continue;
package/dist/ir/shake.js CHANGED
@@ -294,7 +294,7 @@ const sliceBody = (body, placements, liveCells, structuralViewScopes) => {
294
294
  }
295
295
  if (operation.kind === 'allocate-callable')
296
296
  citedFunctions.add(operation.functionId);
297
- if (operation.kind === 'allocate-constructor')
297
+ if (operation.kind === 'allocate-constructor' && !operation.constructionDeferred)
298
298
  evaluatedClasses.add(operation.declaration);
299
299
  if (operation.kind === 'construct') {
300
300
  const targets = operation.target.kind === 'exact'
@@ -348,7 +348,7 @@ const sliceBody = (body, placements, liveCells, structuralViewScopes) => {
348
348
  const scopes = receiverClassScopes(operation.receiver.representation, structuralViewScopes);
349
349
  // A computed key the semantic graph proved to a finite name set
350
350
  // (`GetOperation.provenKeyTexts`) names exactly those members, the same
351
- // fact `reflection-demand.ts` demands fields by. Hono's
351
+ // fact `reflection-demand.ts` demands fields by. An HTTP framework's
352
352
  // `bodyCache[key]` for `key: keyof Body` reads a cache boxed because
353
353
  // `Body` states `json: any`; filed as an unknown key on an unknown
354
354
  // receiver, it kept every method of every class -- `HonoRequest#query`
@@ -0,0 +1,37 @@
1
+ import type { CallableAbi } from '../representation/model.js';
2
+ import type { IrBody, IrOperand, IrOperation } from './model.js';
3
+ /**
4
+ * Which target-convention argument positions a converted callable can never
5
+ * observe, so its adapter's conversion of them publishes nothing.
6
+ *
7
+ * A callable adapter converts every target input the source convention does
8
+ * not state in the target's own carrier (`reflection-demand.ts`'s
9
+ * `callableAdapterInputsOf`), and a converted input is promoted to full
10
+ * reflection because the source body might read it dynamically. That is only
11
+ * true of a body that reads it at all. three's `WebGLBackground` installs
12
+ * `boxMesh.onBeforeRender = function (renderer, scene, camera) { ... camera ... }`
13
+ * into Object3D's `onBeforeRender(renderer: WebGLRenderer, ...)` slot; the
14
+ * body never names `renderer`, yet promoting it published the renderer, its
15
+ * render lists and every RenderItem to full reflection, and the frame's hot
16
+ * render-item reads went through field-view receipts.
17
+ *
18
+ * The proof is per source body and closed: the converted value must be the
19
+ * exact `allocate-callable` result of its own body, every physical body of
20
+ * that function must take the source convention's fixed frame (no `arguments`
21
+ * object, no rest packing, not a split generator), and each `parameter` value
22
+ * at the position may only be stored into a binding no operation anywhere in
23
+ * the program reads, renews or otherwise names. A position past the source's
24
+ * declared parameters is dropped by the adapter outright, which only an
25
+ * `arguments` object could observe, and that is excluded by the same frame
26
+ * check. Anything else -- a phi, a binding-read source, a body of another
27
+ * shape -- answers `null` and keeps the conservative promotion.
28
+ */
29
+ export interface UnobservedCallableInputs {
30
+ /**
31
+ * The predicate over TARGET parameter positions for the callable `source`
32
+ * names inside the body that executes `operation`, or `null` when the
33
+ * source's body is not proven.
34
+ */
35
+ readonly ignoredParametersOf: (operation: IrOperation, source: IrOperand, sourceAbi: CallableAbi, targetAbi: CallableAbi) => ((index: number) => boolean) | null;
36
+ }
37
+ export declare const createUnobservedCallableInputs: (bodies: readonly IrBody[], bodyOf: (operation: IrOperation) => IrBody | undefined) => UnobservedCallableInputs;
@@ -0,0 +1,111 @@
1
+ import { operandsOfIrOperation } from './queries.js';
2
+ export const createUnobservedCallableInputs = (bodies, bodyOf) => {
3
+ const bodiesByFunction = new Map();
4
+ for (const body of bodies) {
5
+ const key = String(body.sourceOwner);
6
+ const list = bodiesByFunction.get(key);
7
+ if (list)
8
+ list.push(body);
9
+ else
10
+ bodiesByFunction.set(key, [body]);
11
+ }
12
+ let named = null;
13
+ // Every declaration some operation other than a plain `binding-write` names
14
+ // -- a read, a renewal, a constructor allocation, a module binding. A cell
15
+ // outside this set is written and never observed.
16
+ const namedDeclarations = () => {
17
+ if (named !== null)
18
+ return named;
19
+ named = new Set();
20
+ for (const body of bodies)
21
+ for (const block of body.blocks.values())
22
+ for (const operation of [...block.operations, block.terminator]) {
23
+ if (operation.kind === 'binding-write')
24
+ continue;
25
+ const declaration = operation.declaration;
26
+ if (typeof declaration === 'string')
27
+ named.add(declaration);
28
+ }
29
+ return named;
30
+ };
31
+ const definers = new Map();
32
+ const definerOf = (body, value) => {
33
+ let table = definers.get(body);
34
+ if (table === undefined) {
35
+ table = new Map();
36
+ for (const block of body.blocks.values())
37
+ for (const operation of block.operations) {
38
+ const result = operation.result;
39
+ if (result)
40
+ table.set(result.id, operation);
41
+ }
42
+ definers.set(body, table);
43
+ }
44
+ return table.get(value);
45
+ };
46
+ const verdicts = new Map();
47
+ // The parameter ordinals no body of `functionId` observes, or `null` when a
48
+ // body's frame does not match `sourceAbi` exactly.
49
+ const unobservedOrdinalsOf = (functionId, sourceAbi) => {
50
+ const cacheKey = `${String(functionId)}#${sourceAbi.parameters.length}`;
51
+ if (verdicts.has(cacheKey))
52
+ return verdicts.get(cacheKey) ?? null;
53
+ const compute = () => {
54
+ const callees = bodiesByFunction.get(String(functionId));
55
+ if (callees === undefined || callees.length === 0)
56
+ return null;
57
+ const unobserved = new Set(sourceAbi.parameters.map((_, index) => index));
58
+ for (const body of callees) {
59
+ const abi = body.abi;
60
+ if (abi === null ||
61
+ body.generator === true ||
62
+ (body.generatorPrologueBoundary ?? null) !== null ||
63
+ abi.argumentsFrame !== undefined ||
64
+ abi.restFrom !== null ||
65
+ abi.parameters.length !== sourceAbi.parameters.length)
66
+ return null;
67
+ const users = new Map();
68
+ const parameters = [];
69
+ for (const block of body.blocks.values())
70
+ for (const operation of [...block.operations, block.terminator]) {
71
+ if (operation.kind === 'parameter')
72
+ parameters.push(operation);
73
+ for (const operand of operandsOfIrOperation(operation)) {
74
+ const list = users.get(operand.value);
75
+ if (list)
76
+ list.push(operation);
77
+ else
78
+ users.set(operand.value, [operation]);
79
+ }
80
+ }
81
+ for (const parameter of parameters) {
82
+ const silent = (users.get(parameter.result.id) ?? []).every((user) => user.kind === 'binding-write' && !namedDeclarations().has(user.declaration));
83
+ if (!silent)
84
+ unobserved.delete(parameter.ordinal);
85
+ }
86
+ }
87
+ return unobserved;
88
+ };
89
+ const verdict = compute();
90
+ verdicts.set(cacheKey, verdict);
91
+ return verdict;
92
+ };
93
+ return {
94
+ ignoredParametersOf: (operation, source, sourceAbi, targetAbi) => {
95
+ if (sourceAbi.argumentsFrame !== undefined || sourceAbi.restFrom !== null)
96
+ return null;
97
+ if (targetAbi.argumentsFrame !== undefined || targetAbi.restFrom !== null)
98
+ return null;
99
+ const body = bodyOf(operation);
100
+ if (body === undefined)
101
+ return null;
102
+ const definer = definerOf(body, source.value);
103
+ if (definer?.kind !== 'allocate-callable')
104
+ return null;
105
+ const unobserved = unobservedOrdinalsOf(definer.functionId, sourceAbi);
106
+ if (unobserved === null)
107
+ return null;
108
+ return (index) => index >= sourceAbi.parameters.length || unobserved.has(index);
109
+ }
110
+ };
111
+ };
@@ -42,4 +42,4 @@ export interface InspectedNativeSignature {
42
42
  };
43
43
  }
44
44
  /** Native facts come from Clang's resolved type graph; callers authenticate their declaration-to-host binding separately. */
45
- export declare function inspectNativeFunctionSignature(input: NativeFunctionInspection): InspectedNativeSignature;
45
+ export declare function inspectNativeFunctionSignature(requested: NativeFunctionInspection): InspectedNativeSignature;