Attempt to split long or double on the stack exception

#KT-3042 Fixed
This commit is contained in:
Natalia.Ukhorskaya
2012-11-20 13:35:30 +04:00
parent 900788a8e0
commit 3fc2e5d20c
7 changed files with 150 additions and 1 deletions
@@ -443,6 +443,24 @@ public class AsmUtil {
genMethodThrow(mv, STUB_EXCEPTION, STUB_EXCEPTION_MESSAGE);
}
public static void swap(InstructionAdapter v, Type stackTop, Type afterTop) {
if (stackTop.getSize() == 1) {
if (afterTop.getSize() == 1) {
v.swap();
} else {
v.dupX2();
v.pop();
}
} else {
if (afterTop.getSize() == 1) {
v.dup2X1();
} else {
v.dup2X2();
}
v.pop2();
}
}
public static void genNotNullAssertionsForParameters(
@NotNull InstructionAdapter v,
@NotNull GenerationState state,
@@ -1062,7 +1062,7 @@ public abstract class StackValue {
public void store(Type topOfStackType, InstructionAdapter v) {
coerceFrom(topOfStackType, v);
v.load(index, OBJECT_TYPE);
v.swap();
AsmUtil.swap(v, sharedTypeForType(this.type), topOfStackType);
Type refType = refType(this.type);
Type sharedType = sharedTypeForType(this.type);
v.visitFieldInsn(PUTFIELD, sharedType.getInternalName(), "ref", refType.getDescriptor());