@scriptc/compiler 0.2.8 → 0.2.10

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 (275) hide show
  1. package/ambient/scriptc-node-fallback.d.ts +1 -0
  2. package/dist/backend/cycle-analysis.d.ts +56 -0
  3. package/dist/backend/cycle-analysis.js +222 -28
  4. package/dist/backend/cycle-analysis.js.map +1 -1
  5. package/dist/backend/cycle-analysis.test.js +232 -15
  6. package/dist/backend/cycle-analysis.test.js.map +1 -1
  7. package/dist/backend/cycle-mutability.d.ts +27 -6
  8. package/dist/backend/cycle-mutability.js +110 -17
  9. package/dist/backend/cycle-mutability.js.map +1 -1
  10. package/dist/backend/immutability.d.ts +57 -0
  11. package/dist/backend/immutability.js +178 -0
  12. package/dist/backend/immutability.js.map +1 -0
  13. package/dist/backend/immutability.test.d.ts +1 -0
  14. package/dist/backend/immutability.test.js +131 -0
  15. package/dist/backend/immutability.test.js.map +1 -0
  16. package/dist/backend/llvm/alloc.d.ts +13 -3
  17. package/dist/backend/llvm/alloc.js +24 -10
  18. package/dist/backend/llvm/alloc.js.map +1 -1
  19. package/dist/backend/llvm/alloc.test.js +5 -5
  20. package/dist/backend/llvm/alloc.test.js.map +1 -1
  21. package/dist/backend/llvm/borrowed-inputs.d.ts +9 -2
  22. package/dist/backend/llvm/borrowed-inputs.js +31 -3
  23. package/dist/backend/llvm/borrowed-inputs.js.map +1 -1
  24. package/dist/backend/llvm/byte-numbers.js +2 -3
  25. package/dist/backend/llvm/byte-numbers.js.map +1 -1
  26. package/dist/backend/llvm/classes.d.ts +28 -0
  27. package/dist/backend/llvm/classes.js +51 -10
  28. package/dist/backend/llvm/classes.js.map +1 -1
  29. package/dist/backend/llvm/classes.test.js +129 -1
  30. package/dist/backend/llvm/classes.test.js.map +1 -1
  31. package/dist/backend/llvm/common.d.ts +30 -0
  32. package/dist/backend/llvm/common.js +41 -0
  33. package/dist/backend/llvm/common.js.map +1 -1
  34. package/dist/backend/llvm/dense-array-access.js +6 -5
  35. package/dist/backend/llvm/dense-array-access.js.map +1 -1
  36. package/dist/backend/llvm/dense-array-access.test.js +10 -2
  37. package/dist/backend/llvm/dense-array-access.test.js.map +1 -1
  38. package/dist/backend/llvm/dyn.d.ts +6 -4
  39. package/dist/backend/llvm/dyn.js +30 -14
  40. package/dist/backend/llvm/dyn.js.map +1 -1
  41. package/dist/backend/llvm/emitter.d.ts +109 -5
  42. package/dist/backend/llvm/emitter.js +716 -112
  43. package/dist/backend/llvm/emitter.js.map +1 -1
  44. package/dist/backend/llvm/emitter.test.js +54 -3
  45. package/dist/backend/llvm/emitter.test.js.map +1 -1
  46. package/dist/backend/llvm/expr-bytes.js +35 -28
  47. package/dist/backend/llvm/expr-bytes.js.map +1 -1
  48. package/dist/backend/llvm/expr-calls.js +14 -6
  49. package/dist/backend/llvm/expr-calls.js.map +1 -1
  50. package/dist/backend/llvm/expr-containers.js +31 -8
  51. package/dist/backend/llvm/expr-containers.js.map +1 -1
  52. package/dist/backend/llvm/expr-context.d.ts +2 -0
  53. package/dist/backend/llvm/expr-control.js +46 -5
  54. package/dist/backend/llvm/expr-control.js.map +1 -1
  55. package/dist/backend/llvm/expr-dynamic.js +3 -0
  56. package/dist/backend/llvm/expr-dynamic.js.map +1 -1
  57. package/dist/backend/llvm/expr-primitives.js +30 -3
  58. package/dist/backend/llvm/expr-primitives.js.map +1 -1
  59. package/dist/backend/llvm/expr-primitives.test.js +53 -0
  60. package/dist/backend/llvm/expr-primitives.test.js.map +1 -1
  61. package/dist/backend/llvm/expr-stream-bridges.d.ts +3 -0
  62. package/dist/backend/llvm/expr-stream-bridges.js +76 -14
  63. package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
  64. package/dist/backend/llvm/lib-filesystem.js +18 -2
  65. package/dist/backend/llvm/lib-filesystem.js.map +1 -1
  66. package/dist/backend/llvm/lib-shared.js +1 -0
  67. package/dist/backend/llvm/lib-shared.js.map +1 -1
  68. package/dist/backend/llvm/local-array-reads.d.ts +17 -6
  69. package/dist/backend/llvm/local-array-reads.js +157 -45
  70. package/dist/backend/llvm/local-array-reads.js.map +1 -1
  71. package/dist/backend/llvm/loop-array-borrows.d.ts +5 -2
  72. package/dist/backend/llvm/loop-array-borrows.js +27 -8
  73. package/dist/backend/llvm/loop-array-borrows.js.map +1 -1
  74. package/dist/backend/llvm/map-number-lookup.d.ts +7 -0
  75. package/dist/backend/llvm/map-number-lookup.js +18 -1
  76. package/dist/backend/llvm/map-number-lookup.js.map +1 -1
  77. package/dist/backend/llvm/map-read-lifetimes.d.ts +5 -0
  78. package/dist/backend/llvm/map-read-lifetimes.js +14 -4
  79. package/dist/backend/llvm/map-read-lifetimes.js.map +1 -1
  80. package/dist/backend/llvm/map-read-lifetimes.test.js +5 -0
  81. package/dist/backend/llvm/map-read-lifetimes.test.js.map +1 -1
  82. package/dist/backend/llvm/reference-effects.js +34 -1
  83. package/dist/backend/llvm/reference-effects.js.map +1 -1
  84. package/dist/backend/llvm/reference-writes.d.ts +124 -0
  85. package/dist/backend/llvm/reference-writes.js +1090 -0
  86. package/dist/backend/llvm/reference-writes.js.map +1 -0
  87. package/dist/backend/llvm/shapes.d.ts +22 -8
  88. package/dist/backend/llvm/shapes.js +79 -23
  89. package/dist/backend/llvm/shapes.js.map +1 -1
  90. package/dist/backend/llvm/shapes.test.js +5 -5
  91. package/dist/backend/llvm/shapes.test.js.map +1 -1
  92. package/dist/backend/llvm/string-lifetimes.test.js +39 -10
  93. package/dist/backend/llvm/string-lifetimes.test.js.map +1 -1
  94. package/dist/backend/llvm/string-reads.d.ts +3 -0
  95. package/dist/backend/llvm/string-reads.js +45 -11
  96. package/dist/backend/llvm/string-reads.js.map +1 -1
  97. package/dist/backend/llvm/string-slices.js +1 -1
  98. package/dist/backend/llvm/switch-dispatch.d.ts +2 -2
  99. package/dist/backend/llvm/switch-dispatch.js +35 -22
  100. package/dist/backend/llvm/switch-dispatch.js.map +1 -1
  101. package/dist/backend/llvm/switch-dispatch.test.js +28 -10
  102. package/dist/backend/llvm/switch-dispatch.test.js.map +1 -1
  103. package/dist/backend/llvm/trunc.d.ts +8 -0
  104. package/dist/backend/llvm/trunc.js +28 -0
  105. package/dist/backend/llvm/trunc.js.map +1 -0
  106. package/dist/backend/llvm/walk-borrows.d.ts +8 -1
  107. package/dist/backend/llvm/walk-borrows.js +15 -4
  108. package/dist/backend/llvm/walk-borrows.js.map +1 -1
  109. package/dist/backend/loop-polls.d.ts +14 -0
  110. package/dist/backend/loop-polls.js +100 -0
  111. package/dist/backend/loop-polls.js.map +1 -0
  112. package/dist/backend/loop-polls.test.d.ts +1 -0
  113. package/dist/backend/loop-polls.test.js +86 -0
  114. package/dist/backend/loop-polls.test.js.map +1 -0
  115. package/dist/backend/may-throw.d.ts +36 -2
  116. package/dist/backend/may-throw.js +328 -13
  117. package/dist/backend/may-throw.js.map +1 -1
  118. package/dist/backend/may-throw.test.js +169 -1
  119. package/dist/backend/may-throw.test.js.map +1 -1
  120. package/dist/backend/native-codegen.d.ts +1 -3
  121. package/dist/backend/native-codegen.js +4 -32
  122. package/dist/backend/native-codegen.js.map +1 -1
  123. package/dist/backend/publication.d.ts +5 -0
  124. package/dist/backend/publication.js +10 -0
  125. package/dist/backend/publication.js.map +1 -1
  126. package/dist/backend/runtime-abi.d.ts +2 -2
  127. package/dist/backend/runtime-abi.js +2 -2
  128. package/dist/backend/runtime-abi.js.map +1 -1
  129. package/dist/backend/runtime-pack-targets.test.js +1 -1
  130. package/dist/backend/runtime-pack-targets.test.js.map +1 -1
  131. package/dist/backend/runtime-pack.test.js +1 -1
  132. package/dist/backend/runtime-pack.test.js.map +1 -1
  133. package/dist/cli/command.js +8 -1
  134. package/dist/cli/command.js.map +1 -1
  135. package/dist/cli/output-options.d.ts +1 -0
  136. package/dist/cli/output-options.js +3 -0
  137. package/dist/cli/output-options.js.map +1 -1
  138. package/dist/cli/usage.d.ts +5 -1
  139. package/dist/cli/usage.js +6 -0
  140. package/dist/cli/usage.js.map +1 -1
  141. package/dist/compile-types.d.ts +5 -0
  142. package/dist/contracts/check.d.ts +8 -0
  143. package/dist/contracts/check.js +1577 -0
  144. package/dist/contracts/check.js.map +1 -0
  145. package/dist/executable/executable-cache.d.ts +2 -0
  146. package/dist/executable/executable-cache.js +3 -0
  147. package/dist/executable/executable-cache.js.map +1 -1
  148. package/dist/executable/executable-cache.test.js +1 -0
  149. package/dist/executable/executable-cache.test.js.map +1 -1
  150. package/dist/executable/prepare.js +9 -0
  151. package/dist/executable/prepare.js.map +1 -1
  152. package/dist/frontend/contract-types.d.ts +50 -0
  153. package/dist/frontend/contract-types.js +232 -0
  154. package/dist/frontend/contract-types.js.map +1 -0
  155. package/dist/frontend/lowering/array-values.js +37 -1
  156. package/dist/frontend/lowering/array-values.js.map +1 -1
  157. package/dist/frontend/lowering/builtins/strings.js +4 -1
  158. package/dist/frontend/lowering/builtins/strings.js.map +1 -1
  159. package/dist/frontend/lowering/call-arguments.js +96 -4
  160. package/dist/frontend/lowering/call-arguments.js.map +1 -1
  161. package/dist/frontend/lowering/class-method-mutations.js +88 -0
  162. package/dist/frontend/lowering/class-method-mutations.js.map +1 -1
  163. package/dist/frontend/lowering/coercions/unions.d.ts +12 -0
  164. package/dist/frontend/lowering/coercions/unions.js +63 -0
  165. package/dist/frontend/lowering/coercions/unions.js.map +1 -1
  166. package/dist/frontend/lowering/containers/bytes.js +15 -4
  167. package/dist/frontend/lowering/containers/bytes.js.map +1 -1
  168. package/dist/frontend/lowering/expressions/optional-chains.js +4 -1
  169. package/dist/frontend/lowering/expressions/optional-chains.js.map +1 -1
  170. package/dist/frontend/lowering/expressions/union-fields.d.ts +19 -0
  171. package/dist/frontend/lowering/expressions/union-fields.js +236 -0
  172. package/dist/frontend/lowering/expressions/union-fields.js.map +1 -0
  173. package/dist/frontend/lowering/lower-calls.js +21 -4
  174. package/dist/frontend/lowering/lower-calls.js.map +1 -1
  175. package/dist/frontend/lowering/lower-exprs.d.ts +6 -0
  176. package/dist/frontend/lowering/lower-exprs.js +245 -4
  177. package/dist/frontend/lowering/lower-exprs.js.map +1 -1
  178. package/dist/frontend/lowering/lower-island.js +5 -19
  179. package/dist/frontend/lowering/lower-island.js.map +1 -1
  180. package/dist/frontend/lowering/lower-stmts.js +11 -1
  181. package/dist/frontend/lowering/lower-stmts.js.map +1 -1
  182. package/dist/frontend/lowering/lowerer.d.ts +14 -0
  183. package/dist/frontend/lowering/lowerer.js +221 -8
  184. package/dist/frontend/lowering/lowerer.js.map +1 -1
  185. package/dist/frontend/lowering/nan-coded-reads.d.ts +161 -0
  186. package/dist/frontend/lowering/nan-coded-reads.js +1342 -0
  187. package/dist/frontend/lowering/nan-coded-reads.js.map +1 -0
  188. package/dist/frontend/lowering/narrowing-stability.d.ts +100 -0
  189. package/dist/frontend/lowering/narrowing-stability.js +1174 -0
  190. package/dist/frontend/lowering/narrowing-stability.js.map +1 -0
  191. package/dist/frontend/lowering/narrowing-stability.test.d.ts +1 -0
  192. package/dist/frontend/lowering/narrowing-stability.test.js +150 -0
  193. package/dist/frontend/lowering/narrowing-stability.test.js.map +1 -0
  194. package/dist/frontend/lowering/runtime-optional-bounds.d.ts +14 -2
  195. package/dist/frontend/lowering/runtime-optional-bounds.js +17 -11
  196. package/dist/frontend/lowering/runtime-optional-bounds.js.map +1 -1
  197. package/dist/frontend/lowering/runtime-optional-bounds.test.js +28 -0
  198. package/dist/frontend/lowering/runtime-optional-bounds.test.js.map +1 -1
  199. package/dist/frontend/lowering/surfaces.js +8 -0
  200. package/dist/frontend/lowering/surfaces.js.map +1 -1
  201. package/dist/frontend/program.js +1 -1
  202. package/dist/frontend/type-mapper.js +43 -0
  203. package/dist/frontend/type-mapper.js.map +1 -1
  204. package/dist/index.d.ts +1 -1
  205. package/dist/index.js +20 -8
  206. package/dist/index.js.map +1 -1
  207. package/dist/ir/builtin-signatures.d.ts +1 -1
  208. package/dist/ir/builtin-signatures.js +2 -0
  209. package/dist/ir/builtin-signatures.js.map +1 -1
  210. package/dist/ir/constant-globals.d.ts +14 -0
  211. package/dist/ir/constant-globals.js +81 -0
  212. package/dist/ir/constant-globals.js.map +1 -0
  213. package/dist/ir/constant-globals.test.d.ts +1 -0
  214. package/dist/ir/constant-globals.test.js +97 -0
  215. package/dist/ir/constant-globals.test.js.map +1 -0
  216. package/dist/ir/final-fields.d.ts +35 -0
  217. package/dist/ir/final-fields.js +187 -0
  218. package/dist/ir/final-fields.js.map +1 -0
  219. package/dist/ir/final-fields.test.d.ts +1 -0
  220. package/dist/ir/final-fields.test.js +106 -0
  221. package/dist/ir/final-fields.test.js.map +1 -0
  222. package/dist/ir/int32-slots.d.ts +35 -0
  223. package/dist/ir/int32-slots.js +217 -104
  224. package/dist/ir/int32-slots.js.map +1 -1
  225. package/dist/ir/int32-slots.test.js +27 -0
  226. package/dist/ir/int32-slots.test.js.map +1 -1
  227. package/dist/ir/integer-loops.d.ts +5 -0
  228. package/dist/ir/integer-loops.js +23 -4
  229. package/dist/ir/integer-loops.js.map +1 -1
  230. package/dist/ir/integer-loops.test.js +43 -1
  231. package/dist/ir/integer-loops.test.js.map +1 -1
  232. package/dist/ir/integer-ranges.d.ts +20 -0
  233. package/dist/ir/integer-ranges.js +178 -21
  234. package/dist/ir/integer-ranges.js.map +1 -1
  235. package/dist/ir/integer-ranges.test.js +148 -3
  236. package/dist/ir/integer-ranges.test.js.map +1 -1
  237. package/dist/ir/ir.d.ts +38 -1
  238. package/dist/ir/ir.js +4 -0
  239. package/dist/ir/ir.js.map +1 -1
  240. package/dist/ir/serialize.d.ts +17 -3
  241. package/dist/ir/serialize.js +198 -39
  242. package/dist/ir/serialize.js.map +1 -1
  243. package/dist/ir/serialize.test.js +65 -1
  244. package/dist/ir/serialize.test.js.map +1 -1
  245. package/dist/ir/unshare.d.ts +14 -0
  246. package/dist/ir/unshare.js +60 -0
  247. package/dist/ir/unshare.js.map +1 -0
  248. package/dist/ir/unshare.test.d.ts +1 -0
  249. package/dist/ir/unshare.test.js +115 -0
  250. package/dist/ir/unshare.test.js.map +1 -0
  251. package/dist/library/prepare.js +9 -0
  252. package/dist/library/prepare.js.map +1 -1
  253. package/dist/native/cache.d.ts +8 -1
  254. package/dist/native/cache.js +38 -1
  255. package/dist/native/cache.js.map +1 -1
  256. package/dist/native/cache.test.js +11 -0
  257. package/dist/native/cache.test.js.map +1 -1
  258. package/dist/native/compiler.js +4 -3
  259. package/dist/native/compiler.js.map +1 -1
  260. package/dist/native/prepare.d.ts +3 -1
  261. package/dist/native/prepare.js +63 -28
  262. package/dist/native/prepare.js.map +1 -1
  263. package/dist/native/prepare.test.js +23 -1
  264. package/dist/native/prepare.test.js.map +1 -1
  265. package/dist/native/text-file.d.ts +10 -0
  266. package/dist/native/text-file.js +41 -0
  267. package/dist/native/text-file.js.map +1 -0
  268. package/dist/text-parts.d.ts +5 -0
  269. package/dist/text-parts.js +36 -0
  270. package/dist/text-parts.js.map +1 -0
  271. package/package.json +20 -20
  272. package/surface-manifest.json +7 -1
  273. package/dist/frontend/lowering/expressions/union-field-write.d.ts +0 -8
  274. package/dist/frontend/lowering/expressions/union-field-write.js +0 -108
  275. package/dist/frontend/lowering/expressions/union-field-write.js.map +0 -1
@@ -11,6 +11,7 @@ import { OptionalArrayReads, type LocalArrayRead } from "./local-array-reads.js"
11
11
  import { CheckedNarrows } from "./checked-narrows.js";
12
12
  import { type MapReadLifetimes } from "./map-read-lifetimes.js";
13
13
  import { ReferenceEffects } from "./reference-effects.js";
14
+ import { ReferenceWrites, type Writes } from "./reference-writes.js";
14
15
  import { StackCallbacks } from "./stack-callbacks.js";
15
16
  import { AmbientReceiverReaders } from "./constant-callbacks.js";
16
17
  import { type StringSliceSnapshot } from "./string-slices.js";
@@ -45,10 +46,14 @@ export interface LlvmTargetOptions {
45
46
  /** Emit retain/release fast paths inline (the `speed` posture). Off, every
46
47
  * retain and release is a runtime call. */
47
48
  inlineRc?: boolean;
49
+ /** Define `scr_detached_exit` so the Linux runtime hands the address-space
50
+ * teardown after `process.exit` to a helper process (`--detached-exit`).
51
+ * Executables only; the runtime's weak default keeps it off. */
52
+ detachedExit?: boolean;
48
53
  }
49
- export declare function emitLlvmModule(mod: IrModule, options?: LlvmTargetOptions): string;
54
+ export declare function emitLlvmModule(input: IrModule, options?: LlvmTargetOptions): string;
50
55
  /** Keep large translation units below the host's single-string limit. */
51
- export declare function emitLlvmModuleSource(mod: IrModule, options?: LlvmTargetOptions): string | readonly string[];
56
+ export declare function emitLlvmModuleSource(input: IrModule, options?: LlvmTargetOptions): string | readonly string[];
52
57
  export declare class LlEmitter {
53
58
  readonly mod: IrModule;
54
59
  localArrayReads: Map<string, LocalArrayRead>;
@@ -73,12 +78,27 @@ export declare class LlEmitter {
73
78
  private debugScope;
74
79
  readonly sizeType: "i32" | "i64";
75
80
  readonly ffiExtendNarrowIntegers: boolean;
76
- readonly cycleColorOffset: number;
81
+ readonly cycleBufferedOffset: number;
82
+ /** Emitted ScrCycType descriptors so far (their collector statistics
83
+ * indices; see ShapeHost.nextCycKind). */
84
+ private cycKinds;
77
85
  readonly wasi: boolean;
86
+ /** The target lacks a rounding instruction at its baseline CPU (x86-64
87
+ * before SSE4.1), so `llvm.trunc` would lower to a libm call: emit
88
+ * truncation inline through an integer round trip instead. */
89
+ readonly inlineTrunc: boolean;
78
90
  /** ELF worker executables give thread-locals the executable TLS models. */
79
91
  private readonly executableTls;
92
+ /** Source loops enclosing the statement being emitted in the current
93
+ * function body. */
94
+ private loopDepth;
95
+ /** Darwin worker executables read the stack guard from a pthread
96
+ * thread-specific-data slot off the thread pointer (scr_runtime.h's
97
+ * SCR_STACK_GUARD_TSD): the architecture names the access sequence. */
98
+ private readonly stackGuardTsd;
80
99
  private readonly emitLibraryIdentity;
81
100
  private readonly runtimeAbiMarker;
101
+ private readonly detachedExit;
82
102
  /** Interned string literals: UTF-8 text → { symbol, byte length } —
83
103
  * first-use order, the runtime ABI’s determinism discipline. */
84
104
  private readonly literals;
@@ -140,6 +160,12 @@ export declare class LlEmitter {
140
160
  * fiberless-async analysis scans it for suspension entry points. */
141
161
  private readonly fnDefText;
142
162
  readonly referenceEffects: ReferenceEffects;
163
+ /** Field-sensitive reference writes (null in debug builds). */
164
+ referenceWrites: ReferenceWrites | null;
165
+ private readonly borrowedReturnKeyCache;
166
+ /** The statement list being emitted and the current index, for blocks
167
+ * whose bindings end with the list (emitBlock and function bodies). */
168
+ private stmtCursor;
143
169
  readonly optionalArrayReads: OptionalArrayReads;
144
170
  readonly checkedNarrows: CheckedNarrows;
145
171
  callArrayReads: Map<IrExpr, LocalArrayRead>;
@@ -183,6 +209,9 @@ export declare class LlEmitter {
183
209
  readonly ffiHasRetainedCallback: boolean;
184
210
  private readonly ffiHasForeignCallback;
185
211
  private readonly globalTypes;
212
+ /** Module constants that keep one value once initialized
213
+ * (immutability.ts stableGlobals). */
214
+ private stableGlobals;
186
215
  private readonly tdzGlobals;
187
216
  readonly constantNumericTables: ReadonlyMap<string, ConstantNumericTable>;
188
217
  /** May-throw analysis (computeMayThrow): pending
@@ -198,6 +227,13 @@ export declare class LlEmitter {
198
227
  /** Static types whose values can be published (@scriptc/threads): their
199
228
  * stores carry the frozen-object guard. Null without publish calls. */
200
229
  readonly publishedTypes: PublishedTypes | null;
230
+ /** Construction-only class and record fields (immutability.ts); null
231
+ * where the facts are disabled. */
232
+ private readonly immutableFields;
233
+ /** Constructor function names: their bodies may still write their own
234
+ * `this`'s construction-only fields. */
235
+ private readonly constructorFunctions;
236
+ private inConstructor;
201
237
  /** Method names with at least one may-throw implementation — the
202
238
  * virtualCall pending check's key. */
203
239
  readonly mayThrowMethods: Set<string>;
@@ -273,6 +309,12 @@ export declare class LlEmitter {
273
309
  private readonly initializerBindings;
274
310
  /** Whole-program int32 storage and parameter/result facts. */
275
311
  readonly int32Slots: Int32Slots;
312
+ /** Immutable module constants (contract types) whose graphs become
313
+ * immortal once initialized: their reads need no reference counting. */
314
+ readonly immortalGlobals: ReadonlySet<string>;
315
+ /** ProgramLifetime hierarchy roots (contract types): their instances are
316
+ * immortal from construction (classes.ts programLifetimeClass). */
317
+ readonly programLifetime: ReadonlySet<string>;
276
318
  private numericLocals;
277
319
  private captureIds;
278
320
  /** Active induction bindings retain their width independently of size_t. */
@@ -286,6 +328,11 @@ export declare class LlEmitter {
286
328
  };
287
329
  }>;
288
330
  private countedLoopsEnabled;
331
+ /** Whole-program final reference fields (ir/final-fields.ts). */
332
+ private finalFields;
333
+ /** The current function may borrow final fields of borrowable objects:
334
+ * not a constructor (where they change), not async or a generator. */
335
+ private finalFieldBorrows;
289
336
  integerRanges: IntegerRanges;
290
337
  private byteWindowsEnabled;
291
338
  private byteWindowEntries;
@@ -486,6 +533,13 @@ export declare class LlEmitter {
486
533
  * unwind returns it as the dummy, so a call in tail position keeps a single
487
534
  * return and stays eligible for tail-call and recursion elimination. */
488
535
  private emitUnwind;
536
+ /** Loads the running thread's exact pending word (ELF worker
537
+ * executables, scr_exception.c): bit 0 mirrors the active cell, bit 1
538
+ * requests the context's stop. It lives in the executable's static TLS
539
+ * block, so the access is one thread-pointer-relative load. Monotonic by
540
+ * default: a loop must not hoist the load out and miss a cross-thread
541
+ * stop (see emitPendingCheck for the unordered tests). */
542
+ private loadExcFlag;
489
543
  /** Instructions (two-space indented) that set the i1 `dest` to "an
490
544
  * exception is pending in the active context" — scr_exc_pending()'s
491
545
  * meaning — for the helper and adapter bodies that test it outside
@@ -501,11 +555,12 @@ export declare class LlEmitter {
501
555
  * call's result temp must join its frame BEFORE this runs so the unwind
502
556
  * releases the dummy (NULL for refcounted kinds) harmlessly. A scalar
503
557
  * call result of the function's return type may be passed as the unwind's
504
- * dummy value (see emitUnwind). */
558
+ * dummy value (see emitUnwind). `poll` marks a worker termination poll
559
+ * (function entry or loop budget), whose test must stay ordered. */
505
560
  emitPendingCheck(passThrough?: {
506
561
  name: string;
507
562
  type: IrType;
508
- }): void;
563
+ }, poll?: boolean): void;
509
564
  /** After a runtime call that ALWAYS leaves an exception pending (the
510
565
  * compiler-resolved Node throws): the pending test would always answer
511
566
  * true, so unwind unconditionally. Emission continues in a block with no
@@ -515,6 +570,9 @@ export declare class LlEmitter {
515
570
  /** A recursive function's entry check: below the running stack's guard,
516
571
  * throw Node's RangeError and unwind like any other pending exception. */
517
572
  private emitStackCheck;
573
+ /** Whether the emitter follows this call with a pending test (the
574
+ * conditions in expr-calls.ts). */
575
+ private callTestsPending;
518
576
  private workerLoopBudget;
519
577
  private emitWorkerLoopCheck;
520
578
  /** Moves an already-evaluated value into the runtime's exception cell —
@@ -621,6 +679,13 @@ export declare class LlEmitter {
621
679
  * array cell holding the value and move it into the ARR-kind box
622
680
  * (set_ref releases nothing — the slot was the empty sentinel). */
623
681
  private tdzScalarInit;
682
+ /** The payload a TDZ box holds before its declaration runs, when that is
683
+ * not NULL. A nullable union's value is its arm pointer with NULL as a
684
+ * unit arm (nullable-unions.ts), so a stored `null`/`undefined` would
685
+ * read back as the temporal dead zone; such boxes start at the module's
686
+ * immortal NULLABLE_ABSENT sentinel instead, which no value of the
687
+ * binding can hold and every RC entry point and the collector skip. */
688
+ private tdzEmptySentinel;
624
689
  /** The TDZ-guarded read of a boxed binding: an empty payload slot is
625
690
  * the temporal dead zone — throw Node's exact catchable ReferenceError
626
691
  * (exprs.ts's varRef guard). Scalars then peek the one-element
@@ -664,6 +729,42 @@ export declare class LlEmitter {
664
729
  * rebound during a call; its independent payload owner keeps it alive.
665
730
  * Other writable bindings need an owned snapshot. */
666
731
  canBorrowCallArgument(value: IrExpr): boolean;
732
+ /** A plain-pointer read of a construction-only field outside any
733
+ * constructor (ImmutableFields). */
734
+ private immutableRead;
735
+ /** A projection read whose locations nothing writes while a borrowed
736
+ * read of it is in use (ReferenceWrites), given the writes of that
737
+ * extent. The root binding itself must stay alive across it too, which
738
+ * its own location (`l:`, `g:`, `bx`) covers. */
739
+ unwrittenRead(e: IrExpr, writes: Writes): boolean;
740
+ /** A stable binding initialized by a projection can borrow it when the
741
+ * rest of its block (its whole lifetime) writes none of the projection's
742
+ * locations: the source edge then keeps the value alive, and uses that
743
+ * escape still retain their own copies. */
744
+ private unwrittenAlias;
745
+ /** An optional element read into a projection-only local can borrow the
746
+ * element when the rest of the block writes no array element and none of
747
+ * the locations keeping the array alive (which must itself be read
748
+ * without a frame owner). */
749
+ private unwrittenLocalArrayRead;
750
+ /** An optional element read passed to a projection-only parameter can
751
+ * borrow the element when the callee and later arguments (`writes`)
752
+ * write no array element and nothing keeping the array alive. */
753
+ unwrittenCallArrayRead(read: LocalArrayRead, writes: Writes): boolean;
754
+ /** `return x` of a local whose slot is an owned scope entry of the same
755
+ * type: the return can take over the local's reference. */
756
+ private movableReturn;
757
+ /** A walk host for a body that may write the heap: each walk must read
758
+ * only locations the whole body (with its callees) never writes;
759
+ * rebinding the walk locals themselves releases nothing. */
760
+ private unwrittenWalkHost;
761
+ /** emitReadReceiver yields a plain pointer for `e` that no statement
762
+ * frame owns, so it can outlive the statement (walk-borrows' walks, from
763
+ * any unboxed plain-pointer binding, plus element reads). */
764
+ private unownedWalk;
765
+ /** Every location a borrowed-return callee's walks can read (its body's
766
+ * field, record and element reads, through nested borrowed returns). */
767
+ private borrowedReturnKeys;
667
768
  private emitStmts;
668
769
  /** Emits a block in its own lexical scope (refcounted locals released at
669
770
  * end). `setup` runs after the
@@ -766,6 +867,9 @@ export declare class LlEmitter {
766
867
  private publishedNamesSym;
767
868
  /** The class-name table the hierarchy field guards index by preorder. */
768
869
  private publishedClassNamesDefs;
870
+ /** The frozen-object guard of a class field store, unless the store
871
+ * provably targets a still-private `this` (PublishedTypes.privateStores). */
872
+ private emitStoreGuard;
769
873
  /** The frozen-object guard of a class field or record field store:
770
874
  * Node's "Cannot assign to read only property" TypeError when the target
771
875
  * is published. `className` null means a record (`#<Object>`). */