Skip to content

Commit 5f7e5d1

Browse files
ShikaSDliamoberg
authored andcommitted
Enable PausableComposition flag by default
The flag is ready to graduate to stable Relnote: Enabled PausableComposition feature flag by default
1 parent 637b944 commit 5f7e5d1

692 files changed

Lines changed: 1384 additions & 1437 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

plugins/compose/compiler-hosted/integration-tests/src/jvmTest/kotlin/androidx/compose/compiler/plugins/kotlin/ComposeBytecodeCodegenTest.kt

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -799,9 +799,9 @@ class ComposeBytecodeCodegenTest(useFir: Boolean) : AbstractCodegenTest(useFir)
799799

800800
assertEquals(
801801
"""
802-
LINENUMBER 19 L3
803-
LINENUMBER 20 L5
804-
LINENUMBER 21 L6
802+
LINENUMBER 19 L4
803+
LINENUMBER 20 L6
804+
LINENUMBER 21 L7
805805
""".trimIndent(),
806806
lineNumbers.trimIndent()
807807
)
@@ -1065,4 +1065,23 @@ class ComposeBytecodeCodegenTest(useFir: Boolean) : AbstractCodegenTest(useFir)
10651065
}
10661066
"""
10671067
)
1068+
1069+
@Test
1070+
fun remember() = testCompile(
1071+
"""
1072+
import androidx.compose.runtime.*
1073+
1074+
fun compose(content: () -> Unit) {}
1075+
inline fun <T> myRemember(block: () -> T): T =
1076+
block().also { println(it) }
1077+
1078+
1079+
fun foo(x: Any, boolean: Boolean) {
1080+
compose {
1081+
myRemember { x }
1082+
}
1083+
}
1084+
""",
1085+
dumpClasses = true
1086+
)
10681087
}

plugins/compose/compiler-hosted/integration-tests/src/jvmTest/kotlin/androidx/compose/compiler/plugins/kotlin/ComposeModuleMetricsTests.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ class ComposeModuleMetricsTests(useFir: Boolean) : AbstractMetricsTransformTest(
152152
"StrongSkipping": false,
153153
"IntrinsicRemember": true,
154154
"OptimizeNonSkippingGroups": true,
155-
"PausableComposition": false
155+
"PausableComposition": true
156156
}
157157
}
158158
"""

plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ClassStabilityTransformTests/testComposableCallWithUnstableFinalClassInSameModule[useFir = false].txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fun A(y: Int, x: Foo, %composer: Composer?, %changed: Int) {
3232
if (%changed and 0b00110000 == 0) {
3333
%dirty = %dirty or if (%composer.changedInstance(x)) 0b00100000 else 0b00010000
3434
}
35-
if (%dirty and 0b00010011 != 0b00010010 || !%composer.skipping) {
35+
if (%composer.shouldExecute(%dirty and 0b00010011 != 0b00010010, %dirty and 0b0001)) {
3636
if (isTraceInProgress()) {
3737
traceEventStart(<>, %dirty, -1, <>)
3838
}
@@ -56,7 +56,7 @@ fun B(x: Any, %composer: Composer?, %changed: Int) {
5656
if (%changed and 0b0110 == 0) {
5757
%dirty = %dirty or if (%composer.changedInstance(x)) 0b0100 else 0b0010
5858
}
59-
if (%dirty and 0b0011 != 0b0010 || !%composer.skipping) {
59+
if (%composer.shouldExecute(%dirty and 0b0011 != 0b0010, %dirty and 0b0001)) {
6060
if (isTraceInProgress()) {
6161
traceEventStart(<>, %dirty, -1, <>)
6262
}

plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ClassStabilityTransformTests/testComposableCallWithUnstableFinalClassInSameModule[useFir = true].txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fun A(y: Int, x: Foo, %composer: Composer?, %changed: Int) {
3232
if (%changed and 0b00110000 == 0) {
3333
%dirty = %dirty or if (%composer.changedInstance(x)) 0b00100000 else 0b00010000
3434
}
35-
if (%dirty and 0b00010011 != 0b00010010 || !%composer.skipping) {
35+
if (%composer.shouldExecute(%dirty and 0b00010011 != 0b00010010, %dirty and 0b0001)) {
3636
if (isTraceInProgress()) {
3737
traceEventStart(<>, %dirty, -1, <>)
3838
}
@@ -56,7 +56,7 @@ fun B(x: Any, %composer: Composer?, %changed: Int) {
5656
if (%changed and 0b0110 == 0) {
5757
%dirty = %dirty or if (%composer.changedInstance(x)) 0b0100 else 0b0010
5858
}
59-
if (%dirty and 0b0011 != 0b0010 || !%composer.skipping) {
59+
if (%composer.shouldExecute(%dirty and 0b0011 != 0b0010, %dirty and 0b0001)) {
6060
if (isTraceInProgress()) {
6161
traceEventStart(<>, %dirty, -1, <>)
6262
}

plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ClassStabilityTransformTests/testComposableCall[useFir = false].txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fun A(y: Int, x: Any, %composer: Composer?, %changed: Int) {
3232
if (%changed and 0b00110000 == 0) {
3333
%dirty = %dirty or if (%composer.changedInstance(x)) 0b00100000 else 0b00010000
3434
}
35-
if (%dirty and 0b00010011 != 0b00010010 || !%composer.skipping) {
35+
if (%composer.shouldExecute(%dirty and 0b00010011 != 0b00010010, %dirty and 0b0001)) {
3636
if (isTraceInProgress()) {
3737
traceEventStart(<>, %dirty, -1, <>)
3838
}
@@ -56,7 +56,7 @@ fun B(x: Any, %composer: Composer?, %changed: Int) {
5656
if (%changed and 0b0110 == 0) {
5757
%dirty = %dirty or if (%composer.changedInstance(x)) 0b0100 else 0b0010
5858
}
59-
if (%dirty and 0b0011 != 0b0010 || !%composer.skipping) {
59+
if (%composer.shouldExecute(%dirty and 0b0011 != 0b0010, %dirty and 0b0001)) {
6060
if (isTraceInProgress()) {
6161
traceEventStart(<>, %dirty, -1, <>)
6262
}

plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ClassStabilityTransformTests/testComposableCall[useFir = true].txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fun A(y: Int, x: Any, %composer: Composer?, %changed: Int) {
3232
if (%changed and 0b00110000 == 0) {
3333
%dirty = %dirty or if (%composer.changedInstance(x)) 0b00100000 else 0b00010000
3434
}
35-
if (%dirty and 0b00010011 != 0b00010010 || !%composer.skipping) {
35+
if (%composer.shouldExecute(%dirty and 0b00010011 != 0b00010010, %dirty and 0b0001)) {
3636
if (isTraceInProgress()) {
3737
traceEventStart(<>, %dirty, -1, <>)
3838
}
@@ -56,7 +56,7 @@ fun B(x: Any, %composer: Composer?, %changed: Int) {
5656
if (%changed and 0b0110 == 0) {
5757
%dirty = %dirty or if (%composer.changedInstance(x)) 0b0100 else 0b0010
5858
}
59-
if (%dirty and 0b0011 != 0b0010 || !%composer.skipping) {
59+
if (%composer.shouldExecute(%dirty and 0b0011 != 0b0010, %dirty and 0b0001)) {
6060
if (isTraceInProgress()) {
6161
traceEventStart(<>, %dirty, -1, <>)
6262
}

plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ClassStabilityTransformTests/testEmptyClassAcrossModules[useFir = false].txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ fun A(y: Any, %composer: Composer?, %changed: Int) {
2222
if (%changed and 0b0110 == 0) {
2323
%dirty = %dirty or if (%composer.changedInstance(y)) 0b0100 else 0b0010
2424
}
25-
if (%dirty and 0b0011 != 0b0010 || !%composer.skipping) {
25+
if (%composer.shouldExecute(%dirty and 0b0011 != 0b0010, %dirty and 0b0001)) {
2626
if (isTraceInProgress()) {
2727
traceEventStart(<>, %dirty, -1, <>)
2828
}

plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ClassStabilityTransformTests/testEmptyClassAcrossModules[useFir = true].txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ fun A(y: Any, %composer: Composer?, %changed: Int) {
2222
if (%changed and 0b0110 == 0) {
2323
%dirty = %dirty or if (%composer.changedInstance(y)) 0b0100 else 0b0010
2424
}
25-
if (%dirty and 0b0011 != 0b0010 || !%composer.skipping) {
25+
if (%composer.shouldExecute(%dirty and 0b0011 != 0b0010, %dirty and 0b0001)) {
2626
if (isTraceInProgress()) {
2727
traceEventStart(<>, %dirty, -1, <>)
2828
}

plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ClassStabilityTransformTests/testLocalParameterBasedTypeParameterSubstitution[useFir = false].txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ fun <V> B(value: V, %composer: Composer?, %changed: Int) {
3535
}
3636
) 0b0100 else 0b0010
3737
}
38-
if (%dirty and 0b0011 != 0b0010 || !%composer.skipping) {
38+
if (%composer.shouldExecute(%dirty and 0b0011 != 0b0010, %dirty and 0b0001)) {
3939
if (isTraceInProgress()) {
4040
traceEventStart(<>, %dirty, -1, <>)
4141
}
@@ -62,7 +62,7 @@ fun <T> X(items: List<T>, itemContent: Function3<T, Composer, Int, Unit>, %compo
6262
if (%changed and 0b00110000 == 0) {
6363
%dirty = %dirty or if (%composer.changedInstance(itemContent)) 0b00100000 else 0b00010000
6464
}
65-
if (%dirty and 0b00010011 != 0b00010010 || !%composer.skipping) {
65+
if (%composer.shouldExecute(%dirty and 0b00010011 != 0b00010010, %dirty and 0b0001)) {
6666
if (isTraceInProgress()) {
6767
traceEventStart(<>, %dirty, -1, <>)
6868
}
@@ -89,7 +89,7 @@ fun C(items: List<String>, %composer: Composer?, %changed: Int) {
8989
if (%changed and 0b0110 == 0) {
9090
%dirty = %dirty or if (%composer.changedInstance(items)) 0b0100 else 0b0010
9191
}
92-
if (%dirty and 0b0011 != 0b0010 || !%composer.skipping) {
92+
if (%composer.shouldExecute(%dirty and 0b0011 != 0b0010, %dirty and 0b0001)) {
9393
if (isTraceInProgress()) {
9494
traceEventStart(<>, %dirty, -1, <>)
9595
}
@@ -111,7 +111,7 @@ internal object ComposableSingletons%TestKt {
111111
if (%changed and 0b0110 == 0) {
112112
%dirty = %dirty or if (%composer.changed(item)) 0b0100 else 0b0010
113113
}
114-
if (%dirty and 0b00010011 != 0b00010010 || !%composer.skipping) {
114+
if (%composer.shouldExecute(%dirty and 0b00010011 != 0b00010010, %dirty and 0b0001)) {
115115
if (isTraceInProgress()) {
116116
traceEventStart(<>, %dirty, -1, <>)
117117
}

plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ClassStabilityTransformTests/testLocalParameterBasedTypeParameterSubstitution[useFir = true].txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ fun <V> B(value: V, %composer: Composer?, %changed: Int) {
3535
}
3636
) 0b0100 else 0b0010
3737
}
38-
if (%dirty and 0b0011 != 0b0010 || !%composer.skipping) {
38+
if (%composer.shouldExecute(%dirty and 0b0011 != 0b0010, %dirty and 0b0001)) {
3939
if (isTraceInProgress()) {
4040
traceEventStart(<>, %dirty, -1, <>)
4141
}
@@ -62,7 +62,7 @@ fun <T> X(items: List<T>, itemContent: Function3<T, Composer, Int, Unit>, %compo
6262
if (%changed and 0b00110000 == 0) {
6363
%dirty = %dirty or if (%composer.changedInstance(itemContent)) 0b00100000 else 0b00010000
6464
}
65-
if (%dirty and 0b00010011 != 0b00010010 || !%composer.skipping) {
65+
if (%composer.shouldExecute(%dirty and 0b00010011 != 0b00010010, %dirty and 0b0001)) {
6666
if (isTraceInProgress()) {
6767
traceEventStart(<>, %dirty, -1, <>)
6868
}
@@ -89,7 +89,7 @@ fun C(items: List<String>, %composer: Composer?, %changed: Int) {
8989
if (%changed and 0b0110 == 0) {
9090
%dirty = %dirty or if (%composer.changedInstance(items)) 0b0100 else 0b0010
9191
}
92-
if (%dirty and 0b0011 != 0b0010 || !%composer.skipping) {
92+
if (%composer.shouldExecute(%dirty and 0b0011 != 0b0010, %dirty and 0b0001)) {
9393
if (isTraceInProgress()) {
9494
traceEventStart(<>, %dirty, -1, <>)
9595
}
@@ -111,7 +111,7 @@ internal object ComposableSingletons%TestKt {
111111
if (%changed and 0b0110 == 0) {
112112
%dirty = %dirty or if (%composer.changed(item)) 0b0100 else 0b0010
113113
}
114-
if (%dirty and 0b00010011 != 0b00010010 || !%composer.skipping) {
114+
if (%composer.shouldExecute(%dirty and 0b00010011 != 0b00010010, %dirty and 0b0001)) {
115115
if (isTraceInProgress()) {
116116
traceEventStart(<>, %dirty, -1, <>)
117117
}

0 commit comments

Comments
 (0)