[Wasm] Require location for buildConstF32 & buildConstF64 and fix all usages
This commit is contained in:
+4
-4
@@ -478,8 +478,8 @@ fun generateDefaultInitializerForType(type: WasmType, g: WasmExpressionBuilder)
|
||||
when (type) {
|
||||
WasmI32 -> g.buildConstI32(0, location)
|
||||
WasmI64 -> g.buildConstI64(0, location)
|
||||
WasmF32 -> g.buildConstF32(0f)
|
||||
WasmF64 -> g.buildConstF64(0.0)
|
||||
WasmF32 -> g.buildConstF32(0f, location)
|
||||
WasmF64 -> g.buildConstF64(0.0, location)
|
||||
is WasmRefNullType -> g.buildRefNull(type.heapType)
|
||||
is WasmRefNullNoneType -> g.buildRefNull(WasmHeapType.Simple.NullNone)
|
||||
is WasmRefNullExternrefType -> g.buildRefNull(WasmHeapType.Simple.NullNoExtern)
|
||||
@@ -512,8 +512,8 @@ fun generateConstExpression(expression: IrConst<*>, body: WasmExpressionBuilder,
|
||||
is IrConstKind.Int -> body.buildConstI32(kind.valueOf(expression), location)
|
||||
is IrConstKind.Long -> body.buildConstI64(kind.valueOf(expression), location)
|
||||
is IrConstKind.Char -> body.buildConstI32(kind.valueOf(expression).code, location)
|
||||
is IrConstKind.Float -> body.buildConstF32(kind.valueOf(expression))
|
||||
is IrConstKind.Double -> body.buildConstF64(kind.valueOf(expression))
|
||||
is IrConstKind.Float -> body.buildConstF32(kind.valueOf(expression), location)
|
||||
is IrConstKind.Double -> body.buildConstF64(kind.valueOf(expression), location)
|
||||
is IrConstKind.String -> {
|
||||
val stringValue = kind.valueOf(expression)
|
||||
val (literalAddress, literalPoolId) = context.referenceStringLiteralAddressAndId(stringValue)
|
||||
|
||||
@@ -24,12 +24,12 @@ abstract class WasmExpressionBuilder {
|
||||
buildInstr(WasmOp.I64_CONST, location, WasmImmediate.ConstI64(value))
|
||||
}
|
||||
|
||||
fun buildConstF32(value: Float) {
|
||||
buildInstr(WasmOp.F32_CONST, WasmImmediate.ConstF32(value.toRawBits().toUInt()))
|
||||
fun buildConstF32(value: Float, location: SourceLocation) {
|
||||
buildInstr(WasmOp.F32_CONST, location, WasmImmediate.ConstF32(value.toRawBits().toUInt()))
|
||||
}
|
||||
|
||||
fun buildConstF64(value: Double) {
|
||||
buildInstr(WasmOp.F64_CONST, WasmImmediate.ConstF64(value.toRawBits().toULong()))
|
||||
fun buildConstF64(value: Double, location: SourceLocation) {
|
||||
buildInstr(WasmOp.F64_CONST, location, WasmImmediate.ConstF64(value.toRawBits().toULong()))
|
||||
}
|
||||
|
||||
fun buildConstI32Symbol(value: WasmSymbol<Int>) {
|
||||
|
||||
Reference in New Issue
Block a user