[Wasm] Require location for buildDrop and fix all usages
This commit is contained in:
+5
-6
@@ -68,7 +68,7 @@ class BodyGenerator(
|
|||||||
private fun generateAsStatement(statement: IrExpression) {
|
private fun generateAsStatement(statement: IrExpression) {
|
||||||
generateExpression(statement)
|
generateExpression(statement)
|
||||||
if (statement.type != wasmSymbols.voidType) {
|
if (statement.type != wasmSymbols.voidType) {
|
||||||
body.buildDrop()
|
body.buildDrop(statement.getSourceLocation())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -489,7 +489,7 @@ class BodyGenerator(
|
|||||||
location
|
location
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
body.buildDrop()
|
body.buildDrop(location)
|
||||||
body.buildConstI32(1, location)
|
body.buildConstI32(1, location)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -546,11 +546,11 @@ class BodyGenerator(
|
|||||||
body.buildInstr(WasmOp.I32_EQZ)
|
body.buildInstr(WasmOp.I32_EQZ)
|
||||||
body.buildBr(outerLabel)
|
body.buildBr(outerLabel)
|
||||||
}
|
}
|
||||||
body.buildDrop()
|
body.buildDrop(location)
|
||||||
body.buildConstI32(0, location)
|
body.buildConstI32(0, location)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
body.buildDrop()
|
body.buildDrop(location)
|
||||||
body.buildConstI32(0, location)
|
body.buildConstI32(0, location)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -589,7 +589,6 @@ class BodyGenerator(
|
|||||||
}
|
}
|
||||||
|
|
||||||
wasmSymbols.unsafeGetScratchRawMemory -> {
|
wasmSymbols.unsafeGetScratchRawMemory -> {
|
||||||
|
|
||||||
body.buildConstI32Symbol(context.scratchMemAddr, location)
|
body.buildConstI32Symbol(context.scratchMemAddr, location)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -721,7 +720,7 @@ class BodyGenerator(
|
|||||||
// NOTHING? -> TYPE? -> (NOTHING?)NULL
|
// NOTHING? -> TYPE? -> (NOTHING?)NULL
|
||||||
if (actualType.isNullableNothing() && expectedType.isNullable()) {
|
if (actualType.isNullableNothing() && expectedType.isNullable()) {
|
||||||
if (expectedType.getClass()?.isExternal == true) {
|
if (expectedType.getClass()?.isExternal == true) {
|
||||||
body.buildDrop()
|
body.buildDrop(location)
|
||||||
body.buildRefNull(WasmHeapType.Simple.NullNoExtern, location)
|
body.buildRefNull(WasmHeapType.Simple.NullNoExtern, location)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
|||||||
+2
-2
@@ -333,7 +333,7 @@ private fun BodyGenerator.genTableIntSwitch(
|
|||||||
|
|
||||||
for (expression in branches) {
|
for (expression in branches) {
|
||||||
if (resultType != null) {
|
if (resultType != null) {
|
||||||
body.buildDrop()
|
body.buildDrop(location)
|
||||||
}
|
}
|
||||||
generateWithExpectedType(expression.expression, expectedType)
|
generateWithExpectedType(expression.expression, expectedType)
|
||||||
|
|
||||||
@@ -343,7 +343,7 @@ private fun BodyGenerator.genTableIntSwitch(
|
|||||||
|
|
||||||
if (elseExpression != null) {
|
if (elseExpression != null) {
|
||||||
if (resultType != null) {
|
if (resultType != null) {
|
||||||
body.buildDrop()
|
body.buildDrop(location)
|
||||||
}
|
}
|
||||||
generateWithExpectedType(elseExpression, expectedType)
|
generateWithExpectedType(elseExpression, expectedType)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -179,8 +179,8 @@ abstract class WasmExpressionBuilder {
|
|||||||
buildInstr(WasmOp.REF_NULL, location, WasmImmediate.HeapType(WasmRefType(type)))
|
buildInstr(WasmOp.REF_NULL, location, WasmImmediate.HeapType(WasmRefType(type)))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun buildDrop() {
|
fun buildDrop(location: SourceLocation) {
|
||||||
buildInstr(WasmOp.DROP)
|
buildInstr(WasmOp.DROP, location)
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun commentPreviousInstr(text: () -> String) {
|
inline fun commentPreviousInstr(text: () -> String) {
|
||||||
|
|||||||
Reference in New Issue
Block a user