summaryrefslogtreecommitdiffstats
path: root/dx/src/com/android/dx
Commit message (Collapse)AuthorAgeFilesLines
* Fix dx test 034.Jean-Marie Henaff2014-02-021-1/+1
| | | | | | | | | | - Test 034 requires that a dex file is dumped in a human readable form even if the dex file does not contain ClassDef. Consequently, the command line behavior is modified to satisfy this requirement. (cherry-pick from commit 64f4aad1e6ef58b29f860b59512ca1a676ac6eb8) Change-Id: Id64b563745db2b22ec98fba9be25413192c07719
* Remove code related to extended-opcode.Jean-Marie Henaff2014-02-024-49/+6
| | | | | | | | - This support was removed one year ago. (cherry-pick from commit 18b65cbb3ec6634618bd3240a692507432e634b5) Change-Id: I1154e518dc8a15220f2fcb163056570030492bb0
* Fix synchronization when preparing ids.Yohann Roussel2013-12-204-23/+19
| | | | | | | | | | | Synchronized blocks were using different locks. Replaced by a safer version: marking intern method synchronized. This means synchronizing more than necessary but it had no mesurable perfomance impact. Bug 11744785 Change-Id: I35e691232cd6971d13735be9b72969739ef71e09
* Make a more verbose too many id error message.Yohann Roussel2013-08-283-8/+50
| | | | | | | | | | | This restores the old message, replacing "ids" by "references" and advertising for multidex otpions. Updates dalvik/tests/089-many-methods accordingly. (cherry picked from commit d352de04f03b848e0246119344ea13e7233018f0) Change-Id: I5934bc9fb7812b66c0e38935946cacdf1c35a402
* Increment dx version to 1.8Yohann Roussel2013-08-281-1/+1
| | | | | | (cherry picked from commit 39bcbf75923303d209b7e6640590cd7f5eaaa65a) Change-Id: Iaddb2020b75f2bbba2e2ebda3a4465a890e361ca
* Fix 2 filtering problems in multi dex + main list.Yohann Roussel2013-08-282-13/+18
| | | | | | | | | | | - Classes in archives were added in all dexes. - Adding resources could be done twice in non "strictNameCheck" mode (when using BestEffortMainDexListFilter) if there was 2 secondary dex. (cherry picked from commit ad27e19691c6723a801b127f8802f5cdf4f44359) Change-Id: I5cbc1b273518e868fdd3d642d50488ddcbec2af6
* Introduce --multi-dex option in dx.Benoit Lamarche2013-08-289-103/+514
| | | | | | | | | | | | | | | Add --multi-dex options to dx command line to allow the generation of several dex files when method index limit is about to be reached. Also add --main-dex-list allowing to force some classes in the main dex. --minimal-main-dex to keep in main edx only classes specified by main-dex-list. --set-max-idx-number to set an arbitrary idx limit for the splitting. (cherry picked from commit c7daf656da3a4854296b6a8bb702e3ee418450e5) Change-Id: I2b42272be91484a75783eb94cd30581159948975
* If dalvik wants ASCII casing, it needs to ask for it.Elliott Hughes2013-08-021-4/+4
| | | | | | | http://elliotth.blogspot.com/2012/01/beware-convenience-methods.html Bug: https://code.google.com/p/android/issues/detail?id=58359 Change-Id: I1601cda215ebc5995117323e40a684ad352fe733
* Merge "Added support for version 51 class files in dx"Jean-Philippe Lesot2013-05-175-35/+75
|\
| * Added support for version 51 class files in dxdelphinemartin2013-05-165-35/+75
| | | | | | | | | | | | | | | | If an invokedynamic is present, an exception is thrown. (cherry picked from commit 94629f2a31206637fc79535ffef1b223e9f02e30) Change-Id: I1922d4cf78465dfd2ac53f8694b7317a1d98016d
* | Report problems as errors in dx (with exit codes)delphinemartin2013-05-161-13/+3
|/ | | | | | (cherry picked from commit 593a7233e13d6eeb8ae5d894e29c6a27cbc7b7f0) Change-Id: I6421f95ceb97a596a19781e46cb4767bfb21cdbd
* Fix alignment when recompacting a DexMerger result.yroussel2013-05-041-0/+1
| | | | | | (cherry picked from commit a659fe6f8a0b7d32eafc9a2ff7aa1387702da053) Change-Id: I7c93e7d45b52655cd7adfdc3fc783757ee71079b
* Use zero filled alignment padding before method codeJesse Wilson2013-05-041-1/+1
| | | | | | (cherry picked from commit d8760772c49647ab197c34b8e46438c410decb42) Change-Id: I092ff646b02abf7b3ee6285361e4e256c1ade37d
* Allow the merging of more than 2 dex file at a time.yroussel2013-05-031-6/+9
| | | | | | (cherry picked from commit f9f7020a0a181ffba3bb9ed123f5bb211a61738e) Change-Id: I2dd875399c2d30d214b6a025ffea995155ff48c1
* Fix bug on register compatibility.mikaelpeltier2013-05-031-2/+26
| | | | | | | | - Bad register usage to compute prefix or suffix expansion. (cherry picked from commit 5bce02865087b7ec3c6321a1bef9542c18b0f90e) Change-Id: Ife9b2b07870bbc933f959c194a4a72dfa9507cfb
* Switch Dex from byte[] to ByteBuffer for backing store. Part 2.Jesse Wilson2013-04-302-97/+39
| | | | | | | | Change-Id: Ifd3672027d075b6c9f8df208a04bc33122c883af (cherry picked from commit f8357511efd16d76ce4410459c15dbb08b0140b6) Conflicts: dx/src/com/android/dx/merge/DexMerger.java
* Mechanical refactoring of dx into two parts.Jesse Wilson2013-04-30190-3573/+408
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This splits off a new package, com.android.dex that contains code for parsing and modelling dex files. This code is usable both at build time (for compilation and analysis) and at runtime (for introspection). The original package, com.android.dx is the tool that compiles .class files into .dex files. That package also includes utilities for merging and querying dex files, all visible to the dx command line application. In a follow up change I'll move the new com.android.dex package into the libcore/ project, and configure build rules so that it's included in both dx.jar and core.jar. The core.jar will then be able to use it for annotation processing. Change-Id: I3c58cf87e728e4dda1925a0992c1ee7b8130e81a (cherry picked from commit bab4abb07335d162ecdb8091fc395cf84803a580) Conflicts: dx/junit-tests/com/android/dx/util/BitIntSetTest.java dx/junit-tests/com/android/dx/util/BitsTest.java dx/junit-tests/com/android/dx/util/IntListTest.java dx/junit-tests/com/android/dx/util/ListIntSetTest.java dx/src/com/android/dex/Dex.java dx/src/com/android/dex/TableOfContents.java dx/src/com/android/dx/annotations/AnnotationAccess.java dx/src/com/android/dx/command/Main.java dx/src/com/android/dx/dex/code/OutputFinisher.java dx/src/com/android/dx/dex/code/form/Form32s.java dx/src/com/android/dx/dex/code/form/Form33x.java dx/src/com/android/dx/dex/code/form/Form41c.java dx/src/com/android/dx/dex/code/form/Form52c.java dx/src/com/android/dx/gen/DexGenerator.java dx/src/com/android/dx/merge/DexMerger.java
* Change com.android.dx.io.Annotation to use EncodedValueBrian Carlstrom2013-04-294-82/+47
| | | | | | (cherry picked from commit 4ec022b0b6c84f994ab2fc78934110ad96d0bdec) Change-Id: Ia420b7661f372c59af8fe62bdab7982a1d2b008f
* Teach dex how to parse encoded values from .dex files.Jesse Wilson2013-04-296-251/+492
| | | | | | | | | | | | | | | | | | Previously primitive values were treated as opaque byte arrays. Now the encoded values can be interpreted as their proper types: integers, indices, floats, chars, etc. This gets complicated pretty fast due to the dense packing dx performs when encoding the values. The encoding code is moved from ValueEncoder. The decoding code is ported from C++ to Java from Annotation.cpp. There's a bunch of new tests to make sure the decoding is correct; porting from C++ to Java was tricky because of the '>>' shifts on unsigned values. The test input data is generated by dex! Change-Id: I83b2fc3e16115d667fa94b3dab782d1a9687f3ad (cherry picked from commit 27847605b9255358f0577ffec28886c450263898)
* Don't duplicate annotation set ref lists when merging.jwilson2013-04-052-14/+45
| | | | | | | See exception reported on this thread: https://groups.google.com/d/msg/android-contrib/h0sDMo5DVBI/MAMiBv5XR44J Change-Id: I867a8d2328b32625e5baa0b029f55e373fe11271
* Fail if the new index is out of range.jwilson2012-12-171-0/+12
| | | | | | | | We were silently truncating, which made an obvious problem into a non-obvious one. Bug: http://code.google.com/p/android/issues/detail?id=40409 Change-Id: I15576357c72ac0e98cf85c0a1d289fd5009468f9
* Add dx option to always generate const-string/jumbo.do not merge.jeffhao2012-11-095-9/+32
| | | | | | | | This allows large dex files with many strings to be merged properly. (cherry picked from commit 266f45ff7da18022faf5f77df76c69f8cdad313f) Change-Id: I5fe4c55d84a91101a4f89f590117aa6dc0bfc0f2
* Merge "Fix an ugly bug where try/catch offsets weren't being mapped properly."Jean-Philippe Lesot2012-09-054-32/+116
|\
| * Fix an ugly bug where try/catch offsets weren't being mapped properly.Jesse Wilson2012-09-014-32/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In dex files, there are several places where one object refers to another object by its position in the file. The dex merger is generally very careful to adjust these mappings when combining dex files. Unfortunately one of these cases was broken. Each try_item refers to a corresponding encoded_catch_handler by its byte offset in a list. Most of the time this byte offset is the same in the input dex file and the output dex file. But encoded_catch_handlers are variable-length because they use a variable-length uleb128 encoding to address the type_idx being caught. When dex files are merged, some exception types may go from having a small index to having a large index, increasing the number of bytes required to encode that index. This breaks our ability to directly copy over offsets as we were doing previously. Bug: http://code.google.com/p/android/issues/detail?id=36490 Change-Id: I3bdadf20899fdb5d4d074e69103b33c0404a31f8
* | Fix a bug where the max blowup of annotations was incorrect.Jesse Wilson2012-09-011-2/+2
|/ | | | | | | | | | | I'm not sure where the 1.34 number comes from but it's incorrect. From the spec, the encoded_annotation is made up of a single byte plus an unlimited number of uleb128 values. Each of these values can double in width in the worst case. I received (personal) email from one user who'd run into a case worse than the incorrect 1.34 limit. Change-Id: I3b676e6d2b274aaa538ca61ce23945b3d49aff04
* Merge "Correctly handle switches on values in a high register"Jean-Philippe Lesot2012-08-283-2/+59
|\
| * Correctly handle switches on values in a high registerBen Gruver2012-08-223-2/+59
| | | | | | | | | | | | | | | | | | | | When dx generates a switch on a value in a high register, it prepends a move instruction, to move the value to a low register. However, this causes the switch data pseudo-instruction to use address of the move instruction as the base address of the switch targets, rather than the address of the switch instruction Change-Id: I0708d35ec3059c30221cd0a64f426244411d31ea
* | Fix a bug where debugInfos' size wasn't being computed.Jesse Wilson2012-08-221-2/+1
|/ | | | | | | | Previously debugInfos' size of 0 caused a malformed dex file because debug data was present but not mentioned in the table of contents. Change-Id: I07171aaee12fef9f303fc505909f44ef1a714114
* am effc95cb: Merge "Make dex merging stateless."Elliott Hughes2012-06-111-0/+4
|\ | | | | | | | | * commit 'effc95cb732d8d5453930e647240a1665b6dc71a': Make dex merging stateless.
| * Make dex merging stateless.Xavier Ducrohet2012-06-111-0/+4
| | | | | | | | | | | | | | | | | | This is required to run dx in Eclipse which doesn't unload the dx library after each run. (cherry-pick of 7aa5ce7e990dc3766eba97cd0932b62e4de21503.) Change-Id: I7a69a3015d448ddd5558c307cd01346156cbc739
* | am a9ac3a9d: Merge "Support debug info in dexmerge."Elliott Hughes2012-06-112-4/+99
|\| | | | | | | | | * commit 'a9ac3a9d1f8de71bcdc39d1f4827c04a952a0c29': Support debug info in dexmerge.
| * Support debug info in dexmerge.Elliott Hughes2012-06-112-4/+99
| | | | | | | | | | | | | | | | | | Bug: 4090053 (cherry-pick of bc23c4f3ebaefebb3f1be7732767631f91e165ea.) Change-Id: I1108933fc03330ff91be3a2edef8b4966977dcd7 Signed-off-by: Jesse Wilson <jesse@swank.ca>
* | am 92ab8d50: am 531f7273: am 54ff31a5: Merge "Compact merged dexes on their ↵Elliott Hughes2012-03-272-26/+25
|\| | | | | | | | | | | | | byte aligned size" * commit '92ab8d5069c51de75903a5b4768d4d94563bceb1': Compact merged dexes on their byte aligned size
| * Compact merged dexes on their byte aligned sizeCharlie Groves2012-03-102-26/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, if a merged dex had too much free space, the compaction step would subtract the unused space from the section sizes generated by adding the merged dexes section sizes. The merged sizes weren't 4-byte aligned, which meant if a section had been bumped in size for the boundary, the compaction would fail when loading into a section eg 'Section limit 3665072 exceeded by string data'. This gets the compacted section size from the actual used space instead of from the non-aligned estimate, so everything fits. Change-Id: I1aee1abd721ec21998bb3ea78f6f424e7421b614
* | Transform static values eagerly rather than on use.Jesse Wilson2012-03-263-10/+36
| | | | | | | | | | | | | | | | Apparently there is some situations where a single static value may be referenced by multiple sites. Not transforming them eagerly lead to oversized dex files (and could crash the merge). Change-Id: I4ac5b9cd621b0fff1e5ba247c9590aa0d562cd65
* | Provide detail when methods or fields exceed the limit.Jesse Wilson2012-01-122-4/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Here's what the new message looks like: trouble writing output: Too many fields: 88304; max is 65536. By package: 10 dalvik.annotation 278 dalvik.bytecode 81 dalvik.system 94 dalvik.system.profiler 111 java.awt.font 12 java.beans 322 java.io 519 java.lang 20 java.lang.annotation 13 java.lang.ref 72 java.lang.reflect 72 java.math ... Change-Id: Ieea7efb178522d9ac3cb10c5a6cfb453be3fd72d
* | Remove unsupported experimental opcodes.Elliott Hughes2012-01-0511-1191/+42
| | | | | | | | | | | | | | External developers were starting to try to get themselves into trouble with this stuff... Change-Id: I2b03bfeaa8c98b6a994bc7924fc8dcf4e4d4f6cb
* | Remove dexmaker code from dx.Jesse Wilson2012-01-0413-2350/+0
| | | | | | | | | | | | | | This now lives as a standalone project: http://code.google.com/p/dexmaker/ Change-Id: I4f7abff9399d6827082c9af78a015562fdbcdbb3
* | Introduces ProxyBuilder and tests.Hugo Hudson2011-12-213-1/+698
| | | | | | | | | | | | | | | | | | | | | | | | | | - ProxyBuilder is to concrete classes what java.lang.reflect.Proxy is to interfaces. - Uses a builder pattern to make specifying of the various (optional) parameters easier. - Creates a concrete subclass of the supplied input class whose implementation delegates to the given invocation handler. - Also provides a fix for the Code#loadConstant method to allow loading null values. Change-Id: I3ca6a98b91c64466df03120bc85f095365250aca
* | Merge "DexGenerator: allow specifying dex cache dir."Hugo Hudson2011-12-161-8/+30
|\ \
| * | DexGenerator: allow specifying dex cache dir.Hugo Hudson2011-12-161-8/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Switches DexGenerator to not use extended opcodes. This allows us to write suitable files for earlier versions of Android. - Allows caller to specify optimised dex directory. This allows us to get around /data/dalvik-cache not being world-writeable. - Allows caller to specify optimised dex files cache dir. This allows us to skip the requirement of being able to write to /sdcard. Change-Id: I2cae2e187ccf5b20b98763cb7eb791383a7d5a59
* | | DexOptions should default targetApiLevel to API_NO_EXTENDED_OPCODESBrian Carlstrom2011-12-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Bug: 5738782 (cherry picked from commit b14b69728337cf5808eed4d5652fb9d5be33dff0) Change-Id: I51991c85c74b41fa51556b369a3724ba9dd0c090
* | | Merge "Don't throw an AssertionError on invalid input."Jesse Wilson2011-12-131-2/+1
|\ \ \
| * | | Don't throw an AssertionError on invalid input.Jesse Wilson2011-12-131-2/+1
| |/ / | | | | | | | | | | | | | | | | | | | | | Throwing an AssertionError prevents tools like FindUsages from recovering. Bug: http://b/5470168 Change-Id: I6ae99bd29e25f868a739548266cedf85d0b26e90
* / / Remove dx's copy of JUnit.Jesse Wilson2011-12-096-876/+0
|/ / | | | | | | | | | | | | | | | | | | | | | | | | Instead, use JUnit the same way other code uses JUnit: by depending on the copy in external. There is no longer a top-level option in dx to run JUnit tests on itself. There are two failing tests in dx/junit-tests. Both of these are in the recently created DexGeneratorTest; I intend to fix these in another change. Bug: http://b/2286423 Change-Id: I3a173a0302c7ccc81be3b5a2a4d766000d1c242b
* | Fix DexMerger to emit dex files without extended op codes.Jesse Wilson2011-11-181-2/+2
| | | | | | | | | | | | Certain tools in our tool chain don't like these. Change-Id: Iaaff85c1b634f647d0105c36f403b2e03aaf0ca7
* | Be humane when there are more methods or fields than Dalvik can handle.Jesse Wilson2011-11-171-0/+11
|/ | | | | | | | | | | | | | Previously our errors would look like this: trouble writing output: opcode == null Or this: trouble writing output: No expanded opcode for 7f9c1af3 Now our errors look like this: trouble writing output: Too many methods: 86922; max is 65536 Bug: http://code.google.com/p/android/issues/detail?id=20814 Change-Id: I2d9dc55e188a6ac1661b74af2194b18019859a29
* Provide debugging info should extended opcode lookup fail.Jesse Wilson2011-10-191-1/+2
| | | | | Bug: http://code.google.com/p/android/issues/detail?id=20814 Change-Id: Iedaf07721c29dd3d24827c3f7a953b7371c9735d
* Merge "Dx reg allocator fix for accidental long/double clobbering."jeffhao2011-09-021-2/+4
|\
| * Dx reg allocator fix for accidental long/double clobbering.jeffhao2011-08-261-2/+4
| | | | | | | | | | | | Addresses this bug: http://b/issue?id=5215643. Change-Id: I82613c38b0a6247d071aa6c5cc90bf8b60d5d84b