OSDN Git Service

Fix issue #1794388.
authorDan Bornstein <danfuzz@android.com>
Fri, 17 Apr 2009 20:30:51 +0000 (13:30 -0700)
committerDan Bornstein <danfuzz@android.com>
Fri, 17 Apr 2009 20:30:51 +0000 (13:30 -0700)
commitd24414a5d1780ce25179f3467b228f9a53863fb4
tree6fcc6d27043fab2714355bb0139eede7ad493f9e
parentf46eaf452dab5a3527bee36f3c060e0b45e3c6e0
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.
dx/src/com/android/dx/Version.java
dx/src/com/android/dx/cf/code/RopperMachine.java
dx/src/com/android/dx/cf/code/Simulator.java
dx/src/com/android/dx/cf/code/ValueAwareMachine.java
dx/src/com/android/dx/rop/code/Rops.java