Merge RestrictedCoroutineImpl into CoroutineImpl

This commit is contained in:
Denis Zharkov
2017-01-11 20:22:49 +03:00
parent d487c1ef0f
commit 7837d736f7
6 changed files with 20 additions and 38 deletions
@@ -187,7 +187,7 @@ class CoroutineCodegen(
// .resume(Unit)
StackValue.putUnitInstance(this)
invokevirtual(
AsmTypes.RESTRICTED_COROUTINE_IMPL.internalName,
AsmTypes.COROUTINE_IMPL.internalName,
CONTINUATION_RESUME_METHOD_NAME.identifier,
Type.getMethodDescriptor(Type.VOID_TYPE, AsmTypes.OBJECT_TYPE),
false
@@ -110,7 +110,7 @@ class CoroutineTransformerMethodVisitor(
VarInsnNode(Opcodes.ALOAD, 0),
FieldInsnNode(
Opcodes.GETFIELD,
AsmTypes.RESTRICTED_COROUTINE_IMPL.internalName,
AsmTypes.COROUTINE_IMPL.internalName,
COROUTINE_LABEL_FIELD_NAME, Type.INT_TYPE.descriptor
),
TableSwitchInsnNode(0,
@@ -295,7 +295,7 @@ class CoroutineTransformerMethodVisitor(
VarInsnNode(Opcodes.ALOAD, 0),
*withInstructionAdapter { iconst(id) }.toArray(),
FieldInsnNode(
Opcodes.PUTFIELD, AsmTypes.RESTRICTED_COROUTINE_IMPL.internalName, COROUTINE_LABEL_FIELD_NAME,
Opcodes.PUTFIELD, AsmTypes.COROUTINE_IMPL.internalName, COROUTINE_LABEL_FIELD_NAME,
Type.INT_TYPE.descriptor
)
)
@@ -41,7 +41,6 @@ public class AsmTypes {
public static final Type MUTABLE_PROPERTY_REFERENCE1 = Type.getObjectType("kotlin/jvm/internal/MutablePropertyReference1");
public static final Type MUTABLE_PROPERTY_REFERENCE2 = Type.getObjectType("kotlin/jvm/internal/MutablePropertyReference2");
public static final Type COROUTINE_IMPL = Type.getObjectType("kotlin/jvm/internal/CoroutineImpl");
public static final Type RESTRICTED_COROUTINE_IMPL = Type.getObjectType("kotlin/jvm/internal/RestrictedCoroutineImpl");
public static final Type COROUTINES_INTRINSICS_FILE_FACADE = Type.getObjectType("kotlin/coroutines/intrinsics/IntrinsicsKt");
public static final Type CONTINUATION = Type.getObjectType("kotlin/coroutines/Continuation");
+1 -1
View File
@@ -15,7 +15,7 @@ fun builder1(c: suspend () -> Unit) {
fun builder2(c: suspend () -> Unit) {
val continuation = c.createCoroutine(EmptyContinuation)
val declaredField = continuation.javaClass.superclass.superclass.getDeclaredField("label")
val declaredField = continuation.javaClass.superclass.getDeclaredField("label")
declaredField.setAccessible(true)
declaredField.set(continuation, -3)
continuation.resume(Unit)