Reducing device/host differences. This is now required since libutils
Trace.h always calls the libcutils functions, instead of before where
it only called these functions on device.
Bug: 124524556
Test: build & boot
Change-Id: Ic096ed7caf8ca59292b3427a16c4e2545d12dfd9
The code was previously pretty messy and hard to follow. This reworks some
things to make it more manageable. Among the changes:
* Pull out fragments of code into their own method, so the high level steps are
more apparent in methods like DexViewBuilder::Start.
* Pull frequently used types into global constants in dex_layout_compiler.cc.
* Rework register handling to track liveness so a strict stack discipline is no
longer needed.
Change-Id: Idb4b41f88c96a1ac4efb2c7b9bed05c2de0da999
The existing LayoutCompilerTest only covered compiled layouts generated from
text XML files. It did not cover layouts that were extracted from the APK. This
is an important area to cover.
This test works by calling `pm compile --compile-layouts` on the test APK, and
then directly loads the `compiled_view.dex` file. From there, it pulls out the
compiled layouts and executes their inflater. This makes sure the generated DEX
files validate and execute without error.
Bug: 111895153
Merged-In: Ifc6719c2f438474b5474def02422ef68eee800b2
Change-Id: I7024069bb4d77a81871366f259fb34ae54a55aac
This test is problematic because it links against libdexfile and we would like
to remove this dependency. All of the functionality covered by this test is also
tested more thoroughly by the on-device dex-builder-test, so there's no reason
to test it here as well.
Change-Id: Ie45d4a1c99668b68476168fc072a220fa5db3695
This allows us to generate code that can read static fields in a class. Once we
include several other field operations, we will be able to generate more
specialized inflation code in the view compiler.
Bug: 111895153
Change-Id: Ia11195b1cea6d5a3ddbc60d972922586a062c853
libz is already linked as a static library through
libdexfile_static_defaults, don't also link it as a shared library.
Fixes:
=================================================================
==43189==ERROR: AddressSanitizer: odr-violation (0x55d1ed723a60):
[1] size=48 'inflate_copyright' external/zlib/src/inftrees.c:11:12
[2] size=48 'inflate_copyright' external/zlib/src/inftrees.c:11:12
These globals were registered at these points:
[1]:
#0 0x55d1ed769a0e (/buildbot/src/android/master/out/soong/host/linux-x86/bin/viewcompiler+0xf3a0e)
#1 0x55d1ed991b1b (/buildbot/src/android/master/out/soong/host/linux-x86/bin/viewcompiler+0x31bb1b)
[2]:
#0 0x55d1ed769a0e (/buildbot/src/android/master/out/soong/host/linux-x86/bin/viewcompiler+0xf3a0e)
#1 0x7f5dff20a09b (/buildbot/src/android/master/out/soong/host/linux-x86/bin/../lib64/libz-host.so+0x3e09b)
Test: m SANITIZE_HOST=address viewcompiler && viewcompiler
Change-Id: I4ebdf7ef4ec1641488fbc25275dbf6aa0cdbe2eb
This was causing the viewcompiler to crash on deeper layout hierarchies.
We fix this by reserving several scratch registers. When an invoke instruction
uses registers that don't fit in a 4-bit field, we move all of these values into
the scratch registers and use an invoke/range instruction instead. The scratch
registers are all above the highest allocated register, so they are guaranteed
not to clobber meaningful values.
Supporting more registers for invoke also required supporting
register-to-register moves, which some how we'd gotten by without so far.
Finally, to make viewcompiler fail more loudly when things go wrong, many
DCHECKs have been changed to CHECKs.
Bug: 123517491
Test: atest
Change-Id: I9eb7c9bcf1fc7d713e664b331804bdcddafc95a4
PrecompiledLayoutTest makes sure that layouts generated by the viewcompiler are
equivalent to inflating from the resource XML file. We'll want to run these
tests when making changes to the viewcompiler.
Bug: 111895153
Test: atest
Change-Id: Iffa6f0f01c3f43d43feaabd1a5cd36be76650975
libdexfile.so is moving to APEX and the external API doesn't include
the features needed for startop.
Bug: 119632407
Test: Builds
Change-Id: I6d33e8737341a508637321921ca732af913827a3
This is needed to be able to launch the viewcompiler from installd. We only
support FD-input mode when reading from APKs. For output to an FD, we rely on
stdout redirection.
Bug: 111895153
Change-Id: I3025d83c60494485bada5f2f4cd67e25354d1d53
We'll need this binary on device to be able to compile views at application
install time. There will be a followup CL to the build system to make sure
viewcompiler is built and installed by default.
Bug: 111895153
Change-Id: I2c98864118dfeca79e36be760bd44b9afa03b4d4
This moves some helper functions into our own namespace to avoid conflicting
with other util.h files.
Bug: 111895153
Change-Id: I2b4c77732a97b34a8528d69867c15ed802686703
TEST_MAPPING supports both host and device tests now, so we should run both.
Test: atest
Bug: 111895153
Change-Id: I48f26093fc0ae3cdaa9e5295375945b5a519e1c2
* Add explicit to conversion constructors/operators
Bug: 28341362
Test: make with WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=-*,google-explicit-constructor
Change-Id: I9e7b929cfa65c68f4cdb4710c1c5c6760d56e4d5