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