Fix compiler warnings in new wasm modules
Also don't output v8ExecutablePath in js.tests on each project configuration.
This commit is contained in:
committed by
Alexander Udalov
parent
84d1393711
commit
d96223a2ff
+2
-1
@@ -90,6 +90,7 @@ class CheckIrElementVisitor(
|
|||||||
override fun <T> visitConst(expression: IrConst<T>) {
|
override fun <T> visitConst(expression: IrConst<T>) {
|
||||||
super.visitConst(expression)
|
super.visitConst(expression)
|
||||||
|
|
||||||
|
@Suppress("UNUSED_VARIABLE")
|
||||||
val naturalType = when (expression.kind) {
|
val naturalType = when (expression.kind) {
|
||||||
IrConstKind.Null -> {
|
IrConstKind.Null -> {
|
||||||
expression.ensureNullable()
|
expression.ensureNullable()
|
||||||
@@ -106,9 +107,9 @@ class CheckIrElementVisitor(
|
|||||||
IrConstKind.Double -> irBuiltIns.doubleType
|
IrConstKind.Double -> irBuiltIns.doubleType
|
||||||
}
|
}
|
||||||
|
|
||||||
var type = expression.type
|
|
||||||
/*
|
/*
|
||||||
TODO: This check used to have JS inline class helpers. Rewrite it in a common way.
|
TODO: This check used to have JS inline class helpers. Rewrite it in a common way.
|
||||||
|
var type = expression.type
|
||||||
while (true) {
|
while (true) {
|
||||||
val inlinedClass = type.getInlinedClass() ?: break
|
val inlinedClass = type.getInlinedClass() ?: break
|
||||||
if (getInlineClassUnderlyingType(inlinedClass) == type)
|
if (getInlineClassUnderlyingType(inlinedClass) == type)
|
||||||
|
|||||||
+2
-3
@@ -272,10 +272,9 @@ class InlineClassLowering(val context: CommonBackendContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun IrFunction.toInlineClassImplementationName(): Name {
|
private fun IrFunction.toInlineClassImplementationName(): Name {
|
||||||
val klass = this.parentAsClass!!
|
val newName = parentAsClass.name.asString() + "__" + name.asString() + INLINE_CLASS_IMPL_SUFFIX
|
||||||
val newName = klass.name.asString() + "__" + name.asString() + INLINE_CLASS_IMPL_SUFFIX
|
|
||||||
return when {
|
return when {
|
||||||
name.isSpecial -> Name.special("<" + newName + ">")
|
name.isSpecial -> Name.special("<$newName>")
|
||||||
else -> Name.identifier(newName)
|
else -> Name.identifier(newName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -41,12 +41,12 @@ class EnumUsageLowering(val context: JsCommonBackendContext) : BodyLoweringPass
|
|||||||
val enumEntry = expression.symbol.owner
|
val enumEntry = expression.symbol.owner
|
||||||
val klass = enumEntry.parent as IrClass
|
val klass = enumEntry.parent as IrClass
|
||||||
if (klass.isExternal) return expression
|
if (klass.isExternal) return expression
|
||||||
return lowerEnumEntry(enumEntry, klass)
|
return lowerEnumEntry(enumEntry)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun lowerEnumEntry(enumEntry: IrEnumEntry, klass: IrClass) =
|
private fun lowerEnumEntry(enumEntry: IrEnumEntry) =
|
||||||
enumEntry.getInstanceFun!!.run { JsIrBuilder.buildCall(symbol) }
|
enumEntry.getInstanceFun!!.run { JsIrBuilder.buildCall(symbol) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -48,8 +48,8 @@ import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid
|
|||||||
* Related issue: [https://github.com/WebAssembly/gc/issues/29]
|
* Related issue: [https://github.com/WebAssembly/gc/issues/29]
|
||||||
*/
|
*/
|
||||||
class EraseVirtualDispatchReceiverParametersTypes(val context: CommonBackendContext) : FileLoweringPass {
|
class EraseVirtualDispatchReceiverParametersTypes(val context: CommonBackendContext) : FileLoweringPass {
|
||||||
override fun lower(file: IrFile) {
|
override fun lower(irFile: IrFile) {
|
||||||
file.acceptChildrenVoid(object : IrElementVisitorVoid {
|
irFile.acceptChildrenVoid(object : IrElementVisitorVoid {
|
||||||
override fun visitElement(element: IrElement) {
|
override fun visitElement(element: IrElement) {
|
||||||
element.acceptChildrenVoid(this)
|
element.acceptChildrenVoid(this)
|
||||||
}
|
}
|
||||||
@@ -88,4 +88,4 @@ class EraseVirtualDispatchReceiverParametersTypes(val context: CommonBackendCont
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -185,15 +185,15 @@ class WasmBaseTypeOperatorTransformer(val context: WasmBackendContext) : IrEleme
|
|||||||
// Handling null manually
|
// Handling null manually
|
||||||
if (toType.isNullable() && fromType.isNullable()) {
|
if (toType.isNullable() && fromType.isNullable()) {
|
||||||
return builder.irComposite {
|
return builder.irComposite {
|
||||||
val value = cacheValue(value)
|
val cachedValue = cacheValue(value)
|
||||||
+builder.irIfNull(
|
+builder.irIfNull(
|
||||||
type = toType,
|
type = toType,
|
||||||
subject = value() as IrExpression,
|
subject = cachedValue() as IrExpression,
|
||||||
thenPart = builder.irNull(toType),
|
thenPart = builder.irNull(toType),
|
||||||
elsePart = builder.irCall(symbols.wasmRefCast, type = toType).apply {
|
elsePart = builder.irCall(symbols.wasmRefCast, type = toType).apply {
|
||||||
putTypeArgument(0, fromType)
|
putTypeArgument(0, fromType)
|
||||||
putTypeArgument(1, toType)
|
putTypeArgument(1, toType)
|
||||||
putValueArgument(0, value() as IrExpression)
|
putValueArgument(0, cachedValue() as IrExpression)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -291,7 +291,6 @@ projectTest("wasmTest", true) {
|
|||||||
include("org/jetbrains/kotlin/js/test/wasm/semantics/*")
|
include("org/jetbrains/kotlin/js/test/wasm/semantics/*")
|
||||||
val jsShellExecutablePath = File(unzipJsShell.get().destinationDir, "js").absolutePath
|
val jsShellExecutablePath = File(unzipJsShell.get().destinationDir, "js").absolutePath
|
||||||
val v8ExecutablePath = File(unzipV8.get().destinationDir, "d8").absolutePath
|
val v8ExecutablePath = File(unzipV8.get().destinationDir, "d8").absolutePath
|
||||||
println(v8ExecutablePath)
|
|
||||||
|
|
||||||
systemProperty("javascript.engine.path.SpiderMonkey", jsShellExecutablePath)
|
systemProperty("javascript.engine.path.SpiderMonkey", jsShellExecutablePath)
|
||||||
systemProperty("javascript.engine.path.V8", v8ExecutablePath)
|
systemProperty("javascript.engine.path.V8", v8ExecutablePath)
|
||||||
|
|||||||
@@ -39,16 +39,19 @@ abstract class WasmExpressionBuilder {
|
|||||||
buildInstr(WasmOp.UNREACHABLE)
|
buildInstr(WasmOp.UNREACHABLE)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("UNUSED_PARAMETER")
|
||||||
fun buildBlock(label: String?, resultType: WasmType? = null) {
|
fun buildBlock(label: String?, resultType: WasmType? = null) {
|
||||||
numberOfNestedBlocks++
|
numberOfNestedBlocks++
|
||||||
buildInstr(WasmOp.BLOCK, WasmImmediate.BlockType.Value(resultType))
|
buildInstr(WasmOp.BLOCK, WasmImmediate.BlockType.Value(resultType))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("UNUSED_PARAMETER")
|
||||||
fun buildLoop(label: String?, resultType: WasmType? = null) {
|
fun buildLoop(label: String?, resultType: WasmType? = null) {
|
||||||
numberOfNestedBlocks++
|
numberOfNestedBlocks++
|
||||||
buildInstr(WasmOp.LOOP, WasmImmediate.BlockType.Value(resultType))
|
buildInstr(WasmOp.LOOP, WasmImmediate.BlockType.Value(resultType))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("UNUSED_PARAMETER")
|
||||||
fun buildIf(label: String?, resultType: WasmType? = null) {
|
fun buildIf(label: String?, resultType: WasmType? = null) {
|
||||||
numberOfNestedBlocks++
|
numberOfNestedBlocks++
|
||||||
buildInstr(WasmOp.IF, WasmImmediate.BlockType.Value(resultType))
|
buildInstr(WasmOp.IF, WasmImmediate.BlockType.Value(resultType))
|
||||||
|
|||||||
@@ -460,6 +460,7 @@ abstract class ByteWriter {
|
|||||||
|
|
||||||
private fun writeUnsignedLeb128(v: UInt) {
|
private fun writeUnsignedLeb128(v: UInt) {
|
||||||
// Taken from Android source, Apache licensed
|
// Taken from Android source, Apache licensed
|
||||||
|
@Suppress("NAME_SHADOWING")
|
||||||
var v = v
|
var v = v
|
||||||
var remaining = v shr 7
|
var remaining = v shr 7
|
||||||
while (remaining != 0u) {
|
while (remaining != 0u) {
|
||||||
@@ -474,6 +475,7 @@ abstract class ByteWriter {
|
|||||||
|
|
||||||
private fun writeSignedLeb128(v: Long) {
|
private fun writeSignedLeb128(v: Long) {
|
||||||
// Taken from Android source, Apache licensed
|
// Taken from Android source, Apache licensed
|
||||||
|
@Suppress("NAME_SHADOWING")
|
||||||
var v = v
|
var v = v
|
||||||
var remaining = v shr 7
|
var remaining = v shr 7
|
||||||
var hasMore = true
|
var hasMore = true
|
||||||
@@ -508,4 +510,4 @@ abstract class ByteWriter {
|
|||||||
|
|
||||||
override fun createTemp() = OutputStream(ByteArrayOutputStream())
|
override fun createTemp() = OutputStream(ByteArrayOutputStream())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user