Commit 7188a52
committed
BridgeJS: Route container stack ABI emission through shared codecs
The non-generic bridging paths cloned each container's stack ABI (array
loops with the typed-array fast path, dictionary key/value ordering, the
optional presence-flag protocol) inline into every thunk, while the
generic paths already described those shapes once via the codec
combinators. Route the non-generic array/dictionary/optional emission
through the same combinators so each container's stack ABI is described
exactly once and instantiated with an element codec:
- __bjs_primitiveCodecs becomes a token-keyed table (Bool, Int, ...,
String, JSValue) referenced by both combinator instantiations and the
generic type-handle registration hooks (same canonical order).
- @js struct elements compose directly with structHelpers.<T> (already
codec-shaped); associated-value enums adapt their helper through the
new __bjs_enumCodec combinator; other element shapes (case enums,
JSObject, heap objects, ...) get a local codec literal built from the
single element stack fragment description.
- __bjs_optionalCodec gains an isUndefinedOr parameter so the
JSUndefinedOr flavor instantiates the same combinator instead of a
bespoke inline form; stack-convention optional parameters and returns
now route through it too. Nested compositions recurse
(e.g. __bjs_arrayCodec(__bjs_optionalCodec(__bjs_primitiveCodecs.Int))).
- Emission gating: the combinators and the primitive codec table are
emitted through the intrinsic registry whenever any linked module uses
container bridging (generic or not); builds bridging no containers pay
nothing. The generic runtime (codecByTypeId, registration hooks,
afterInitialize) stays gated on generics, independently.
- Paths that cannot use the combinators keep inline code with comments:
side-channel/sentinel optional returns, and optional parameters whose
presence flag arrives as a wasm parameter rather than on the i32 stack.
Deletes the inline array/dictionary loop fragments, stackOptionalLower,
and optionalLiftReturnStruct from JSGlueGen; snapshots re-recorded.1 parent 60403ee commit 7188a52
21 files changed
Lines changed: 6395 additions & 2168 deletions
File tree
- Plugins/BridgeJS
- Sources/BridgeJSLink
- Tests/BridgeJSToolTests
- __Snapshots__/BridgeJSLinkTests
Lines changed: 31 additions & 51 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
339 | 339 | | |
340 | 340 | | |
341 | 341 | | |
342 | | - | |
343 | | - | |
344 | 342 | | |
345 | 343 | | |
346 | 344 | | |
| |||
404 | 402 | | |
405 | 403 | | |
406 | 404 | | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
407 | 415 | | |
408 | 416 | | |
409 | 417 | | |
| |||
413 | 421 | | |
414 | 422 | | |
415 | 423 | | |
416 | | - | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
450 | | - | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | | - | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
461 | 431 | | |
462 | 432 | | |
463 | 433 | | |
| |||
475 | 445 | | |
476 | 446 | | |
477 | 447 | | |
| 448 | + | |
| 449 | + | |
478 | 450 | | |
479 | 451 | | |
480 | 452 | | |
481 | 453 | | |
482 | 454 | | |
483 | | - | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
484 | 462 | | |
485 | 463 | | |
486 | 464 | | |
| |||
676 | 654 | | |
677 | 655 | | |
678 | 656 | | |
679 | | - | |
680 | | - | |
681 | | - | |
682 | 657 | | |
683 | 658 | | |
684 | 659 | | |
| |||
2556 | 2531 | | |
2557 | 2532 | | |
2558 | 2533 | | |
| 2534 | + | |
| 2535 | + | |
| 2536 | + | |
| 2537 | + | |
| 2538 | + | |
2559 | 2539 | | |
2560 | 2540 | | |
2561 | 2541 | | |
| |||
0 commit comments