WASM: Generate throw instruction instead of wasmThrow call

This commit is contained in:
Igor Laevsky
2021-08-18 14:57:14 +03:00
committed by TeamCityServer
parent e5e44a0152
commit 6ca965af6f
10 changed files with 26 additions and 53 deletions
@@ -72,6 +72,14 @@ abstract class WasmExpressionBuilder {
buildInstr(WasmOp.BR, WasmImmediate.LabelIdx(relativeLevel))
}
fun buildThrow(tagIdx: Int) {
buildInstr(WasmOp.THROW, WasmImmediate.TagIdx(tagIdx))
}
fun buildCatch(tagIdx: Int) {
buildInstr(WasmOp.CATCH, WasmImmediate.TagIdx(tagIdx))
}
fun buildBrIf(absoluteBlockLevel: Int) {
val relativeLevel = numberOfNestedBlocks - absoluteBlockLevel
assert(relativeLevel >= 0) { "Negative relative block index" }