Skip to content
This repository has been archived by the owner on May 11, 2020. It is now read-only.

wasm: ExecInitExpr is done too early #85

Open
losfair opened this issue Aug 25, 2018 · 1 comment
Open

wasm: ExecInitExpr is done too early #85

losfair opened this issue Aug 25, 2018 · 1 comment

Comments

@losfair
Copy link
Contributor

losfair commented Aug 25, 2018

The execution of case getGlobal in ExecInitExpr depends on runtime imports to work correctly. We don't have that information before imports get resolved and therefore cannot execute init expressions ahead of time.

@twitchyliquid64
Copy link
Contributor

In the docs it says:

In the MVP, to keep things simple while still supporting the basic needs of dynamic linking, initializer expressions are restricted to the following nullary operators:

 - the four constant operators; and
 - get_global, where the global index must refer to an immutable import.

The current implementation appears to work for globals that are defined before the global referencing it is defined (index-wise) - does that not suit?

I guess we could re-order module initialization or do two passes to resolve this if necessary.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants