summaryrefslogtreecommitdiff
path: root/chromium/third_party/r8
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2021-09-01 11:08:40 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2021-10-01 12:16:21 +0000
commit03c549e0392f92c02536d3f86d5e1d8dfa3435ac (patch)
treefe49d170a929b34ba82cd10db1a0bd8e3760fa4b /chromium/third_party/r8
parent5d013f5804a0d91fcf6c626b2d6fb6eca5c845b0 (diff)
downloadqtwebengine-chromium-03c549e0392f92c02536d3f86d5e1d8dfa3435ac.tar.gz
BASELINE: Update Chromium to 91.0.4472.160
Change-Id: I0def1f08a2412aeed79a9ab95dd50eb5c3f65f31 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/third_party/r8')
-rw-r--r--chromium/third_party/r8/3pp/3pp.pb20
-rwxr-xr-xchromium/third_party/r8/3pp/install.sh27
-rw-r--r--chromium/third_party/r8/3pp/patches/0001-Statefull-lambdas-regress-dex-size.patch (renamed from chromium/third_party/r8/patches/0001-Statefull-lambdas-regress-dex-size.patch)8
-rw-r--r--chromium/third_party/r8/3pp/patches/0002-Allow-access-modification-everywhere.patch (renamed from chromium/third_party/r8/patches/0003-Allow-access-modification-everywhere.patch)8
-rw-r--r--chromium/third_party/r8/OWNERS1
-rw-r--r--chromium/third_party/r8/README.chromium73
-rw-r--r--chromium/third_party/r8/patches/0001-Desugaring-Make-all-lambdas-stateless-fix-naming-sch.patch39
-rw-r--r--chromium/third_party/r8/patches/0002-Command-line-flags-for-class-merging-and-outlining.patch45
-rw-r--r--chromium/third_party/r8/patches/0002-Disable-horizontal-class-merging.patch26
9 files changed, 99 insertions, 148 deletions
diff --git a/chromium/third_party/r8/3pp/3pp.pb b/chromium/third_party/r8/3pp/3pp.pb
new file mode 100644
index 00000000000..ef9c4babc4d
--- /dev/null
+++ b/chromium/third_party/r8/3pp/3pp.pb
@@ -0,0 +1,20 @@
+create {
+ source {
+ git {
+ repo: "https://r8.googlesource.com/r8"
+ tag_pattern: "%s-dev"
+ }
+ patch_dir: "patches"
+ }
+
+ build {
+ dep: "chromium/third_party/jdk"
+ # gradle cannot be executed correctly under docker env
+ no_docker_env: true
+ }
+}
+
+upload {
+ pkg_prefix: "chromium/third_party"
+ universal: true
+}
diff --git a/chromium/third_party/r8/3pp/install.sh b/chromium/third_party/r8/3pp/install.sh
new file mode 100755
index 00000000000..981083d0628
--- /dev/null
+++ b/chromium/third_party/r8/3pp/install.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+# Copyright 2021 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+set -e
+set -x
+set -o pipefail
+
+PREFIX="$1"
+DEPS_PREFIX="$2"
+
+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
+
+# Download depot_tools
+git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git $SCRIPT_DIR/depot_tools
+
+# Build
+PATH=$SCRIPT_DIR/depot_tools:$PATH tools/gradle.py r8
+
+# Shrink (improves r8/d8 launch time):
+$DEPS_PREFIX/current/bin/java -jar build/libs/r8.jar --debug --classfile --output r8.jar \
+ --lib $DEPS_PREFIX/current --pg-conf src/main/keep.txt \
+ --no-minification --no-desugaring build/libs/r8.jar
+
+mkdir -p "$PREFIX/lib"
+cp r8.jar "$PREFIX/lib"
diff --git a/chromium/third_party/r8/patches/0001-Statefull-lambdas-regress-dex-size.patch b/chromium/third_party/r8/3pp/patches/0001-Statefull-lambdas-regress-dex-size.patch
index 84f3139cdb9..fb7ec5c58da 100644
--- a/chromium/third_party/r8/patches/0001-Statefull-lambdas-regress-dex-size.patch
+++ b/chromium/third_party/r8/3pp/patches/0001-Statefull-lambdas-regress-dex-size.patch
@@ -1,4 +1,4 @@
-From 9b56f86378001e3de79dd7267544d4e8c0bec67f Mon Sep 17 00:00:00 2001
+From 3b49944c32255f08638d3df1212361194c981b3e Mon Sep 17 00:00:00 2001
From: Andrew Grieve <agrieve@chromium.org>
Date: Mon, 1 Feb 2021 15:09:52 -0500
Subject: [PATCH 1/3] Statefull lambdas regress dex size.
@@ -9,10 +9,10 @@ Bug: b/129997269
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/LambdaClass.java b/src/main/java/com/android/tools/r8/ir/desugar/LambdaClass.java
-index 477d8d87f..b8d8ec5f3 100644
+index d54264cf7..5ec5eca7a 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/LambdaClass.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/LambdaClass.java
-@@ -133,7 +133,8 @@ public final class LambdaClass {
+@@ -144,7 +144,8 @@ public final class LambdaClass {
}
public final boolean isStateless() {
@@ -23,5 +23,5 @@ index 477d8d87f..b8d8ec5f3 100644
// Synthesize virtual methods.
--
-2.30.0.365.g02bc693789-goog
+2.30.1.766.gb4fecdf3b7-goog
diff --git a/chromium/third_party/r8/patches/0003-Allow-access-modification-everywhere.patch b/chromium/third_party/r8/3pp/patches/0002-Allow-access-modification-everywhere.patch
index 81a7206d56a..b142ebe8005 100644
--- a/chromium/third_party/r8/patches/0003-Allow-access-modification-everywhere.patch
+++ b/chromium/third_party/r8/3pp/patches/0002-Allow-access-modification-everywhere.patch
@@ -1,4 +1,4 @@
-From 6891e6dfb271c471a09bf92c74b3e47b7dd50c39 Mon Sep 17 00:00:00 2001
+From 26cc9b33cd474f71e4f498d60ea9cd2e4d742b82 Mon Sep 17 00:00:00 2001
From: Andrew Grieve <agrieve@chromium.org>
Date: Wed, 21 Oct 2020 10:59:42 -0400
Subject: [PATCH 3/3] Allow access modification everywhere
@@ -11,10 +11,10 @@ than adding ",allowaccessmodification" to every single -keep rule.
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/com/android/tools/r8/shaking/AppInfoWithLiveness.java b/src/main/java/com/android/tools/r8/shaking/AppInfoWithLiveness.java
-index baa118963..e0ec96ea8 100644
+index b186a527f..ba77672e8 100644
--- a/src/main/java/com/android/tools/r8/shaking/AppInfoWithLiveness.java
+++ b/src/main/java/com/android/tools/r8/shaking/AppInfoWithLiveness.java
-@@ -903,7 +903,7 @@ public class AppInfoWithLiveness extends AppInfoWithClassHierarchy
+@@ -949,7 +949,7 @@ public class AppInfoWithLiveness extends AppInfoWithClassHierarchy
public boolean isAccessModificationAllowed(DexReference reference) {
assert options().getProguardConfiguration().isAccessModificationAllowed();
@@ -24,5 +24,5 @@ index baa118963..e0ec96ea8 100644
public boolean isRepackagingAllowed(DexProgramClass clazz) {
--
-2.30.0.365.g02bc693789-goog
+2.30.1.766.gb4fecdf3b7-goog
diff --git a/chromium/third_party/r8/OWNERS b/chromium/third_party/r8/OWNERS
index 29e1a003412..cb00e5e1618 100644
--- a/chromium/third_party/r8/OWNERS
+++ b/chromium/third_party/r8/OWNERS
@@ -1,2 +1,3 @@
smaier@chromium.org
agrieve@chromium.org
+wnwen@chromium.org
diff --git a/chromium/third_party/r8/README.chromium b/chromium/third_party/r8/README.chromium
index e27afc0531a..9c1ee864236 100644
--- a/chromium/third_party/r8/README.chromium
+++ b/chromium/third_party/r8/README.chromium
@@ -1,7 +1,6 @@
Name: R8
URL: https://r8.googlesource.com/r8
-Revision: 4c912119af8e3d21f70af8362d41cfff1db2bcc9
-Version: latest
+Version: 3.0.28
License: BSD 3-Clause
License File: NOT_SHIPPED
Security Critical: no
@@ -9,6 +8,8 @@ Security Critical: no
Description:
lib/r8.jar
- Contains R8 (proguard replacement) as well as D8 (dexer).
+3pp
+ - Contains code for 3pp-linux-amd64-packager to package and upload new versions of r8.
desugar_jdk_libs.json
- Configuration for Java library desugaring.
- Taken from
@@ -19,62 +20,69 @@ desugar_jdk_libs.json
R8 is a proguard-like optimizer that also has the ability to dex.
Local Modifications:
-* Refer to commit descriptions within "patches" directory.
+* Refer to commit descriptions within "3pp/patches" directory.
* Added "playground" directory for quick "how does this optimize" tests.
* Removed references to ConcurrentHashMap and TimeZone#getTimeZone in desugar_jdk_libs.json.
* Added "java/src/org/chromium/build/CustomD8.java", custom_d8.jar, and BUILD.gn.
* Used in "build/android/gyp/dex.py" to enable desugar dependencies.
Update Instructions:
-# For the custom d8 jar (required only when CustomD8.java changes):
+* For the custom d8 jar:
+ * This is required only when CustomD8.java changes.
+ * Uncomment the flag --skip-custom-d8 in internal_rules.gni to avoid depending
+ on the previously built custom_d8.jar.
autoninja -C out/Debug third_party/r8:custom_d8_java
cp out/Debug/obj/third_party/r8/custom_d8_java.javac.jar third_party/r8/custom_d8.jar
-# Download R8:
+* For a new version of r8:
+ * Find the latest successful run of the build bot:
+ * https://ci.chromium.org/p/chromium/builders/ci/3pp-linux-amd64-packager
+ * The bot autoruns every 6 hours. Ping a trooper to trigger it if you need it sooner.
+ * https://luci-scheduler.appspot.com/jobs/chromium/3pp-linux-amd64-packager
+ * Go to its log page and look under:
+ * Expand "building chromium/third_party/r8" to see the CIPD instance ID.
+ * Copy this instance ID to the r8 entry in //DEPS.
+ * Update this file with the new version string and submit.
+
+* If patching fails:
git clone https://r8.googlesource.com/r8
cd r8
-# Find latest tag:
+ * Find latest tag:
git fetch origin --tags
git tag -l # Often unnecessary as output from the fetch includes recent tags.
-git checkout $TAG # e.g. 2.2.9-dev
-
-# Apply patches:
+git checkout $TAG # e.g. 3.0.25-dev, whichever tag failed patching.
+ * Apply patches:
git checkout -b my_branch
git am $CHROMIUM_SRC/third_party/r8/patches/*.patch
-# Build:
+ * Fix patch conflicts.
+ * Save new patches. Change number if expecting more or fewer patches:
+git format-patch -3 -o $CHROMIUM_SRC/third_party/r8/3pp/patches
+ * Submit these fixed patches and the bot will automatically retry.
+
+* Local development (see above for setting up the r8 repo):
+ * Build
tools/gradle.py r8
-# Shrink (improves r8/d8 launch time):
+ * Shrink (improves r8/d8 launch time):
java -jar build/libs/r8.jar --debug --classfile --output r8.jar \
--lib $CHROMIUM_SRC/third_party/jdk/current --pg-conf src/main/keep.txt \
--no-minification --no-desugaring build/libs/r8.jar
mv $CHROMIUM_SRC/third_party/r8/lib/r8.jar{,.bak}
cp r8.jar $CHROMIUM_SRC/third_party/r8/lib/r8.jar
-# Create patches if conflicts / new patches. Change number if expecting
-# different amount of patches:
-git format-patch -3 -o $CHROMIUM_SRC/third_party/r8/patches
-
-# Upload to CIPD:
-cd $CHROMIUM_SRC/third_party/r8
-cipd create --pkg-def cipd.yaml # Make note of the instance ID
-
-# Update backported methods list:
+* Update backported methods list:
cd $CHROMIUM_SRC
java -cp third_party/r8/lib/r8.jar com.android.tools.r8.BackportedMethodList --min-api 16 > third_party/r8/backported_methods.txt
-# Manually update:
-* README.chromium (revision is the R8 commit (before patches applied)
-* //DEPS (instance ID output by cipd create)
-
-Update instructions for desugar_jdk_libs.json:
-* unzip -p third_party/android_deps/libs/com_android_tools_desugar_jdk_libs_configuration/*.jar META-INF/desugar/d8/desugar.json > third_party/r8/desugar_jdk_libs.json
-* Remove all mentions of ConcurrentHashMap and TimeZone#getTimeZone and remove trailing commas.
-* Update //build/config/android/internal_rules.gni to point at the new .jar files:
- 1) desugar_jdk_libs-1.1.1.jar
- 2) desugar_jdk_libs_configuration-1.1.1.jar
+* Update instructions for desugar_jdk_libs.json:
+unzip -p third_party/android_deps/libs/com_android_tools_desugar_jdk_libs_configuration/*.jar META-INF/desugar/d8/desugar.json > third_party/r8/desugar_jdk_libs.json
+ * Remove all mentions of ConcurrentHashMap and TimeZone#getTimeZone and remove trailing commas.
+ * Update //build/config/android/internal_rules.gni to point at the new .jar files:
+ * desugar_jdk_libs-1.1.1.jar
+ * desugar_jdk_libs_configuration-1.1.1.jar
How to file bugs against R8:
* Copy & paste the failing ninja command (starts with proguard.py), and add --dump-inputs.
+ * This also works for dex.py, it produces d8inputs.zip
* File bug at go/r8bug
* Things to include (use discretion if some are not relevant):
* src revision bug reproduces at
@@ -82,3 +90,8 @@ How to file bugs against R8:
* Prefer enable_chrome_android_internal=false
* The r8inputs.zip from --dump-inputs
* Any relevant dexdump analysis
+
+How to submit CLs to R8:
+* Request to be added to their allowlist in order to upload CLs.
+* After CLs are submitted, check the bots for build breakage.
+ * https://ci.chromium.org/p/r8/g/main_all/console
diff --git a/chromium/third_party/r8/patches/0001-Desugaring-Make-all-lambdas-stateless-fix-naming-sch.patch b/chromium/third_party/r8/patches/0001-Desugaring-Make-all-lambdas-stateless-fix-naming-sch.patch
deleted file mode 100644
index 55440801b4b..00000000000
--- a/chromium/third_party/r8/patches/0001-Desugaring-Make-all-lambdas-stateless-fix-naming-sch.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From 5a248a7f422c11f6e41e1c8684d207f3c2953b3b Mon Sep 17 00:00:00 2001
-From: Sam Maier <smaier@chromium.org>
-Date: Tue, 19 May 2020 15:55:44 -0400
-Subject: [PATCH 1/3] Desugaring: Make all lambdas stateless & fix naming
- scheme of method references
-
-Statefull lambdas regress dex size.
-
-Bug: b/129997269
----
- .../java/com/android/tools/r8/ir/desugar/LambdaClass.java | 5 +++--
- 1 file changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/src/main/java/com/android/tools/r8/ir/desugar/LambdaClass.java b/src/main/java/com/android/tools/r8/ir/desugar/LambdaClass.java
-index a50581ee0..0d166d275 100644
---- a/src/main/java/com/android/tools/r8/ir/desugar/LambdaClass.java
-+++ b/src/main/java/com/android/tools/r8/ir/desugar/LambdaClass.java
-@@ -134,7 +134,8 @@ public final class LambdaClass {
- // If the lambda class should match 1:1 the class it is accessed from, we
- // just add the name of this type to make lambda class name unique.
- // It also helps link the class lambda originated from in some cases.
-- if (match.delegatesToLambdaImplMethod() || match.needsAccessor(accessedFrom)) {
-+ if (true || match.delegatesToLambdaImplMethod() || match.needsAccessor(accessedFrom)) {
-+ // Chrome: This class name is required for supersize to map the symbol to source .java file.
- lambdaClassDescriptor.append(accessedFrom.getHolderType().getName()).append('$');
- }
-
-@@ -213,7 +214,7 @@ public final class LambdaClass {
- }
-
- public final boolean isStateless() {
-- return descriptor.isStateless();
-+ return false; // descriptor.isStateless();
- }
-
- void addSynthesizedFrom(DexProgramClass clazz) {
---
-2.30.0.284.gd98b1dd5eaa7-goog
-
diff --git a/chromium/third_party/r8/patches/0002-Command-line-flags-for-class-merging-and-outlining.patch b/chromium/third_party/r8/patches/0002-Command-line-flags-for-class-merging-and-outlining.patch
deleted file mode 100644
index 9d6ac916388..00000000000
--- a/chromium/third_party/r8/patches/0002-Command-line-flags-for-class-merging-and-outlining.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From bfb105aec6d8e20aa91f23652b148cda5d800211 Mon Sep 17 00:00:00 2001
-From: Andrew Grieve <agrieve@chromium.org>
-Date: Mon, 28 Sep 2020 15:51:32 -0400
-Subject: [PATCH 2/3] Command-line flags for class merging and outlining
-
----
- .../java/com/android/tools/r8/utils/InternalOptions.java | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/src/main/java/com/android/tools/r8/utils/InternalOptions.java b/src/main/java/com/android/tools/r8/utils/InternalOptions.java
-index 985090a37..64daa52a6 100644
---- a/src/main/java/com/android/tools/r8/utils/InternalOptions.java
-+++ b/src/main/java/com/android/tools/r8/utils/InternalOptions.java
-@@ -240,8 +240,8 @@ public class InternalOptions implements GlobalKeepInfoConfiguration {
- public boolean enableFieldAssignmentTracker = true;
- public boolean enableFieldBitAccessAnalysis =
- System.getProperty("com.android.tools.r8.fieldBitAccessAnalysis") != null;
-- public boolean enableStaticClassMerging = true;
-- public boolean enableVerticalClassMerging = true;
-+ public boolean enableStaticClassMerging = System.getProperty("com.android.tools.r8.staticClassMerging") != null;
-+ public boolean enableVerticalClassMerging = System.getProperty("com.android.tools.r8.verticalClassMerging") != null;
- public boolean enableArgumentRemoval = true;
- public boolean enableUnusedInterfaceRemoval = true;
- public boolean enableDevirtualization = true;
-@@ -1202,7 +1202,7 @@ public class InternalOptions implements GlobalKeepInfoConfiguration {
- public static final String CLASS_NAME = "com.android.tools.r8.GeneratedOutlineSupport";
- public static final String METHOD_PREFIX = "outline";
-
-- public boolean enabled = true;
-+ public boolean enabled = System.getProperty("com.android.tools.r8.disableOutlining") == null;
- public int minSize = 3;
- public int maxSize = 99;
- public int threshold = 20;
-@@ -1273,7 +1273,7 @@ public class InternalOptions implements GlobalKeepInfoConfiguration {
-
- public static class HorizontalClassMergerOptions {
-
-- public boolean enable = true;
-+ public boolean enable = System.getProperty("com.android.tools.r8.horizontalClassMerging") != null;
- public boolean enableConstructorMerging = true;
- public boolean enableJavaLambdaMerging = false;
- public boolean enableKotlinLambdaMerging = true;
---
-2.30.0.284.gd98b1dd5eaa7-goog
-
diff --git a/chromium/third_party/r8/patches/0002-Disable-horizontal-class-merging.patch b/chromium/third_party/r8/patches/0002-Disable-horizontal-class-merging.patch
deleted file mode 100644
index a07cf4a979e..00000000000
--- a/chromium/third_party/r8/patches/0002-Disable-horizontal-class-merging.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From 77844d5d6dce373125d26cac31056fb832960c27 Mon Sep 17 00:00:00 2001
-From: Andrew Grieve <agrieve@chromium.org>
-Date: Mon, 1 Feb 2021 15:14:20 -0500
-Subject: [PATCH 2/3] Disable horizontal class merging
-
-Bug: 1173182
----
- src/main/java/com/android/tools/r8/utils/InternalOptions.java | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/main/java/com/android/tools/r8/utils/InternalOptions.java b/src/main/java/com/android/tools/r8/utils/InternalOptions.java
-index 0d4a76804..934e7edad 100644
---- a/src/main/java/com/android/tools/r8/utils/InternalOptions.java
-+++ b/src/main/java/com/android/tools/r8/utils/InternalOptions.java
-@@ -1135,7 +1135,7 @@ public class InternalOptions implements GlobalKeepInfoConfiguration {
-
- public static class HorizontalClassMergerOptions {
-
-- public boolean enable = true;
-+ public boolean enable = System.getProperty("com.android.tools.r8.horizontalClassMerging") != null;
- public boolean enableConstructorMerging = true;
- // TODO(b/174809311): Update or remove the option and its tests after new lambdas synthetics.
- public boolean enableJavaLambdaMerging = false;
---
-2.30.0.365.g02bc693789-goog
-