summaryrefslogtreecommitdiff
path: root/dexlayout/dex_ir_builder.cc
Commit message (Collapse)AuthorAgeFilesLines
* Switch-interpreter: Add helpers to get opcode arguments.David Srbecky2019-05-241-0/+1
| | | | | | | | | | | | | | | Add trivial helpers to get opcodes arguments (A/B/C). Ensure the generic getters in Instruction can take advantage of knowing the format at compile-time. As the first step, I have simplified the code only where the argument is used as index for SetVReg/GetVReg calls. Test: ART_USE_CXX_INTERPRETER=true ./art/test.py -b --host Test: ART_USE_CXX_INTERPRETER=true ./art/tools/run-jdwp-tests.sh \ --mode=host --variant=X32 --debug --no-jit Change-Id: I765c0eb16438806c3624fabe3aade040c7bb3387
* ART: Move dex structs into own headerAndreas Gampe2019-01-021-43/+43
| | | | | | | | | Separating out the structs from DexFile allows them to be forward- declared, which reduces the need to include the dex_file header. Bug: 119869270 Test: m Change-Id: I32dde5a632884bca7435cd584b4a81883de2e7b4
* Merge "Revert^4: Add dex item for hiddenapi flags"David Brazdil2018-10-301-3/+46
|\
| * Revert^4: Add dex item for hiddenapi flagsDavid Brazdil2018-10-281-3/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move hiddenapi access flags to own data section so as to: (a) increase amount of information stored per method/field (b) use encoding which can be supported long-term. The dex item is implemented as: - array of offsets indexed by class def index - streams of uleb-128 encoded flags. Offsets in array point to the beginning of the flags stream for the given class def. Flags are encoded in the same order as fields and methods are encoded in class data. Zero offset means that the class either does not have class data, or all of its flags are zero. The patch updates: (a) libdexfile with data structure declarations and accessor methods, (b) hiddenapi tool to create the new item from hiddenapi lists and insert it into the given dex file, (c) dexlayout to copy the flags into compact dex, (d) dex file verifier to verify the item. It also removes skipping of verification for boot class path dex files as those now pass DexFileVerifier, and removes the need for removing the flags for JVMTI. The size increase is 450 KB. This reverts commit d33d318685ec4a1c9e7995c914c104ab6487513b. Change-Id: Id00e0efb38ee1eab8d7ed5c645a7778b6b94b849 Test: phone boots Test: m test-art
* | Modernise code to use std::make_uniqueYi Kong2018-10-291-7/+8
|/ | | | | | | Generated by clang-tidy. Test: m checkbuild Change-Id: Idb24960d9326c0d94ab5d04b18deb0894d23da9f
* Revert "Revert^2: Add dex item for hiddenapi flags"Luman Qu2018-10-261-46/+3
| | | | | | | | This reverts commit fe3a979f6214e2ea94a9aed4c573c6a6f64c7096. Reason for revert: Caught by droidcop https://b.corp.google.com/issues/118481351 Change-Id: I17cc3586c9ae3b49839633d9543edce2937c388d
* Revert^2: Add dex item for hiddenapi flagsDavid Brazdil2018-10-251-3/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move hiddenapi access flags to own data section so as to: (a) increase amount of information stored per method/field (b) use encoding which can be supported long-term. The dex item is implemented as: - array of offsets indexed by class def index - streams of uleb-128 encoded flags. Offsets in array point to the beginning of the flags stream for the given class def. Flags are encoded in the same order as fields and methods are encoded in class data. Zero offset means that the class either does not have class data, or all of its flags are zero. The patch updates: (a) libdexfile with data structure declarations and accessor methods, (b) hiddenapi tool to create the new item from hiddenapi lists and insert it into the given dex file, (c) dexlayout to copy the flags into compact dex, (d) dex file verifier to verify the item. It also removes skipping of verification for boot class path dex files as those now pass DexFileVerifier, and removes the need for removing the flags for JVMTI. The size increase is 450 KB. This reverts commit d9a0437b0d6cb1438bf21284a2502cbfe293db06. Test: phone boots Test: m test-art Change-Id: I224bf1b587529f36ea00a666680c4e4c8ca16a42
* Revert "Add dex item for hiddenapi flags"David Brazdil2018-10-241-46/+3
| | | | | | | | This reverts commit 0dbc363f32d075017e1c4fb5e17715e3f12d0157. Reason for revert: marlin running out of space Change-Id: I80218af6408812b639b7c807bf8cb2a1d5239d94
* Add dex item for hiddenapi flagsDavid Brazdil2018-10-231-3/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move hiddenapi access flags to own data section so as to: (a) increase amount of information stored per method/field (b) use encoding which can be supported long-term. The dex item is implemented as: - array of offsets indexed by class def index - streams of uleb-128 encoded flags. Offsets in array point to the beginning of the flags stream for the given class def. Flags are encoded in the same order as fields and methods are encoded in class data. Zero offset means that the class either does not have class data, or all of its flags are zero. The patch updates: (a) libdexfile with data structure declarations and accessor methods, (b) hiddenapi tool to create the new item from hiddenapi lists and insert it into the given dex file, (c) dexlayout to copy the flags into compact dex, (d) dex file verifier to verify the item. It also removes skipping of verification for boot class path dex files as those now pass DexFileVerifier, and removes the need for removing the flags for JVMTI. The size increase is 450 KB. Test: phone boots Test: m test-art Change-Id: Idec301db540cf164fccc97136d1df4abb8f758bd
* ART: Add Size() to CollectionMapAndreas Gampe2018-09-071-0/+2
| | | | | | | | | Add a Size() override. Make base function pure to avoid future errors. Fixes clang-tidy's bugprone-virtual-near-miss. Bug: 32619234 Test: mmma art Change-Id: I4112ea4d652a39a6b18712fb649823f086dd5b38
* Remove superfluous 'virtual' specifiers in ART.Roland Levillain2018-08-281-1/+1
| | | | | | | | Remove 'virtual' specifier on methods already bearing the 'override' specifier. Test: mmma art Change-Id: I114930969a5ca048d88de9ecd18e2c6403593e31
* Use 'final' and 'override' specifiers directly in ART.Roland Levillain2018-08-281-1/+1
| | | | | | | | | | | | | | | Remove all uses of macros 'FINAL' and 'OVERRIDE' and replace them with 'final' and 'override' specifiers. Remove all definitions of these macros as well, which were located in these files: - libartbase/base/macros.h - test/913-heaps/heaps.cc - test/ti-agent/ti_macros.h ART is now using C++14; the 'final' and 'override' specifiers have been introduced in C++11. Test: mmma art Change-Id: I256c7758155a71a2940ef2574925a44076feeebf
* Move dex_file_verifier_test and dexlayout to ClassAccessorMathieu Chartier2018-08-011-26/+34
| | | | | | | Bug: 79758018 Test: test-art-host Change-Id: I01d53eaf45d28fd762800c2716d6bf2dd3c9ad9e
* Refactor ownership in dex_irDavid Sehr2018-06-151-53/+1057
| | | | | | | | | | | Remove some unnecessary generality, consolidating and simplifying the interface to Header and moving all the construction code out of dex_ir. This makes item ownership exclusively controlled by the collections themselves, preparing for in-place construction. Bug: 33017139 Test: make -j 40 test-art-host-gtest Change-Id: Ice461ae89ef9f8bed3350780e8dd6283bc6eca1b
* Use factory pattern for dex_ir objectsDavid Sehr2018-06-131-1/+8
| | | | | | | | | In preparation for memory improvements, make dex_ir API more friendly to pre-allocated or in-place type allocation. Bug: 33017139 Test: make -j 50 test-art-host Change-Id: I09b67e279a04535b175433287ce98ecbdc37f7a3
* Add dexlayout class filteringMathieu Chartier2018-01-261-5/+24
| | | | | | | | | | | For fixed_up_dexfile, the returned dex only needs to contain a single class. This CL adds filtering during IR creation to only contain that class. This speeds up wifi tests from 25s to 15s on marlin. Bug: 63756964 Bug: 72064989 Test: mm test-art-host-gtest-dexlayout_test -j64 Change-Id: I3648ac886b377d95e33e5b40a63a34c2a9dbde58
* Add shared separate data section for compact dexMathieu Chartier2018-01-241-4/+3
| | | | | | | | | | | | | | | | | Added a shared dex data buffer for compact dex files, this buffer is referenced by all compact dex files in a vdex file. Repurposed the existing data_off / data_size fields in the header. After the shared buffer is filled up, it is placed after the dex files in the oat writer and the dex file headers are fixed up to have the correct offsets / sizes to the shared buffer. Motivation: Make it easy to deduplicate data across dexes. Bug: 63756964 Test: test-art-host Change-Id: I17855a0c78b20be3d323d12dedb9c695962be3ed
* Fix default method verifier check for compact dexMathieu Chartier2018-01-021-1/+2
| | | | | | | | | | | | | | | | | | Add a feature flag and mark if the compact dex file was generated from a dex file that supported default methods or not. This is done to maintain the existing verifier behavior differences for dex files that do and don't support default methods. Fixed callers to use a virtual function instead of always checking the dex file version. Re-enabled run-test 975. Bug: 70930171 Bug: 63756964 Test: test-art-host Change-Id: I46ac5d3cde0d0c9f41cbc68cccaf954b531e0edf
* Write link data for dexlayoutMathieu Chartier2017-11-201-0/+5
| | | | | | | | | | | | | Instead of not writing out the link data and leaving an invalid link_offset, write it out. Fixes dex verifier failures for a few APKs. Added test. Test: test-art-host Bug: 69561363 Change-Id: Iec1c331f74f9fd58658d4c13465a3bcb6295ce24
* Add logic for calculating offsets during writingMathieu Chartier2017-11-201-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Delete all the offset related layout logic, move the logic to writing. Layout is now controlled by changing the order of the data vectors. Calculate all offsets during writing instead of reading. This allows more flexible layout optimizations without needing to be as careful about offsets in other sections changing. Maintained logic for using existing offsets in the case where changing the layout is not required. Areas to improve: How to size the memmap, do we want 2 passes? Currently the algorithm reserves 10% extra space in case required. This is sufficient for top 1000 apps in the play store. Will consider a two pass approach later. Bug: 63756964 Bug: 68948395 Bug: 68867570 Bug: 68864106 Bug: 68864168 Test: test/testrunner/testrunner.py --host -j40 Test: test-art-host-gtest Test: Dexlayout speed profile top 1000 apps Change-Id: I7dee869da3a010559547f8cfdf93e9aa4c3f47ff
* Re-enable dex verifier after dexlayoutMathieu Chartier2017-10-261-0/+1
| | | | | | | | | | | | | | | | | | | | | Disabled class def ordering since it violates the spec regarding superclasses occurring before subclasses. This fixes a dex verifier failure. Adjust the data section size based on string data and code item diff. This fixes dex2oat_image_test failing dex file verification. Fixed handling of unreference annotations. Previously, these would not get written back out. This resulted the dex file verifier prematurely ending for annotations during CheckIntraSectionIterate and then complaining about non zero padding (that was actually an annotation). Test: test-art-host Bug: 63756964 Bug: 68208404 Change-Id: Id2b9b360640c360ac562826e9193971f7bb30eea
* Add dexlayout support for call sites and method handles.Jeff Hao2017-05-041-0/+10
| | | | | | | | | | | Tested that it works with Orion's test dex files. Can generate output files that match the test input files. Unit tests to follow. Bug: 37732062 Test: mm test-art-host Change-Id: Icb76cf858d29e52022f98ac625bd35c3bd763e9f
* Dexlayout cleanup and refactoring.Jeff Hao2016-11-221-1/+1
| | | | | | | | | Created option to output to a mem map in preparation of hooking dexlayout into dex2oat. Test: mm test-art-host-gtest-dexlayout_test Bug: 29921113 Change-Id: Id42ef15cb8f83cc8d05b025b7647a4338e9b96b0
* Revert "Revert "Add dex file writer to dexlayout tool.""Jeff Hao2016-10-041-5/+7
| | | | | | | | | | | | This reverts commit fd1a6c2a08ca3e2476b7424b9b0fa58e73b29e87. Fixed output being clobbered during DexLayoutTest.DexFileOutput. Option added to put dex output file in scratch directory. Bug: 29921113 Test: mm test-art-host-gtest-dexlayout_test Change-Id: I9e6b139cf06aaa39c83ad1e74329db266464a8e4
* Option to gnuplot dex layoutDavid Sehr2016-10-041-0/+81
| | | | | | | | | | Display the portions of the dex file that are accessed by the classes in the dex file. Optionally limit the display to only those classes that are present in a runtime profile. Bug: 29921113 Change-Id: I2a998fba448fec6c23941d3b4358531b1336e1b3 Test: dexlayout test
* Revert "Add dex file writer to dexlayout tool."Nicolas Geoffray2016-10-041-2/+0
| | | | | | | | Bug: 29921113 This reverts commit 69b58cf399c3507ca3debf9ec9b2db3c5a0fe7f2. Change-Id: I8bf9b1222d99489059e45f47d220396a853170a4
* Add dex file writer to dexlayout tool.Jeff Hao2016-10-031-0/+2
| | | | | | | | | | All sections are being written out properly. There is one small difference: - unindexed string data is not written out Bug: 29921113 Test: mm test-art-host-gtest-dexlayout_test Change-Id: I3872327526a350f33f0f851516a389622c1a54ae
* Dexlayout changes to support offset/size output of items.Jeff Hao2016-09-191-444/+13
| | | | | | | | | | | | | | | - Created offset & size fields for items, initially populated with values from original dex file. - Created index field for indexed items in header. - Created Item objects for StringData and TypeList. - Created Collections container to hold unique_ptrs for all objects - Reorganized EncodedArrayItems to make it easier to collect them - Added relevant annotations-related items to Collections - Some size calculations and section offsets left as TODO Bug: 29921113 Test: mm test-art-host-gtest-dexlayout_test Change-Id: Id812f104c1930a3ee381e885f353a9a49f29ac9b
* Fix some memory leaks found by valgrind.David Sehr2016-09-071-27/+27
| | | | | | Bug: 29921113 Change-Id: If70d475a3317751d206658c5794a32d78bc33e47 Test: valgrind-test-art-host-gtest (with --trace-children=yes)
* Separate DexIr building from constructors.David Sehr2016-09-061-0/+507
Move all the construction from DexFile out of the constructors of the basic IR. Bug: 29921113 Change-Id: I3f79c104ce7183ddde73f143c047061416009a54 Test: test-art-host-gtest