bazel icon indicating copy to clipboard operation
bazel copied to clipboard

CompatDx producting excessive "stack map table" warnings

Open Bencodes opened this issue 2 years ago • 7 comments

Description of the bug:

After updating to rolling release 6.0.0-pre.20220526.1, CompatDx produces a massive amount of "stack map table" warnings.

Warning in bazel-out/darwin_arm64-dbg/bin/apps/entertainment/bin_devRelease_proguard.jar:com/google/android/exoplayer2/upstream/cache/CacheDataSource.class at Lcom/google/android/exoplayer2/upstream/cache/CacheDataSource;getResponse
Headers()Ljava/util/Map;:
Expected stack map table for method with non-linear control flow.
Warning in bazel-out/darwin_arm64-dbg/bin/apps/entertainment/bin_devRelease_proguard.jar:com/google/android/exoplayer2/upstream/cache/CacheDataSource.class at Lcom/google/android/exoplayer2/upstream/cache/CacheDataSource;close()V:
Expected stack map table for method with non-linear control flow.
Warning in bazel-out/darwin_arm64-dbg/bin/apps/entertainment/bin_devRelease_proguard.jar:com/lyft/protocgenlyftandroid/googlecommoncompanions/AnyDTOTypeAdapterFactory.class at Lcom/lyft/protocgenlyftandroid/googlecommoncompanions/An
yDTOTypeAdapterFactory;create(Lcom/google/gson/d;Lcom/google/gson/b/a;)Lcom/google/gson/n;:
Expected stack map table for method with non-linear control flow.
Warning in bazel-out/darwin_arm64-dbg/bin/apps/entertainment/bin_devRelease_proguard.jar:pb/api/endpoints/stripe/CardWireProto$a.class at Lpb/api/endpoints/stripe/CardWireProto$a;a(Lcom/squareup/wire/n;)Lpb/api/endpoints/stripe/Card
WireProto;:
Expected stack map table for method with non-linear control flow.
Warning in bazel-out/darwin_arm64-dbg/bin/apps/entertainment/bin_devRelease_proguard.jar:androidx/appcompat/widget/de.class at Landroidx/appcompat/widget/de;d(Landroid/database/Cursor;)V:
Expected stack map table for method with non-linear control flow.
Warning in bazel-out/darwin_arm64-dbg/bin/apps/entertainment/bin_devRelease_proguard.jar:pb/api/endpoints/v1/mapping_reports/LocalizedLocationDTOTypeAdapterFactory.class at Lpb/api/endpoints/v1/mapping_reports/LocalizedLocationDTOTy
peAdapterFactory;create(Lcom/google/gson/d;Lcom/google/gson/b/a;)Lcom/google/gson/n;:
Expected stack map table for method with non-linear control flow.
Warning in bazel-out/darwin_arm64-dbg/bin/apps/entertainment/bin_devRelease_proguard.jar:androidx/appcompat/widget/de.class at Landroidx/appcompat/widget/de;b(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;:
Expected stack map table for method with non-linear control flow.
Warning in bazel-out/darwin_arm64-dbg/bin/apps/entertainment/bin_devRelease_proguard.jar:androidx/appcompat/widget/de.class at Landroidx/appcompat/widget/de;a(Landroid/widget/TextView;Ljava/lang/CharSequence;)V:
Expected stack map table for method with non-linear control flow.
Warning in bazel-out/darwin_arm64-dbg/bin/apps/entertainment/bin_devRelease_proguard.jar:androidx/appcompat/widget/de.class at Landroidx/appcompat/widget/de;e(Landroid/database/Cursor;)Landroid/graphics/drawable/Drawable;:
Expected stack map table for method with non-linear control flow.
Warning in bazel-out/darwin_arm64-dbg/bin/apps/entertainment/bin_devRelease_proguard.jar:androidx/appcompat/widget/de.class at Landroidx/appcompat/widget/de;f(Landroid/database/Cursor;)Landroid/graphics/drawable/Drawable;:
Expected stack map table for method with non-linear control flow.
Warning in bazel-out/darwin_arm64-dbg/bin/apps/entertainment/bin_devRelease_proguard.jar:androidx/appcompat/widget/de.class at Landroidx/appcompat/widget/de;a(Landroid/widget/ImageView;Landroid/graphics/drawable/Drawable;I)V:
Expected stack map table for method with non-linear control flow.
Warning in bazel-out/darwin_arm64-dbg/bin/apps/entertainment/bin_devRelease_proguard.jar:androidx/appcompat/widget/de.class at Landroidx/appcompat/widget/de;a(Ljava/lang/String;)Landroid/graphics/drawable/Drawable;:
Expected stack map table for method with non-linear control flow.

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

# Enable experimental d8 merger
build --define=android_dexmerger_tool=d8_dexmerger
build --define=android_incremental_dexing_tool=d8_dexbuilder
build --define=android_standalone_dexing_tool=d8_compat_dx

Which operating system are you running Bazel on?

Mac OS

What is the output of bazel info release?

6.0.0-pre.20220526.1

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse master; git rev-parse HEAD ?

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

Bencodes avatar Jun 27 '22 19:06 Bencodes

This was originally reported here but has been broken out into a new issue specifically reporting the warnings.

Bencodes avatar Jun 27 '22 19:06 Bencodes

From some quick internet sleuthing, it looks like these warning can be produced when the ClassWriter instance doesn't have ClassWriter.COMPUTE_FRAMES set. I see a bunch of references to ClassWriter and associated flags (COMPUTE_FRAMES, COMPUTE_MAXS) in the desugarer code but none for the dexer somehow. Needs more investigation. @Bencodes did you see this warning pop up with the legacy dexer?

ted-xie avatar Jul 07 '22 19:07 ted-xie

@ted-xie not that i'm aware of but we haven't used the dx, nor does it actually work in our codebase. We hit errors like these https://github.com/bazelbuild/bazel/issues/15742#issuecomment-1168157842

Bencodes avatar Jul 07 '22 19:07 Bencodes

If it helps, I did a bisect to figure out which version of R8/D8 this issue was introduced in and found that the switch from version 2.1.96 (builds with with no warnings) to 2.2.64 (console gets spammed with warnings) is where it started happening. Note: I was only looking at major and not minor releases so skipped over 2.2.60.

Bencodes avatar Jul 07 '22 19:07 Bencodes

Thanks, Ben. I tried to git-diff those two tags in the r8 repo and there was way too much to look at; I'll try to come up with some bisect automation to make this easier.

ted-xie avatar Jul 07 '22 20:07 ted-xie

Just to refine this search a bit more in case it helps, it seems like the stack map issues were introduced in 2.2.60.

Bencodes avatar Aug 02 '22 21:08 Bencodes

Thanks, Ben. I'm marking this P2 for now; I'll try to jump back on this after a few more things clear off my plate.

ted-xie avatar Aug 03 '22 16:08 ted-xie

@ted-xie to quickly circle back here - this doesn't seem to be an issue using R8 instead of Proguard.

Bencodes avatar Oct 18 '22 22:10 Bencodes