StackValue.pop()

This commit is contained in:
Alexander Udalov
2012-08-10 14:37:14 +04:00
parent b497fcc167
commit 4bc1b2636a
@@ -212,6 +212,13 @@ public abstract class StackValue {
} }
} }
protected static void pop(Type type, InstructionAdapter v) {
if (type.getSize() == 1)
v.pop();
else
v.pop2();
}
protected void coerce(Type toType, InstructionAdapter v) { protected void coerce(Type toType, InstructionAdapter v) {
coerce(this.type, toType, v); coerce(this.type, toType, v);
} }
@@ -220,10 +227,7 @@ public abstract class StackValue {
if (toType.equals(fromType)) return; if (toType.equals(fromType)) return;
if (toType.getSort() == Type.VOID && fromType.getSort() != Type.VOID) { if (toType.getSort() == Type.VOID && fromType.getSort() != Type.VOID) {
if (fromType.getSize() == 1) pop(fromType, v);
v.pop();
else
v.pop2();
} }
else if (toType.getSort() != Type.VOID && fromType.getSort() == Type.VOID) { else if (toType.getSort() != Type.VOID && fromType.getSort() == Type.VOID) {
if (toType.getSort() == Type.OBJECT) { if (toType.getSort() == Type.OBJECT) {
@@ -357,17 +361,7 @@ public abstract class StackValue {
@Override @Override
public void put(Type type, InstructionAdapter v) { public void put(Type type, InstructionAdapter v) {
if (type == Type.VOID_TYPE && this.type != Type.VOID_TYPE) { coerce(type, v);
if (this.type.getSize() == 2) {
v.pop2();
}
else {
v.pop();
}
}
else {
coerce(type, v);
}
} }
@Override @Override
@@ -627,10 +621,7 @@ public abstract class StackValue {
method.invoke(v); method.invoke(v);
Type returnType = asmMethod.getReturnType(); Type returnType = asmMethod.getReturnType();
if (returnType != Type.VOID_TYPE) { if (returnType != Type.VOID_TYPE) {
if (returnType.getSize() == 2) pop(returnType, v);
v.pop2();
else
v.pop();
} }
} }
else else