Elide ClinitCheck for superclasses with trivial init.
We cannot generally elide ClinitCheck for superclasses
because of escaping instances of erroneous classes and
because a subclass can be successfully initialized while
the superclass is initializing and the subclass remains
initialized even when the superclass initializer throws.
However, for those superclasses that have trivial init,
i.e. that class and its superclasses (and superinterfaces
with default methods) initialize only their own static
fields using constant values, there is no chance to end
up in one of these weird situations and we can safely
eliminate the ClinitCheck.
The size of the aosp_taimen-userdebug prebuilts:
- before:
arm/boot*.oat: 16856928
arm64/boot*.oat: 19846592
oat/arm64/services.odex: 24662880
- after:
arm/boot*.oat: 16848696 (-8.0KiB, -0.05%)
arm64/boot*.oat: 19842320 (-4.2KiB, -0.02%)
oat/arm64/services.odex: 24629952 (-32.2KiB, -0.13%)
with minor changes to other app prebuilts.
Test: Improved 478-checker-clinit-check-pruning.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Test: Pixel 2 XL boots.
Test: testrunner.py --target --optimizing
Bug: 62478025
Change-Id: I865f567443f1b7f172e5e6559d8eb3232adb7833
5 files changed