Drop compatibility flag, suppressing optimized generation of callable references
This commit is contained in:
@@ -46,7 +46,6 @@ import org.jetbrains.kotlin.serialization.ProtoBuf;
|
|||||||
import org.jetbrains.kotlin.types.KotlinType;
|
import org.jetbrains.kotlin.types.KotlinType;
|
||||||
import org.jetbrains.kotlin.types.expressions.ExpressionTypingUtils;
|
import org.jetbrains.kotlin.types.expressions.ExpressionTypingUtils;
|
||||||
import org.jetbrains.kotlin.util.OperatorNameConventions;
|
import org.jetbrains.kotlin.util.OperatorNameConventions;
|
||||||
import org.jetbrains.kotlin.utils.FunctionsKt;
|
|
||||||
import org.jetbrains.org.objectweb.asm.AnnotationVisitor;
|
import org.jetbrains.org.objectweb.asm.AnnotationVisitor;
|
||||||
import org.jetbrains.org.objectweb.asm.MethodVisitor;
|
import org.jetbrains.org.objectweb.asm.MethodVisitor;
|
||||||
import org.jetbrains.org.objectweb.asm.Type;
|
import org.jetbrains.org.objectweb.asm.Type;
|
||||||
@@ -212,7 +211,7 @@ public class ClosureCodegen extends MemberCodegen<KtElement> {
|
|||||||
this.constructor = generateConstructor();
|
this.constructor = generateConstructor();
|
||||||
|
|
||||||
if (isConst(closure)) {
|
if (isConst(closure)) {
|
||||||
generateConstInstance(asmType, asmType, FunctionsKt.<InstructionAdapter>doNothing());
|
generateConstInstance(asmType, asmType);
|
||||||
}
|
}
|
||||||
|
|
||||||
genClosureFields(closure, v, typeMapper);
|
genClosureFields(closure, v, typeMapper);
|
||||||
@@ -259,12 +258,6 @@ public class ClosureCodegen extends MemberCodegen<KtElement> {
|
|||||||
v.invokespecial(asmType.getInternalName(), "<init>", constructor.getDescriptor(), false);
|
v.invokespecial(asmType.getInternalName(), "<init>", constructor.getDescriptor(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (functionReferenceTarget != null) {
|
|
||||||
if (!"true".equalsIgnoreCase(System.getProperty("kotlin.jvm.optimize.callable.references"))) {
|
|
||||||
v.invokestatic(REFLECTION, "function", Type.getMethodDescriptor(K_FUNCTION, FUNCTION_REFERENCE), false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Unit.INSTANCE;
|
return Unit.INSTANCE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,9 +18,7 @@ package org.jetbrains.kotlin.codegen;
|
|||||||
|
|
||||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||||
import com.intellij.psi.PsiElement;
|
import com.intellij.psi.PsiElement;
|
||||||
import kotlin.Unit;
|
|
||||||
import kotlin.jvm.functions.Function0;
|
import kotlin.jvm.functions.Function0;
|
||||||
import kotlin.jvm.functions.Function1;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.kotlin.backend.common.CodegenUtil;
|
import org.jetbrains.kotlin.backend.common.CodegenUtil;
|
||||||
@@ -552,20 +550,17 @@ public abstract class MemberCodegen<T extends KtElement/* TODO: & JetDeclaration
|
|||||||
return sourceMapper;
|
return sourceMapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void generateConstInstance(
|
protected void generateConstInstance(@NotNull Type thisAsmType, @NotNull Type fieldAsmType) {
|
||||||
@NotNull Type thisAsmType,
|
v.newField(
|
||||||
@NotNull Type fieldAsmType,
|
JvmDeclarationOriginKt.OtherOrigin(element), ACC_STATIC | ACC_FINAL | ACC_PUBLIC, JvmAbi.INSTANCE_FIELD,
|
||||||
@NotNull Function1<InstructionAdapter, Unit> initialization
|
fieldAsmType.getDescriptor(), null, null
|
||||||
) {
|
);
|
||||||
v.newField(JvmDeclarationOriginKt.OtherOrigin(element), ACC_STATIC | ACC_FINAL | ACC_PUBLIC, JvmAbi.INSTANCE_FIELD, fieldAsmType.getDescriptor(),
|
|
||||||
null, null);
|
|
||||||
|
|
||||||
if (state.getClassBuilderMode() == ClassBuilderMode.FULL) {
|
if (state.getClassBuilderMode() == ClassBuilderMode.FULL) {
|
||||||
InstructionAdapter iv = createOrGetClInitCodegen().v;
|
InstructionAdapter iv = createOrGetClInitCodegen().v;
|
||||||
iv.anew(thisAsmType);
|
iv.anew(thisAsmType);
|
||||||
iv.dup();
|
iv.dup();
|
||||||
iv.invokespecial(thisAsmType.getInternalName(), "<init>", "()V", false);
|
iv.invokespecial(thisAsmType.getInternalName(), "<init>", "()V", false);
|
||||||
initialization.invoke(iv);
|
|
||||||
iv.putstatic(thisAsmType.getInternalName(), JvmAbi.INSTANCE_FIELD, fieldAsmType.getDescriptor());
|
iv.putstatic(thisAsmType.getInternalName(), JvmAbi.INSTANCE_FIELD, fieldAsmType.getDescriptor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,11 +79,7 @@ public class PropertyReferenceCodegen(
|
|||||||
|
|
||||||
// TODO: ImplementationBodyCodegen.markLineNumberForSyntheticFunction?
|
// TODO: ImplementationBodyCodegen.markLineNumberForSyntheticFunction?
|
||||||
override fun generateBody() {
|
override fun generateBody() {
|
||||||
generateConstInstance(asmType, wrapperMethod.getReturnType()) { iv ->
|
generateConstInstance(asmType, wrapperMethod.getReturnType())
|
||||||
if (!"true".equals(System.getProperty("kotlin.jvm.optimize.callable.references"), ignoreCase = true)) {
|
|
||||||
iv.invokestatic(REFLECTION, wrapperMethod.getName(), wrapperMethod.getDescriptor(), false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
generateMethod("property reference init", 0, method("<init>", Type.VOID_TYPE)) {
|
generateMethod("property reference init", 0, method("<init>", Type.VOID_TYPE)) {
|
||||||
load(0, OBJECT_TYPE)
|
load(0, OBJECT_TYPE)
|
||||||
|
|||||||
Reference in New Issue
Block a user