From 97176b5d603a418b1de1b472c96f23655017c2ce Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Wed, 25 Aug 2021 20:40:11 +0200 Subject: [PATCH] Remove experimental coroutines wrapper generation --- .../kotlin/codegen/ExpressionCodegen.java | 41 ------------------- .../codegen/binding/CodegenBinding.java | 1 - 2 files changed, 42 deletions(-) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java index c9c68ec8aeb..a6e4ae0835e 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java @@ -331,8 +331,6 @@ public class ExpressionCodegen extends KtVisitor impleme StackValue stackValue = selector.accept(visitor, receiver); - stackValue = suspendFunctionTypeWrapperIfNeeded(selector, stackValue); - stackValue = coerceAndBoxInlineClassIfNeeded(selector, stackValue); RuntimeAssertionInfo runtimeAssertionInfo = null; @@ -357,32 +355,6 @@ public class ExpressionCodegen extends KtVisitor impleme } } - private StackValue suspendFunctionTypeWrapperIfNeeded(KtElement selector, StackValue stackValue) { - Type functionTypeForWrapper = - selector instanceof KtExpression - ? bindingContext.get(CodegenBinding.FUNCTION_TYPE_FOR_SUSPEND_WRAPPER, (KtExpression) selector) - : null; - - if (functionTypeForWrapper == null) return stackValue; - - StackValue stackValueToWrap = stackValue; - stackValue = new StackValue(stackValue.type, stackValue.kotlinType) { - @Override - public void putSelector( - @NotNull Type type, @Nullable KotlinType kotlinType, @NotNull InstructionAdapter v - ) { - stackValueToWrap.put(functionTypeForWrapper, null, v); - invokeCoroutineMigrationMethod( - v, - "toExperimentalSuspendFunction", - Type.getMethodDescriptor(functionTypeForWrapper, functionTypeForWrapper) - ); - coerce(functionTypeForWrapper, type, v); - } - }; - return stackValue; - } - private StackValue coerceAndBoxInlineClassIfNeeded(KtElement selector, StackValue stackValue) { ResolvedCall resolvedCall = CallUtilKt.getResolvedCall(selector, bindingContext); if (resolvedCall == null) return stackValue; @@ -2619,19 +2591,6 @@ public class ExpressionCodegen extends KtVisitor impleme tempVariables.put(continuationExpression, coroutineInstanceValue); } - private static void invokeCoroutineMigrationMethod( - @NotNull InstructionAdapter v, - String methodName, - String descriptor - ) { - v.invokestatic( - "kotlin/coroutines/experimental/migration/CoroutinesMigrationKt", - methodName, - descriptor, - false - ); - } - private StackValue getContinuationParameterFromEnclosingSuspendFunction(@NotNull ResolvedCall resolvedCall) { FunctionDescriptor enclosingSuspendFunction = bindingContext.get(BindingContext.ENCLOSING_SUSPEND_FUNCTION_FOR_SUSPEND_FUNCTION_CALL, resolvedCall.getCall()); diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/binding/CodegenBinding.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/binding/CodegenBinding.java index 7553dee5a6b..36cabad4644 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/binding/CodegenBinding.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/binding/CodegenBinding.java @@ -45,7 +45,6 @@ public class CodegenBinding { private static final WritableSlice> INNER_CLASSES = Slices.createSimpleSlice(); public static final WritableSlice SAM_VALUE = Slices.createSimpleSlice(); - public static final WritableSlice FUNCTION_TYPE_FOR_SUSPEND_WRAPPER = Slices.createSimpleSlice(); public static final WritableSlice SAM_CONSTRUCTOR_TO_ARGUMENT = Slices.createSimpleSlice();