Skip to content

NFC: BridgeJS: Remove dead cleanup infrastructure#655

Merged
krodak merged 1 commit intoswiftwasm:mainfrom
PassiveLogic:kr/cleanup-removal
Feb 18, 2026
Merged

NFC: BridgeJS: Remove dead cleanup infrastructure#655
krodak merged 1 commit intoswiftwasm:mainfrom
PassiveLogic:kr/cleanup-removal

Conversation

@krodak
Copy link
Member

@krodak krodak commented Feb 18, 2026

Overview

As discussed recently, we're not going with the type descriptor approach from #622. Instead, splitting the improvements into targeted PRs, as #622 even after the cleanup is a bit too much, as most likely we don't want to include all changes (even after the cleanup), so this approach should work better.
This is the first one - removing cleanup infrastructure that became dead code after #635 and #636.

What changed

After #635 (string lower no longer needs cleanup) and #636 (fixed JSObject? double-release in struct lowering), no type produces cleanup code at runtime. This PR removes all of it:

  • cleanupCode printer field from IntrinsicJSFragment.PrintCodeContext
  • tmpStructCleanups array and swift_js_struct_cleanup BJS handler from generated JS
  • _swift_js_struct_cleanup extern and wrapper from BridgeJSIntrinsics.swift
  • swift_js_struct_cleanup stub from instantiate.js
  • Struct helper lower() no longer returns { cleanup } - just pushes fields to stacks
  • Enum helper lower() returns caseId directly instead of { caseId, cleanup }
  • Struct/enum helper factory collapse: () => { return () => ({...}); } simplified to () => ({...}); call-site ()() becomes ()
  • init(unsafelyCopying:) no longer calls struct cleanup; lower extern returns Void instead of Int32
  • strStack.push(textDecoder.decode(bytes)) inlined (removed intermediate variable)

@krodak krodak self-assigned this Feb 18, 2026
@krodak krodak merged commit 8bbf832 into swiftwasm:main Feb 18, 2026
12 checks 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.

2 participants

Comments