Status Update
Comments
ey...@gmail.com <ey...@gmail.com> #2
ey...@gmail.com <ey...@gmail.com> #4
ri...@google.com <ri...@google.com> #5
ey...@gmail.com <ey...@gmail.com> #6 Restricted
ey...@gmail.com <ey...@gmail.com> #7
--set-max-idx-number=<value>
Unfortunately changing the default is not a solution since the linearAlloc limit can be reached at very different levels depending on the classes hierarchy and other criteria.
In addition for most applications, moving to multidex will only help to workaround the linearalloc limit for the installation. But the application will still crash against the same limit at execution. The only working use case where I know multidex can help with linearalloc is when the apk does not contains one application but distinct pieces running in separate process.
ri...@google.com <ri...@google.com> #8
It's nice to know about that command line option. I do not see it in the output of 'dx --help', might be good to add that.
I'm not very familiar with the 'linearAlloc limit' issue outside of the context of the dexopt step. My sample app is able to run once the lower idx value is set, although I do not actually call into any of the library code that is bundled with the app. I assume it's undefined when/if the 'linearAlloc limit' will be hit in a large application on gb.
I'm a bit confused as to the platform compatibility of multidex given the 'linearAlloc limit' bug. What specific versions of Android are supported? The multidex code implies back to v4 (
ey...@gmail.com <ey...@gmail.com> #9
The linearalloc limit is reached when loading classes. At install time dexopt is loading all classes contained in the dex so it's facing the limit immediately. At execution the limit may be reached after some delay dependending of the usage you have of the packaged classes. If you face it at install time but not at execution, this means you never trigger the loading of some classes. In a real application those never loaded classes should have been shrinked away manually or by Proguard. The exception is when there are different groups of classes in the dex files used in separate process.
About multidex library supported versions I've merged recently a change to try to be clearer
The summary is that the library should work down to API 4 (Donut), but below ICS applications will probably be hit by the linearalloc limit
ri...@google.com <ri...@google.com> #10
dexOptions {
additionalParameters = ['--multi-dex', '--set-max-idx-number=40000']
}
ey...@gmail.com <ey...@gmail.com> #11
ey...@gmail.com <ey...@gmail.com> #13 Restricted
ri...@google.com <ri...@google.com> #14
The code for ProcessRestarterImpl has a very strange pattern, probably from your dependency injection, where it will generate an array of type android/content/Intent
It will then call the Function0, which returns an Object, and store that into the array, which we pass on to call into ProcessPhoenix. This will actually type check, even when the types don't match, since you are allowed to put anything into the array (if the type is wrong, it would fail at runtime though when using the value)
R8 will inline the call to 'Lcom/jakewharton/processphoenix/ProcessPhoenix;triggerRebirth(Landroid/content/Context;[Landroid/content/Intent;)V', and since we track that only a single element was in the array it will simply reuse the value already in that register (i.e., not load from the array and check, simply use the 'java/lang/Object' value)
In this case, we should not do the elimination of the array load, since we can't guarantee the type
ap...@google.com <ap...@google.com> #15
Branch: main
commit 4799c3f590cd6725e6b21c7d5c69e3369b7fa623
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Wed Apr 19 12:55:00 2023
Reproduce VerifyError after redundant array get elimination
Bug:
Change-Id: Ia2c62ad8f7a4c5f2d9333a6514a71f7d8db8720c
A src/test/java/com/android/tools/r8/ir/optimize/redundantarraygetelimination/ArrayGetTypePromotionTest.java
ap...@google.com <ap...@google.com> #16
Branch: main
commit 862bfb5e4301b8d085fe9d4a92fcb880d83b8386
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Wed Apr 19 12:56:35 2023
Ensure redundant array get elimination leads to narrowing
Bug:
Change-Id: I5f4fd4f491ddac40d4e720862ab711220c0be145
M src/main/java/com/android/tools/r8/ir/optimize/RedundantFieldLoadAndStoreElimination.java
M src/test/java/com/android/tools/r8/ir/optimize/redundantarraygetelimination/ArrayGetTypePromotionTest.java
ap...@google.com <ap...@google.com> #17
Branch: 8.1
commit f98e89fc43f7a36661fcac1c11d8eed2a896865b
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Wed Apr 19 14:16:18 2023
Version 8.1.38
Bug:
Change-Id: I47151eb88508eba9c9efe3fa637054f67a61bd5b
M src/main/java/com/android/tools/r8/Version.java
ap...@google.com <ap...@google.com> #18
Branch: 8.1
commit 5b05fb6ade7fe062b259cd4d814016e3eb38e1b8
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Wed Apr 19 14:15:30 2023
Ensure redundant array get elimination leads to narrowing
Bug:
Change-Id: I5f4fd4f491ddac40d4e720862ab711220c0be145
M src/main/java/com/android/tools/r8/ir/optimize/RedundantFieldLoadAndStoreElimination.java
M src/test/java/com/android/tools/r8/ir/optimize/redundantarraygetelimination/ArrayGetTypePromotionTest.java
ap...@google.com <ap...@google.com> #19
Branch: 8.1
commit 5ebb25ada2139cd2f74383d938f43a4640682b3e
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Wed Apr 19 14:15:02 2023
Reproduce VerifyError after redundant array get elimination
Bug:
Change-Id: Ia2c62ad8f7a4c5f2d9333a6514a71f7d8db8720c
A src/test/java/com/android/tools/r8/ir/optimize/redundantarraygetelimination/ArrayGetTypePromotionTest.java
ap...@google.com <ap...@google.com> #20
Branch: 8.0
commit 1232278046bfec8d70bf4d0ff9891c732855bed1
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Wed Apr 19 14:28:29 2023
Version 8.0.41
Bug:
Change-Id: I36de3c467318a872f9b52e6c1665a03cda894015
M src/main/java/com/android/tools/r8/Version.java
ap...@google.com <ap...@google.com> #21
Branch: 8.0
commit aa653f09ec2c293dfb1441c41ee3b23c14edbc14
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Wed Apr 19 14:27:02 2023
Ensure redundant array get elimination leads to narrowing
Bug:
Change-Id: I5f4fd4f491ddac40d4e720862ab711220c0be145
M src/main/java/com/android/tools/r8/ir/optimize/RedundantFieldLoadAndStoreElimination.java
M src/test/java/com/android/tools/r8/ir/optimize/redundantarraygetelimination/ArrayGetTypePromotionTest.java
ap...@google.com <ap...@google.com> #22
Branch: 8.0
commit 3c78b472e17ff4df1a4cbe7f779963f4551ceac7
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Wed Apr 19 14:26:09 2023
Reproduce VerifyError after redundant array get elimination
Bug:
Change-Id: Ia2c62ad8f7a4c5f2d9333a6514a71f7d8db8720c
A src/test/java/com/android/tools/r8/ir/optimize/redundantarraygetelimination/ArrayGetTypePromotionTest.java
ap...@google.com <ap...@google.com> #23
Branch: 4.0
commit 6847d39873c892ae31dd0a0051ede9c029a73e53
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Wed Apr 19 14:29:51 2023
Version 4.0.60
Bug:
Change-Id: I5c3e809529a800a2bd0cf393f12fafb86b9d27c1
M src/main/java/com/android/tools/r8/Version.java
ap...@google.com <ap...@google.com> #24
Branch: 4.0
commit 44f109564ca44b7457b0426ace67db36a5fbea3a
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Wed Apr 19 14:26:59 2023
Ensure redundant array get elimination leads to narrowing
Bug:
Change-Id: I5f4fd4f491ddac40d4e720862ab711220c0be145
M src/main/java/com/android/tools/r8/ir/optimize/RedundantFieldLoadAndStoreElimination.java
M src/test/java/com/android/tools/r8/ir/optimize/redundantarraygetelimination/ArrayGetTypePromotionTest.java
ap...@google.com <ap...@google.com> #25
Branch: 4.0
commit 5b029e66087245d269c4c484e553142b9d7dbb22
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Wed Apr 19 14:26:11 2023
Reproduce VerifyError after redundant array get elimination
Bug:
Change-Id: Ia2c62ad8f7a4c5f2d9333a6514a71f7d8db8720c
A src/test/java/com/android/tools/r8/ir/optimize/redundantarraygetelimination/ArrayGetTypePromotionTest.java
ap...@google.com <ap...@google.com> #26
Branch: 8.0
commit aa653f09ec2c293dfb1441c41ee3b23c14edbc14
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Wed Apr 19 14:27:02 2023
Ensure redundant array get elimination leads to narrowing
Bug:
Change-Id: I5f4fd4f491ddac40d4e720862ab711220c0be145
M src/main/java/com/android/tools/r8/ir/optimize/RedundantFieldLoadAndStoreElimination.java
M src/test/java/com/android/tools/r8/ir/optimize/redundantarraygetelimination/ArrayGetTypePromotionTest.java
ap...@google.com <ap...@google.com> #27
Branch: 8.0
commit 3c78b472e17ff4df1a4cbe7f779963f4551ceac7
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Wed Apr 19 14:26:09 2023
Reproduce VerifyError after redundant array get elimination
Bug:
Change-Id: Ia2c62ad8f7a4c5f2d9333a6514a71f7d8db8720c
A src/test/java/com/android/tools/r8/ir/optimize/redundantarraygetelimination/ArrayGetTypePromotionTest.java
ch...@google.com <ch...@google.com> #28
This should be fixed in R8 4.0, 8.0, 8.1, and 8.2 now. It would be great if you could confirm if 8.1.39 works for you. Thanks.
ey...@gmail.com <ey...@gmail.com> #29
I tested with 8.1.39 and it looks like it is fixed, thank you!
Any idea of what version of AGP this will ship with?
ch...@google.com <ch...@google.com> #30
Good to hear! This should land in AGP 8.1 beta 2.
Description
After updating Kotlin to 1.8.20 my app crashes in release mode with R8 enabled:
From the mapping, it appears that
rm3
isandroidx.profileinstaller.ProfileInstallerInitializer$Choreographer16Impl
We're using AGP 8.1.0-alpha11