1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348
|
// This file is generated by Utilities/generate_inst_dispatch.swift
extension ExecutionState {
@inline(__always)
mutating func doExecute(_ instruction: Instruction, runtime: Runtime, locals: UnsafeMutablePointer<Value>) throws -> Bool {
switch instruction {
case .unreachable:
try self.unreachable(runtime: runtime)
return true
case .nop:
try self.nop(runtime: runtime)
return true
case .block(let endRef, let type):
self.block(runtime: runtime, endRef: endRef, type: type)
return true
case .loop(let type):
self.loop(runtime: runtime, type: type)
return true
case .ifThen(let endRef, let type):
self.ifThen(runtime: runtime, endRef: endRef, type: type)
return true
case .ifThenElse(let elseRef, let endRef, let type):
self.ifThenElse(runtime: runtime, elseRef: elseRef, endRef: endRef, type: type)
return true
case .end:
self.end(runtime: runtime)
return true
case .`else`:
self.`else`(runtime: runtime)
return true
case .br(let labelIndex):
try self.br(runtime: runtime, labelIndex: labelIndex)
return false
case .brIf(let labelIndex):
try self.brIf(runtime: runtime, labelIndex: labelIndex)
return false
case .brTable(let brTable):
try self.brTable(runtime: runtime, brTable: brTable)
return false
case .`return`:
try self.`return`(runtime: runtime)
return false
case .call(let functionIndex):
try self.call(runtime: runtime, functionIndex: functionIndex)
return false
case .callIndirect(let tableIndex, let typeIndex):
try self.callIndirect(runtime: runtime, tableIndex: tableIndex, typeIndex: typeIndex)
return false
case .endOfFunction:
try self.endOfFunction(runtime: runtime)
return false
case .endOfExecution:
try self.endOfExecution(runtime: runtime)
return false
case .i32Load(let memarg):
try self.i32Load(runtime: runtime, memarg: memarg)
case .i64Load(let memarg):
try self.i64Load(runtime: runtime, memarg: memarg)
case .f32Load(let memarg):
try self.f32Load(runtime: runtime, memarg: memarg)
case .f64Load(let memarg):
try self.f64Load(runtime: runtime, memarg: memarg)
case .i32Load8S(let memarg):
try self.i32Load8S(runtime: runtime, memarg: memarg)
case .i32Load8U(let memarg):
try self.i32Load8U(runtime: runtime, memarg: memarg)
case .i32Load16S(let memarg):
try self.i32Load16S(runtime: runtime, memarg: memarg)
case .i32Load16U(let memarg):
try self.i32Load16U(runtime: runtime, memarg: memarg)
case .i64Load8S(let memarg):
try self.i64Load8S(runtime: runtime, memarg: memarg)
case .i64Load8U(let memarg):
try self.i64Load8U(runtime: runtime, memarg: memarg)
case .i64Load16S(let memarg):
try self.i64Load16S(runtime: runtime, memarg: memarg)
case .i64Load16U(let memarg):
try self.i64Load16U(runtime: runtime, memarg: memarg)
case .i64Load32S(let memarg):
try self.i64Load32S(runtime: runtime, memarg: memarg)
case .i64Load32U(let memarg):
try self.i64Load32U(runtime: runtime, memarg: memarg)
case .i32Store(let memarg):
try self.i32Store(runtime: runtime, memarg: memarg)
case .i64Store(let memarg):
try self.i64Store(runtime: runtime, memarg: memarg)
case .f32Store(let memarg):
try self.f32Store(runtime: runtime, memarg: memarg)
case .f64Store(let memarg):
try self.f64Store(runtime: runtime, memarg: memarg)
case .i32Store8(let memarg):
try self.i32Store8(runtime: runtime, memarg: memarg)
case .i32Store16(let memarg):
try self.i32Store16(runtime: runtime, memarg: memarg)
case .i64Store8(let memarg):
try self.i64Store8(runtime: runtime, memarg: memarg)
case .i64Store16(let memarg):
try self.i64Store16(runtime: runtime, memarg: memarg)
case .i64Store32(let memarg):
try self.i64Store32(runtime: runtime, memarg: memarg)
case .memorySize:
self.memorySize(runtime: runtime)
case .memoryGrow:
try self.memoryGrow(runtime: runtime)
case .memoryInit(let dataIndex):
try self.memoryInit(runtime: runtime, dataIndex: dataIndex)
case .memoryDataDrop(let dataIndex):
self.memoryDataDrop(runtime: runtime, dataIndex: dataIndex)
case .memoryCopy:
try self.memoryCopy(runtime: runtime)
case .memoryFill:
try self.memoryFill(runtime: runtime)
case .numericConst(let value):
self.numericConst(runtime: runtime, value: value)
case .numericIntUnary(let intUnary):
self.numericIntUnary(runtime: runtime, intUnary: intUnary)
case .numericFloatUnary(let floatUnary):
self.numericFloatUnary(runtime: runtime, floatUnary: floatUnary)
case .numericIntBinary(let intBinary):
try self.numericIntBinary(runtime: runtime, intBinary: intBinary)
case .numericFloatBinary(let floatBinary):
self.numericFloatBinary(runtime: runtime, floatBinary: floatBinary)
case .numericConversion(let conversion):
try self.numericConversion(runtime: runtime, conversion: conversion)
case .i32Add:
self.i32Add(runtime: runtime)
case .i64Add:
self.i64Add(runtime: runtime)
case .f32Add:
self.f32Add(runtime: runtime)
case .f64Add:
self.f64Add(runtime: runtime)
case .i32Sub:
self.i32Sub(runtime: runtime)
case .i64Sub:
self.i64Sub(runtime: runtime)
case .f32Sub:
self.f32Sub(runtime: runtime)
case .f64Sub:
self.f64Sub(runtime: runtime)
case .i32Mul:
self.i32Mul(runtime: runtime)
case .i64Mul:
self.i64Mul(runtime: runtime)
case .f32Mul:
self.f32Mul(runtime: runtime)
case .f64Mul:
self.f64Mul(runtime: runtime)
case .i32Eq:
self.i32Eq(runtime: runtime)
case .i64Eq:
self.i64Eq(runtime: runtime)
case .f32Eq:
self.f32Eq(runtime: runtime)
case .f64Eq:
self.f64Eq(runtime: runtime)
case .i32Ne:
self.i32Ne(runtime: runtime)
case .i64Ne:
self.i64Ne(runtime: runtime)
case .f32Ne:
self.f32Ne(runtime: runtime)
case .f64Ne:
self.f64Ne(runtime: runtime)
case .i32LtS:
self.i32LtS(runtime: runtime)
case .i64LtS:
self.i64LtS(runtime: runtime)
case .i32LtU:
self.i32LtU(runtime: runtime)
case .i64LtU:
self.i64LtU(runtime: runtime)
case .i32GtS:
self.i32GtS(runtime: runtime)
case .i64GtS:
self.i64GtS(runtime: runtime)
case .i32GtU:
self.i32GtU(runtime: runtime)
case .i64GtU:
self.i64GtU(runtime: runtime)
case .i32LeS:
self.i32LeS(runtime: runtime)
case .i64LeS:
self.i64LeS(runtime: runtime)
case .i32LeU:
self.i32LeU(runtime: runtime)
case .i64LeU:
self.i64LeU(runtime: runtime)
case .i32GeS:
self.i32GeS(runtime: runtime)
case .i64GeS:
self.i64GeS(runtime: runtime)
case .i32GeU:
self.i32GeU(runtime: runtime)
case .i64GeU:
self.i64GeU(runtime: runtime)
case .drop:
self.drop(runtime: runtime)
case .select:
try self.select(runtime: runtime)
case .refNull(let referenceType):
self.refNull(runtime: runtime, referenceType: referenceType)
case .refIsNull:
self.refIsNull(runtime: runtime)
case .refFunc(let functionIndex):
self.refFunc(runtime: runtime, functionIndex: functionIndex)
case .tableGet(let tableIndex):
try self.tableGet(runtime: runtime, tableIndex: tableIndex)
case .tableSet(let tableIndex):
try self.tableSet(runtime: runtime, tableIndex: tableIndex)
case .tableSize(let tableIndex):
self.tableSize(runtime: runtime, tableIndex: tableIndex)
case .tableGrow(let tableIndex):
self.tableGrow(runtime: runtime, tableIndex: tableIndex)
case .tableFill(let tableIndex):
try self.tableFill(runtime: runtime, tableIndex: tableIndex)
case .tableCopy(let dest, let src):
try self.tableCopy(runtime: runtime, dest: dest, src: src)
case .tableInit(let tableIndex, let elementIndex):
try self.tableInit(runtime: runtime, tableIndex: tableIndex, elementIndex: elementIndex)
case .tableElementDrop(let elementIndex):
self.tableElementDrop(runtime: runtime, elementIndex: elementIndex)
case .localGet(let index):
self.localGet(runtime: runtime, locals: locals, index: index)
case .localSet(let index):
self.localSet(runtime: runtime, locals: locals, index: index)
case .localTee(let index):
self.localTee(runtime: runtime, locals: locals, index: index)
case .globalGet(let index):
try self.globalGet(runtime: runtime, index: index)
case .globalSet(let index):
try self.globalSet(runtime: runtime, index: index)
}
programCounter += 1
return true
}
}
extension Instruction {
var name: String {
switch self {
case .unreachable: return "unreachable"
case .nop: return "nop"
case .block: return "block"
case .loop: return "loop"
case .ifThen: return "ifThen"
case .ifThenElse: return "ifThenElse"
case .end: return "end"
case .`else`: return "`else`"
case .br: return "br"
case .brIf: return "brIf"
case .brTable: return "brTable"
case .`return`: return "`return`"
case .call: return "call"
case .callIndirect: return "callIndirect"
case .endOfFunction: return "endOfFunction"
case .endOfExecution: return "endOfExecution"
case .i32Load: return "i32Load"
case .i64Load: return "i64Load"
case .f32Load: return "f32Load"
case .f64Load: return "f64Load"
case .i32Load8S: return "i32Load8S"
case .i32Load8U: return "i32Load8U"
case .i32Load16S: return "i32Load16S"
case .i32Load16U: return "i32Load16U"
case .i64Load8S: return "i64Load8S"
case .i64Load8U: return "i64Load8U"
case .i64Load16S: return "i64Load16S"
case .i64Load16U: return "i64Load16U"
case .i64Load32S: return "i64Load32S"
case .i64Load32U: return "i64Load32U"
case .i32Store: return "i32Store"
case .i64Store: return "i64Store"
case .f32Store: return "f32Store"
case .f64Store: return "f64Store"
case .i32Store8: return "i32Store8"
case .i32Store16: return "i32Store16"
case .i64Store8: return "i64Store8"
case .i64Store16: return "i64Store16"
case .i64Store32: return "i64Store32"
case .memorySize: return "memorySize"
case .memoryGrow: return "memoryGrow"
case .memoryInit: return "memoryInit"
case .memoryDataDrop: return "memoryDataDrop"
case .memoryCopy: return "memoryCopy"
case .memoryFill: return "memoryFill"
case .numericConst: return "numericConst"
case .numericIntUnary: return "numericIntUnary"
case .numericFloatUnary: return "numericFloatUnary"
case .numericIntBinary: return "numericIntBinary"
case .numericFloatBinary: return "numericFloatBinary"
case .numericConversion: return "numericConversion"
case .i32Add: return "i32Add"
case .i64Add: return "i64Add"
case .f32Add: return "f32Add"
case .f64Add: return "f64Add"
case .i32Sub: return "i32Sub"
case .i64Sub: return "i64Sub"
case .f32Sub: return "f32Sub"
case .f64Sub: return "f64Sub"
case .i32Mul: return "i32Mul"
case .i64Mul: return "i64Mul"
case .f32Mul: return "f32Mul"
case .f64Mul: return "f64Mul"
case .i32Eq: return "i32Eq"
case .i64Eq: return "i64Eq"
case .f32Eq: return "f32Eq"
case .f64Eq: return "f64Eq"
case .i32Ne: return "i32Ne"
case .i64Ne: return "i64Ne"
case .f32Ne: return "f32Ne"
case .f64Ne: return "f64Ne"
case .i32LtS: return "i32LtS"
case .i64LtS: return "i64LtS"
case .i32LtU: return "i32LtU"
case .i64LtU: return "i64LtU"
case .i32GtS: return "i32GtS"
case .i64GtS: return "i64GtS"
case .i32GtU: return "i32GtU"
case .i64GtU: return "i64GtU"
case .i32LeS: return "i32LeS"
case .i64LeS: return "i64LeS"
case .i32LeU: return "i32LeU"
case .i64LeU: return "i64LeU"
case .i32GeS: return "i32GeS"
case .i64GeS: return "i64GeS"
case .i32GeU: return "i32GeU"
case .i64GeU: return "i64GeU"
case .drop: return "drop"
case .select: return "select"
case .refNull: return "refNull"
case .refIsNull: return "refIsNull"
case .refFunc: return "refFunc"
case .tableGet: return "tableGet"
case .tableSet: return "tableSet"
case .tableSize: return "tableSize"
case .tableGrow: return "tableGrow"
case .tableFill: return "tableFill"
case .tableCopy: return "tableCopy"
case .tableInit: return "tableInit"
case .tableElementDrop: return "tableElementDrop"
case .localGet: return "localGet"
case .localSet: return "localSet"
case .localTee: return "localTee"
case .globalGet: return "globalGet"
case .globalSet: return "globalSet"
}
}
}
|