Fix minor compile warnings

This commit is contained in:
Dmitry Gridin
2019-04-17 17:48:26 +07:00
parent 79793a4bda
commit 37c856290f
226 changed files with 618 additions and 479 deletions
@@ -97,7 +97,7 @@ open class FrameMapBase<T : Any> {
val descriptors = Lists.newArrayList<Trinity<T, Int, Int>>()
for (descriptor0 in myVarIndex.keys()) {
val descriptor = descriptor0 as T
@Suppress("UNCHECKED_CAST") val descriptor = descriptor0 as T
val varIndex = myVarIndex.get(descriptor)
val varSize = myVarSizes.get(descriptor)
descriptors.add(Trinity.create(descriptor, varIndex, varSize))
@@ -234,7 +234,7 @@ class ScriptCodegen private constructor(
hasMain = true
}
}
is KtProperty, is KtNamedFunction, is KtTypeAlias -> genSimpleMember(declaration)
is KtProperty, is KtTypeAlias -> genSimpleMember(declaration)
is KtClassOrObject -> genClassOrObject(declaration)
is KtDestructuringDeclaration -> for (entry in declaration.entries) {
genSimpleMember(entry)
@@ -135,10 +135,9 @@ internal fun performRefinedTypeAnalysis(methodNode: MethodNode, thisName: String
override fun use(frame: VarExpectedTypeFrame, insn: AbstractInsnNode) {
val (expectedType, sources) = expectedTypeAndSourcesByInsnIndex[insn.index()] ?: return
sources.flatMap(SourceValue::insns).forEach {
insn ->
if (insn.isIntLoad()) {
frame.updateExpectedType((insn as VarInsnNode).`var`, expectedType)
sources.flatMap(SourceValue::insns).forEach { insnNode ->
if (insnNode.isIntLoad()) {
frame.updateExpectedType((insnNode as VarInsnNode).`var`, expectedType)
}
}
}
@@ -168,12 +168,12 @@ abstract class InlineCodegen<out T : BaseExpressionCodegen>(
}
}
@Suppress("UNREACHABLE_CODE")
private fun canSkipStackSpillingOnInline(methodNode: MethodNode): Boolean {
// Temporary disable this optimization until
// TODO: Temporary disable this optimization until
// https://issuetracker.google.com/issues/68796377 is fixed
// or until d8 substitute dex
return false
// Stack spilling before inline function 'f' call is required if:
// - 'f' is a suspend function
// - 'f' has try-catch blocks
@@ -96,19 +96,19 @@ class LocalVarRemapper(private val params: Parameters, private val additionalShi
}
fun visitVarInsn(opcode: Int, `var`: Int, mv: InstructionAdapter) {
var opcode = opcode
val remapInfo = remap(`var`)
val value = remapInfo.value
if (value is StackValue.Local) {
val isStore = isStoreInstruction(opcode)
if (remapInfo.parameterInfo != null) {
val localOpcode = if (remapInfo.parameterInfo != null) {
//All remapped value parameters can't be rewritten except case of default ones.
//On remapping default parameter to actual value there is only one instruction that writes to it according to mask value
//but if such parameter remapped then it passed and this mask branch code never executed
//TODO add assertion about parameter default value: descriptor is required
opcode = value.type.getOpcode(if (isStore) Opcodes.ISTORE else Opcodes.ILOAD)
}
mv.visitVarInsn(opcode, value.index)
value.type.getOpcode(if (isStore) Opcodes.ISTORE else Opcodes.ILOAD)
} else opcode
mv.visitVarInsn(localOpcode, value.index)
if (remapInfo.parameterInfo != null && !isStore) {
StackValue.coerce(value.type, remapInfo.parameterInfo.type, mv)
}
@@ -58,7 +58,7 @@ class InFloatingPointRangeLiteralExpressionGenerator(
// goto jumpLabel
// exitLabel:
frameMap.useTmpVar(operandType) { argVar ->
frameMap.useTmpVar(operandType) { _ ->
val exitLabel = Label()
genJumpIfFalse(v, exitLabel)
v.goTo(jumpLabel)
@@ -278,8 +278,8 @@ class GenerationState private constructor(
?.let { destination -> SignatureDumpingBuilderFactory(it, File(destination)) } ?: it
}
)
.wrapWith(ClassBuilderInterceptorExtension.getInstances(project)) { builderFactory, extension ->
extension.interceptClassBuilderFactory(builderFactory, bindingContext, diagnostics)
.wrapWith(ClassBuilderInterceptorExtension.getInstances(project)) { classBuilderFactory, extension ->
extension.interceptClassBuilderFactory(classBuilderFactory, bindingContext, diagnostics)
}
this.factory = ClassFileFactory(this, interceptedBuilderFactory)