Skip to content

fix(interp): release the operand coro.done pops - #336

Merged
siyul-park merged 2 commits into
mainfrom
fix/coro-done-release
Nov 12, 2026
Merged

siyul-park merged 2 commits into
mainfrom
fix/coro-done-release

Conversation

@siyul-park

Copy link
Copy Markdown
Owner

Summary

CORO_DONE replaced its reference operand with the i1 result but never released that operand, so each check leaked one count on the iterator or coroutine it tested. CORO_VALUE already released its operand. The handler, in the codegen generator and regenerated in interp/threaded.go, now releases it.

On ARM64, CORO_DONE bridges. The bridge retains each ref operand before running the handler and releases only the operands the op adopts, and CORO_DONE adopts none. The handler's release therefore balances the bridge's retain.

Fixes #331.

Evidence

TestInterpreter_Run/coro.done releases the reference it pops walks a 5-entry map with map.iter and checks the heap counts afterwards:

map iterator
expected (local + iterator for the map; local for the iterator) 2 1
before the fix 2 6
after the fix 2 1

Validation

  • go test ./...
  • cd benchmarks && go test ./... -run TestKernels
  • make check-generated
  • make check (pre-commit)
  • git diff --check

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 599674df-7c73-4cc3-bff3-45b47fd036d4
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CORO_DONE replaced its reference operand with an i1 without releasing
it, so every check leaked one count on the iterator or coroutine it
tested. CORO_VALUE already released its operand. The JIT bridge retains
each operand before running the handler, so the release balances there
too.

Fixes #331

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@siyul-park
siyul-park force-pushed the fix/coro-done-release branch from 0c7a61b to db2a797 Compare November 12, 2026 09:31
@siyul-park
siyul-park merged commit 0e648ac into main Nov 12, 2026
1 check passed
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.

interp: CORO_DONE leaks one reference to its operand per execution

1 participant