@@ -72,21 +72,15 @@ class EvallingModuleRunner;
7272class EvallingImportResolver : public ImportResolver {
7373public:
7474 EvallingImportResolver (
75- std::map<Name, std::shared_ptr<EvallingModuleRunner>> linkedInstances,
76- ModuleRunnerBase<EvallingModuleRunner>::ExternalInterface*
77- externalInterface)
78- : externalInterface(externalInterface) {}
75+ std::map<Name, std::shared_ptr<EvallingModuleRunner>> linkedInstances) {}
7976
8077 std::optional<Literals*> getGlobal (QualifiedName name, Type type) override {
81- externalInterface->trap ((std::stringstream ()
82- << " EvallingImportResolver: unexpected getGlobal "
83- << name)
84- .str ());
85- return std::nullopt ;
78+ auto [it, _] = stubLiterals.try_emplace (name, Literals ({Literal (type)}));
79+ return &it->second ;
8680 }
8781
8882private:
89- ModuleRunnerBase<EvallingModuleRunner>::ExternalInterface* externalInterface ;
83+ std::map<QualifiedName, Literals> stubLiterals ;
9084};
9185
9286class EvallingModuleRunner : public ModuleRunnerBase <EvallingModuleRunner> {
@@ -569,6 +563,8 @@ struct CtorEvalExternalInterface : EvallingModuleRunner::ExternalInterface {
569563 wasm->updateMaps ();
570564
571565 for (auto & oldGlobal : oldGlobals) {
566+ if (oldGlobal->imported ())
567+ continue ;
572568 // Serialize the global's value. While doing so, pass in the name of this
573569 // global, as we may be able to reuse the global as the defining global
574570 // for the value. See getSerialization() for more details.
0 commit comments