• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

moonbitlang / core / 6509
89%

Build:
DEFAULT BRANCH: main
Ran 03 Sep 2026 03:50AM UTC
Jobs 1
Files 453
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

03 Sep 2026 03:47AM UTC coverage: 90.974% (-0.001%) from 90.975%
6509

push

github

bobzhang
fix(builtin): stop nulling vacated Array slots so views cannot read invalid memory

Taking a view from an `Array` shares the underlying buffer, and every
shrinking operation cleared the slots it vacated with `%fixedarray.set_null`.
A view created before such a mutation then read a null slot: SIGSEGV on native
for reference element types, `null` on wasm-gc, `undefined` on JS.
`Array::view` is plain `pub`, so this was undefined behaviour reachable from
entirely safe code.

Vacated slots are now left alone, so a view can only ever observe valid values
of `T`. Mutating an array while a view of it is alive stays a program error,
but what the view yields is merely unspecified rather than invalid.

The cost is that a removal retains what it removes, and that applies uniformly:
`clear` empties an array the same way `pop` shortens it, and neither writes to
the slots it gives up. No existing signature changes. The removed elements are
released once a later push reuses the slot, once the buffer grows, or once the
array is dropped, so clear-and-refill self-heals -- each push releases one old
occupant, and repeated fill/drain cycles on one array hold flat.

Reclaiming on demand is explicit. The new `Array::release_unused(placeholder~)`
overwrites every slot from `length()` to `capacity()` with the placeholder,
which is exactly the region any removal leaves behind: one pass, no
allocation, capacity kept. `shrink_to_fit` was
already releasing those elements by letting the old buffer go, at the cost of
an allocation plus a copy of every survivor; that is now documented rather
than incidental.

Writing into that region needs no high-water mark, because it is always either
NULL or a live reference, never garbage. `%fixedarray.make_uninit` NULL-fills
for reference element types -- it has to, since `moonbit_drop_object` walks a
REF_ARRAY's full capacity and skips slots with `if (!obj) continue` -- and
`moonbit_make_ref_array_with_blit` NULL-fills everything outside the b... (continued)

4 of 4 new or added lines in 1 file covered. (100.0%)

16862 of 18535 relevant lines covered (90.97%)

283389.82 hits per line

Jobs
ID Job ID Ran Files Coverage
1 6509.1 03 Sep 2026 03:50AM UTC 454
90.99
GitHub Action Run
Source Files on build 6509
  • Tree
  • List 453
  • Changed 3
  • Source Changed 3
  • Coverage Changed 3
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • b4e2d87c on github
  • Prev Build on main (#6502)
  • Next Build on main (#6513)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc