Commit 2670c7c
test(lit): cover cross-unit __vtable__ctor in FB member (Phase 4.5 revert scenario)
A FUNCTION_BLOCK that holds a polymorphic FB as a member must, in its
synthesised constructor, call the member's __ctor — which in turn must
call __vtable__ctor(self.__vtable) for the member. The Phase 4.5 revert
(commit 85181cb) backed out a UnitLowerer migration of the
polymorphism table pass that broke this chain: 13 initializer snapshots
all lost the __vtable__ctor(self.__vtable) line because the table pass
and dispatch pass diverged across two PolymorphismLowerer instances.
This lit test exercises the chain end-to-end across three compilation
units (Base, Derived, Wrapper holding Derived as a member) and
dispatches through a POINTER TO Base aimed at the embedded member. If
the member's vtable is not initialised, the dispatch lands on
uninitialised memory and the CHECK line fails. The test thus
documents what the `Rc<RefCell<PolymorphismLowerer>>` workaround in
participant.rs is load-bearing for and gates a future re-attempt of
the table-pass split.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 8ee1641 commit 2670c7c
6 files changed
Lines changed: 66 additions & 0 deletions
File tree
- tests/lit/multi/cross_unit_vtable_ctor_in_member
- src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
0 commit comments