diff options
author | Alon Zakai <azakai@google.com> | 2022-01-31 08:37:38 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-31 08:37:38 -0800 |
commit | c28f6cc1c93b282d1497e1e184ffba5efb782025 (patch) | |
tree | 288fc2da2d58cd11ae32c1a8d40e50d1c6064377 /src/ir/module-utils.cpp | |
parent | 098e02abadefe0e227c3c88a36e93d083ce004a8 (diff) | |
download | binaryen-c28f6cc1c93b282d1497e1e184ffba5efb782025.tar.gz binaryen-c28f6cc1c93b282d1497e1e184ffba5efb782025.tar.bz2 binaryen-c28f6cc1c93b282d1497e1e184ffba5efb782025.zip |
Interpreter: Remove GlobalManager (#4486)
GlobalManager is another class that added complexity in the interpreter logic,
and did not help. In fact it hurts extensibility, as when one wants to extend the
interpreter one has another class to customize, and it is templated on the main
runner, so again as #4479 we end up with annoying template cycles.
This simply removes that class. That makes the interpreter code strictly
simpler. Applying that change to wasm-ctor-eval also ends up fixing a
pre-existing bug, so this PR gets testing through that.
The ctor-eval issue was that we did not extend the GlobalManager properly
in the past: we checked for accesses on imported globals there, but not in
the main class, i.e., not on global.get operations. Needing to do things in
two places is an example of the previous complexity. The fix is simply to
implement visitGlobalGet in one place, and remove all the GlobalManager
logic added in ctor-eval, which then gets a lot simpler as well.
The new imported-global-2.wast checks for that bug (a global.get of an
import should stop us from evalling). Existing tests cover the other cases,
like it being ok to read a non-imported global, etc. The existing test
indirect-call3.wast required a slight change: There was a global.get of
an imported global, which was ignored in the place it happened (an init
of an elem segment); the new code checks all global.gets, so it now
catches that.
Diffstat (limited to 'src/ir/module-utils.cpp')
0 files changed, 0 insertions, 0 deletions