Fix for KT-15575: VerifyError: Bad type on operand stack

#KT-15575 Fixed
This commit is contained in:
Mikhael Bogdanov
2017-01-09 17:50:11 +01:00
parent a3f6fbe0c1
commit 2931c316a3
14 changed files with 123 additions and 4 deletions
@@ -161,7 +161,8 @@ public class AsmUtil {
return isPrimitiveClass((ClassDescriptor) descriptor) && !isBoolean((ClassDescriptor) descriptor);
}
public static Type correctElementType(Type type) {
@NotNull
public static Type correctElementType(@NotNull Type type) {
String internalName = type.getInternalName();
assert internalName.charAt(0) == '[';
return Type.getType(internalName.substring(1));
@@ -24,7 +24,7 @@ import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
class ArraySet : IntrinsicMethod() {
override fun toCallable(method: CallableMethod): Callable {
val type = correctElementType(method.dispatchReceiverType)
val type = correctElementType(method.dispatchReceiverType!!)
return object : IntrinsicCallable(
Type.VOID_TYPE,
listOf(Type.INT_TYPE, type),
@@ -18,6 +18,7 @@ package org.jetbrains.kotlin.codegen.optimization.common;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.codegen.AsmUtil;
import org.jetbrains.org.objectweb.asm.Handle;
import org.jetbrains.org.objectweb.asm.Opcodes;
import org.jetbrains.org.objectweb.asm.Type;
@@ -164,7 +165,7 @@ public class OptimizationBasicInterpreter extends Interpreter<BasicValue> implem
if (insn.getOpcode() == Opcodes.AALOAD) {
Type arrayType = value1.getType();
if (arrayType != null && arrayType.getSort() == Type.ARRAY) {
return new StrictBasicValue(arrayType.getElementType());
return new StrictBasicValue(AsmUtil.correctElementType(arrayType));
}
}