From 12854af0a2fc4bedd32334fca8ee86ec6f6e2374 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Tue, 13 Dec 2022 19:24:52 +0100 Subject: [PATCH] [Wasm] Require location for `buildRefTestStatic` and fix all usages --- .../jetbrains/kotlin/backend/wasm/ir2wasm/BodyGenerator.kt | 3 ++- .../src/org/jetbrains/kotlin/wasm/ir/WasmExpressionBuilder.kt | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/BodyGenerator.kt b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/BodyGenerator.kt index 99b956aeabe..a3cb2f90ce7 100644 --- a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/BodyGenerator.kt +++ b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/BodyGenerator.kt @@ -484,7 +484,8 @@ class BodyGenerator( private fun generateRefTest(fromType: IrType, toType: IrType, location: SourceLocation) { if (!isDownCastAlwaysSuccessInRuntime(fromType, toType)) { body.buildRefTestStatic( - toType = context.referenceGcType(toType.getRuntimeClass(irBuiltIns).symbol) + toType = context.referenceGcType(toType.getRuntimeClass(irBuiltIns).symbol), + location ) } else { body.buildDrop() diff --git a/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/WasmExpressionBuilder.kt b/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/WasmExpressionBuilder.kt index 0f31c1a4941..c9d0269696d 100644 --- a/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/WasmExpressionBuilder.kt +++ b/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/WasmExpressionBuilder.kt @@ -171,8 +171,8 @@ abstract class WasmExpressionBuilder { buildInstr(WasmOp.REF_CAST_DEPRECATED, location, WasmImmediate.TypeIdx(toType)) } - fun buildRefTestStatic(toType: WasmSymbolReadOnly) { - buildInstr(WasmOp.REF_TEST_DEPRECATED, WasmImmediate.TypeIdx(toType)) + fun buildRefTestStatic(toType: WasmSymbolReadOnly, location: SourceLocation) { + buildInstr(WasmOp.REF_TEST_DEPRECATED, location, WasmImmediate.TypeIdx(toType)) } fun buildRefNull(type: WasmHeapType) {