Skip to content

Commit f969e61

Browse files
alex28shSpace Team
authored andcommitted
[Wasm] poolId variables for getPackageName/getSimpleName
1 parent 3742270 commit f969e61

File tree

2 files changed

+8
-5
lines changed
  • compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm
  • libraries/stdlib/wasm/internal/kotlin/wasm/internal

2 files changed

+8
-5
lines changed

compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/BodyGenerator.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1152,7 +1152,8 @@ class BodyGenerator(
11521152
val arrayGcType = WasmImmediate.GcType(
11531153
wasmFileCodegenContext.referenceGcType(call.typeArguments[0]!!.getRuntimeClass(irBuiltIns).symbol)
11541154
)
1155-
val dataIdx = (call.arguments[2] as? IrConst)?.value as? Int ?: error("An argument for dataIdx should be a compile time const with type Int")
1155+
val dataIdx = (call.arguments[2] as? IrConst)?.value as? Int
1156+
?: error("An argument for dataIdx should be a compile time const with type Int")
11561157
body.buildDrop(location)
11571158
body.buildInstr(WasmOp.ARRAY_NEW_DATA, location, arrayGcType, WasmImmediate.DataIdx(dataIdx))
11581159
}

libraries/stdlib/wasm/internal/kotlin/wasm/internal/TypeInfo.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,20 @@ internal fun getQualifiedName(rtti: kotlin.wasm.internal.reftypes.structref): St
6060

6161
internal fun getPackageName(rtti: kotlin.wasm.internal.reftypes.structref): String {
6262
val flagFitsOneBitQualifier = wasmGetRttiIntField(5, rtti) and TYPE_INFO_FLAG_FITS_LATIN1_QUALIFIER
63+
val poolId = wasmGetRttiIntField(2, rtti)
6364
return if (flagFitsOneBitQualifier != 0)
64-
stringLiteralLatin1(wasmGetRttiIntField(2, rtti))
65+
stringLiteralLatin1(poolId)
6566
else
66-
stringLiteralUtf16(wasmGetRttiIntField(2, rtti))
67+
stringLiteralUtf16(poolId)
6768
}
6869

6970
internal fun getSimpleName(rtti: kotlin.wasm.internal.reftypes.structref): String {
7071
val flagFitsOneBitSimpleName = wasmGetRttiIntField(5, rtti) and TYPE_INFO_FLAG_FITS_LATIN1_SIMPLE_NAME
72+
val poolId = wasmGetRttiIntField(3, rtti)
7173
return if (flagFitsOneBitSimpleName != 0)
72-
stringLiteralLatin1(wasmGetRttiIntField(3, rtti))
74+
stringLiteralLatin1(poolId)
7375
else
74-
stringLiteralUtf16(wasmGetRttiIntField(3, rtti))
76+
stringLiteralUtf16(poolId)
7577
}
7678

7779
internal fun getTypeId(rtti: kotlin.wasm.internal.reftypes.structref): Long =

0 commit comments

Comments
 (0)