Remove redundant parameters
This commit is contained in:
@@ -2125,7 +2125,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
|||||||
CallableDescriptor descriptor = resolvedCall.getResultingDescriptor();
|
CallableDescriptor descriptor = resolvedCall.getResultingDescriptor();
|
||||||
boolean isInline = call != null && descriptor instanceof SimpleFunctionDescriptor && ((SimpleFunctionDescriptor) descriptor).getInlineStrategy().isInline();
|
boolean isInline = call != null && descriptor instanceof SimpleFunctionDescriptor && ((SimpleFunctionDescriptor) descriptor).getInlineStrategy().isInline();
|
||||||
Inliner inliner = !isInline ? Inliner.NOT_INLINE :
|
Inliner inliner = !isInline ? Inliner.NOT_INLINE :
|
||||||
new InlineCodegen(this, true, state, disable, (SimpleFunctionDescriptor) unwrapFakeOverride(
|
new InlineCodegen(this, state, (SimpleFunctionDescriptor) unwrapFakeOverride(
|
||||||
(CallableMemberDescriptor) descriptor.getOriginal()), call);
|
(CallableMemberDescriptor) descriptor.getOriginal()), call);
|
||||||
|
|
||||||
if (resolvedCall instanceof VariableAsFunctionResolvedCall) {
|
if (resolvedCall instanceof VariableAsFunctionResolvedCall) {
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ import org.jetbrains.jet.lang.psi.*;
|
|||||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||||
import org.jetbrains.jet.lang.resolve.BindingContextUtils;
|
import org.jetbrains.jet.lang.resolve.BindingContextUtils;
|
||||||
import org.jetbrains.jet.lang.resolve.java.AsmTypeConstants;
|
import org.jetbrains.jet.lang.resolve.java.AsmTypeConstants;
|
||||||
|
import org.jetbrains.jet.lang.types.lang.InlineStrategy;
|
||||||
import org.jetbrains.jet.lang.types.lang.InlineUtil;
|
import org.jetbrains.jet.lang.types.lang.InlineUtil;
|
||||||
import org.jetbrains.jet.renderer.DescriptorRenderer;
|
import org.jetbrains.jet.renderer.DescriptorRenderer;
|
||||||
|
|
||||||
@@ -62,12 +63,10 @@ public class InlineCodegen implements ParentCodegenAware, Inliner {
|
|||||||
|
|
||||||
private final ExpressionCodegen codegen;
|
private final ExpressionCodegen codegen;
|
||||||
|
|
||||||
private final boolean notSeparateInline;
|
private final boolean asFunctionInline;
|
||||||
|
|
||||||
private final GenerationState state;
|
private final GenerationState state;
|
||||||
|
|
||||||
private final boolean disabled;
|
|
||||||
|
|
||||||
private final Call call;
|
private final Call call;
|
||||||
|
|
||||||
private final SimpleFunctionDescriptor functionDescriptor;
|
private final SimpleFunctionDescriptor functionDescriptor;
|
||||||
@@ -90,18 +89,15 @@ public class InlineCodegen implements ParentCodegenAware, Inliner {
|
|||||||
|
|
||||||
public InlineCodegen(
|
public InlineCodegen(
|
||||||
@NotNull ExpressionCodegen codegen,
|
@NotNull ExpressionCodegen codegen,
|
||||||
boolean notSeparateInline,
|
|
||||||
@NotNull GenerationState state,
|
@NotNull GenerationState state,
|
||||||
boolean disabled,
|
|
||||||
@NotNull SimpleFunctionDescriptor functionDescriptor,
|
@NotNull SimpleFunctionDescriptor functionDescriptor,
|
||||||
@NotNull Call call
|
@NotNull Call call
|
||||||
) {
|
) {
|
||||||
|
assert functionDescriptor.getInlineStrategy().isInline() : "InlineCodegen could inline only inline function but " + functionDescriptor;
|
||||||
|
|
||||||
this.state = state;
|
this.state = state;
|
||||||
this.typeMapper = state.getTypeMapper();
|
this.typeMapper = state.getTypeMapper();
|
||||||
|
|
||||||
this.codegen = codegen;
|
this.codegen = codegen;
|
||||||
this.notSeparateInline = notSeparateInline;
|
|
||||||
this.disabled = disabled;
|
|
||||||
this.call = call;
|
this.call = call;
|
||||||
this.functionDescriptor = functionDescriptor.getOriginal();
|
this.functionDescriptor = functionDescriptor.getOriginal();
|
||||||
bindingContext = codegen.getBindingContext();
|
bindingContext = codegen.getBindingContext();
|
||||||
@@ -110,6 +106,10 @@ public class InlineCodegen implements ParentCodegenAware, Inliner {
|
|||||||
context = (MethodContext) getContext(functionDescriptor, state);
|
context = (MethodContext) getContext(functionDescriptor, state);
|
||||||
originalFunctionFrame = context.prepareFrame(typeMapper);
|
originalFunctionFrame = context.prepareFrame(typeMapper);
|
||||||
jvmSignature = typeMapper.mapSignature(functionDescriptor, context.getContextKind());
|
jvmSignature = typeMapper.mapSignature(functionDescriptor, context.getContextKind());
|
||||||
|
|
||||||
|
InlineStrategy inlineStrategy =
|
||||||
|
codegen.getContext().isInlineFunction() ? InlineStrategy.IN_PLACE : functionDescriptor.getInlineStrategy();
|
||||||
|
this.asFunctionInline = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -244,7 +244,7 @@ public class InlineCodegen implements ParentCodegenAware, Inliner {
|
|||||||
public void putCapturedInLocal(
|
public void putCapturedInLocal(
|
||||||
@NotNull Type type, @Nullable StackValue stackValue, @Nullable ValueParameterDescriptor valueParameterDescriptor, int index
|
@NotNull Type type, @Nullable StackValue stackValue, @Nullable ValueParameterDescriptor valueParameterDescriptor, int index
|
||||||
) {
|
) {
|
||||||
if (!disabled && notSeparateInline && Type.VOID_TYPE != type) {
|
if (!asFunctionInline && Type.VOID_TYPE != type) {
|
||||||
//TODO remap only inlinable closure => otherwise we could get a lot of problem
|
//TODO remap only inlinable closure => otherwise we could get a lot of problem
|
||||||
boolean couldBeRemapped = !shouldPutValue(type, stackValue, codegen.getContext(), valueParameterDescriptor);
|
boolean couldBeRemapped = !shouldPutValue(type, stackValue, codegen.getContext(), valueParameterDescriptor);
|
||||||
StackValue remappedIndex = couldBeRemapped ? stackValue : null;
|
StackValue remappedIndex = couldBeRemapped ? stackValue : null;
|
||||||
@@ -364,14 +364,9 @@ public class InlineCodegen implements ParentCodegenAware, Inliner {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDisabled() {
|
|
||||||
return disabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isInliningClosure(JetExpression expression, ValueParameterDescriptor valueParameterDescriptora) {
|
public boolean isInliningClosure(JetExpression expression, ValueParameterDescriptor valueParameterDescriptora) {
|
||||||
return !disabled &&
|
return expression instanceof JetFunctionLiteralExpression &&
|
||||||
expression instanceof JetFunctionLiteralExpression &&
|
|
||||||
!InlineUtil.hasNoinlineAnnotation(valueParameterDescriptora);
|
!InlineUtil.hasNoinlineAnnotation(valueParameterDescriptora);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user