Problem
The binary decoder parses section 9 and stores it in Component.Start, but the component instantiation paths do not read or execute that field. A component containing a start section therefore instantiates as though the section were absent.
Relevant code:
The decoder also overwrites c.Start if multiple start sections occur, rather than rejecting a component with more than one start declaration.
Impact
A valid component can depend on its start function to initialize memory/state and produce the values consumed by later definitions. Skipping it can expose uninitialized state, bind later definitions incorrectly, or make exports behave differently from a conforming engine while instantiation reports success.
For a feature the runtime does not yet implement, silent omission is worse than a deterministic unsupported-feature error.
Suggested fix
Either:
- implement start-section validation and execution at the correct point in component instantiation, including argument/result typing, index-space resolution, trap propagation, and one-time execution; or
- reject any non-nil
Component.Start before mutating runtime state until support is complete.
Also reject a second start section during decode/validation rather than replacing the first.
Regression tests
- A component whose start function mutates state observed by an exported function must expose the initialized value.
- A trapping start must make instantiation fail and clean up already-created core modules/resources.
- The start function must run exactly once per instance, including cached/repeated instantiation.
- A component with two start sections must be rejected.
- Until implemented, all of the above should fail at validation with an explicit unsupported-start error rather than instantiate successfully.
Problem
The binary decoder parses section 9 and stores it in
Component.Start, but the component instantiation paths do not read or execute that field. A component containing a start section therefore instantiates as though the section were absent.Relevant code:
The decoder also overwrites
c.Startif multiple start sections occur, rather than rejecting a component with more than one start declaration.Impact
A valid component can depend on its start function to initialize memory/state and produce the values consumed by later definitions. Skipping it can expose uninitialized state, bind later definitions incorrectly, or make exports behave differently from a conforming engine while instantiation reports success.
For a feature the runtime does not yet implement, silent omission is worse than a deterministic unsupported-feature error.
Suggested fix
Either:
Component.Startbefore mutating runtime state until support is complete.Also reject a second start section during decode/validation rather than replacing the first.
Regression tests