Expand description
Cross-package class reconstruction (SUB-488).
A consumer that imports a class from another package never sees that
class’s Wasm module — only its public PackageDeclaration. To use the class
(construct it, read fields, dispatch methods, instanceof, or extends it)
the consumer must rebuild the class’s WasmGC types in its own module so that
structural canonicalization unifies them with the producer’s.
Each class is emitted as its own rec group (rec $C_vtable $C) — matching the
producer (super::classes) — so the consumer reconstructs only the classes
it transitively needs, parents first. There are no cross-class type
references (a class’s fields live in the shared object-fields payload, not as
named struct fields), so per-class groups always canonicalize. The consumer
also imports each class’s constructor, self-first ctor-init, and method bodies
(exported by the producer in super::classes::ClassPlan::exported_funcs) so
new, super(...), and a local subclass’s inherited vtable slots resolve.
Structs§
- Imported
Class Layout - The resolved full layout of an imported class, handed to
super::classesso a local subclass extending it lays its own fields/methods out after the inherited prefix. - Imported
Slot
Functions§
- reconstruct
- Reconstruct every imported class reachable from this module: emit its rec
group, record type/slot indices, and import its functions. Returns the
resolved layout of each, keyed by mangled name, for
classes::ClassPlan.