Skip to content
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

Fix empty TypedArray creation #278

Merged
merged 1 commit into from
Dec 8, 2024
Merged

Conversation

kateinoigakukun
Copy link
Member

Close swiftwasm/swift#5599

Empty array instances share the same storage for all element types, so their baseAddress can be unaligned. (It seems the empty array storage had been placed at 8-aligned position fortunately but it's no longer the case since Swift 6.0, I guess)

https://github.com/swiftlang/swift/blob/2914d0e46eda33cadfd81c3381e8737855ce397c/stdlib/public/stubs/GlobalObjects.cpp#L42

Copy link

github-actions bot commented Dec 8, 2024

Time Change: +260ms (2%)

Total Time: 9,837ms

Test name Duration Change
Serialization/JavaScript function call from Swift 116ms +9ms (7%) 🔍
Serialization/Swift Int to JavaScript with assignment 354ms +32ms (9%) 🔍
Serialization/JavaScript Number to Swift Int 317ms +17ms (5%) 🔍
Serialization/Swift String to JavaScript with assignment 393ms +20ms (5%) 🔍
View Unchanged
Test name Duration Change
Serialization/JavaScript function call through Wasm import 20ms -1ms
Serialization/JavaScript function call through Wasm import with int 14ms -0ms
Serialization/Swift Int to JavaScript with call 1,071ms +51ms (4%)
Serialization/Swift String to JavaScript with call 1,118ms +39ms (3%)
Serialization/JavaScript String to Swift String 3,775ms +109ms (2%)
Object heap/Increment and decrement RC 2,647ms -16ms (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 2ms
Serialization/Call with JavaScript string directly 2ms

@kateinoigakukun kateinoigakukun merged commit d4f24ae into main Dec 8, 2024
17 of 18 checks passed
@kateinoigakukun kateinoigakukun deleted the katei/fix-empty-typed-array branch December 8, 2024 10:09
@ephemer
Copy link

ephemer commented Dec 9, 2024

Thank you for this change!

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.

Base address of every empty array seems to be the same: issues where type alignment > word size
2 participants