Repository navigation
Debug builds: the fewer-parameters thunk has a debug location; ___range_check is private to each module - #747
Merged
Conversation
…ge_check is private to each module Two failures only a debug build sees, found building the debug default library as the release workflow does (`--di --opt_level=0`, TSLANG_DEBUG_CRT=/MT) and running its tests: - `a.every((v) => v < 40)` - since array callbacks take the element's index too, any one-parameter callback - was rejected by LLVM in every model: "inlinable function call in a function with a DISubprogram location must have a debug location". fewerParametersThunk (#733) made the thunk with no location; with --di the debug-info pass gave it a subprogram and its call had none. It now gets a subprogram at the place that first needs it and its body is scoped under it, as the catch copy thunk (mlirGenCatchCopyThunk) does. - A program linked against the debug default library failed with "LNK2005: ___range_check already defined": the RangeError check (#731) is generated from source as a public function in every module that checks, the library's included. It is private to each module now (internal linkage, as the thunks). An optimized link dropped one copy, which is why release builds linked. test-compile-debug-info-glue (debug-info-glue.cmake): the fewer-parameter tests emitted with `--di --opt_level=0` under every model - test-runner in a release build never compiles with --di. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two failures that only a Debug build hits, so PR CI (Release only) can't see them. Both would have failed the next release's Windows Debug default-library pass. I found them by building the Debug default library the way
create-release.ymldoes (TSLANG_DEBUG_CRT=/MT, with the release compiler's libraries) and running the fulltests.ps1.1.
--di: the fewer-parameters thunk had no debug locationThis failed in every memory model, in 18 of DefaultLib's tests (
array_every,array_map,string_localeCompare,date_parse2, …). Since array callbacks take the element's index too (DefaultLib #59), any one-parameter callback goes throughfewerParametersThunk(#733).Cause. The thunk was built with no location. With
--di, the debug-info pass still gave the thunk a subprogram, so the call inside it had no debug location, and LLVM rejected the module.Fix. The thunk gets its own subprogram at the first place that needs it, with its body scoped under it. This is the same fix alpha85 needed for the catch-copy thunk (
mlirGenCatchCopyThunk).2. Debug link:
___range_checkdefined twiceEvery program linked against the Debug default library (
--emit=exe) failed this way: 43 of its tests in every model.Cause. The RangeError check (#731) is generated from source as a public function in every module that uses it, the library included. An optimized link drops one copy, which is why Release builds linked.
Fix. The check is now private to each module, with internal linkage, as the thunks are.
Tests
test-compile-debug-info-glue(debug-info-glue.cmake) emits the two fewer-parameter tests with--di --opt_level=0under every model. Each makes six thunks. In a Release buildtest-runnernever compiles with--di, which is how A finally that throws during unwinding replaces the exception; fewer-parameter functions as wider function types #733's tests missed this.tests.ps1(Release and Debug passes, compile and JIT, plus the declarations check): gc 182/182, rc 181, none 181, own 171 (11 skipped by design), in both passes.Found on the way, not fixed here
They fail with or without
--diand aren't in any test:a.every((v: number) => v < 40)on ans32array: "can't assign '(p0: number) => boolean' to '(p0: s32, p1: number) => boolean'".a.every(function (v) { return v < 40; }): "'ts.Call' op '.f_main..fe…' does not reference a valid function".🤖 Generated with Claude Code