Skip to content

[NFC] BridgeJS: Rename Stack ABI operation methods#634

Merged
kateinoigakukun merged 1 commit intomainfrom
cursor/bridgejs-stack-parameter-names-d5dd
Feb 15, 2026
Merged

[NFC] BridgeJS: Rename Stack ABI operation methods#634
kateinoigakukun merged 1 commit intomainfrom
cursor/bridgejs-stack-parameter-names-d5dd

Conversation

@kateinoigakukun
Copy link
Member

@kateinoigakukun kateinoigakukun commented Feb 14, 2026

To make push/pop operations agnostic to import/export contexts, rename the following methods:

  • bridgeJSLiftParameter() -> bridgeJSStackPop()
  • bridgeJSLowerStackReturn() -> bridgeJSStackPush()

Open in Cursor Open in Web


Note

Medium Risk
Broad, cross-cutting rename across generated bridging code and runtime intrinsics; risk is primarily ABI/stack order mismatches or missed call sites causing runtime interop failures on wasm.

Overview
Renames the Stack ABI bridging API to make stack operations import/export agnostic: bridgeJSLiftParameter() (no-arg stack lift) becomes bridgeJSStackPop(), and bridgeJSLowerStackReturn() becomes bridgeJSStackPush().

This updates JavaScriptKit’s BridgeJSIntrinsics.swift protocols/default implementations (including Optional, arrays/dictionaries, structs, enums, JSValue, and heap objects), the BridgeJS code generator (ExportSwift’s StackCodegen and struct codegen), and regenerates affected snapshots/benchmark generated Swift glue to use the new method names throughout.

Written by Cursor Bugbot for commit 98099d6. This will update automatically on new commits. Configure here.

@cursor
Copy link

cursor bot commented Feb 14, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

To make push/pop operations agnostic to import/export contexts, rename
the following methods:
- `bridgeJSLiftParameter()` -> `bridgeJSStackPop()`
- `bridgeJSLowerStackReturn()` -> `bridgeJSStackPush()`
@kateinoigakukun kateinoigakukun force-pushed the cursor/bridgejs-stack-parameter-names-d5dd branch from 9bb855b to 98099d6 Compare February 15, 2026 03:35
@kateinoigakukun kateinoigakukun changed the title BridgeJS stack parameter names [NFC] BridgeJS: Rename Stack ABI operation methods Feb 15, 2026
@kateinoigakukun kateinoigakukun marked this pull request as ready for review February 15, 2026 03:58
@kateinoigakukun kateinoigakukun merged commit a8b249c into main Feb 15, 2026
11 of 12 checks passed
@kateinoigakukun kateinoigakukun deleted the cursor/bridgejs-stack-parameter-names-d5dd branch February 15, 2026 03:58
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

bridgeJSStackPush()
}

@_spi(BridgeJS) public static func bridgeJSStackPop() -> Wrapped? {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional enum stack pop uses wrong ABI

High Severity

Optional for Wrapped: _BridgedSwiftAssociatedValueEnum decodes stack values using isSome + caseId in bridgeJSStackPop(), but bridgeJSStackPush() encodes this type as a single discriminant (-1 or enum case id plus payload). This mismatched ABI can over-pop the stack and corrupt subsequent argument decoding.

Fix in Cursor Fix in Web

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