History log of /libcore/dex/src/main/java/com/android/dex/Dex.java
Revision Date Author Comments
bbbb6e80422eba9770be7410ba2521e0dfe35606 03-Jun-2014 Jeff Hao <jeffhao@google.com> Workaround to tolerate void methods with non-zero parameters_off. - DO NOT MERGE

Bug: 15259852
Change-Id: Ibf5903b6a1c88fa6df4e5ef9c01351ab899df1f8
c5b2915ad8865cc1907217e4b3dfdb838c3c843d 31-Mar-2014 Neil Fuller <nfuller@google.com> Fix a copy and paste doc error

Change-Id: I2a142f0a6e8348993b37666876d4f812a7e69986
08da684abe6d5515a9c760a3a33af4f8b426095d 26-Mar-2014 Neil Fuller <nfuller@google.com> Improve the performance of Annotation checks

In the circumstance where the annotated element (field/
method/constructor/class) was loaded from a different Dex file
than the annotation:

The previous code would perform a binary
search to determine the type ID of the annotation in the Dex
file of the annotated element. That type ID would then be
compared against the type IDs of annotations present on the
annotated element. The binary search was quite expensive: it
involved various indirections, many small native method calls
and temporary String creation.

Instead, the code now compares the names of the
annotations on the annotated element with the name of the
annotation being searched for. The name of the annotation
is known and cached on the class and is therefore cheap to
get. The name was previously being used to binary search for
the type ID so this appears to be no less correct.

Also removed some unused methods in order to delete the
getFieldIndex() method.

Change-Id: Ib8fb021ddf1221e3eac983aa87e7aea8174720ef
a6e22fc9b70ebe39abd716ce37450bda935c0fb8 19-Sep-2013 Ian Rogers <irogers@google.com> Avoid computing class def indices.

Bug: 10244719
Also tidy AnnotationAccess.

(cherry-picked from 8b2c0b9abc3f520495f4387ea040132ba85cae69)
Change-Id: I6ec8fd4e36b428d7e16e01d98b7bebc143fac8c3

Conflicts:
libdvm/src/main/java/java/lang/Class.java
d4ec55c4e1acc3c3df937facbd367aff6618536c 07-Sep-2013 Ian Rogers <irogers@google.com> Lazier annotation signature parsing.

Bug: 10244719.
Also, make wider use of empty arrays.
Also, use named inner classes to aid profiling.
Remove caching as the empty result will be fast.
Porting the ART changes to DVM, to avoid the caching, results in bringing
in a bunch of other ART clean-up.
TODO, avoid modified-UTF8 to String conversions by Dex.

Change-Id: I051b6e34b5a4e7a7f1383461a799755947a5ba36

Conflicts:
libdvm/src/main/java/java/lang/Class.java
d3e311496e0b08acd959c3ffa31d9930a71bae19 24-Jul-2013 Ian Rogers <irogers@google.com> Improve the performance of reflective operations.

Common dex index lookups require a number of different types to be constructed,
implement short-cuts that avoid the intermediate data types.
Refactor reflective operations to use dex methods that don't require temporary
objects.
Note: this change adds an empty short array to Dex, this code can't appear in
libcore.util as Dex doesn't always come with libcore.util.

Bug: 9968234

(cherry picked from commit 381db8de0ac5df124c7f482bf4be9d5756bf3ca4)

Change-Id: I9122a3f01b4f41b07a84aff768193c092e29698c
00a2d1ee4cfee1f33344c3798940bbae22f96187 05-Sep-2012 Benoit Lamarche <benoitlamarche@google.com> Fix an ugly bug where try/catch offsets weren't being mapped properly

This CL comes from CL I3bdadf20899fdb5d4d074e69103b33c0404a31f8 in AOSP master.
Modifications have been made to files that were in dalvik but are now in libcore.
Here is the original commit message:

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.

Change-Id: I61adb8fce6fa9b83cbfbe5eef7edea84664d7ea6
(cherry picked from commit b44450d600807ab130aa7c6d91b534fde52e0a21)
dc5a528c10462726682b8f490772e0677b038c1f 08-Jun-2012 Elliott Hughes <enh@google.com> *libcore* resolved conflicts for merge of bc23c4f3 to dalvik-dev

DexBuffer became Dex, and moved to libcore.

Change-Id: I32447f83c03dd18f2339e879d015134be9f4fc18
(cherry picked from commit 621d004d61b3eaca74fc045a3fba6afa14327a2e)
0436f436f122e7e74285faf32b8db2259f56ded7 28-Mar-2012 Jesse Wilson <jessewilson@google.com> Manually merge "Compact merged dexes on their byte aligned size"

The changed file was moved from dalvik/ to libcore/ in this branch.

See https://android-review.googlesource.com/34010

Change-Id: I9b2fae8767fb4e7461e9b762e70efb4171e7a9f5
(cherry picked from commit 20d13d20f6b8d4094d4d66bb692ac19c4b81348f)
a34f79ba9d4983b96571bbde0a18d352d495f601 06-Oct-2011 Jesse Wilson <jessewilson@google.com> Make Dex access faster by making binarySearch work.

Change-Id: I5f506ef2cd73c2f88f395ad1e1200d79ed33f654
(cherry picked from commit 8cf91498080408179f1b96ae832b581b8547d7c4)
450a197f09d35a07be12a924d4db1ecd2bee65fe 30-Apr-2013 Brian Carlstrom <bdc@google.com> Remove redundant alignToFourBytes in favor of alignToFourBytesWithZeroFill

(cherry picked from commit d2301a66b2629f2841ab3a3cc7684a645ebe7217)

Change-Id: I32522d86950d0c1a89e77b44ddeab071ce9c021a
df60589435658db76be61708bfa66515ffba40af 30-Apr-2013 Brian Carlstrom <bdc@google.com> Fix Dex.create(ByteBuffer) to not allocate a byte[] to check magic

(cherry picked from commit 34c119762d55411ec2451b38f4782b923217aa2c)

Change-Id: I968762e1962fb720bbcf0c2866f17cd0500a9e54
030bd62e38ba41b8f464f009382955c51bd72f04 19-Sep-2011 Jesse Wilson <jessewilson@google.com> Switch Dex from byte[] to ByteBuffer for backing store.

The ByteBuffer allows Dex to share the mapped data with
Class.getDex().

This also changes Dex.Section to use a ByteBuffer; that
ByteBuffer's position and limit are used instead of a
separate pair of integers.

Change-Id: I2b8042a493f70213c30e5c26e0bacfb03daebf55
(cherry picked from commit 59653899ed7cbca17f5a3dd32a23e81b3c4a5339)
c69e85bfb7ddd6c4b0023ca29eeb0416087f9a8b 30-Apr-2013 Brian Carlstrom <bdc@google.com> Add Dex.create(ByteBuffer)

(cherry picked from commit aca7a4ba7597be831164d94d787f383b8d4ac2fd)

Change-Id: Id517f2ccda31a20e28fe63005120e4e975935980
2bea5ee615b0f4add658d5660bd81c5145a0d05e 18-Sep-2011 Jesse Wilson <jessewilson@google.com> Move dex utilities from dalvik/dx to libcore/dex part 2

Change-Id: Ib5bb7bec80d77464f632f1cdfef708d868301c42
(cherry picked from commit 9ae95d8f3381204108abc722e8e5a03d6ecbf311)