Introduce CoroutineImpl as a common super class for coroutines

The main benefit are class-files sizes for them
(not repeating the same declaration for each coroutine)
Also it helped to simplify coroutine codegen code a little

Note that controller/label field become non-volatile (see KT-14636)

 #KT-14636 In Progress
This commit is contained in:
Denis Zharkov
2016-11-08 10:43:45 +03:00
parent fc9605b94e
commit 7e49db8768
9 changed files with 133 additions and 141 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ fun builder1(coroutine c: Controller.() -> Continuation<Unit>) {
fun builder2(coroutine c: Controller.() -> Continuation<Unit>) {
val continuation = c(Controller())
val declaredField = continuation!!.javaClass.getDeclaredField("label")
val declaredField = continuation.javaClass.superclass.getDeclaredField("label")
declaredField.setAccessible(true)
declaredField.set(continuation, -3)
continuation.resume(Unit)