History log of /dalvik/dx/src/com/android/dx/cf/code/Simulator.java
Revision Date Author Comments
6f3916321e14235a0bceea92a90460215f4c1b73 05-Oct-2017 Orion Hodson <oth@google.com> dx: Revise interface method handling

Adds a new flag --allow-all-interface-method-invokes to allow default
interface methods to be invoked at any API level and static interface
methods to be invoked at API level >= 21. This is primarily present
for app compat and should be used with caution.

Adds warning on {default,static} interface method definition below API
level 24.

Extends error reporting from the simulator to include details of the
method causing the issue.

Bug: 35261456
Test: dalvik/dx/tests/run-test 143
Test: dalvik/dx/tests/run-all-tests
Test: m -j32
Change-Id: I8ce5c8c31e84e4734d6ca3d215030340d93f2964
766a678339e615d7e0b3935111392b7eef50df24 21-Sep-2017 Orion Hodson <oth@google.com> New bytecodes for constant-method-{handle,type}

Adds new bytecodes with const-method-handle and const-method-type for
loading constant method handles and method types. Both bytecodes use
format 21c.

Updates dexdump and libdex to include new bytecodes.

Increases the DEX file version to 039 and API level to 27 for DEX
files using these new bytecodes.

Bug: 66562179
Test: dx/tests/run-test 142
Test: dx/tests/run-all-tests

Change-Id: If349a1e026b2ab604560d200e3c6424378958491
9dbd802c8c96c3a66873bc600bc7d1374a1d08e5 31-Aug-2017 Orion Hodson <oth@google.com> dx: Minor code clean-up

A few automated code clean-ups:
- Insert missing @Override annotations.
- Make fields final where possible.
- Use StringBuilder rather StringBuffer for local use.
- Clean-up imports.

Bug: 65231722
Test: dx/tests/run-all-tests
Change-Id: I49810f1d43cb53ad32636a66eda2fadc538ba249
d5370b6315ee137744746479003c9d07185f34f0 10-Jul-2017 Orion Hodson <oth@google.com> Revert^2 "Refinements relating to invoke-custom"

This reverts commit bd6107f1deec28e1184bfa4fd5a717d6b35b259d.

Use the dump informatin from dx to validate call sites rather using
dexdump. The latter is not available in the buildbot build.

Bug: 36641082
Test: dalvik/dx/tests/run-all-tests
Test: dalvik/dx/tests/run-test 135
Change-Id: Id7126010bc84f9bade956c9a4c8c1c5563a307fe
bd6107f1deec28e1184bfa4fd5a717d6b35b259d 07-Jul-2017 Nicolas Geoffray <ngeoffray@google.com> Revert "Refinements relating to invoke-custom"

Breaks dx tests.

This reverts commit ff80988c1d58ccc63f12e61cce1417c4f5239eee.

Change-Id: I822b6cfb81c99d2d92bb560b8cedfaea42913344
ff80988c1d58ccc63f12e61cce1417c4f5239eee 05-Jul-2017 Orion Hodson <oth@google.com> Refinements relating to invoke-custom

Move assignment of call site references in dx to avoid call site
duplication. Previously we were allocating call site references in the
BytecodeArray when visiting instructions, but there are two visitors
that are applied to instructions :- the BasicBlocker and the
Simulator. Allocation now happens in the Simulator visitor.

Update dexdump to print call site offset of each listed callsite to
enable calculating the number of call site ids and call site instances.

Update 135-invoke-custom test to sanity check the number of call sites
and call site ids.

Do not allow dx/tests/run-test to report success if it fails when run
with --update.

Bug: 36641082
Test: dalvik/dx/tests/run-all-tests
Test: dalvik/dx/tests/run-test 135
Change-Id: I8bb1f6c99c97c7a9fa785503df4f66c9e9b80672
b7d748318354aba23ba03f76bdefc31fa6adc885 13-Jun-2017 Orion Hodson <oth@google.com> dx: Add support for invoke-custom

This change adds the translations to invoke-custom and extends the DEX
file sections that dx emits sections for method handles and call
sites.

Test: dx/tests/run-test 135
Test: dx/testse/run-all-tests
Bug: 36641082
Bug: 36957105
Change-Id: Ia1c5b548755485755e8bab0a8f99bd745c2960cd
cdef1ee858fde291205f3da685b2720227d2d42f 22-Feb-2017 Orion Hodson <oth@google.com> DX: Add support for invoke-polymorphic.

This change identifies virtual calls to signature polymorphic methods
and converts the instruction from invoke-virtual to invoke-polymorphic.

Enabled if --min-sdk-version >= 26.

Bug: 30550796,33191712
Test: dx/tests/run-test 132-invoke-polymorphic
Change-Id: I6771d43982f1b72db030b0c77285bb8e04f918b9
e9262fc38f6fc3645a209fac7c4919e4d9cda576 04-Jan-2017 Colin Cross <ccross@android.com> Allow invokevirtual, invokespecial, invokestatic on interface methods

Allow default and static methods on interfaces if
--min-sdk-version >= 24.

Test: make checkbuild
Change-Id: I6b617a37256bdb95f4c11e58fe2ebf08cf7aa324
c8e3e7a6dc4623368de675d8a75954d345504af0 22-Feb-2017 Colin Cross <ccross@android.com> Plumb DexOptions through to Simulator

Pass DexOptions throught to Simulator so the next patch can change
behavior based on minimum targeted API version. Pass an empty
DexOptions when called through dump.

Test: make checkbuild
Change-Id: If4bf6e867fff8d0c55e2e2d45eaebf0378afe8dd
333f9f7cfebf965204067a91d0750c78bcc39c3a 14-Nov-2016 Benoit Lamarche <benoitlamarche@google.com> Ignore LV debug info when the type doesn't match

As a consequence of the CL that relaxes the conditions to retrieve LV
debug info (455443f47d9e217b99edcc33202f889e2c637b7b), there may be a
SimException because of a "local variable type mismatch".
Some local variable slots may be used for different local variables
with different types, but only one has debug info.
So we need to check if the types match, and ignore the local variable
info if it doesn't.

Bug: 32432143
Test: manual
Change-Id: I0a12ac6476f612c0d8e597c9690587826ac41841
c2ea99d6fb4f9ac04b26ab0011fa6f1f85722e95 29-Oct-2015 Rohit Agrawal <rohitagr@google.com> Handle ACONST_NULL multidimensional arrays.

Instead of inferring that an AALOAD following an ACONST_NULL means that
the null constant was of type Object[] and the result is of type Object,
infer that the result is also null and don't infer the type of the null
constant. Note that this is also incorrect but it doesn't matter since
the code will always throw a NullPointerException at runtime.

This removes dx's reliance on javac bug
https://bugs.openjdk.java.net/browse/JDK-7040592

Bug: 25075957

(cherry picked from commit 54576c56f05c659186dc2117ecb7ed2739c175df)

Change-Id: I021a6686cfc298ada50df04fd6b345f4ad838229
54576c56f05c659186dc2117ecb7ed2739c175df 29-Oct-2015 Rohit Agrawal <rohitagr@google.com> Handle ACONST_NULL multidimensional arrays.

Instead of inferring that an AALOAD following an ACONST_NULL means that
the null constant was of type Object[] and the result is of type Object,
infer that the result is also null and don't infer the type of the null
constant. Note that this is also incorrect but it doesn't matter since
the code will always throw a NullPointerException at runtime.

This removes dx's reliance on javac bug
https://bugs.openjdk.java.net/browse/JDK-7040592

Bug: 25075957
Change-Id: Ic5818f5d8138b14afaa63026b0479a13f45ad241
fe107fb6e3f308ac5174ebdc5a794ee880c741d9 17-Sep-2011 Jesse Wilson <jessewilson@google.com> Mechanical refactoring of dx into two parts.

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
333201833d506a3accdeac6ceb7caba8d4b95797 13-Apr-2011 Jesse Wilson <jessewilson@google.com> Combine CstUtf8 and CstString.

The only benefit we were seeing is that one wrapped its toHuman
in quotes, the other didn't.

It was far too easy to use the wrong one. We had code defending
against that in NameValuePair and CstArray.

Change-Id: Ib2e6a1596b97decced37952d46e1831b7bcd0d5d
c31f795aef67a0d6af9abe4610db5ecae8d30c19 12-Mar-2011 jeffhao <jeffhao@google.com> Verifier allows certain errors so they can fail at runtime.

Specifically, this relaxes array typing in the absense of local variable
info.

Change-Id: I1b1aeb64a0842be3cffe70c02418444457abe972
9c907e0f7dd74ef351d0116783e088bb9ed68bdb 27-Oct-2010 Dan Bornstein <danfuzz@android.com> The failure of dx test 105 wasn't actually spurious. Fixed the code.

In particular, for array load and store instructions, dx was being too
aggressive about letting the contents of the stack override the
implied type expected by the instructions. This led to cases where dx
would emit code instead of reporting an error.

The failure on the array load side of things implied that there also
needed to be a new regression test on the store side, since the
existing array store test didn't catch this. So, I added that too in
this change.

Finally, I took this opportunity to do minor whitespace-type cleanups
in a couple of related files that I opened during the course of the
investigation.

Change-Id: I72c644f66afb1108ae43a129ac81b010d072155a
de75089fb7216d19e9c22cce4dc62a49513477d3 09-Jun-2010 Carl Shapiro <cshapiro@google.com> Remove trailing whitespace.

Change-Id: I95534bb2b88eaf48f2329282041118cd034c812b
72e93344b4d1ffc71e9c832ec23de0657e5b04a5 13-Nov-2009 Jean-Baptiste Queru <jbq@google.com> eclair snapshot
d24414a5d1780ce25179f3467b228f9a53863fb4 17-Apr-2009 Dan Bornstein <danfuzz@android.com> Fix issue #1794388.

In particular, when encountering a known-null being used as an array,
always emit an instruction that's compatible with the element type
expected/encountered in context. This will sometimes lead to
surprising instruction choices, such as "aget-byte" when the original
source used a boolean[], but in all of these cases the output is valid
and behaves correctly, where "correctly" in this case means (a)
passing verification, and (b) throwing a NullPointerException if ever
executed.

The test case (dx test #111) reflects unsurprising expectations and
so needs updating, which I will do in a follow-up to this patch.

I know this makes me an awful git user, but I fixed some comments and
whitespace while I was in the territory and *didn't* turn these into
separate commits.
99409883d9c4c0ffb49b070ce307bb33a9dfe9f1 19-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import //branches/master/...@140412
f6c387128427e121477c1b32ad35cdcaa5101ba3 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
f72d5de56a522ac3be03873bdde26f23a5eeeb3c 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
2ad60cfc28e14ee8f0bb038720836a4696c478ad 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution