diff --git a/Sources/WasmKit/Execution/Instructions/Control.swift b/Sources/WasmKit/Execution/Instructions/Control.swift index b37d4bad..f9e82db4 100644 --- a/Sources/WasmKit/Execution/Instructions/Control.swift +++ b/Sources/WasmKit/Execution/Instructions/Control.swift @@ -10,7 +10,7 @@ extension ExecutionState { typealias BlockType = Instruction.BlockType - mutating func ifThen(runtime: Runtime, stack: inout Stack, elseOrEndRef: ExpressionRef, type: BlockType) { + mutating func ifThen(runtime: Runtime, stack: inout Stack, elseOrEndRef: ExpressionRef) { let isTrue = stack.popValue().i32 != 0 if isTrue { programCounter += 1 diff --git a/Sources/WasmKit/Execution/Instructions/Instruction.swift b/Sources/WasmKit/Execution/Instructions/Instruction.swift index 001e3c17..59720000 100644 --- a/Sources/WasmKit/Execution/Instructions/Instruction.swift +++ b/Sources/WasmKit/Execution/Instructions/Instruction.swift @@ -6,7 +6,7 @@ enum Instruction: Equatable { case globalSet(index: GlobalIndex) case unreachable case nop - case ifThen(elseOrEndRef: ExpressionRef, type: BlockType) + case ifThen(elseOrEndRef: ExpressionRef) case end case `else`(endRef: ExpressionRef) case br(offset: Int32, copyCount: UInt32, popCount: UInt32) diff --git a/Sources/WasmKit/Execution/Runtime/InstDispatch.swift b/Sources/WasmKit/Execution/Runtime/InstDispatch.swift index e5b67ae3..d13f6056 100644 --- a/Sources/WasmKit/Execution/Runtime/InstDispatch.swift +++ b/Sources/WasmKit/Execution/Runtime/InstDispatch.swift @@ -19,8 +19,8 @@ extension ExecutionState { case .nop: try self.nop(runtime: runtime, stack: &stack) return true - case .ifThen(let elseOrEndRef, let type): - self.ifThen(runtime: runtime, stack: &stack, elseOrEndRef: elseOrEndRef, type: type) + case .ifThen(let elseOrEndRef): + self.ifThen(runtime: runtime, stack: &stack, elseOrEndRef: elseOrEndRef) return true case .end: self.end(runtime: runtime, stack: &stack) diff --git a/Sources/WasmKit/Translator.swift b/Sources/WasmKit/Translator.swift index 18101563..dfc8b072 100644 --- a/Sources/WasmKit/Translator.swift +++ b/Sources/WasmKit/Translator.swift @@ -423,7 +423,7 @@ struct InstructionTranslator: InstructionVisitor { } else { elseOrEndRef = ExpressionRef(from: selfPC, to: endPC) } - return .ifThen(elseOrEndRef: elseOrEndRef, type: Instruction.BlockType(blockType)) + return .ifThen(elseOrEndRef: elseOrEndRef) } } diff --git a/Utilities/generate_inst_dispatch.swift b/Utilities/generate_inst_dispatch.swift index 08eadf4a..b4f35864 100644 --- a/Utilities/generate_inst_dispatch.swift +++ b/Utilities/generate_inst_dispatch.swift @@ -133,7 +133,6 @@ let instructions: [Instruction] = [ Instruction(name: "ifThen", isControl: true, immediates: [ // elseRef for if-then-else-end sequence, endRef for if-then-end sequence Immediate(name: "elseOrEndRef", type: "ExpressionRef"), - Immediate(name: "type", type: "BlockType") ]), Instruction(name: "end", isControl: true, immediates: []), Instruction(name: "`else`", isControl: true, immediates: [