You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2c6594e
Browse filesBrowse the repository at this point in the historyBrowse files
The JIT cache no longer crashes a run that compiles two or more modules (#549)
The JIT cache compiles each module in an MLIRContext of its own, but the
built-in types (i32, f32, Opaque, ...) were kept in a function-local static
map, made once in the first module's context. Every later module in the run
got types from a context already destroyed: 0xC0000005 in the compiler. The
default library's declarations name such types, so every program importing
a .ts module crashed (native_ts_graphics finding 7). The map is now a member
of MLIRGenImpl, made on first use per module.
Regression test test-jit-cache-embedded-types runs from an empty cache
every time (jit-cache-empty.cmake); a test-runner test keeps its cache
beside the source and compiles nothing from its second run on.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/bugs/native-ts-graphics-findings.md
+9-1Lines changed: 9 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,7 @@ keeps failing by design. The repros stay here as the record of what was reported
29
29
| 4 | Escapes not processed in templates with substitutions | Wrong value, silent |`ntg_template_literal_escape.ts`|[#539](https://github.com/ASDAlexander77/TypeScriptCompiler/pull/539)|
30
30
| 5 |`Math.max` of negative numbers returns 2.2e-308 | Wrong value, silent (default lib) |`ntg_math_max_negative.ts`|[DefaultLib#31](https://github.com/ASDAlexander77/TypeScriptCompilerDefaultLib/pull/31), and [#535](https://github.com/ASDAlexander77/TypeScriptCompiler/pull/535) for why its test passed |
31
31
| 6 |`boolean && (Class \| null)` as a condition fails to compile | Compile error |`ntg_and_nullable_class.ts`|[#540](https://github.com/ASDAlexander77/TypeScriptCompiler/pull/540), and [#541](https://github.com/ASDAlexander77/TypeScriptCompiler/pull/541) for its misplaced first error |
32
-
| 7 | The JIT cache crashes a run that compiles two or more modules (pre-alpha93) | Compiler crash, no message |`ntg_jit_cache_import.ts`|open|
32
+
| 7 | The JIT cache crashes a run that compiles two or more modules (pre-alpha93) | Compiler crash, no message |`ntg_jit_cache_import.ts`|[#549](https://github.com/ASDAlexander77/TypeScriptCompiler/pull/549)|
33
33
34
34
The silent ones (2 to 5) cost the most time: the programs compile and run, and only the output
35
35
is wrong.
@@ -226,6 +226,14 @@ per run) every run works.
226
226
imports `core/donut.ts`, so every example crashed under the JIT twice before running.
227
227
`run_jit.bat` passes `--jit-cache=false`.
228
228
229
+
**Fixed by #549:** the cache compiles each module in an MLIRContext of its own, and the built-in
230
+
types (`i32`, `f32`, `Opaque`, ...) were kept in a `static` map, made once, in the first module's
231
+
context. Every later module in the run got types from a context destroyed by then. The map is
232
+
now per module. The default library's declarations name such types, which is why every program
233
+
importing a module crashed; without it (the suite runs with `--no-default-lib`) a module only
234
+
crashed if it named one itself. Regression test: `test-jit-cache-embedded-types`, which runs from
235
+
an empty cache every time.
236
+
229
237
---
230
238
231
239
## Seen earlier but not reproduced in minimal form
0 commit comments