Skip to content

-mm=rc: the array splice gives back is born owned (release blocker, TSLANG 206) - #1042

Merged
ASDAlexander77 merged 1 commit into
mainfrom
rc-splice-result
Nov 26, 2026
Merged

ASDAlexander77 merged 1 commit into
mainfrom
rc-splice-result

Conversation

@ASDAlexander77

Copy link
Copy Markdown
Owner

Fixes the release run failure of 2026-11-26 (run 45878505115): array_class_splice.ts under -mm=rc, debug JIT, crashed with no output on Ubuntu 22.04/24.04 on every attempt.

Cause. mlirGenArraySplice marks splice's result owned, so its receiver takes the reference over instead of retaining. ArraySpliceOpLowering built the result header with ArrayLayout::make, whose block is born with no reference. In the default library's Array<T>.splice (const removed = this.data.splice(...); ...; return removed;) the return retained it to 1 and the local's release took it to 0, so the caller got a freed array. Later allocations wrote over it and over mimalloc's free list, and the next splice crashed in mi_malloc.

Fix. Under rc, the header is born with that reference when the op is marked owned, as an owned new C()'s is (NewOpLowering).

Why only CI. It is not the CPU. CI starts every tests.sh pass with a cold JIT cache, and a warm cache passed. On Windows the freed block happened to survive. The IR is the same in pre-alpha134, so this is not new.

Checked

  • docker ubuntu:22.04 / 26.04 with the release run's package and the default library at 760e34f, the CI layout, cold cache:
    • unfixed: 3/3 crashes, 7 invalid reads/writes under valgrind
    • fixed: 0 crashes, 0 invalid reads/writes
  • New test 00rc_splice_result_owned.ts (gc, rc, none): pre-alpha134 crashes on it on Windows.
  • Windows ctest: 9871/9871 passed.

🤖 Generated with Claude Code

… being returned (TSLANG 206)

The release run of 2026-11-26 failed every time on array_class_splice.ts (-mm=rc, debug JIT, Ubuntu
22.04/24.04) with no output. Cause: mlirGenArraySplice marks splice's result owned, so its receiver takes
the reference over instead of retaining, but ArraySpliceOpLowering made the header with ArrayLayout::make,
whose block is born with no reference. `const removed = this.data.splice(...); return removed;` (the default
library's Array<T>.splice) retained it to 1 for the return and released the local to 0: the caller got a
freed array, later allocations wrote over it and mimalloc's free list, and the next splice crashed in
mi_malloc. Under rc the header is now born with that reference, as an owned `new C()`'s is (NewOpLowering).

It was not the CPU: CI starts every pass with a cold JIT cache (a warm one passed), and on Windows the freed
block happened to survive. Checked in docker ubuntu:22.04/26.04 with the release run's package and default
library: unfixed 3/3 crashes and 7 invalid accesses under valgrind, fixed 0 and 0.

Test 00rc_splice_result_owned.ts (gc, rc, none): pre-alpha134 crashes on it on Windows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ASDAlexander77
ASDAlexander77 merged commit c64c205 into main Nov 26, 2026
8 checks passed
@ASDAlexander77
ASDAlexander77 deleted the rc-splice-result branch November 26, 2026 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant