@@ -99,8 +99,8 @@ final class Emitter(config: Emitter.Config) {
99
99
watpe.RefType (genTypeName.anyArray),
100
100
wamod.Expr (
101
101
List (
102
- wa.I32_CONST (stringPoolCount),
103
- wa.ARRAY_NEW_DEFAULT (genTypeName.anyArray)
102
+ wa.I32Const (stringPoolCount),
103
+ wa.ArrayNewDefault (genTypeName.anyArray)
104
104
)
105
105
),
106
106
isMutable = false
@@ -131,13 +131,13 @@ final class Emitter(config: Emitter.Config) {
131
131
132
132
interfaces.foreach { iface =>
133
133
val idx = ctx.getItableIdx(iface)
134
- instrs += wa.GLOBAL_GET (genGlobalName.forITable(className))
135
- instrs += wa.I32_CONST (idx)
134
+ instrs += wa.GlobalGet (genGlobalName.forITable(className))
135
+ instrs += wa.I32Const (idx)
136
136
137
137
for (method <- iface.tableEntries)
138
138
instrs += ctx.refFuncWithDeclaration(resolvedMethodInfos(method).tableEntryName)
139
- instrs += wa.STRUCT_NEW (genTypeName.forITable(iface.name))
140
- instrs += wa.ARRAY_SET (genTypeName.itables)
139
+ instrs += wa.StructNew (genTypeName.forITable(iface.name))
140
+ instrs += wa.ArraySet (genTypeName.itables)
141
141
}
142
142
}
143
143
@@ -151,21 +151,21 @@ final class Emitter(config: Emitter.Config) {
151
151
// Use getClassInfoOption in case the reachability analysis got rid of those interfaces
152
152
interfaceInfo <- ctx.getClassInfoOption(interfaceName)
153
153
} {
154
- instrs += wa.GLOBAL_GET (globalName)
155
- instrs += wa.I32_CONST (ctx.getItableIdx(interfaceInfo))
154
+ instrs += wa.GlobalGet (globalName)
155
+ instrs += wa.I32Const (ctx.getItableIdx(interfaceInfo))
156
156
157
157
for (method <- interfaceInfo.tableEntries)
158
158
instrs += ctx.refFuncWithDeclaration(resolvedMethodInfos(method).tableEntryName)
159
- instrs += wa.STRUCT_NEW (genTypeName.forITable(interfaceName))
160
- instrs += wa.ARRAY_SET (genTypeName.itables)
159
+ instrs += wa.StructNew (genTypeName.forITable(interfaceName))
160
+ instrs += wa.ArraySet (genTypeName.itables)
161
161
}
162
162
}
163
163
164
164
// Initialize the JS private field symbols
165
165
166
166
for (fieldName <- ctx.getAllJSPrivateFieldNames()) {
167
- instrs += wa.CALL (genFunctionName.newSymbol)
168
- instrs += wa.GLOBAL_SET (genGlobalName.forJSPrivateField(fieldName))
167
+ instrs += wa.Call (genFunctionName.newSymbol)
168
+ instrs += wa.GlobalSet (genGlobalName.forJSPrivateField(fieldName))
169
169
}
170
170
171
171
// Emit the static initializers
@@ -176,7 +176,7 @@ final class Emitter(config: Emitter.Config) {
176
176
className,
177
177
StaticInitializerName
178
178
)
179
- instrs += wa.CALL (funcName)
179
+ instrs += wa.Call (funcName)
180
180
}
181
181
182
182
// Initialize the top-level exports that require it
@@ -185,28 +185,28 @@ final class Emitter(config: Emitter.Config) {
185
185
// Load the (initial) exported value on the stack
186
186
tle.tree match {
187
187
case TopLevelJSClassExportDef (_, exportName) =>
188
- instrs += wa.CALL (genFunctionName.loadJSClass(tle.owningClass))
188
+ instrs += wa.Call (genFunctionName.loadJSClass(tle.owningClass))
189
189
case TopLevelModuleExportDef (_, exportName) =>
190
- instrs += wa.CALL (genFunctionName.loadModule(tle.owningClass))
190
+ instrs += wa.Call (genFunctionName.loadModule(tle.owningClass))
191
191
case TopLevelMethodExportDef (_, methodDef) =>
192
192
instrs += ctx.refFuncWithDeclaration(genFunctionName.forExport(tle.exportName))
193
193
if (methodDef.restParam.isDefined) {
194
- instrs += wa.I32_CONST (methodDef.args.size)
195
- instrs += wa.CALL (genFunctionName.makeExportedDefRest)
194
+ instrs += wa.I32Const (methodDef.args.size)
195
+ instrs += wa.Call (genFunctionName.makeExportedDefRest)
196
196
} else {
197
- instrs += wa.CALL (genFunctionName.makeExportedDef)
197
+ instrs += wa.Call (genFunctionName.makeExportedDef)
198
198
}
199
199
case TopLevelFieldExportDef (_, _, fieldIdent) =>
200
200
/* Usually redundant, but necessary if the static field is never
201
201
* explicitly set and keeps its default (zero) value instead. In that
202
202
* case this initial call is required to publish that zero value (as
203
203
* opposed to the default `undefined` value of the JS `let`).
204
204
*/
205
- instrs += wa.GLOBAL_GET (genGlobalName.forStaticField(fieldIdent.name))
205
+ instrs += wa.GlobalGet (genGlobalName.forStaticField(fieldIdent.name))
206
206
}
207
207
208
208
// Call the export setter
209
- instrs += wa.CALL (genFunctionName.forTopLevelExportSetter(tle.exportName))
209
+ instrs += wa.Call (genFunctionName.forTopLevelExportSetter(tle.exportName))
210
210
}
211
211
212
212
// Emit the module initializers
@@ -215,26 +215,26 @@ final class Emitter(config: Emitter.Config) {
215
215
def genCallStatic (className : ClassName , methodName : MethodName ): Unit = {
216
216
val functionName =
217
217
genFunctionName.forMethod(MemberNamespace .PublicStatic , className, methodName)
218
- instrs += wa.CALL (functionName)
218
+ instrs += wa.Call (functionName)
219
219
}
220
220
221
221
ModuleInitializerImpl .fromInitializer(init) match {
222
222
case ModuleInitializerImpl .MainMethodWithArgs (className, encodedMainMethodName, args) =>
223
223
// vtable of Array[String]
224
- instrs += wa.GLOBAL_GET (genGlobalName.forVTable(BoxedStringClass ))
225
- instrs += wa.I32_CONST (1 )
226
- instrs += wa.CALL (genFunctionName.arrayTypeData)
224
+ instrs += wa.GlobalGet (genGlobalName.forVTable(BoxedStringClass ))
225
+ instrs += wa.I32Const (1 )
226
+ instrs += wa.Call (genFunctionName.arrayTypeData)
227
227
228
228
// itable of Array[String]
229
- instrs += wa.GLOBAL_GET (genGlobalName.arrayClassITable)
229
+ instrs += wa.GlobalGet (genGlobalName.arrayClassITable)
230
230
231
231
// underlying array of args
232
232
args.foreach(arg => instrs ++= ctx.getConstantStringInstr(arg))
233
- instrs += wa.ARRAY_NEW_FIXED (genTypeName.anyArray, args.size)
233
+ instrs += wa.ArrayNewFixed (genTypeName.anyArray, args.size)
234
234
235
235
// array object
236
236
val stringArrayTypeRef = ArrayTypeRef (ClassRef (BoxedStringClass ), 1 )
237
- instrs += wa.STRUCT_NEW (genTypeName.forArrayClass(stringArrayTypeRef))
237
+ instrs += wa.StructNew (genTypeName.forArrayClass(stringArrayTypeRef))
238
238
239
239
// call
240
240
genCallStatic(className, encodedMainMethodName)
@@ -265,7 +265,7 @@ final class Emitter(config: Emitter.Config) {
265
265
* introduce these declarations.
266
266
*/
267
267
val exprs = funcDeclarations.map { name =>
268
- wamod.Expr (List (wa.REF_FUNC (name)))
268
+ wamod.Expr (List (wa.RefFunc (name)))
269
269
}
270
270
ctx.moduleBuilder.addElement(
271
271
wamod.Element (watpe.RefType .funcref, exprs, wamod.Element .Mode .Declarative )
0 commit comments