158 Commits

Author SHA1 Message Date
Izzat Bahadirov
3d721348c5 Unit test for iterative goto embiggening and consequent payload re-alignment. 2013-03-25 19:06:07 -04:00
Izzat Bahadirov
dae24249f1 Fix for bug with incorrect removal of previously inserted alignment nop. 2013-03-25 19:04:39 -04:00
Izzat Bahadirov
c995fb5086 Unit tests for goto and goto/16 instructions embiggening. 2013-03-25 17:59:21 -04:00
Izzat Bahadirov
6e524ece32 Fix for incorrect goto/16 to goto/32 conversion. 2013-03-25 16:44:32 -04:00
Izzat Bahadirov
add494945d Unit tests for payload alignment. Also, typo correction. 2013-03-25 14:07:58 -04:00
Izzat Bahadirov
e7ab4b681b Unit tests for offset modification in SparseSwitchPayload and PackedSwitchPayload. 2013-03-25 13:14:14 -04:00
Izzat Bahadirov
8309057de3 Minor refactoring of simple unit tests, using the same test implementation for all branch target instructions. 2013-03-25 12:28:43 -04:00
Izzat Bahadirov
e05e01eee0 Simple unit tests for const-string to const-string/jumbo conversions, as well as target offset modifications for goto and branch target instructions. 2013-03-25 11:41:38 -04:00
Izzat Bahadirov
f598b96244 Proper opcode for const-string instruction modification prediction. 2013-03-25 11:39:22 -04:00
Izzat Bahadirov
5df16db108 Iterative logic to handle embiggening of goto instructions, when subsequent code shifts are inserted. Layout logic creates a HashMap of predicted instruction replacements and nop insertions to be used later in writing method, which is more cromulent solution than simply replicating the logic, given its iterativeness. 2013-03-21 11:25:12 -04:00
Izzat Bahadirov
15ae0affc4 Handling jumbo string conversions and consequent offset adjustments for branch target instructions and 4-byte alignment enforcement for payload instructions (by prepending them with nops). 2013-02-20 23:28:37 -05:00
Ben Gruver
7b89cbdf6b Add @Override annotation for some methods missing it in ImmutableMethod 2012-12-30 20:58:53 -08:00
Ben Gruver
d4b08e1b21 Move MethodReference.getParameters() to Method, and replace with getParameterTypes()
It's common that the caller only needs the parameter type info, and not the
name/annotation/etc, and retrieving just the parameter types can be implemented
more efficiently.
2012-12-30 20:58:13 -08:00
Ben Gruver
a70faf072b Fix an error when getting parameters on a method with no debug info 2012-12-30 16:03:23 -08:00
Ben Gruver
d521168155 Return correct value on first attempt to resolve synthetic accessor 2012-12-30 16:03:23 -08:00
Ben Gruver
0a9e289eb2 Cache the strings when reading a dex file 2012-12-30 13:47:04 -08:00
Ben Gruver
e29142d406 Fix AnnotationDirectoryPool comparisons 2012-12-29 23:06:20 -08:00
Ben Gruver
db5d398850 Write an encoded char as uint rather than int. 2012-12-29 18:45:48 -08:00
Ben Gruver
8045a499ff Fix how proto id items are sorted 2012-12-29 18:44:58 -08:00
Ben Gruver
0843bbe9c6 Add TODO reminder to add support for unknown opcodes 2012-12-29 18:12:57 -08:00
Izzat Bahadirov
ca6bcd56b6 Writing field_idx before proto_idx to satisfy dex spec. 2012-12-29 18:06:06 -08:00
Ben Gruver
5152315e25 Fix method sorting in AnnotationDirectoryPool 2012-12-29 14:51:07 -08:00
Ben Gruver
7d5439950f Fix various issues related to comparing method references. 2012-12-29 14:50:15 -08:00
Ben Gruver
3360e18c53 Fix AnnotationSetRefPool.getOffset 2012-12-29 11:44:52 -08:00
Ben Gruver
34cc1b7b82 Fix multiple minor issues with debug info generation 2012-12-28 23:00:21 -08:00
Ben Gruver
b64be8ba36 Make sure we write an even number of bytes for an array data instruction 2012-12-28 22:01:10 -08:00
Ben Gruver
e240310664 Fix how the code units are counted when writing a code_item 2012-12-28 21:16:22 -08:00
Ben Gruver
1e325b6134 Use the correct string for the local signature 2012-12-28 20:57:24 -08:00
Ben Gruver
710ef75b81 Write the parameter names as uleb128p1, in debug_info_item 2012-12-28 20:56:48 -08:00
Ben Gruver
b2ae115dd5 Fix how reference index is written in format 35c and 3rc 2012-12-28 20:10:43 -08:00
Ben Gruver
257fa2dfca Write the header for annotation and array encoded values 2012-12-28 19:42:28 -08:00
Ben Gruver
8721a614f5 Sort the method_id_items before writing them 2012-12-28 18:28:31 -08:00
Ben Gruver
3d0419c963 Track and seek to the current position in RandomAccessFileOutputStream 2012-12-28 17:40:46 -08:00
Izzat Bahadirov
b85cfe5cc8 Fix for incorrect map_item offset. 2012-12-28 17:22:35 -08:00
Izzat Bahadirov
b254a997b5 Fixed the count of map_items in map_list. 2012-12-28 17:22:35 -08:00
Izzat Bahadirov
0e3a7a36d1 Helper method to get map_item name. Useful when dumping stats. 2012-12-28 17:22:30 -08:00
Ben Gruver
7dff6ada5e Add tests for DexWriter (and fixes to DexWriter, to make said tests pass) 2012-12-28 16:37:41 -08:00
Ben Gruver
9a90c5560c Refactor DexWriter to write to a generic OutputStream 2012-12-28 16:28:35 -08:00
Izzat Bahadirov
9393c08e36 Using tempBuf when writing encoded floats and doubles. Otherwise, output dex file gets corrupted. 2012-12-27 19:19:38 -08:00
Izzat Bahadirov
fcd1286d41 Added support for getting dex file stats: checkum, signature, map. 2012-12-27 19:19:32 -08:00
Izzat Bahadirov
8aef982e0c Add support for writing header_item 2012-12-27 19:18:40 -08:00
Izzat Bahadirov
085cfce948 Add support for writing map_item 2012-12-27 19:18:34 -08:00
Izzat Bahadirov
e68daf22aa Add support for writing class_def_items and class_data 2012-12-26 20:40:35 -08:00
Izzat Bahadirov
f3c33259dd Add support for writing code_items 2012-12-26 20:24:25 -08:00
Izzat Bahadirov
56c7adde03 ExceptionHandlers are now stored in a List rather than a Set. Order matters. 2012-12-26 20:18:15 -08:00
Izzat Bahadirov
03411559cf Setting an index in iterator correctly. 2012-12-26 20:18:15 -08:00
Ben Gruver
3952733b85 Return an offset of 0 for an empty annotation directory item 2012-12-11 23:37:24 -08:00
Ben Gruver
280b97e995 Add support for writing debug_info_items 2012-11-18 19:00:22 -08:00
Ben Gruver
4ffbfa2e71 Initial commit of writer functionality
It's not fully functional yet, but the structure is there, and it's
got most item types
2012-11-18 14:33:32 -08:00
Ben Gruver
22c3185bb7 Major cleanup of the interface and library in general 2012-11-17 17:51:36 -08:00