summaryrefslogtreecommitdiff
path: root/startop/view_compiler/dex_builder.cc
AgeCommit message (Collapse)Author
2019-11-01Switch to slicer DEX opcode definitionsOrion Hodson
Removes dependency on art/libdexfile and uses equivalent definitions from the dexter/slicer library. Bug: 133140750 Bug: 142948359 Test: m Test: atest dex-builder-test \ view-compiler-tests \ android.view.cts.PrecompiledLayoutTest Change-Id: I49562ac4867254ecde287b828f76d23cb5132dd0
2019-09-18Refactor DexViewBuilderEric Holk
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
2019-07-30[view compiler] Add DexBuilder support for getting and setting instance fieldsEric Holk
Bug: 111895153 Change-Id: I5fa2936501c79e30a66f3863b76229ec83433928
2019-07-26[viewcompiler] Add support for static field put to DexBuilderEric Holk
Bug: 111895153 Change-Id: I12b38fa520790debec545d7d1f6b3522a65ce03b
2019-07-26[viewcompiler] Add static field get instructions to DexBuilderEric Holk
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
2019-02-05Work around clang-tidy bug in dex_builder.cc.Chih-Hung Hsieh
Bug: 123880763 Test: build with WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=*,-readability-*, -google-readability-*,-google-runtime-references,-cppcoreguidelines-*, -modernize-*,-llvm-*,-bugprone-narrowing-conversions, -misc-non-private-member-variables-in-classes, -misc-unused-parameters,-hicpp-*,-fuchsia-* Change-Id: Ibf80f951ae2369a55570770febe8a1c4422181e1
2019-01-31[viewcompiler] Support more than 16 registers in invoke instructionsEric Holk
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
2018-12-18[view-compiler] DexBuilder: Add check-cast instructionEric Holk
Bug: 111895153 Test: atest Change-Id: I767e56713fab6beaa6970e58c4fc4d3560cc1304
2018-12-14[view-compiler] DexBuilder: Add more instructionsEric Holk
This CL adds the ability to generate code that calls static and virtual methods which return objects, as well as the not-equal-to-zero comparison operator. Bug: 111895153 Change-Id: I4ae9b3cb2edc6540671112b73c02bf6380d23051
2018-11-15[view_compiler] cleanup: Use format-specific bytecode encoding functionsEric Holk
This change corrals most of the bit shifting and ORing needed to encode Dex instructions into EncodeXXX functions that follow the naming scheme at https://source.android.com/devices/tech/dalvik/instruction-formats. Overall, it makes the code easier to follow and probably even less error prone because we only have to make the format right in one place. Bug: 111895153 Change-Id: I902ec3c8bca6b5dc4ad900503af7aef58d4bbf5f
2018-11-13[view_compiler] DexBuilder: Add support for new and calling constructorsEric Holk
This change also includes support for calling methods with more that one argument. In fact, we can go up to four. Bug: 111895153 Change-Id: I49472171cefcf57cdfce2ac4d41646ed4df29074
2018-11-13[view_compiler] DexBuilder: add support for string literals and null pointersEric Holk
Bug: 111895153 Change-Id: If6bdd9a280f6feed175be4da57733f3442e6dd14
2018-11-10[view compiler] Add conditional branch instructionEric Holk
This CL adds support for the if-eqz instruction. It should be easy to add additional comparisons as needed. This also introduces a new kind of Value called a Label. Labels may be created any time and then must be bound to a location in code at some point. References to labels are tracked, and when a label is bound all references are patched to refer to the concrete address. Bug: 111895153 Change-Id: I15424aec75425004f0f1f4bbc6e760bac3a6c7de
2018-11-07[view-compiler] Support method declaration and invocation in Dex builderEric Holk
The Dex builder can now generate calls to methods (although not in all forms yet). To help do this, we add a new virtual Instruction and Value class. This is needed to generate code with values that are not known until the entire method has been generated. In particular, we can now refer to function parameters. The test method now accepts a String and returns the the length of the string. Bug: 111895153 Change-Id: I11d52b083ae51d8151fccb1a65e45d40ff05fd81
2018-10-22Move startop/tools/view_compiler to startop/view_compilerEric Holk
This is planned to ship on device, so by convention the view_compiler should not be in a tools directory. Change-Id: I0eb03812d77ec38edc3908725acb40bacb345ecd