Skip to content

Use @_expose(wasm) instead of __attribute__((export_name)) and @_cdecl hack #304

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 18, 2025

Conversation

kateinoigakukun
Copy link
Member

@kateinoigakukun kateinoigakukun commented Mar 18, 2025

Symbol references from Swift code to C makes it difficult to properly keep the referenced C definitions. swiftlang/swift#77812

This function was used to check the compatibility between the JavaScriptKit
Swift library and JS runtime because they were manually kept in sync by
users of the library with npm and SwiftPM. Now that the library is
distributed as a single SwiftPM package, there is no need for this
function.
We now support only Swift 6.0 and above, so we can use `@_expose(wasm)`
instead of `__attribute__((export_name))` and `@_cdecl` hack.
Copy link

Time Change: -35ms (0%)

Total Time: 9,583ms

Test name Duration Change
Serialization/JavaScript function call through Wasm import 23ms -3ms (11%) 👏
View Unchanged
Test name Duration Change
Serialization/JavaScript function call through Wasm import with int 23ms -0ms
Serialization/JavaScript function call from Swift 124ms +2ms (1%)
Serialization/Swift Int to JavaScript with assignment 344ms +6ms (1%)
Serialization/Swift Int to JavaScript with call 968ms -3ms (0%)
Serialization/JavaScript Number to Swift Int 272ms +3ms (1%)
Serialization/Swift String to JavaScript with assignment 426ms +8ms (1%)
Serialization/Swift String to JavaScript with call 1,047ms -5ms (0%)
Serialization/JavaScript String to Swift String 3,584ms -31ms (0%)
Object heap/Increment and decrement RC 2,759ms -12ms (0%)
View Baselines
Test name Duration
Serialization/Call JavaScript function directly 3ms
Serialization/Assign JavaScript number directly 3ms
Serialization/Call with JavaScript number directly 3ms
Serialization/Write JavaScript string directly 3ms
Serialization/Call with JavaScript string directly 2ms

@kateinoigakukun kateinoigakukun marked this pull request as ready for review March 18, 2025 12:27
@kateinoigakukun kateinoigakukun merged commit 1de7acc into main Mar 18, 2025
5 checks passed
@kateinoigakukun kateinoigakukun deleted the yt/remove-cdecls branch March 18, 2025 12:27
kateinoigakukun added a commit that referenced this pull request Mar 18, 2025
This reverts commit 1de7acc, reversing
changes made to e36e93c.
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