History log of /dalvik/libdex/
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
0e2282bc5a58c5778d6c13d15445cea95adb9e37 04-Jun-2014 Ian Rogers <irogers@google.com> Merge "Clean-up some compiler warning messages."
7d765f1d167ad205040e588f339ee057ba83b9cc 29-May-2014 Brian Carlstrom <bdc@google.com> Fix Windows SDK build

Change-Id: Ia11ad288a165040e3895115632e1eebd5b8bb976
ptInvocation.cpp
cc54b98659bad043bb9d2ec5cf2c7456ccb9728d 28-May-2014 Brian Carlstrom <bdc@google.com> Add .../dalvik-cache/<isa> directory creation for art/run-test --dalvik support

Change-Id: Idcf995f1d4862a2984966d308ba45633ba687a81
ptInvocation.cpp
0f75403dcede6ef6c1e650921376101686e7ba17 24-May-2014 Ian Rogers <irogers@google.com> Clean-up some compiler warning messages.

Change-Id: I24522a57eaabedd4191856b80e5efe1b845be2fd
exFile.h
ysUtil.cpp
e4e5d8caab4869eaec8995e8e64e4fa7af914845 01-May-2014 Ian Rogers <irogers@google.com> Define kInstructionSet for x86-64 and arm64.

This fixes 64-bit host compilation of libdex.

Change-Id: I364b624e12620f844cc7bbaa08e679c8a529f87c
ptInvocation.cpp
44e824dd0836b5b2413b0464449db89972065de2 29-Apr-2014 Narayan Kamath <narayan@google.com> Track package manager changes for arch specific dexopt.

- Changes signature of isDexOptNeededInternal. No behavioural
changes are needed because dalvik only uses the first argument
to the function (the "name") and dexopt is architecture agnostic.

- Changes dexOptGenerateCacheFileName to place dex files under
/data/dalvik-cache/<instruction-set>. This allows us to avoid
needing dalvik specific logic in the package manager and installd.

(cherry picked from commit f752d041dac2cc8e26d03292ffec986a2bf905f9)

Change-Id: Ie31c9925269d6ac97d358ce49219557692704329
ptInvocation.cpp
93a264eba965b0c6072369a7001f8d8c647a73c3 22-Mar-2014 Colin Cross <ccross@android.com> dalvik: let 32-bit dalvik build on multilib targets

Set LOCAL_32_BIT_ONLY for all target modules
Use LOCAL_LDFLAGS_x86 instead of ifeq ($(TARGET_ARCH),x86)
Set dvm_arch to TARGET_2ND_ARCH instead of TARGET_ARCH on 64-bit
targets

This will allow "make checkbuild" to succeed on 64-bit platforms.

Change-Id: Idd51dda26b54855c0c8640f8fcfbf4274baf8845
ndroid.mk
1506726d9ccd8404b3af6c51173f637cc88aaffe 17-Dec-2013 Narayan Kamath <narayan@google.com> Fix a few bugs introduced by the move to zip_archive.

- mmap failures because the output file was opened with
O_WRONLY instead of O_RDWR

- In two instances, we were passing the wrong handle
to CloseArchive(ZipArchiveHandle). The issue is code
like this:

ZipArchiveHandle h;
OpenArchive(&h);
CloseArchive(&h);

This compiles, but isn't correct. ZipArchiveHandle is
a typedef for (void *) and the compiler won't complain
because void** is also void*. Some of this code was written
before the API was changed from CloseArchive(ZipArchiveHandle&)
to CloseArchie(ZipArchiveHandle) but continued to compile
even after the API change. I'll change the API in the follow up
to catch errors like this at compile time.

bug: 12173498
bug: 12176258
bug: 12178641

Change-Id: I71ac36654311f582b5ab633e1ed0d13e00053c84
mdUtils.cpp
39e8b7e287742ea1e1af58d6b25e12897cf66632 17-Dec-2013 Narayan Kamath <narayan@google.com> Revert "Revert "Use libziparchive for dalvik zip processing.""

This reverts commit 52dacd58ac8735ffdcd6bbe952586a38ad70e6a5.
ndroid.mk
mdUtils.cpp
ipArchive.cpp
ipArchive.h
0e216ea3225b896bc6b6bf02a2f80d2c89c6216e 20-Sep-2013 Jeff Hao <jeffhao@google.com> Merge "Ignore invalid access flags." into klp-dev
dfec26e7ded987620e5b8e2eb88c4b02d479fdca 19-Sep-2013 Kenny Root <kroot@google.com> Fix mac sdk build

Macs don't have off64_t and instead use loff_t. This is taken care of in
the Compat.h header from system/core. Include that.

Bug: 10424836
Change-Id: Ic892e1edfecab502159209d463394864370c5537
ipArchive.cpp
386a7f3314911c9250ec984092022ed634dfdb6d 19-Sep-2013 Kenny Root <kroot@google.com> Reconcile differences between zip implementations

Copy new behavior of ZipFileRO to dalvik's ZipArchive.cpp

Bug: 10424836
Change-Id: Ic0ce11281f7318abda9d3c8062a095186448d2a9
ipArchive.cpp
4b44ea2e3a8f5d5f30926095b0e5d803d406fbef 03-Aug-2013 Elliott Hughes <enh@google.com> Ignore invalid access flags.

Bug: 10134551
Change-Id: I9df8f7a2541e0c9bd2f9294a202fef2afce815f8
exSwapVerify.cpp
6f4dda18850d4b0676ebe964582eb637e0f70972 24-Jul-2013 Colin Cross <ccross@android.com> add static dependency on liblog

Change-Id: Id431382f0fc71ef126dd35e5949d5de2abe2b785
ndroid.mk
9275963e79d1625120db610b78c3a0812ebb2922 13-May-2013 Elliott Hughes <enh@google.com> Merge "Move verification of class access flags to libdex"
c2e9a5b2b70d69c027964c9a4d07a4bdf723dd36 08-May-2013 Ben Gruver <bgruv@google.com> Move verification of class access flags to libdex

Change-Id: I020a168cfff46e319b0bebb6c7477f0b4139c6de
exSwapVerify.cpp
dc7f63d94a9abf924a4d95cf6ba393ed43158f16 04-May-2013 Brian Carlstrom <bdc@google.com> Fix bad whitespace alignment from LOGW to ALOGW change

Change-Id: I8eba74b92976f433aff42e6c4461e3127e519d77
exSwapVerify.cpp
62018a643f77d597ca9b32bc2eb5b58b34fe6f46 04-May-2013 Brian Carlstrom <bdc@google.com> Remove unnecessary JNI_H_INCLUDE from LOCAL_C_INCLUDES

Change-Id: I463a62898e5dd8eb01d1dfbaf71f67d8e1b4e67c
ndroid.mk
bbe8cb53ab16b5c3ff2520ba2af4f2a4a5947a9d 17-Dec-2012 Elliott Hughes <enh@google.com> Remove dead code.

Change-Id: I56c27c510c8fc0ba2d8e691c788b433dce250f7a
ysUtil.cpp
ysUtil.h
4f29f302c71d886db8ced57b6ede2d9cf41b30de 23-Jul-2012 Elliott Hughes <enh@google.com> Fix Method.getParameterAnnotations.

The dex format represents parameter annotations using an
annotation_set_ref_item for each parameter. According to the spec,
the item's annotation_offset can be "0 if there are no annotations for this
element". The Dalvik VM accepts 0 values in the verification step,
but Method#getParameterAnnotations then crashes with a segmentation fault.

Bug: http://code.google.com/p/android/issues/detail?id=35304
Change-Id: I0ac7336d369894520c8e17848ab6a91dbbd905e9
exFile.h
b210a9f9c7ae17e2028a86d9a4e9a3b35472862a 15-Jul-2012 SangWook Han <sangwook.han@gmail.com> Use uintptr_t for cast pointer to integer.

On 64bit host, sizeof pointer is not equal to sizeof int/u4.
Need for host tools.

Change-Id: Id8d9418787e79523226b9c9e3f67277f9ac7c6aa
exFile.h
exOptData.cpp
exSwapVerify.cpp
ysUtil.cpp
728c403e16be708e75d5afd4b17a42cc1fdc87a1 31-Mar-2012 Elliott Hughes <enh@google.com> am 6353fe2f: am 2a3cc744: Merge "Set SYSTEM_PAGE_SIZE from PAGE_SHIFT"

* commit '6353fe2fbb380551a576fb38ad68dbc1566d250c':
Set SYSTEM_PAGE_SIZE from PAGE_SHIFT
356839bd278d7c7f2675b56755d4a2f0e4a5d88c 31-Jan-2012 Chris Dearman <chris@mips.com> Set SYSTEM_PAGE_SIZE from PAGE_SHIFT

Hardwiring the expected page size is not portable

Signed-off-by: Chris Dearman <chris@mips.com>
ysUtil.h
c1a4ab9c313d8a3d12007f2dbef7b5a6fa4ac2ef 06-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGE(_IF) to (IF_)ALOGE(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/#/c/157220

Also fix an occurrence of LOGW missed in an earlier change.

Bug: 5449033
Change-Id: I2e3b23839e6dcd09015d6402280e9300c75e3406
exDataMap.cpp
exDebugInfo.cpp
exFile.cpp
exOptData.cpp
exSwapVerify.cpp
ptInvocation.cpp
ysUtil.cpp
ipArchive.cpp
e8e1ddccd616e8226b7cc1e4e9fdb327429249e8 06-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGW(_IF) to (IF_)ALOGW(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/157065

Bug: 5449033
Change-Id: Ia5d301248024df26c2a29dabdfe738e39ec87c82
exFile.cpp
exSwapVerify.cpp
nstrUtils.cpp
ysUtil.cpp
ipArchive.cpp
4308417beec548c2b2c06ecec4f7f4a965b09fb2 04-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGI(_IF) to (IF_)ALOGI(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/156801

Bug: 5449033
Change-Id: Ic558031c75b3702d90eb78bd730501ae5d3c077b
exOptData.cpp
ysUtil.cpp
ab35b50311951feea3782151dd5422ee944685c2 05-Jan-2012 Elliott Hughes <enh@google.com> Remove unsupported experimental opcodes.

External developers were starting to try to get themselves into trouble with
this stuff...

Change-Id: I2b03bfeaa8c98b6a994bc7924fc8dcf4e4d4f6cb
exOpcodes.cpp
exOpcodes.h
nstrUtils.cpp
nstrUtils.h
062bf509a77fce9dfcb7e7b2e401cf2a124d83d5 20-Dec-2011 Steve Block <steveblock@google.com> Rename (IF_)LOGD(_IF) to (IF_)ALOGD(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/156016

Bug: 5449033
Change-Id: Ic663376d1ad6a6cb14bf81405ad9afd247cf2f60
exFile.cpp
ysUtil.cpp
ipArchive.cpp
92c1f6f1b4249e4e379452ee7b49f027052bf4ce 20-Oct-2011 Steve Block <steveblock@google.com> Rename (IF_)LOGV(_IF) to (IF_)ALOGV(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/#/c/143865

Bug: 5449033
Change-Id: I8bd96961e369a08e86ff78b82d90f20f42787eb1
exFile.cpp
exOptData.cpp
exSwapVerify.cpp
ptInvocation.cpp
ysUtil.cpp
ipArchive.cpp
d48cf5c57a850dd4b712efeeb35a09e3d5390f5e 20-Jul-2011 Jeff Brown <jeffbrown@google.com> Fix memory leak in mapCentralDirectory.
Bug: 4984352

mapCentralDirectory was allocating a buffer of size 65557
that it passed to mapCentralDirectory0. Then mapCentralDirectory0
was reallocating a new buffer which it failed to free.

This patch rearranges the code a little to ensure that only
buffer gets allocated and it gets freed.

Change-Id: I3b22e2b904f6e7584ab8a3af49c8f1350a40be87
ipArchive.cpp
375fb116bcb817b37509ab579dbd55cdbb765cbf 15-Jun-2011 Carl Shapiro <cshapiro@google.com> Normalize the include guard style.

An leading underscore followed by a capital letter is a reserved
name space in C and C++.

This change also moves any #include directives within the include
guard in some of the compiler/codegen/arm header files.

Change-Id: I9715e2c5301699d31886e61d0fe6e29483555a2a
mdUtils.h
exCatch.h
exClass.h
exDataMap.h
exDebugInfo.h
exFile.h
exOpcodes.h
exProto.h
exUtf.h
nstrUtils.h
eb128.h
ptInvocation.h
ysUtil.h
ipArchive.h
ha1.h
6f9edbe7d3a83f7741c4d56f9f5be1414ecabc9f 02-Jun-2011 Dan Bornstein <danfuzz@android.com> Add some error checking and clean out some cruft.

Error checking #1: When a cached dex file can't be created, do extra
analysis to figure out (and report) why.

Error checking #2: When opening classpath entries, become sensitive
to the file extension, only trying to open files with the right
extensions and complaining explicitly if it's unrecognized.

Cruft cleaning: We've never supported finding class files in directory
hierarchies in Dalvik. Fix some related comments and clean out some
code that tried (in vain) to implement a piece of that.

Bug: 4523201
Change-Id: I05b7a8570f147955cd62229fca72b50d36703752
ptInvocation.cpp
6f3c21fb026d9489e5046416bcd5a84fa8e4615b 26-May-2011 Dan Bornstein <danfuzz@android.com> More LOG newline cleanup.

This changes all the places I could find where the log string was on the
line after its LOG call.

Change-Id: Iac6a9fcc64f46631fb093824ab60237dce1a5241
exFile.cpp
exSwapVerify.cpp
291c84f60853d30e1c0d79dd08c5e5164f588e26 26-May-2011 Dan Bornstein <danfuzz@android.com> Prefer printf format "%#x" over "0x%x".

I exist to serve.

Change-Id: I8e2880b20eefd466da8515d5b6b0c5cb75d56169
exDataMap.cpp
exSwapVerify.cpp
614dca3bb487f17ef8ea37a82a22dd6c4abc027e 26-May-2011 Dan Bornstein <danfuzz@android.com> Conservation of newlines in libdex.

The log facility adds newlines automatically, and the prevailing
convention is now to omit them.

Change-Id: I14762ea4a7c24eea333f778724a0e4b6b65bae2b
exDataMap.cpp
exFile.cpp
exOptData.cpp
exSwapVerify.cpp
nstrUtils.cpp
ptInvocation.cpp
ysUtil.cpp
ipArchive.cpp
9fdbd91288a237eb58e18e4de9c729c3c268c318 25-May-2011 Dan Bornstein <danfuzz@android.com> Update dex file magic number.

Even though the dex format was technically resilient with respect to
the addition of new opcodes, consensus is that the errors one sees
when trying to use a new dex file on an old build were sufficiently
inscrutable that it was worth the effort to update the version number
embedded in the dex format magic.

This change updates dx to produce the new version number when extended
opcodes are enabled (which is the default, but may be overridden by
targeting an older API level).

This also updates the vm to recognize and accept both the new current
version number as well as the immediately previous one. Note: It won't
reject an old-version file if it happens to use the new opcodes; that
would just be a gratuitous and pointless failure.

Bug: 4364986
Change-Id: If8febbb0b91c1719df4247bf69c511251362d91f
exFile.cpp
exFile.h
exSwapVerify.cpp
bbf31b58c50fb892423b7fef0d8c1093bd0c1a6c 05-May-2011 Brian Carlstrom <bdc@google.com> Merge remote branch 'goog/dalvik-dev' into dalvik-dev-to-master

Change-Id: I99c4289bd34f63b0b970b6ed0fa992b44e805393
bfc9799b1a53fd6f6136d07e6278d4538cf70f13 27-Apr-2011 Carl Shapiro <cshapiro@google.com> Make libdex structures tool friendly.

Previously, the struct name and its typedef name were identical. This
confuses emacs and etags. This change eliminates the typedef names and
removes the extern "C" wrapping the libdex header files. To support
this change the transitive C dependencies have been made to compile as
C++ instead.

Change-Id: I7065f32d61d776f9b09c7b461adf2502268d852f
mdUtils.h
exCatch.h
exClass.h
exDataMap.h
exDebugInfo.cpp
exDebugInfo.h
exFile.h
exOpcodes.h
exOptData.h
exProto.h
exSwapVerify.cpp
exUtf.h
nstrUtils.h
eb128.h
ptInvocation.h
ysUtil.h
ipArchive.h
ha1.cpp
ha1.h
a70a3d8faa8f7332549fa0c9ae2008d428e28606 14-Apr-2011 Dan Bornstein <danfuzz@android.com> Compile libdex as C++.

The major-looking code changes were all just to unravel some gotos.

Change-Id: I86f98a48b160f357ce93c87446bad5d705d5f05b
ndroid.mk
mdUtils.c
mdUtils.cpp
exCatch.c
exCatch.cpp
exClass.c
exClass.cpp
exDataMap.c
exDataMap.cpp
exDebugInfo.c
exDebugInfo.cpp
exDebugInfo.h
exFile.c
exFile.cpp
exInlines.c
exInlines.cpp
exOpcodes.c
exOpcodes.cpp
exOptData.c
exOptData.cpp
exProto.c
exProto.cpp
exSwapVerify.c
exSwapVerify.cpp
exUtf.c
exUtf.cpp
nstrUtils.c
nstrUtils.cpp
eb128.c
eb128.cpp
ptInvocation.c
ptInvocation.cpp
ptInvocation.h
ysUtil.c
ysUtil.cpp
ipArchive.c
ipArchive.cpp
ha1.c
ha1.cpp
db0c9549818d9f6e508d26e45ff9d886802aa1da 13-Apr-2011 Carl Shapiro <cshapiro@google.com> Convert the internal and in-line natives to C++.

Change-Id: I2ece682bc3b4d3b55ab27c60fd84a0b3243d7ca6
mdUtils.h
exCatch.h
exClass.h
exDataMap.h
exFile.h
exOpcodes.h
exOptData.h
exProto.h
exUtf.h
nstrUtils.h
eb128.h
ipArchive.h
ha1.h
ae188c676c681e47a93ade7fdf0144099b470e03 08-Apr-2011 Carl Shapiro <cshapiro@google.com> Compile the garbage collector and heap profiler as C++.

Change-Id: I25d8fa821987a3dd6d7109d07fd42dbf2fe0e589
ysUtil.h
c99fe6df38af0e55821d8d98ccf67664ce35231a 25-Mar-2011 Jesse Wilson <jessewilson@google.com> Optimize annotations.

See libcore change I5912b526dfa87a61a95fbe7b7efc48d0dca3ad38

Change-Id: I89ed0be331eea3d9c0d02bebeaa719b686d532ca
http://code.google.com/p/android/issues/detail?id=7811
exFile.h
1a777d230192f3f8c4d41f58f68b29ef2dbae9ff 22-Mar-2011 Carl Shapiro <cshapiro@google.com> Add a missing strings.h include for strcasecmp.

Change-Id: I06949c34d8ce0f48fa905d3a03d87de81e47e2f9
mdUtils.c
3475f9cdb47a6d6f8ad2ce49bbc3af46bca92f09 21-Mar-2011 Carl Shapiro <cshapiro@google.com> Move finalization out of the VM.

This change introduces a new reference class whose referent
points to instances requiring finalization. This makes the
finalization of objects possible using a reference queue and
a dedicated thread which removes objects from the queue.

Change-Id: I0ff6dd272f00ca08c6ed3aa667bf766a039a944e
nstrUtils.c
1553988115a2ecfce43eedebc488e0a8b8dea847 12-Mar-2011 Dan Bornstein <danfuzz@android.com> Clarify a comment.

Per suggestion during code review of previous patch.

Change-Id: I9bf88d3127f32036c1668ad03ffc491947a4f696
exFile.c
exFile.h
a9c49df6714b3a37b7a7d0522932e622be2b35ac 11-Mar-2011 Dan Bornstein <danfuzz@android.com> Clean up how primitive types are handled.

The PrimitiveType enum got "promoted" to libdex, and I added a
few helper functions there. I also quashed the idea that there
is some sort of canonical ordering of the enumerated values.

In the vm (per se), I made PrimitiveType uses where it had assumed
an ordering instead switch(). This mostly made things much simpler.

I also split out the array of type classes in Globals.h into
individual ClassObject*s. This mostly made things simpler, but the gc
got a tiny bit of extra cruft because of it.

Finally, I made it so that the type classes get created explicitly
during vm startup, instead of happening implicitly the first time
they're accessed. This both simplified the code and, in particular,
made it so that the type classes didn't have to be declared volatile.

There are still a couple of related items that could stand to be
cleaned up, but I think what's here is enough for one patch.

Change-Id: Id14a6dfdb200abce9f30911c330ba32d9c2a4c3f
exFile.c
exFile.h
9dfc114cad60f4a79d934307a51fd520fdac9e98 11-Mar-2011 Andy McFadden <fadden@android.com> Merge "Add volatile/jumbo opcodes" into dalvik-dev
24bd4c50bb3ea13be4f049710967961f0546fb2c 10-Mar-2011 Andy McFadden <fadden@android.com> Add volatile/jumbo opcodes

This adds 12 dexopt-generated "volatile/jumbo" instructions, to
be used for replacing appropriate get/put ops, plus a jumbo
replacement for invoke-object-init/range.

The new instructions are defined but not yet used. For x86 and
x86-atom, C stubs are selected.

Also, guarded macro args used in arithmetic expressions in header.S.

Bug 3403118

Change-Id: I283cea053d1cee1d70c3715df3e71177e8b8d3b2
exOpcodes.c
exOpcodes.h
nstrUtils.c
9ea32b0a0fa0eb4c4bfcd73f0c7fe15ddb0f9ce2 10-Mar-2011 Dan Bornstein <danfuzz@android.com> A bit of libdex spring cleaning.

Give the UTF-8 parsing/validation code and the debug info decoder
their own files in libdex. Also, moved the random utility
dexRoundUpPower2() so it wasn't in the middle of unrelated stuff
(though maybe it doesn't want to stay in DexFile.c at all).

Change-Id: I115447e49904e2440dd538b1df90616ea95707a9
ndroid.mk
exDebugInfo.c
exDebugInfo.h
exFile.c
exFile.h
exInlines.c
exSwapVerify.c
exUtf.c
exUtf.h
d4bd92bdc81b5eee09db7f752020a0d435683f7b 10-Mar-2011 Dan Bornstein <danfuzz@android.com> Better class name validation.

I made a combined class name / type descriptor validator in
libdex extracted from the original type descriptor validator,
made the original validator use that, and added another public
function to do class name validation.

The two not-quite-validators in CheckJNI.c and InternalNative.c
now do proper checking.

Change-Id: I0f25e3efb439da065d92596197d219792d5a46b1
exFile.c
exFile.h
57fd399d1265ec627d28a15b3d4b98e5f239ac88 04-Mar-2011 Andy McFadden <fadden@android.com> Low-level support for in-memory DEX

We want to be able to load classes from a DEX file in memory,
rather than insisting that they always be loaded from disk. This
provides the underpinnings.

The code was previously using the "are we in dexopt" flag to
decide if it needed to mprotect(RW) DEX data before altering it.
We now have an explicit flag.

Also, scraped off some "opt header flags" checks that never did much.

Bug 1338213

Change-Id: If7128bf246992156662e089a2a87cebf475a6f2a
exFile.h
d31fab3e62e3b4f4867b0d8ec29ada7be30506f5 03-Mar-2011 Raphael <raphael@google.com> am bf0cce6d: Fix build.

* commit 'bf0cce6d471ffcd65161eca6e027e1b66f02f054':
Fix build.
65a6bfb507967652834e784c9180209fbaf675df 03-Mar-2011 Raphael Moll <ralf@android.com> am b3086d3b: am 0c91e9d5: am 98e0347a: am 2b3d7e8e: Merge "Open dexdump files in binary mode."

* commit 'b3086d3b933b6942c32a3c9ef4d0ed8f6850afac':
Open dexdump files in binary mode.
bf0cce6d471ffcd65161eca6e027e1b66f02f054 02-Mar-2011 Raphael <raphael@google.com> Fix build.

The build server is stuck waiting for the O_BINARY change
from system/core. This will unblock it.

Change-Id: Iedd5f7a6cb140ac07b5084948a69eb5d94e2070f
mdUtils.c
ipArchive.c
0346e9dcddccd449c731e42ef83708ff6d8f0976 02-Mar-2011 Andy McFadden <fadden@android.com> Change invoke-object-init to /range form

The invoke-object-init instruction pretends to be a regular invoke
that only knows how to call Object.<init>. As such it always takes
one argument, and if we use the /range version we can specify the
"this" register with 16 bits instead of only 4.

Bug 3486699

Change-Id: I9ee4700c6935beee1dcbaa583b57befd33641414
exOpcodes.c
exOpcodes.h
b3086d3b933b6942c32a3c9ef4d0ed8f6850afac 02-Mar-2011 Raphael Moll <ralf@android.com> am 0c91e9d5: am 98e0347a: am 2b3d7e8e: Merge "Open dexdump files in binary mode."

* commit '0c91e9d5a4078bc1c6da2c225bde5fb703fd9d58':
Open dexdump files in binary mode.
0c91e9d5a4078bc1c6da2c225bde5fb703fd9d58 01-Mar-2011 Raphael Moll <ralf@android.com> am 98e0347a: am 2b3d7e8e: Merge "Open dexdump files in binary mode."

* commit '98e0347a7f016764403384567267db6e9dcf8edf':
Open dexdump files in binary mode.
75144030732a492207f594ae6bf73f0308d6be6c 24-Feb-2011 Dan Bornstein <danfuzz@android.com> Add new comparator function.

This one compares a DexProto with a list of method parameter types,
and it is immediately useful in the new getMethod() reflection code,
to avoid doing a bunch of extra string manipulation.

While I was in the territory, I removed some comment redundancy.

Change-Id: I5049e2ac4606e44a65c3c426ac2f880a891c51f9
exProto.c
exProto.h
46bc4670d5ff653c3f132a2493efcbe434643b32 24-Feb-2011 Dan Bornstein <danfuzz@android.com> Add new comparator function.

This one compares a DexProto with a list of method parameter types,
and it is immediately useful in the new getMethod() reflection code,
to avoid doing a bunch of extra string manipulation.

While I was in the territory, I removed some comment redundancy.

Change-Id: I1d3c8df534601890165b2e251c036579e4caccdc
exProto.c
exProto.h
5a023aab73158b34b6c329c42318736d115c0742 23-Feb-2011 Jesse Wilson <jessewilson@google.com> am 5945bc11: Merge "Optimize Class.getMethod() by loading only one method."

* commit '5945bc11f354083d24f952992dc579a1fd77dba8':
Optimize Class.getMethod() by loading only one method.
3c6f4c012e0a314dc9f9f540b9374dbf530d03b0 23-Feb-2011 Jesse Wilson <jessewilson@google.com> Optimize Class.getMethod() by loading only one method.

Change-Id: Ia2cd776c0a14914264e8d94e978d55854ed75623
http://b/3431686
exProto.c
exProto.h
b4719eda048c4dc4a4b6e5280c7a2b8299051078 16-Feb-2011 Raphael Moll <ralf@android.com> Open dexdump files in binary mode.

Requires change Ia5c0a59e from system/core
(which defines O_BINARY globally.)

Change-Id: If814608ee9662190a7cf80aae2ad2451d88364ae
mdUtils.c
ipArchive.c
750d110b62cef538e193b6f91f5239b0c4b63ef1 12-Feb-2011 Andy McFadden <fadden@android.com> Rename invoke-direct-empty to invoke-object-init

The invoke-direct-empty instruction was introduced to remove the
overhead of calling the empty Object constructor. We now need it
to do some extra work on behalf of object construction, so it's
appropriate to change the instruction name to match the role it
fills rather than the more general role it was hoped to fill.

No functional changes.

Bug 3342343

Change-Id: I65dd6a2c00c99581c9a19b16fe193b70642c8fbb
exOpcodes.c
exOpcodes.h
71eee1f0c2eb514585fdbee16730c9c2209e8f68 04-Jan-2011 jeffhao <jeffhao@google.com> Added vm support for new jumbo opcodes.

This enables jumbo opcodes by default, and they will get used by the
current build without modification. Support has been added for arm, x86,
and the portable interpreter. x86-atom support is on the TODO list. This
commit also includes a test for the new jumbo opcodes.

Change-Id: Ic3f1b41b51645861c5196f76aaf0e96e727ea537
exOpcodes.c
exOpcodes.h
nstrUtils.c
nstrUtils.h
650177ee24fbe07cdd9ad9d8913fbf44cf44be13 16-Dec-2010 Dan Bornstein <danfuzz@android.com> Expose sysCopyFileToFile() and use it.

Moved from ZipArchive.c, with tweaks to for argument order and name. Also
tweaked a related function in ZipArchive to match.

Change-Id: I4d2e3c8b44386d87c5aa1c4565f72da87357fce8
ysUtil.c
ysUtil.h
ipArchive.c
44209fab6f9a58368809ca278f04e5c9384e7515 04-Dec-2010 Dan Bornstein <danfuzz@android.com> These asserts are no longer pointless.

Change-Id: I32cfd2334de344156a41d1c2d7c10a8d96e970c4
nstrUtils.h
ccaab18ae6d203108445fef7682065dfbb007657 04-Dec-2010 Dan Bornstein <danfuzz@android.com> Another clarifying rename and a bit more automation.

kNumDalvikInstructions is now kNumPackedOpcodes, there is a new
kMaxOpcodeValue, and both are generated by opcode-gen.

Change-Id: Ic46f1f52d2d21382452c8e777024f4a985ad31d3
Bonus: Reworded the switch and array data comment for clarity.
exOpcodes.c
exOpcodes.h
nstrUtils.c
nstrUtils.h
90f15431b24a4004fab2db70f273155fcd1c42a4 03-Dec-2010 Dan Bornstein <danfuzz@android.com> Make opcode 00ff be called "dispatch-ff".

With this change, it's still implemented as an unused opcode, but
it's now ready for its new life!

Change-Id: Ic70d311704925067e47d87b657d133a792144e65
exOpcodes.c
exOpcodes.h
0f737c5778b9661bdb0b978f4bd29ccbcd73b5fb 03-Dec-2010 Dan Bornstein <danfuzz@android.com> Extremely minor cleanup.

Change-Id: Ia302597d27773aa72f675509e9b4f844db65cc85
nstrUtils.h
e485276c6ba778cafa373b3b5c867f84e91b0bfd 02-Dec-2010 Dan Bornstein <danfuzz@android.com> Rename some instruction/opcode types and utilities.

A lot of this is more about properties of opcodes as opposed to
inspecting instructions per se, and the new naming attempts to
make it clear what is being queried and what sort of data is being
returned.

Change-Id: Ice6f9f2ebf4f1cfa8c99597419aa13d1134a33b2
nstrUtils.c
nstrUtils.h
4b6e9baa06c39376496a1860972a68924c8d4440 02-Dec-2010 Dan Bornstein <danfuzz@android.com> Make the enums typedeffed as such.

This makes these definitions C++-friendly. I also tried to clean up
and generally improve the documentation in this area. (Maybe you can
guess what's coming next.)

Change-Id: I76ab3087dcde5cc255288a993ec7b2963f2b733b
nstrUtils.c
nstrUtils.h
9a1f81699cc05b58378ffb9aadb4e97677943791 02-Dec-2010 Dan Bornstein <danfuzz@android.com> It's "opcode" not "opCode".

Similarly "Opcode" not "OpCode".

This appears to be the general worldwide consensus on the matter. Other
residents of my office didn't seem to mind one way or the other how it's
spelled in our code, but for whatever reason, it really bugged me.

Change-Id: Ia0b73d19c54aefc0f543a9c9451dda22ee876a59
exOpcodes.c
exOpcodes.h
nstrUtils.c
nstrUtils.h
5befcb64d815614a855199e19a0236ec3a01091c 02-Dec-2010 Dan Bornstein <danfuzz@android.com> Rename OpCodeNames.c -> DexOpcodes.c.

Change-Id: I9e22543740129f4a8fd50ff246a165d6358ed9b5
ndroid.mk
exOpcodes.c
pCodeNames.c
df4daaf8f41e3dcaa8221f54273338160dd43138 01-Dec-2010 Dan Bornstein <danfuzz@android.com> Rename OpCode.h -> DexOpcodes.h.

Also incorporate the former contents of OpCodeNames.h. This is a small
attempt to increase naming consistency in libdex. There will be a bit
more to come, in a follow-up.

Change-Id: Ia7ab06042dde2e19eda02ef1fee72fb4260e899d
exInlines.c
exOpcodes.h
nstrUtils.h
pCode.h
pCodeNames.c
pCodeNames.h
111221644c5b7b1d4f426d02786aeebf1addc8f6 01-Dec-2010 Dan Bornstein <danfuzz@android.com> Add more "extended opcode" structure to libdex.

Although we don't yet generate any of the extended opcodes, this
change makes it a bit easier to add them.

In particular, we now differentiate between the raw opcode in a code
unit and an associated "packed opcode number." The packed opcode space
is densely populated in the range 0x000-0x1ff (though there will still
be a few unused slots), whereas the raw opcode values are sparse
throughout the range 0x0000-0xffff.

The OpCode enum is redefined/clarified to have packed, not sparse,
opcode values.

Change-Id: Ie3208a258648fbf044d344646f66c49ad24c31b2
exInlines.c
nstrUtils.c
pCode.h
0759f52f2dd8497cc489b889a25e91d48ea10751 30-Nov-2010 Dan Bornstein <danfuzz@android.com> invoke-direct-empty doesn't actually invoke anything.

Update bytecode.txt as well as a couple bits in the JIT in recognition
of this fact.

Change-Id: I989556d39b40a879021eaf841404e015076073be
nstrUtils.c
758a6733f7d1a525aa1530e008cab8a912e7a084 30-Nov-2010 Dan Bornstein <danfuzz@android.com> Clean up the opcode maintenance instructions.

Change-Id: Ic9d7fcfd234116099ef510e4339a9af0bc3fcb1d
nstrUtils.h
pCode.h
41e286c0623dcb4efc6243c94ba14e7febed4b25 19-Nov-2010 Dan Bornstein <danfuzz@android.com> Get rid of the copies of the opcode table pointers.

This inclduded fixing all the accessor functions to refer to the
global ones defined in InstrUtils.[ch] instead of taking separate
"table pointer" arguments.

This did end up adding a few more truly global references to some of
the code paths, particularly when performing dex optimization, so I
went ahead and measured the time to do a cold first-boot both before
and after the change (on real hardware). The times were identical (to
one-second granularity), so I'm reasonably comfortable making this
change.

Change-Id: I604d9f7882bad4245bb11371218d13b06c3a5375
nstrUtils.c
nstrUtils.h
543223954993a19fa96670692bc7aa55d851966b 17-Nov-2010 Dan Bornstein <danfuzz@android.com> Use the generated opcode info tables.

This is, once again, an intermediate step. Soon, I'm going to try to
remove need to keep and pass copies of the opcode info pointers all
over the place.

Change-Id: Ic6af849310b22ca604a7f2d18c78ff8d112459b4
nstrUtils.c
nstrUtils.h
pCode.h
8424432a87c784547e4510bca538eaedc312e40d 17-Nov-2010 Dan Bornstein <danfuzz@android.com> Generate the tables in InstrUtils.c...almost.

This patch adds code to opcode-gen to generate the opcode info tables
currently built at vm start time, but they are left commented out for
now. I wanted to separate the work of getting these tables generated
from the work of getting those new tables hooked up, and this seemed
like a reasonable way to cut through the larger effort.

To be clear, I've already verified that the data in the new
pregenerated tables matches what's in the status quo.

Change-Id: Ie73dc6c6a5721e8f714f845c97b5338141995770
nstrUtils.c
nstrUtils.h
d03baafc41fe04167d0a8ba01d8cbc9bcbed8195 17-Nov-2010 Dan Bornstein <danfuzz@android.com> Generate the contents of OpCodeNames.c.

This was another one that was pretty easy to add to opcode-gen. I did
end up tweaking opcode-gen to make it obvious that the two forms of
name are different by more than just upper vs. lower case, especially
because I duplicated the original distinction of the optimized opcodes
having extra prefix characters in their human-oriented names but not
in the names when used as programming constants.

Change-Id: I5062442540d26318914964bd2722cc32380b19ca
pCode.h
pCodeNames.c
11a4a79b09a2be2bd7a7141ce112de3ad0432e53 16-Nov-2010 Dan Bornstein <danfuzz@android.com> Generate most of OpCode.h using opcode-gen.

This was the easiest bit to tackle in libdex. More to come!

Change-Id: I3f79039ce98951d694d2c896ee1c7a60b417bc49
pCode.h
c2b486fe6e49555c3a5df0702d04c20b6d6a33c4 13-Nov-2010 Dan Bornstein <danfuzz@android.com> Get rid of kInstrUnconditional.

Replace its use with an inline function dexIsGoto(flags), which uses
the existing flag bits kInstrCanBranch and kInstrCanContinue.

Change-Id: I84f533f619434ad0ad2831c147b50f6dc79b9928
nstrUtils.c
nstrUtils.h
1530c3e6952581aa20ac1e06562a49b9d70bc2b6 12-Nov-2010 Dan Bornstein <danfuzz@android.com> TypeRef, not ClassRef.

Old habits die hard. The things in question have been called TypeRefs
for quite a while now.

Change-Id: I77b0066a67c63b8e801ec62eb613f18a4812585a
nstrUtils.c
nstrUtils.h
a0929372ae4996cde3aece52f98128a957166ffc 12-Nov-2010 Andy McFadden <fadden@android.com> Stop reporting negative widths.

At one point, returning a negative width for dexopt output was useful.
That stopped being the case a long time ago.

This also removes a bad assert that went into my previous checkin.

Change-Id: I18880c2316f5499a09dc479d271ca70b2a5be259
nstrUtils.c
nstrUtils.h
4a6b4825a5d3ac267e359897a5fb4d132a82c935 11-Nov-2010 Dan Bornstein <danfuzz@android.com> Add the new instruction formats.

This just adds new elements to the enum and adds code to InstrUtils
and dexdump which knows how to decode them.

In dexdump, I took advantage of the new index type table to simplify
how all the index-bearing instructions get dumped, to the point where
adding the new formats was really just a matter of picking the right
switch cases to add new labels to.

Change-Id: I9094b0d568e7c71ee237672bbea8c319274c6697
nstrUtils.c
nstrUtils.h
44a38f4a6a1cde0490e78b7de3b27906c6c81078 11-Nov-2010 Dan Bornstein <danfuzz@android.com> Add a new index type table for instruction decoding.

This is in prep for -- recurring theme here -- adding the new extended
opcode formats. It turns out that we can avoid a lot of duplicated code
if we determine the type of thing referred to in index-bearing instructions
inside the general instruction decoder. To do so straightforwardly, this
means adding a new opcode info table and then passing it into the decoder.
Rather than add another argument to the decoder, I defined a struct to
contain all the info tables together, and a pointer to that can get passed
in.

I simplified the setting up of the info tables, too, so all the
allocation is handled within InstrUtils, rather than being (partially)
duplicated in a couple places. The only downside is that dexdump will
construct one more table than it actually needs, but given that
construction is quick and the table is only 256 bytes (though will
soon be growing to -- gasp! -- 294 bytes), I figure it's not such a
big deal.

Most of the files that changed only had edits for how to refer to these
info tables.

Change-Id: Ia6f1cb25da6e558ac90c6dd3af6bce36b82a6b4d
nstrUtils.c
nstrUtils.h
ff70f76988296fe8b2521c17b6cc1968c774b641 10-Nov-2010 Dan Bornstein <danfuzz@android.com> Simplify the instruction decoder.

The decoder for format 35mi was *mostly* identical to the one for
35c/35ms. The one place where it differed was in the allowing (or not)
of a fifth argument. I combined the two blocks and just added an
additional format check in the five-argument case. I ended up
rewriting the stuff to pull arguments into the args array, because
while the original loop at the core of it was attractively simple, the
extra stuff around it just made the code obscure. With this change,
the code just does switch(count) and has a nice little cascade.

While I was in the territory, I did a couple other minor cleanups.

Change-Id: Ib75d47eae92a91571445751789d56feeb4e0ca81
nstrUtils.c
7b3e9b0886f2b716b004f0377866988ae39a136e 10-Nov-2010 Dan Bornstein <danfuzz@android.com> Reharmonize the implementation with the spec.

In particular, I altered the naming of some instruction format fields
as well as the names of instruction formats themselves, all in an attempt
to make the implementation be a more straightforward match of the spec.

This patch mostly changes comments to reflect the new harmonized
reality. The only "code-like" change is the renaming of kFmt3inline
and kFmt3rinline to kFmt35mi and kFmt3rmi (respectively), which is
what they're called in the spec.

Bonus: Added the new extended opcode instruction formats to
InstrUtils.h, though I left them commented out for now.

Change-Id: I0109f361c1e9b6f0308c45e8cda5320e9ad3060c
nstrUtils.c
nstrUtils.h
d325011fc98e0f1179d467bbc284cccea72f560b 03-Nov-2010 Andy McFadden <fadden@android.com> Shift register index tests to static pass.

This rather hefty change moves the range tests on register index values
from the code-flow pass to the earlier static analysis pass. The idea
is to test everything up front so that we don't have to do a bounds
check every time we get or set a register value during verification.

This allowed some simplification in the code-flow pass, since get/set
of a register no longer needs to have the method register count passed
in, and can no longer fail due to bad input.

As part of doing this, some of the static verification code was
cleaned up, e.g. the instruction decoding is now only done in one place.

This had no apparently effect on performance on nexus one -- verify+opt
of the bootstrap classes takes the same amount of time. However, it
does reduce the compiled size of the humongous instruction verification
method by about 10%.

Also, cleaned up some instruction format stuff (e.g. removed 3rfs).

Bug 2534655.

(cherry-pick from dalvik-dev)

Change-Id: I1b220f4e97b1214ed575470695c52e1bd64d5137
ndroid.mk
nstrUtils.c
nstrUtils.h
c49ec998a1d575eb950c529eacb837efbbc3fe17 25-Oct-2010 Andy McFadden <fadden@android.com> Improve dexdump temp file handling.

When dexdump is handed a zip or APK, it has to unpack classes.dex to a
temp file. It currently tries /tmp and /sdcard, neither of which are
likely to exist on a Windows system.

We now print a warning when those directories don't exist, and try to
create the temp file in the current directory.

Bug 3125957.

Change-Id: I7724ce48c35f22ed4b5116dfe5783243107df6a1
mdUtils.c
d8b5f50d0c6c9a0ce157e89df4ee1e8eb8b334c3 30-Sep-2010 Andy McFadden <fadden@android.com> Correct dexopt for uniprocessors.

The SMP flag was defaulting to "true" for dexopt, even on uniprocessors.
With this change the VM now has three choices: dexopt for SMP, dexopt
for uniprocessor, or dexopt for current system. The last is used for
just-in-time dexopt (used by -eng and -userdebug builds on bootstrap DEX
files) and installd dexopt (used for apps on all builds).

The dexopt used by the build system during -user builds will either be
explicitly SMP or explicitly uniprocessor, since "current system" has
no meaning when you're cross-dexopting.

Also, unified the dexopt control flags into a single enum.

(cherry-pick from dalvik-dev)

Change-Id: Id1d9c548ca8567585a28ef9ee911cc2ac6b116dd
ptInvocation.h
b91b37eb8b8746d1057dd86ed3835de824439e65 30-Sep-2010 Andy McFadden <fadden@android.com> Correct dexopt for uniprocessors.

The SMP flag was defaulting to "true" for dexopt, even on uniprocessors.
With this change the VM now has three choices: dexopt for SMP, dexopt
for uniprocessor, or dexopt for current system. The last is used for
just-in-time dexopt (used by -eng and -userdebug builds on bootstrap DEX
files) and installd dexopt (used for apps on all builds).

The dexopt used by the build system during -user builds will either be
explicitly SMP or explicitly uniprocessor, since "current system" has
no meaning when you're cross-dexopting.

Also, unified the dexopt control flags into a single enum.

Change-Id: I02e22d53ccde2e8603cac8090ca3aae59f792f70
ptInvocation.h
e50255299c3df62ce4dabccd16c1c0d89dad2e96 17-Sep-2010 Jesse Wilson <jessewilson@google.com> am 0cd73fed: am 7c73c80e: am 42929e15: Add optional tags to dalvik.

Merge commit '0cd73fed767e2d6f6f6147789b2b24bbaffa6670' into dalvik-dev

* commit '0cd73fed767e2d6f6f6147789b2b24bbaffa6670':
Add optional tags to dalvik.
42929e15765640324d9181ec1159effd22aa86ca 17-Sep-2010 Jesse Wilson <jessewilson@google.com> Add optional tags to dalvik.

Change-Id: I29a78ccb6312d12b3ef0ed02cfbc638a5b01db9c
ndroid.mk
291758c5c4902900c6f86794ba8ab9cad9b26197 10-Sep-2010 Andy McFadden <fadden@android.com> Add return-void-barrier instruction.

This introduces the return-void-barrier instruction, which is identical
to return-void on UP systems, but provides an additional store/store
barrier on SMP. This is intended for use in constructors of objects
with final fields.

The assembler doesn't like "dmb st", and we don't have an
ANDROID_MEMBAR_STORE barrier defined, so this currently uses full
fences.

This just defines the new instruction. It's not actually used yet.

Also, removed some stale "unused" files from the x86 and x86-atom
directories.

Bug 2965743.

Change-Id: I072e372fd2d57f2617a8d4fff5fd4b38bdda75d1
nstrUtils.c
pCode.h
pCodeNames.c
d394371bd84bacc51e96e2d2eacb8549d9110b1e 09-Sep-2010 Dan Bornstein <danfuzz@android.com> Remove the functionality in ReduceConstants.[ch].

It was a good experiment to try, but it was never made production-ready,
and it doesn't look like it would be a net win at this point. We
metaphorically pour out a beer in its honor.

Change-Id: I7f6ac95f5b7c963df0a3015ed33595fa1a928636
exFile.h
exOptData.c
ddc7d29baa92cb24b7bfa80395479f878109f3f8 03-Sep-2010 buzbee <buzbee@google.com> Correct Volatile SGET/SPUT format tag, add missing cases for JIT

Fix for http://b/issue?id=2971877, which was identified via
debug tracing on http://b/issue?id=2971569. There were a couple
of problems: first, the volatile sget/sput byte codes had the
wrong format tag (22c instead of 21c). Second, the JIT was missing
a couple of case statments to handle these. As far as the JIT goes,
this would not have caused correctness problems, but would have
been slower than necessary.

Change-Id: I57a41c4e063642b0c19acba5bb0855dd8ce2d4ba
nstrUtils.c
4a2b20a1128b13dbcda9e7d1114f4d60a02431ed 02-Sep-2010 Dan Bornstein <danfuzz@android.com> Let <stdbool.h> (or its substitute) get picked up via the preexisting
mechanism in vm/Common.h.

Change-Id: I6b79ee3d67b23d8077567a1bce0a58ae46ceb7f3
exOptData.h
e377ef62a40267ab16c2dd20cc5f4c63af6397cc 01-Sep-2010 Dan Bornstein <danfuzz@android.com> Split out the optimized dex file handling into its own file.

Also, make the optimized dex data area be consistently referred to as
the "opt" section instead of sometimes the "aux" section.

Change-Id: Id5589c13ce4b53d713f8186314ea886cd884c865
ndroid.mk
exFile.c
exFile.h
exOptData.c
exOptData.h
33085cbedefd897069cdc12d2abb0d5627f14f36 17-Aug-2010 Dan Bornstein <danfuzz@android.com> Add a little bit of paranoia to the odex data reader.

This prevents some potential segfaults when working with (e.g., trying
to run) corrupted dex files, turning them into more informative error
messages.

Change-Id: Ie6845087bb17a5f65fafbd6f9ff335b6af489996
exFile.c
c6b25c79a4ec5cc83e2bc14af24e8eabad931743 22-Jun-2010 Andy McFadden <fadden@android.com> Relocate OpCodeNames.[ch].

The JIT was pulling it out of the dexdump directory, which is Just
Plain Wrong[tm]. Now it's part of libdex, for all to enjoy.

Change-Id: Ic1e4c981eb2d70ccc3c841ceb5a54f4f77af2008
ndroid.mk
pCodeNames.c
pCodeNames.h
c35a2ef53d0cccd6f924eeba36633220ec67c32e 17-Jun-2010 Andy McFadden <fadden@android.com> Add opcodes for volatile field accesses

This adds instructions for {i,s}{get,put}{,-object}-volatile, for a
total of eight new instructions.

On SMP systems, these instructions will be substituted in for existing
field access instructions, either by dexopt or during just-in-time
verification. Unlike the wide-volatile instructions, these will not be
used at all when the VM is not built for SMP.

(Ideally we'd omit the volatile instruction implementations entirely on
non-SMP builds, but that requires a little work in gen-mterp.py.)

The change defines and implements the opcodes and support methods, but
does not cause them to be used.

Also, changed dvmQuasiAtomicRead64's argument to be const.

Change-Id: I9e44fe881e87f27aa41f6c6e898ec4402cb5493e
nstrUtils.c
pCode.h
228a6b01918304f2cd1213c722e028a6e25252bb 05-May-2010 Andy McFadden <fadden@android.com> Forward progress on verifier.

Promoted VerifierData to a more prominent role in passing state around.
This will (a) allow us to pass fewer explicit arguments around in the
core of the verifier, and (b) make it easier to maintain some fancier
data structures that we will need shortly.

Made use of dexGetInstrOrTableWidthAbs() in a couple of places where
we were still explicitly calculating the sizes of NOP data chunks.

Converted some things from int to size_t.

Change-Id: I206f588bf1fc116a9d1f50fb631a9af33479b291
nstrUtils.c
nstrUtils.h
7365493ad8d360c1dcf9cd8b6eee62747af01cae 09-Jun-2010 Carl Shapiro <cshapiro@google.com> Remove repeated newlines at the end of files.

Change-Id: I1e3d103a7b932ef21acedb6438c0f26b315df28f
exFile.c
exInlines.c
exProto.c
ptInvocation.c
ysUtil.c
ipArchive.c
de75089fb7216d19e9c22cce4dc62a49513477d3 09-Jun-2010 Carl Shapiro <cshapiro@google.com> Remove trailing whitespace.

Change-Id: I95534bb2b88eaf48f2329282041118cd034c812b
mdUtils.c
exCatch.c
exCatch.h
exClass.c
exClass.h
exFile.c
exFile.h
exProto.c
nstrUtils.c
nstrUtils.h
pCode.h
ipArchive.c
ha1.c
4b0750e8df91220690bb417f45d7ae8b7851b220 27-May-2010 Dan Bornstein <danfuzz@android.com> Fix two dex file structural verification issues.

First, structural verification failed to check for inconsistencies with
the number of arguments to methods compared to the number of registers
declared by those methods.

Second, neither the dexdump nor dexlist tools would run structural
verification.

As an added bonus, I renamed the function that performs byte swapping
and structural verification to be more descriptive about what it
does.

Bug: 2716693
Change-Id: I58794713967f5bea95010084c85efe1f929ce7d1
mdUtils.c
mdUtils.h
exFile.h
exSwapVerify.c
64896a2543ee54e47c586f4cf26f54e7fdb366bd 05-May-2010 Andy McFadden <fadden@android.com> Write until we fall over.

Implement enh's idea about repeating write() until it fails. Use it
in the zip expander and dexopt, which have an above-average chance of
failing due to lack of disk space.

Replace a stray DEFAULT_PAGE_SIZE with SYSTEM_PAGE_SIZE. Apparently I
missed that during the Great Page Size Unification.

Change-Id: Id173cb7669330deebe2f24ae23ece4009a90e3bd
ysUtil.c
ysUtil.h
ipArchive.c
8911f7a2222124ba724a4a9281555b74d0e098e2 24-Apr-2010 Andy McFadden <fadden@android.com> Dalvik Zip rewrite.

Change the way zip archives are handled. This is necessary to deal with
very large (~1GB) APK files, for which our current approach of mapping
the entire file falls over.

We now do the classic scavenger hunt for the End Of Central Directory magic
on a buffer of data read from the file, instead of a memory-mapped section.
We use what we find to create a map that covers the Central Directory only.
For most uses in the VM this is all we really need, since we just want
to check file attributes vs. the optimized DEX to see if we're out of date.

If the caller is interested in unpacking the file contents, we have to
do an additional file read to discover the size of the Local File Header
section so we can skip past it. We also now do a file-to-file extraction
using read() calls instead of a buffer-to-file extraction on mmap()ed data.
No difference in performance (as measured by first-boot dexopt).

Since this is more of a rewrite than an update, I also took the opportunity
to change buffer size variables from "long" to "size_t", and normalized
return values to int (some were using bool, which is common in the VM but
was mixed in the zip code). Failure messages are now all LOGW with the
word "Zip" up front (didn't want to change log tag away from "dalvikvm").

Also, removed a not-quite-right check in the "map part of a file" code,
and clarified that the file offset is absolute.

For bug 2620103.

Change-Id: I745fb15abb541376f467969ffe422222676f1e5f
mdUtils.c
ysUtil.c
ysUtil.h
ipArchive.c
ipArchive.h
2e1ee50a08cc3dd07ce4e956b925c1f0f28cf329 24-Mar-2010 Andy McFadden <fadden@android.com> Rearrange some things.

This splits DexOptimize into DexPrepare (which deals with file shuffling
and fork/exec) and Optimize (which does the actual quickening of
instructions). The Optimize functions are now effectively private to
the "analysis" directory.

Twiddled some comments.

No substantive code changes.

Change-Id: Ia51865b259fb32822132e2373997866e360ca86a
nstrUtils.h
861b33855aff080278ea5125e4372a2d4bf8aef5 06-Mar-2010 Andy McFadden <fadden@android.com> Make wide-volatile loads and stores atomic.

This implements the four wide-volatile instructions added in a previous
change, and modifies the verifier to substitute the opcodes into the
instruction stream when appropriate.

For mterp, the ARM wide get/put instructions now have conditional code
that replaces ldrd/strd with a call to the quasiatomic functions. The
C version does essentially the same thing. ARMv4T lacks ldrd/stdrd, and
uses separate implementations for the wide field accesses, so those were
updated as well. x86 will just use stubs.

The JIT should punt these to the interpreter.

Change-Id: Ife88559ed1a698c3267d43c454896f6b12081c0f
Also:
- We don't seem to be using the negative widths in the instruction
table. Not sure they're useful anymore.
- Tabs -> spaces in x86-atom throw-verification-error impl.
nstrUtils.c
nstrUtils.h
5387824f19033ed51a945fbc8c2b574998404b3d 05-Mar-2010 Andy McFadden <fadden@android.com> Add instructions for volatile wide fields.

This adds four new instructions for accessing volatile wide fields (long
and double). The JLS requires that such accesses are atomic, but the
VM doesn't otherwise make guarantees about the atomicity of reads and
writes on 64-bit fields.

There are no behavioral changes. This just adds definitions for the new
instructions and a couple of tests. The current implementation is just
the non-volatile form of the instructions or a C stub, but since we're
not generating them it doesn't really matter yet.

Also:
- bumped Dalvik version to 1.3.0
- added a note to the x86-atom TODO list

For bug 1633591.
nstrUtils.c
pCode.h
e02aff71838cff53fb7a8869be8ef010ac4f3ea7 26-Jan-2010 Dan Bornstein <danfuzz@android.com> Cause dex verification to fail if the class_defs section contains more
than one definition for any given class.

Bonus: Killed off a bunch of trailing whitespace, to reduce the gerrit
bloodbath.

Change-Id: Idc599364f1a38887fb4b9f91dc91b9b53343ca03
Bug: 2382215
exSwapVerify.c
7d18e38e260d79df8144908b28033b800d5d7470 04-Dec-2009 Andy McFadden <fadden@android.com> Added additional DEX checksum.

We have a checksum on the base DEX data, but not on the stuff that
dexopt appends. If a flash block goes "funny" we might not be able to
detect the problem. This change adds a checksum field to the
"optimized" header.

The new checksum is verified under the same circumstances as the base
DEX checksum: when you use "dexdump", and when you enable additional
checking with -Xcheckdexsum (or the property dalvik.vm.check-dex-sum
is set to "true").

For bug 2255640.
exFile.c
exFile.h
518925b0103405fd0fa03cde1b9e58acf76a6a64 24-Nov-2009 Andy McFadden <fadden@android.com> Fix windows SDK build.

Broken by 96516932f1557d8f48a8b2dbbb885af01a11ef6e.
ysUtil.c
b0a0541b59d1126ff77c88de742b4a74579fe296 19-Nov-2009 Andy McFadden <fadden@android.com> Add execute-inline/range instruction.

Like "execute-inline", this is an instruction generated by dexopt that
replaces a method invoke instruction. It's useful for small, frequently
called methods in the core libs.

As with execute-inline, we allow at most 4 arguments, but with /range
we're no longer limited to the low 16 registers.

Also: marked execute-inline as being able to throw an exception.

Needed: native x86 implementation; support in JIT.

For bug 2268232.
nstrUtils.c
nstrUtils.h
pCode.h
b5ebe47515c9750c7347557075d3714ba7671aa9 17-Nov-2009 Andy McFadden <fadden@android.com> Restore support for DEX on FAT.

The recent change to mmap(read-write)+mprotect(read-only) doesn't seem
to work on FAT filesystems like /sdcard. This caused problems for the
code that opens Zip files and the code that opens DEX files.

This change splits the "map file" function into "read only" and
"writable read only" versions, using the former for Zip and the latter
for DEX. Further, failure to mprotect(read-only) is now considered a
soft failure and only causes a warning.

The only apps that will be affected by this are those using /sdcard to
hold optimized DEX data for "plugin" APKs.

Also: moved the non-HAVE_POSIX_FILEMAP implementation of file mapping
into a shared function. (Could probably go away entirely.)

Also: fixed the expected output for test 071.
mdUtils.c
ysUtil.c
ysUtil.h
ipArchive.c
96516932f1557d8f48a8b2dbbb885af01a11ef6e 29-Oct-2009 Andy McFadden <fadden@android.com> Change the way breakpoints work.

This replaces the breakpoint mechanism with a more efficient approach.
We now insert breakpoint instructions into the bytecode stream instead of
maintaining a table. This requires mapping DEX files as private instead
of shared, which allows copy-on-write to work. mprotect() is used to
guard the pages against inadvertent writes.

Unused opcode EC is now OP_BREAKPOINT. It's not recognized by dexdump or
any interpreter except portdbg, but it can be encountered by the bytecode
verifier (the debugger can request breakpoints in unverified code).
Breakpoint changes are blocked while the verifier runs to avoid races.

This eliminates method->debugBreakpointCount, which is no longer needed.
(Also, it clashed with LinearAlloc's read-only mode.)

The deferred verification error mechanism was using a code-copying
approach to modify the bytecode stream. That has been changed to use
the same copy-on-write modification mechanism.

Also, normalized all PAGE_SIZE/PAGESIZE references to a single
SYSTEM_PAGE_SIZE define.

Simple Fibonacci computation test times (opal-eng):
JIT, no debugger: 10.6ms
Fast interp, no debugger: 36ms
Portable interp, no debugger: 43.8ms

ORIG debug interp, no breakpoints set: 458ms
ORIG debug interp, breakpoint set nearby: 697ms

NEW debug interp, no breakpoints set: 341ms
NEW debug interp, breakpoints set nearby: 341ms

Where "nearby" means there's a breakpoint in the method doing the
computation that isn't actually hit -- the VM had an optimization where
it flagged methods with breakpoints and skipped some of the processing
when possible.

The bottom line is that code should run noticeably faster while a
debugger is attached.
nstrUtils.c
pCode.h
ysUtil.c
ysUtil.h
ec628b5b580f00339d971107b8370960e55ea94f 20-Sep-2009 David 'Digit' Turner <digit@google.com> Allow dalvik pre-optimization to run in ARMv7 emulator.

This sad hack is used to allow the Dex preopt pass to run properly
in ARMv7 emulation mode. Without it, the function dvmComputeWidths()
aborts the VM in ways that are hard to properly understand.

This issue has been discussed extensively with fadden, which provided
the patch. It seems that adding both log lines fixes it, but only using
one will not. I'm suspecting an emulation bug, or even worse, a C compiler
bug that would generate invalid machine code.

NOTE: The dex pre-optimization pass of user builds requires to run
the DexOpt in the emulator for all -user builds. While this patch
might not fix the underlying issue, it allows us to generate these
images correctly (along with a few other system hacks).
nstrUtils.c
50a6bf2f01efba0acbff9bb03e7ee09688553e08 08-Jul-2009 Bill Buzbee <buzbee@google.com> Inline-execute for Java.Lang.Math routines, jit codegen restructure, various bug fixes.
nstrUtils.c
nstrUtils.h
ba4fc8bfc1bccae048403bd1cea3b869dca61dd7 01-Jun-2009 Ben Cheng <bccheng@android.com> Initial port of the Dalvik JIT enging to the internal repository.
Fixed files with trailing spaces.
Addressed review comments from Dan.
Addressed review comments from fadden.
Addressed review comments from Dan x 2.
Addressed review comments from Dan x 3.
nstrUtils.c
nstrUtils.h
b51ea11c70602918c42764bfafe92a997d3b1803 09-May-2009 Andy McFadden <fadden@android.com> Defer reporting of certain verifier failures.

The verifier currently reports all failures immediately. Certain failures,
such as the failure to resolve a method, or the determination that access
to a field is not allowed, are supposed to deferred until the first time
that executing code does something that could cause the resolution.

With this change, several kinds of verification failures are deferred.
This is done by making a writable copy of the bytecode and replacing the
failing instruction with an "always throw" opcode.

Gory details:
- Added throw-verification-error instruction. Implemented in "portable"
and ARM interpreters. x86 uses portable form through stub.
- Added a function that creates a copy of a DexCode area and makes the
bytecodes writable.
- Added code that replaces a single instruction with an "always throw".
- Replaced runtime check for abstract/interface in new-instance with a
check at verification time.
- Added a test to exercise the deferred error mechanism.
- Minor cleanups (replaced tab, bad valgrind command, ...).
exFile.c
exFile.h
nstrUtils.c
3a1aedbc9777eab6275a360b93b81b079464238e 07-May-2009 Andy McFadden <fadden@android.com> Added throw-verification-error instruction.

This is for the deferred verifier error reporting. It replaces OP_UNUSED_ED.
The instructions aren't actually used yet, which is good since the x86
version hasn't been written yet.

The mterp regen also pushed out some recent-ish changes that hadn't
propagated to the armv4t sources.
nstrUtils.c
nstrUtils.h
pCode.h
d18aff3e3ef753a0b6725f1b0a9cd47faa5989e0 06-May-2009 Andy McFadden <fadden@android.com> merge a2ee53b and resolved conflicts...
a2ee53bac4db4c77aa2bb31bad8a9d177fd09301 06-May-2009 Andy McFadden <fadden@android.com> Added XML output mode for dexdump.

This adds an output mode that looks similar to the "current.xml" we
generate for our public APIs. There are a number of differences in
content. The original ("plain") output has not been altered.

I pulled in the bad checksum handling change (internal 142686) since
it's small, has turned out to be useful, and might make the merge of
this to master slightly easier.

This also renames a buffer in the ongoing temp file variable saga.
mdUtils.c
66b2ebae558a949e462de3dbba040cc068655fd3 05-May-2009 Android (Google) Code Review <android-gerrit@google.com> am 6d874d2: Merge change 993 into donut

Merge commit '6d874d2bda563ada1034d2b3219b35d800fc6860'

* commit '6d874d2bda563ada1034d2b3219b35d800fc6860':
Pull fix from master branch, and correct filename juggling.
bcb095953a1a4a91d86911377e4bc1a72a56e891 05-May-2009 Andy McFadden <fadden@android.com> Pull fix from master branch, and correct filename juggling.

The original fix was in p4 144906. This also corrects some problems that
arise when the temp file is specified.
mdUtils.c
mdUtils.h
11131596dee3cf7feabd21a33d1758165fcf3794 08-Apr-2009 Andy McFadden <> AI 144906: Default to failure, not success.

Automated import of CL 144906
mdUtils.c
mdUtils.h
0198b1443707d575d30c2b20f1bc3766a9221e96 02-Apr-2009 Andy McFadden <> AI 144278: Some changes to make examination of flaky devices easier.
Added "dexcheck" shell script, which runs the dexdump checksum
verification against every file in /data/dalvik-cache.
Added "-c" flag to dexdump, which quits after the checksum test
(faster than sending everything to /dev/null).
Initialize a ZipArchive struct earlier; without this dexdump was
crashing in some situations when dealing with a nonexistent file.
BUG=1749836

Automated import of CL 144278
ipArchive.c
e5058effe94df3c29966e5ad35f94cf00f0c579a 30-Mar-2009 Andy McFadden <> AI 143506: Fix swap issue affecting big-endian machines.
Reported on android-porting mailing list (by "Anand Android").
Also renamed a local that shadowed an earlier local.

Automated import of CL 143506
exSwapVerify.c
ab0f0a0581860a575cb869f6d3cdbba88fed9d04 27-Mar-2009 Andy McFadden <> AI 143123: Three minor changes.
1. detab "dx" script
2. log an error when annotation value parsing fails
3. slightly improve a resolver failure message

Automated import of CL 143123
exSwapVerify.c
d45a88794c6470d96e2139cbe803002d9d5d3a6c 25-Mar-2009 Andy McFadden <> Automated import from //branches/master/...@141645,141645
eb128.h
99409883d9c4c0ffb49b070ce307bb33a9dfe9f1 19-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import //branches/master/...@140412
exFile.c
exFile.h
ysUtil.c
ysUtil.h
f6c387128427e121477c1b32ad35cdcaa5101ba3 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
ndroid.mk
mdUtils.c
mdUtils.h
exCatch.c
exCatch.h
exClass.c
exClass.h
exDataMap.c
exDataMap.h
exFile.c
exFile.h
exInlines.c
exProto.c
exProto.h
exSwapVerify.c
nstrUtils.c
nstrUtils.h
eb128.c
eb128.h
pCode.h
ptInvocation.c
ptInvocation.h
ysUtil.c
ysUtil.h
ipArchive.c
ipArchive.h
ha1.c
ha1.h
f72d5de56a522ac3be03873bdde26f23a5eeeb3c 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
ndroid.mk
mdUtils.c
mdUtils.h
exCatch.c
exCatch.h
exClass.c
exClass.h
exDataMap.c
exDataMap.h
exFile.c
exFile.h
exInlines.c
exProto.c
exProto.h
exSwapVerify.c
nstrUtils.c
nstrUtils.h
eb128.c
eb128.h
pCode.h
ptInvocation.c
ptInvocation.h
ysUtil.c
ysUtil.h
ipArchive.c
ipArchive.h
ha1.c
ha1.h
446b11cd80658706d77d58996670b8eead3683a4 13-Feb-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@131421
exSwapVerify.c
5d709784bbf5001012d7f25172927d46f6c1abe1 11-Feb-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@130745
exFile.c
exFile.h
exSwapVerify.c
nstrUtils.c
pCode.h
ptInvocation.h
4c1a2915e40eceeb68dbc323d28b8bf8763af83b 20-Jan-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@127101
exSwapVerify.c
cc05ad238516f1303687aba4a978e24e57c0c07a 10-Jan-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@125939
nstrUtils.c
89c1feb0a69a7707b271086e749975b3f7acacf7 18-Dec-2008 The Android Open Source Project <initial-contribution@android.com> Code drop from //branches/cupcake/...@124589
exFile.c
exFile.h
exProto.c
exProto.h
exSwapVerify.c
nstrUtils.c
nstrUtils.h
ptInvocation.c
ptInvocation.h
ipArchive.c
2ad60cfc28e14ee8f0bb038720836a4696c478ad 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution
ndroid.mk
mdUtils.c
mdUtils.h
exCatch.c
exCatch.h
exClass.c
exClass.h
exDataMap.c
exDataMap.h
exFile.c
exFile.h
exInlines.c
exProto.c
exProto.h
exSwapVerify.c
nstrUtils.c
nstrUtils.h
eb128.c
eb128.h
pCode.h
ptInvocation.c
ptInvocation.h
ysUtil.c
ysUtil.h
ipArchive.c
ipArchive.h
ha1.c
ha1.h