[NFC] BridgeJS: Rename Stack ABI operation methods#634
Conversation
|
Cursor Agent can help with this pull request. Just |
To make push/pop operations agnostic to import/export contexts, rename the following methods: - `bridgeJSLiftParameter()` -> `bridgeJSStackPop()` - `bridgeJSLowerStackReturn()` -> `bridgeJSStackPush()`
9bb855b to
98099d6
Compare
There was a problem hiding this comment.
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? { |
There was a problem hiding this comment.
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.


To make push/pop operations agnostic to import/export contexts, rename the following methods:
bridgeJSLiftParameter()->bridgeJSStackPop()bridgeJSLowerStackReturn()->bridgeJSStackPush()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) becomesbridgeJSStackPop(), andbridgeJSLowerStackReturn()becomesbridgeJSStackPush().This updates JavaScriptKit’s
BridgeJSIntrinsics.swiftprotocols/default implementations (includingOptional, arrays/dictionaries, structs, enums,JSValue, and heap objects), the BridgeJS code generator (ExportSwift’sStackCodegenand 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.