Commit 6589dbb
committed
BridgeJS: Use direct string retain + encodeInto() for stack ABI paths
For arrays, struct fields, enum payloads, and dictionary entries, the
stack ABI now retains the JS string directly (instead of encoding to a
Uint8Array first) and passes the worst-case UTF-8 byte length via
_maxUTF8Len() as buffer capacity.
A new dedicated swift_js_init_memory_from_string import handles the
string path - it encodes UTF-8 directly into the WASM buffer via
encodeInto() and returns the actual byte count written. This avoids
modifying the existing swift_js_init_memory contract.
This eliminates the intermediate Uint8Array allocation for every string
element in arrays and struct fields.1 parent 33fa793 commit 6589dbb
55 files changed
Lines changed: 506 additions & 143 deletions
File tree
- Plugins
- BridgeJS
- Sources/BridgeJSLink
- Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests
- PackageToJS/Templates
- Sources/JavaScriptKit
- Tests/JavaScriptEventLoopTests
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
356 | 356 | | |
357 | 357 | | |
358 | 358 | | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
359 | 363 | | |
360 | 364 | | |
361 | 365 | | |
| |||
413 | 417 | | |
414 | 418 | | |
415 | 419 | | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
416 | 439 | | |
417 | 440 | | |
418 | 441 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
| 63 | + | |
62 | 64 | | |
63 | 65 | | |
64 | 66 | | |
| |||
2122 | 2124 | | |
2123 | 2125 | | |
2124 | 2126 | | |
2125 | | - | |
2126 | 2127 | | |
| 2128 | + | |
| 2129 | + | |
| 2130 | + | |
2127 | 2131 | | |
2128 | | - | |
| 2132 | + | |
2129 | 2133 | | |
2130 | | - | |
2131 | | - | |
| 2134 | + | |
| 2135 | + | |
| 2136 | + | |
2132 | 2137 | | |
2133 | | - | |
2134 | 2138 | | |
2135 | 2139 | | |
2136 | 2140 | | |
| |||
Lines changed: 21 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| |||
88 | 89 | | |
89 | 90 | | |
90 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
91 | 98 | | |
92 | 99 | | |
93 | 100 | | |
| |||
317 | 324 | | |
318 | 325 | | |
319 | 326 | | |
320 | | - | |
321 | | - | |
322 | | - | |
| 327 | + | |
| 328 | + | |
323 | 329 | | |
324 | 330 | | |
325 | 331 | | |
| |||
427 | 433 | | |
428 | 434 | | |
429 | 435 | | |
430 | | - | |
431 | | - | |
432 | | - | |
| 436 | + | |
| 437 | + | |
433 | 438 | | |
434 | 439 | | |
435 | 440 | | |
| |||
482 | 487 | | |
483 | 488 | | |
484 | 489 | | |
485 | | - | |
486 | | - | |
487 | | - | |
| 490 | + | |
| 491 | + | |
488 | 492 | | |
489 | 493 | | |
490 | 494 | | |
| |||
667 | 671 | | |
668 | 672 | | |
669 | 673 | | |
670 | | - | |
671 | | - | |
672 | | - | |
| 674 | + | |
| 675 | + | |
673 | 676 | | |
674 | 677 | | |
675 | 678 | | |
| |||
823 | 826 | | |
824 | 827 | | |
825 | 828 | | |
826 | | - | |
827 | | - | |
828 | | - | |
| 829 | + | |
| 830 | + | |
829 | 831 | | |
830 | 832 | | |
831 | 833 | | |
| |||
992 | 994 | | |
993 | 995 | | |
994 | 996 | | |
995 | | - | |
996 | | - | |
997 | | - | |
| 997 | + | |
| 998 | + | |
998 | 999 | | |
999 | 1000 | | |
1000 | 1001 | | |
| |||
1013 | 1014 | | |
1014 | 1015 | | |
1015 | 1016 | | |
1016 | | - | |
1017 | | - | |
1018 | | - | |
| 1017 | + | |
| 1018 | + | |
1019 | 1019 | | |
1020 | 1020 | | |
1021 | 1021 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
66 | 73 | | |
67 | 74 | | |
68 | 75 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
178 | 179 | | |
179 | 180 | | |
180 | 181 | | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
181 | 188 | | |
182 | 189 | | |
183 | 190 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
177 | 178 | | |
178 | 179 | | |
179 | 180 | | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
180 | 187 | | |
181 | 188 | | |
182 | 189 | | |
| |||
Lines changed: 11 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
57 | | - | |
58 | | - | |
59 | | - | |
| 58 | + | |
| 59 | + | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
108 | 114 | | |
109 | 115 | | |
110 | 116 | | |
| |||
576 | 582 | | |
577 | 583 | | |
578 | 584 | | |
579 | | - | |
580 | | - | |
581 | | - | |
| 585 | + | |
| 586 | + | |
582 | 587 | | |
583 | 588 | | |
584 | 589 | | |
| |||
0 commit comments