summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jared Duke <jdduke@google.com> 2025-02-18 22:35:45 +0000
committer Jared Duke <jdduke@google.com> 2025-02-20 14:31:41 -0800
commitb6f8f4fd3602b62c068c37fb4f92c3922efe1853 (patch)
tree19d6822503165e7be9b59fe6db596ef7dc8c6282
parenteff8cc80c6b6df1c9973b552c84987976a98af7a (diff)
Integrate RELEASE_R8_GLOBAL_CHECK_NOT_NULL_FLAGS into soong
Include the new set of `checknotnull.flags` based on the build flag, allowing `-convertchecknotnull` R8 optimizations for a class of common null checks. Bug: 280633711 Test: build-flag set RELEASE_R8_GLOBAL_CHECK_NOT_NULL_FLAGS && m Flag: RELEASE_R8_GLOBAL_CHECK_NOT_NULL_FLAGS Change-Id: Idf015a3ea5bd9f6e11213f683da008b5706668e0
-rw-r--r--android/config.go4
-rw-r--r--java/dex.go5
2 files changed, 9 insertions, 0 deletions
diff --git a/android/config.go b/android/config.go
index acaad60ad..82acfc3ec 100644
--- a/android/config.go
+++ b/android/config.go
@@ -2191,6 +2191,10 @@ func (c *config) UseR8StoreStoreFenceConstructorInlining() bool {
return c.productVariables.GetBuildFlagBool("RELEASE_R8_STORE_STORE_FENCE_CONSTRUCTOR_INLINING")
}
+func (c *config) UseR8GlobalCheckNotNullFlags() bool {
+ return c.productVariables.GetBuildFlagBool("RELEASE_R8_GLOBAL_CHECK_NOT_NULL_FLAGS")
+}
+
func (c *config) UseDexV41() bool {
return c.productVariables.GetBuildFlagBool("RELEASE_USE_DEX_V41")
}
diff --git a/java/dex.go b/java/dex.go
index 64465a2de..1a61000f1 100644
--- a/java/dex.go
+++ b/java/dex.go
@@ -362,6 +362,11 @@ func (d *dexer) r8Flags(ctx android.ModuleContext, dexParams *compileDexParams,
android.PathForSource(ctx, "build/make/core/proguard.flags"),
}
+ if ctx.Config().UseR8GlobalCheckNotNullFlags() {
+ flagFiles = append(flagFiles, android.PathForSource(ctx,
+ "build/make/core/proguard/checknotnull.flags"))
+ }
+
flagFiles = append(flagFiles, d.extraProguardFlagsFiles...)
// TODO(ccross): static android library proguard files