Commit be2c962
Fix cross-module interface field/method vtable index mismatch
Interface vtable slot numbers were assigned by two inconsistent
algorithms: declaration-time assignment used raw interleaved
declaration order, while cast-time assignment (getVirtualTable)
always puts methods before fields. Whichever module performs an
actual cast keeps the correct methods-first layout; a module that
only reads an already-typed interface value it imported never runs
the cast-time algorithm and keeps the stale declaration-order index,
so a field read could land on a method's vtable slot (a function
pointer misread as a byte offset) and crash the JIT with 0xC0000005.
Add InterfaceInfo::assignCanonicalVirtualIndexes(), a pure function
of the interface's own declaration, computed once when the
declaration finishes resolving so all modules that re-parse it agree.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>1 parent b770463 commit be2c962
4 files changed
Lines changed: 46 additions & 0 deletions
File tree
- tslang
- include/TypeScript/MLIRLogic
- lib/TypeScript
- test/tester/tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
539 | 539 | | |
540 | 540 | | |
541 | 541 | | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
542 | 574 | | |
543 | 575 | | |
544 | 576 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
581 | 581 | | |
582 | 582 | | |
583 | 583 | | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
584 | 589 | | |
585 | 590 | | |
586 | 591 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
17 | 24 | | |
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
13 | 15 | | |
0 commit comments