Remove useless StackValue.upcast()
This commit is contained in:
@@ -176,16 +176,13 @@ public class ClosureCodegen extends GenerationStateAware {
|
|||||||
final ReceiverParameterDescriptor receiver = funDescriptor.getReceiverParameter();
|
final ReceiverParameterDescriptor receiver = funDescriptor.getReceiverParameter();
|
||||||
int count = 1;
|
int count = 1;
|
||||||
if (receiver != null) {
|
if (receiver != null) {
|
||||||
StackValue.local(count, OBJECT_TYPE).put(OBJECT_TYPE, iv);
|
StackValue.local(count, OBJECT_TYPE).put(typeMapper.mapType(receiver.getType()), iv);
|
||||||
StackValue.onStack(OBJECT_TYPE)
|
|
||||||
.upcast(typeMapper.mapType(receiver.getType()), iv);
|
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<ValueParameterDescriptor> params = funDescriptor.getValueParameters();
|
final List<ValueParameterDescriptor> params = funDescriptor.getValueParameters();
|
||||||
for (ValueParameterDescriptor param : params) {
|
for (ValueParameterDescriptor param : params) {
|
||||||
StackValue.local(count, OBJECT_TYPE).put(OBJECT_TYPE, iv);
|
StackValue.local(count, OBJECT_TYPE).put(typeMapper.mapType(param.getType()), iv);
|
||||||
StackValue.onStack(OBJECT_TYPE).upcast(typeMapper.mapType(param.getType()), iv);
|
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1806,7 +1806,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
|||||||
JetType type = fd.getReturnType();
|
JetType type = fd.getReturnType();
|
||||||
assert type != null;
|
assert type != null;
|
||||||
final Type retType = typeMapper.mapReturnType(type);
|
final Type retType = typeMapper.mapReturnType(type);
|
||||||
StackValue.onStack(callReturnType).upcast(retType, v);
|
StackValue.coerce(callReturnType, retType, v);
|
||||||
return StackValue.onStack(retType);
|
return StackValue.onStack(retType);
|
||||||
}
|
}
|
||||||
return StackValue.none();
|
return StackValue.none();
|
||||||
|
|||||||
@@ -228,17 +228,6 @@ public abstract class StackValue {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void upcast(Type type, InstructionAdapter v) {
|
|
||||||
if (type.equals(this.type)) return;
|
|
||||||
|
|
||||||
if (type.getSort() == Type.OBJECT && this.type.getSort() == Type.OBJECT) {
|
|
||||||
v.checkcast(type);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
coerceTo(type, v);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void pop(Type type, InstructionAdapter v) {
|
private static void pop(Type type, InstructionAdapter v) {
|
||||||
if (type.getSize() == 1) {
|
if (type.getSize() == 1) {
|
||||||
v.pop();
|
v.pop();
|
||||||
|
|||||||
Reference in New Issue
Block a user