Status Update
Comments
ap...@google.com <ap...@google.com> #2
Which version of R8 are you using?
ap...@google.com <ap...@google.com> #3
ap...@google.com <ap...@google.com> #4
In order to diagnose this we would probably need to be able to reproduce this issue.
Would it be possible for you to share a compiler dump file that contains the inputs to R8 (i.e., the Java class files and the keep rules going into R8)? That way we should be able to reproduce the build. You can generate this as below and could share this privately with
./gradlew assembleRelease --no-daemon -Dcom.android.tools.r8.dumpinputtodirectory=/path/to/dumps
Do you know if the class ViewEventSinkImpl
is instantiated using reflection? If so, do you know if there is a corresponding keep rule for the class?
Can you try if the following rule "fixes" the issue:
-keep,allowobfuscation,allowshrinking class org.chromium.content.browser.ViewEventSinkImpl
When this rule is present, R8 should account for the fact that ViewEventSinkImpl
may be instantiated by reflection, which I suspect may fix the issue you are seeing.
sg...@google.com <sg...@google.com>
ap...@google.com <ap...@google.com> #5
Hi! I have also encountered a problem with r8 in --classfile mode incorrectly removing a null check, and curiously enough it also happened in and around ViewEventSinkImpl. I tried with the R8 version in Chromium and also with latest main branch local build from the repo which was be29229a110ce06989f6f3a63b0a83015ed3fefe.
The issue I'm seeing is from code which effectively does
public final class ViewEventSinkImpl ... {
private @Nullable Boolean mHasViewFocus; // not written to anywhere else
public void onViewFocusChanged(boolean gainFocus) {
if (mHasViewFocus != null && mHasViewFocus == gainFocus) return;
mHasViewFocus = gainFocus;
....
}
}
and after r8 with --classfile, the null check gets removed and the code is guaranteed to crash. Without --classfile, the null check remains in the dex. Note: for me, the code (with or without the check) was inlined at the only callsite to onViewFocusChanged.
Adding
-keep,allowobfuscation,allowshrinking class org.chromium.content.browser.ViewEventSinkImpl
works around the issue for me. I believe there is some reflection going on as one part of the code that affects that bug is the presence of
public static ViewEventSinkImpl from(WebContents webContents) {
ViewEventSinkImpl ret =
((WebContentsImpl) webContents)
.getOrSetUserData(
ViewEventSinkImpl.class, UserDataFactoryLazyHolder.INSTANCE);
return ret;
}
I hope the advice to send the repro case directly is still valid, I should have it down to a manageable size soon.
ap...@google.com <ap...@google.com> #6
Thanks, it would be great if you would be able to share a reproduction for this.
an...@google.com <an...@google.com> #7
I have sent the repro over by email. Can you confirm if the mail has gotten thru spam filters, etc.?
an...@google.com <an...@google.com> #8
Project: r8
Branch: main
Author: Christoffer Adamsen <
Link:
Reproduce inadequate value propagation in presence of T::new expressions
Expand for full commit details
Reproduce inadequate value propagation in presence of T::new expressions
Bug: b/397737234
Change-Id: Ia6cbb0ef3366125420afbdfcf3a8f0d228cc2004
Files:
- A
src/test/java/com/android/tools/r8/ir/optimize/membervaluepropagation/DefaultFieldValueJoinerWithLambdaAllocationTest.java
Hash: 0e40b2543f171f14c4727e9673cfbe1581bfb804
Date: Thu Mar 06 08:47:46 2025
vi...@gmail.com <vi...@gmail.com> #9
Project: r8
Branch: main
Author: Christoffer Adamsen <
Link:
Account for T::new expressions in default field value joiner
Expand for full commit details
Account for T::new expressions in default field value joiner
Bug: b/397737234
Change-Id: Iea344f54fa5a8ac40739a51da5d7e6679d5964b8
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/DefaultFieldValueJoinerWithLambdaAllocationTest.java
Hash: faeee0fe013067ef2c1b015822a00ebd999c19c9
Date: Thu Mar 06 09:51:41 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.