@@ -14,7 +14,6 @@ class Globals {
1414
1515 final Map <Field , w.GlobalBuilder > _globals = {};
1616 final Map <w.Global , w.BaseFunction > _globalGetters = {};
17- final Map <w.Global , w.BaseFunction > _globalSetters = {};
1817 final Map <Field , w.BaseFunction > _globalInitializers = {};
1918 final Map <Field , w.Global > _globalInitializedFlag = {};
2019 late final WasmGlobalImporter _globalsModuleMap =
@@ -63,39 +62,6 @@ class Globals {
6362 return global.type.type;
6463 }
6564
66- /// Sets the value of [w.Global] in [b] .
67- ///
68- /// Takes into account the calling module and the module the global belongs
69- /// to. If they are not the same then sets the global indirectly, either
70- /// through an import or a setter call.
71- void updateGlobal (w.InstructionsBuilder b,
72- void Function (w.InstructionsBuilder b) pushValue, w.Global global) {
73- final owningModule = global.enclosingModule;
74- final callingModule = b.module;
75- if (owningModule == callingModule) {
76- pushValue (b);
77- b.global_set (global);
78- } else if (translator.isMainModule (owningModule)) {
79- final importedGlobal = _globalsModuleMap.get (global, callingModule);
80- pushValue (b);
81- b.global_set (importedGlobal);
82- } else {
83- final setter = _globalSetters.putIfAbsent (global, () {
84- final setterType =
85- owningModule.types.defineFunction ([global.type.type], const []);
86- final setterFunction = owningModule.functions.define (setterType);
87- final setterBody = setterFunction.body;
88- setterBody.local_get (setterBody.locals.single);
89- setterBody.global_set (global);
90- setterBody.end ();
91- return setterFunction;
92- });
93-
94- pushValue (b);
95- translator.callFunction (setter, b);
96- }
97- }
98-
9965 /// Return (and if needed create) the Wasm global corresponding to a static
10066 /// field.
10167 w.Global getGlobalForStaticField (Field field) {
0 commit comments