Status Update
Comments
ap...@google.com <ap...@google.com> #2
Could you look into it @christofferqa?
The issue is with this class:
class MySpi : Spi {
@Volatile
private var myApi: Api? = null
// Incorrectly rewritten to return null;
override fun createApi(): Api {
return myApi ?: synchronized(this) {
myApi ?: MyApi().also { myApi = it }
}
}
}
The error seems to be that the ArgumentPropagator believes that the fieldState of myApi is ExactDynamicType(@NotNull MyApi)
while it should be ExactDynamicType(@Nullable MyApi)
It then removes the first branch (assuming myApi is not null):
return myApi ?: synchronized(this) {
myApi ?: MyApi().also { myApi = it }
}
is rewritten into:
return myApi
And then it eventually concludes that myApi is always null, replacing the code by
return null
The ArgumentPropagatorCodeScanner analyzes the assignment myApi = it
and correctly set join the state to ExactDynamicType(@NotNull MyApi)
However the ArgumentPropagator fails to understand that myApi
can be read before being written in the method, relying on the default null value, so it fails to join null
to the dynamic type.
ap...@google.com <ap...@google.com> #3
Yes I can take a look. Would it be possible for you to add a regression test of this issue?
ap...@google.com <ap...@google.com> #4
Project: r8
Branch: main
Author: Christoffer Adamsen <
Link:
Reproduce field propagation issue with ServiceLoader
Expand for full commit details
Reproduce field propagation issue with ServiceLoader
Bug: b/389737060
Change-Id: Id850448f68b999194bc0380dfca625f4f68bc31b
Files:
- A
src/test/java/com/android/tools/r8/ir/optimize/membervaluepropagation/DefaultFieldValueJoinerWithServiceLoaderTest.java
Hash: 6ba9af34b15f2a0d3fe356f6e7a5a4071128aed9
Date: Wed Feb 12 09:31:01 2025
sg...@google.com <sg...@google.com>
ap...@google.com <ap...@google.com> #5
Project: r8
Branch: main
Author: Christoffer Adamsen <
Link:
Account for ServiceLoaders in field value propagation
Expand for full commit details
Account for ServiceLoaders in field value propagation
Fixes: b/389737060
Change-Id: Ide438a8e1b0541f3ce2385087f06f8b9909ab3c5
Files:
- M
src/main/java/com/android/tools/r8/optimize/argumentpropagation/propagation/DefaultFieldValueJoiner.java
- M
src/test/java/com/android/tools/r8/ir/optimize/membervaluepropagation/DefaultFieldValueJoinerWithServiceLoaderTest.java
Hash: 692fff07b70f6ee5ac520b179aed5e125a0d4848
Date: Wed Feb 12 09:34:04 2025
ap...@google.com <ap...@google.com> #6
Project: r8
Branch: 8.9
Author: Christoffer Adamsen <
Link:
Account for ServiceLoaders in field value propagation
Expand for full commit details
Account for ServiceLoaders in field value propagation
Fixes: b/389737060
Change-Id: Ide438a8e1b0541f3ce2385087f06f8b9909ab3c5
Files:
- M
src/main/java/com/android/tools/r8/optimize/argumentpropagation/propagation/DefaultFieldValueJoiner.java
- M
src/test/java/com/android/tools/r8/ir/optimize/membervaluepropagation/DefaultFieldValueJoinerWithServiceLoaderTest.java
Hash: 76cad195cf43c16aa9e7b0203e51662036587e71
Date: Thu Feb 13 10:33:29 2025
an...@google.com <an...@google.com> #7
Project: r8
Branch: 8.9
Author: Christoffer Adamsen <
Link:
Version 8.9.28
Expand for full commit details
Version 8.9.28
Bug: b/389737060
Change-Id: I42c8d3194dc053e3a16eef8ea1c4b3aced6752d6
Files:
- M
src/main/java/com/android/tools/r8/Version.java
Hash: 668c1778e857c1bc8e3f9308a65ddc01a6c14898
Date: Thu Feb 13 10:33:34 2025
an...@google.com <an...@google.com> #8
Project: r8
Branch: 8.9
Author: Christoffer Adamsen <
Link:
Reproduce field propagation issue with ServiceLoader
Expand for full commit details
Reproduce field propagation issue with ServiceLoader
Bug: b/389737060
Change-Id: Id850448f68b999194bc0380dfca625f4f68bc31b
Files:
- A
src/test/java/com/android/tools/r8/ir/optimize/membervaluepropagation/DefaultFieldValueJoinerWithServiceLoaderTest.java
Hash: a76d3e8637b5280dcc972ed9fabc74bb503cc30c
Date: Thu Feb 13 10:33:24 2025
vi...@gmail.com <vi...@gmail.com> #9
Project: r8
Branch: 8.8
Author: Christoffer Adamsen <
Link:
Reproduce field propagation issue with ServiceLoader
Expand for full commit details
Reproduce field propagation issue with ServiceLoader
Bug: b/389737060
Change-Id: Id850448f68b999194bc0380dfca625f4f68bc31b
Files:
- A
src/test/java/com/android/tools/r8/ir/optimize/membervaluepropagation/DefaultFieldValueJoinerWithServiceLoaderTest.java
Hash: a63678f7ebb3321af74c9846be9c851e4da78e4f
Date: Thu Feb 13 10:33:55 2025
kl...@gmail.com <kl...@gmail.com> #10
Project: r8
Branch: 8.8
Author: Christoffer Adamsen <
Link:
Version 8.8.35
Expand for full commit details
Version 8.8.35
Bug: b/389737060
Change-Id: I2361f77b42b529f2cbdfbf60fbe4a95e405ba716
Files:
- M
src/main/java/com/android/tools/r8/Version.java
Hash: d280891c805561bc120f5f96841b50353e74edfe
Date: Thu Feb 13 10:34:06 2025
Description
Backporting of
android.os.Build.VERSION_CODES_FULL.BAKLAVA
used a value of 1.000.000.000 as that was the value present inandroid.jar
in the Baklava SDK revision 3. In revision 5 the value was changed to 3.600.000.The backporting should be updated to reflect the value which will most likely be the final value for the release.